Skip to content

Commit

Permalink
deps: revert ABI breaking changes in V8 6.2
Browse files Browse the repository at this point in the history
Below is the list of changes:

    [ABI] deps: move new PARSER value to end of enum

    [ABI] deps: revert 749b9c062ea from upstream V8

    Original commit message:

        Remove deprecated allow code-gen callback

        BUG=chromium:732736
        R=marja@chromium.org

        Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
        Change-Id: I2c0a96b76ae977e53a418d22175bcc487f548786
        Reviewed-on: https://chromium-review.googlesource.com/543238
        Reviewed-by: Marja Hölttä <marja@chromium.org>
        Commit-Queue: Jochen Eisinger <jochen@chromium.org>
        Cr-Commit-Position: refs/heads/master@{#47509}

    [ABI] deps: reorder InstanceType enum for ABI compat

    [ABI] deps: restore HeapProfiler::GetProfilerMemorySize()

    Reimplemented as a method returning 0.

    [ABI] deps: partially revert a5f321cd9bf

    Remove default arguments from `Context::SetDefaultContext()`
    and `Context::New()`.

    Refs: v8/v8@a5f321cd9bf

    [ABI] deps: revert change to ComputeMaxSemiSpaceSize

    Refs: v8/v8@2178bba

PR-URL: #16413
  • Loading branch information
addaleax authored and gibfahn committed Feb 18, 2018
1 parent 2b84fa9 commit 758b730
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 296 deletions.
3 changes: 3 additions & 0 deletions deps/v8/include/v8-profiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,9 @@ class V8_EXPORT HeapProfiler {
*/
static const uint16_t kPersistentHandleNoClassId = 0;

/** Returns memory used for profiler internal data and snapshots. */
size_t GetProfilerMemorySize();

private:
HeapProfiler();
~HeapProfiler();
Expand Down
42 changes: 29 additions & 13 deletions deps/v8/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -1729,12 +1729,12 @@ class V8_EXPORT StackFrame {
enum StateTag {
JS,
GC,
PARSER,
BYTECODE_COMPILER,
COMPILER,
OTHER,
EXTERNAL,
IDLE
IDLE,
PARSER,
BYTECODE_COMPILER
};

// A RegisterState represents the current state of registers used
Expand Down Expand Up @@ -6348,6 +6348,8 @@ typedef void (*FailedAccessCheckCallback)(Local<Object> target,
* Callback to check if code generation from strings is allowed. See
* Context::AllowCodeGenerationFromStrings.
*/
typedef bool (*DeprecatedAllowCodeGenerationFromStringsCallback)(
Local<Context> context);
typedef bool (*AllowCodeGenerationFromStringsCallback)(Local<Context> context,
Local<String> source);

Expand Down Expand Up @@ -7636,6 +7638,9 @@ class V8_EXPORT Isolate {
*/
void SetAllowCodeGenerationFromStringsCallback(
AllowCodeGenerationFromStringsCallback callback);
V8_DEPRECATED("Use callback with source parameter.",
void SetAllowCodeGenerationFromStringsCallback(
DeprecatedAllowCodeGenerationFromStringsCallback callback));

/**
* Embedder over{ride|load} injection points for wasm APIs. The expectation
Expand Down Expand Up @@ -7796,6 +7801,15 @@ class V8_EXPORT V8 {
"Use isolate version",
void SetFatalErrorHandler(FatalErrorCallback that));

/**
* Set the callback to invoke to check if code generation from
* strings should be allowed.
*/
V8_INLINE static V8_DEPRECATED(
"Use isolate version",
void SetAllowCodeGenerationFromStringsCallback(
DeprecatedAllowCodeGenerationFromStringsCallback that));

/**
* Check if V8 is dead and therefore unusable. This is the case after
* fatal errors such as out-of-memory situations.
Expand Down Expand Up @@ -8205,12 +8219,8 @@ class V8_EXPORT SnapshotCreator {
* Set the default context to be included in the snapshot blob.
* The snapshot will not contain the global proxy, and we expect one or a
* global object template to create one, to be provided upon deserialization.
*
* \param callback optional callback to serialize internal fields.
*/
void SetDefaultContext(Local<Context> context,
SerializeInternalFieldsCallback callback =
SerializeInternalFieldsCallback());
void SetDefaultContext(Local<Context> context);

/**
* Add additional context to be included in the snapshot blob.
Expand Down Expand Up @@ -8562,9 +8572,7 @@ class V8_EXPORT Context {
static Local<Context> New(
Isolate* isolate, ExtensionConfiguration* extensions = NULL,
MaybeLocal<ObjectTemplate> global_template = MaybeLocal<ObjectTemplate>(),
MaybeLocal<Value> global_object = MaybeLocal<Value>(),
DeserializeInternalFieldsCallback internal_fields_deserializer =
DeserializeInternalFieldsCallback());
MaybeLocal<Value> global_object = MaybeLocal<Value>());

/**
* Create a new context from a (non-default) context snapshot. There
Expand Down Expand Up @@ -9021,8 +9029,8 @@ class Internals {
static const int kNodeIsIndependentShift = 3;
static const int kNodeIsActiveShift = 4;

static const int kJSApiObjectType = 0xbd;
static const int kJSObjectType = 0xbe;
static const int kJSApiObjectType = 0xbb;
static const int kJSObjectType = 0xbc;
static const int kFirstNonstringType = 0x80;
static const int kOddballType = 0x82;
static const int kForeignType = 0x86;
Expand Down Expand Up @@ -10275,6 +10283,14 @@ void* Context::GetAlignedPointerFromEmbedderData(int index) {
#endif
}

void V8::SetAllowCodeGenerationFromStringsCallback(
DeprecatedAllowCodeGenerationFromStringsCallback callback) {
Isolate* isolate = Isolate::GetCurrent();
isolate->SetAllowCodeGenerationFromStringsCallback(
reinterpret_cast<AllowCodeGenerationFromStringsCallback>(callback));
}


bool V8::IsDead() {
Isolate* isolate = Isolate::GetCurrent();
return isolate->IsDead();
Expand Down
22 changes: 16 additions & 6 deletions deps/v8/src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -597,16 +597,16 @@ Isolate* SnapshotCreator::GetIsolate() {
return SnapshotCreatorData::cast(data_)->isolate_;
}

void SnapshotCreator::SetDefaultContext(
Local<Context> context, SerializeInternalFieldsCallback callback) {
void SnapshotCreator::SetDefaultContext(Local<Context> context) {
DCHECK(!context.IsEmpty());
SnapshotCreatorData* data = SnapshotCreatorData::cast(data_);
DCHECK(!data->created_);
DCHECK(data->default_context_.IsEmpty());
Isolate* isolate = data->isolate_;
CHECK_EQ(isolate, context->GetIsolate());
data->default_context_.Reset(isolate, context);
data->default_embedder_fields_serializer_ = callback;
data->default_embedder_fields_serializer_ =
v8::SerializeInternalFieldsCallback();
}

size_t SnapshotCreator::AddContext(Local<Context> context,
Expand Down Expand Up @@ -6559,10 +6559,9 @@ Local<Context> NewContext(
Local<Context> v8::Context::New(
v8::Isolate* external_isolate, v8::ExtensionConfiguration* extensions,
v8::MaybeLocal<ObjectTemplate> global_template,
v8::MaybeLocal<Value> global_object,
DeserializeInternalFieldsCallback internal_fields_deserializer) {
v8::MaybeLocal<Value> global_object) {
return NewContext(external_isolate, extensions, global_template,
global_object, 0, internal_fields_deserializer);
global_object, 0, v8::DeserializeInternalFieldsCallback());
}

MaybeLocal<Context> v8::Context::FromSnapshot(
Expand Down Expand Up @@ -9052,6 +9051,13 @@ void Isolate::SetAllowCodeGenerationFromStringsCallback(
isolate->set_allow_code_gen_callback(callback);
}

void Isolate::SetAllowCodeGenerationFromStringsCallback(
DeprecatedAllowCodeGenerationFromStringsCallback callback) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
isolate->set_allow_code_gen_callback(
reinterpret_cast<AllowCodeGenerationFromStringsCallback>(callback));
}

#define CALLBACK_SETTER(ExternalName, Type, InternalName) \
void Isolate::Set##ExternalName(Type callback) { \
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); \
Expand Down Expand Up @@ -10509,6 +10515,10 @@ void HeapProfiler::SetGetRetainerInfosCallback(
callback);
}

size_t HeapProfiler::GetProfilerMemorySize() {
return 0;
}

v8::Testing::StressType internal::Testing::stress_type_ =
v8::Testing::kStressTypeOpt;

Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/heap/heap.h
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,7 @@ class Heap {

static size_t ComputeMaxSemiSpaceSize(uint64_t physical_memory) {
const uint64_t min_physical_memory = 512 * MB;
const uint64_t max_physical_memory = 3 * static_cast<uint64_t>(GB);
const uint64_t max_physical_memory = 2 * static_cast<uint64_t>(GB);

uint64_t capped_physical_memory =
Max(Min(physical_memory, max_physical_memory), min_physical_memory);
Expand Down
8 changes: 4 additions & 4 deletions deps/v8/src/objects.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,10 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
V(JS_MODULE_NAMESPACE_TYPE) \
V(JS_SPECIAL_API_OBJECT_TYPE) \
V(JS_VALUE_TYPE) \
V(JS_MESSAGE_OBJECT_TYPE) \
V(JS_DATE_TYPE) \
V(JS_API_OBJECT_TYPE) \
V(JS_OBJECT_TYPE) \
V(JS_MESSAGE_OBJECT_TYPE) \
V(JS_DATE_TYPE) \
V(JS_ARGUMENTS_TYPE) \
V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \
V(JS_GENERATOR_OBJECT_TYPE) \
Expand Down Expand Up @@ -741,11 +741,11 @@ enum InstanceType : uint8_t {
// interceptors.
JS_SPECIAL_API_OBJECT_TYPE, // LAST_SPECIAL_RECEIVER_TYPE
JS_VALUE_TYPE, // LAST_CUSTOM_ELEMENTS_RECEIVER
JS_MESSAGE_OBJECT_TYPE,
JS_DATE_TYPE,
// Like JS_OBJECT_TYPE, but created from API function.
JS_API_OBJECT_TYPE,
JS_OBJECT_TYPE,
JS_MESSAGE_OBJECT_TYPE,
JS_DATE_TYPE,
JS_ARGUMENTS_TYPE,
JS_CONTEXT_EXTENSION_OBJECT_TYPE,
JS_GENERATOR_OBJECT_TYPE,
Expand Down
Loading

0 comments on commit 758b730

Please sign in to comment.