Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring in 5.1 - 5.0 abi compatibility #23

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions deps/v8/include/v8-debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ enum DebugEvent {
Exception = 2,
NewFunction = 3,
BeforeCompile = 4,
AfterCompile = 5,
AfterCompile = 5,
CompileError = 6,
AsyncTaskEvent = 7,
PromiseEvent = 7,
AsyncTaskEvent = 8,
};


class V8_EXPORT Debug {
public:
/**
Expand Down
6 changes: 3 additions & 3 deletions deps/v8/include/v8-platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ class Platform {
*/
virtual uint64_t AddTraceEvent(
char phase, const uint8_t* category_enabled_flag, const char* name,
const char* scope, uint64_t id, uint64_t bind_id, int32_t num_args,
const char** arg_names, const uint8_t* arg_types,
const uint64_t* arg_values, unsigned int flags) {
uint64_t id, uint64_t bind_id, int32_t num_args, const char** arg_names,
const uint8_t* arg_types, const uint64_t* arg_values,
unsigned int flags) {
return 0;
}

Expand Down
18 changes: 9 additions & 9 deletions deps/v8/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -5212,8 +5212,8 @@ class V8_EXPORT HeapStatistics {
size_t total_available_size_;
size_t used_heap_size_;
size_t heap_size_limit_;
size_t malloced_memory_;
bool does_zap_garbage_;
size_t malloced_memory_;

friend class V8;
friend class Isolate;
Expand Down Expand Up @@ -7330,7 +7330,7 @@ class Internals {
1 * kApiPointerSize + kApiIntSize;
static const int kStringResourceOffset = 3 * kApiPointerSize;

static const int kOddballKindOffset = 5 * kApiPointerSize;
static const int kOddballKindOffset = 4 * kApiPointerSize;
static const int kForeignAddressOffset = kApiPointerSize;
static const int kJSObjectHeaderSize = 3 * kApiPointerSize;
static const int kFixedArrayHeaderSize = 2 * kApiPointerSize;
Expand All @@ -7349,12 +7349,12 @@ class Internals {
static const int kIsolateRootsOffset =
kAmountOfExternalAllocatedMemoryAtLastGlobalGCOffset + kApiInt64Size +
kApiPointerSize;
static const int kUndefinedValueRootIndex = 4;
static const int kTheHoleValueRootIndex = 5;
static const int kNullValueRootIndex = 6;
static const int kTrueValueRootIndex = 7;
static const int kFalseValueRootIndex = 8;
static const int kEmptyStringRootIndex = 9;
static const int kUndefinedValueRootIndex = 5;
static const int kNullValueRootIndex = 7;
static const int kTrueValueRootIndex = 8;
static const int kFalseValueRootIndex = 9;
static const int kEmptyStringRootIndex = 10;
static const int kTheHoleValueRootIndex = 11;

// The external allocation limit should be below 256 MB on all architectures
// to avoid that resource-constrained embedders run low on memory.
Expand All @@ -7370,7 +7370,7 @@ class Internals {
static const int kNodeIsPartiallyDependentShift = 4;
static const int kNodeIsActiveShift = 4;

static const int kJSObjectType = 0xb8;
static const int kJSObjectType = 0xb5;
static const int kFirstNonstringType = 0x80;
static const int kOddballType = 0x83;
static const int kForeignType = 0x87;
Expand Down
4 changes: 2 additions & 2 deletions deps/v8/src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5526,8 +5526,8 @@ HeapStatistics::HeapStatistics()
total_available_size_(0),
used_heap_size_(0),
heap_size_limit_(0),
malloced_memory_(0),
does_zap_garbage_(0) {}
does_zap_garbage_(0),
malloced_memory_(0) {}

HeapSpaceStatistics::HeapSpaceStatistics(): space_name_(0),
space_size_(0),
Expand Down
22 changes: 16 additions & 6 deletions deps/v8/src/builtins.cc
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ inline bool PrototypeHasNoElements(Isolate* isolate, JSObject* object) {
HeapObject* empty = isolate->heap()->empty_fixed_array();
while (prototype != null) {
Map* map = prototype->map();
if (map->instance_type() <= LAST_CUSTOM_ELEMENTS_RECEIVER) return false;
if (map->instance_type() <= LAST_CUSTOM_ELEMENTS_RECEIVER ||
map->instance_type() == JS_GLOBAL_PROXY_TYPE) return false;
if (JSObject::cast(prototype)->elements() != empty) return false;
prototype = HeapObject::cast(map->prototype());
}
Expand All @@ -237,6 +238,7 @@ inline bool IsJSArrayFastElementMovingAllowed(Isolate* isolate,

inline bool HasSimpleElements(JSObject* current) {
return current->map()->instance_type() > LAST_CUSTOM_ELEMENTS_RECEIVER &&
current->map()->instance_type() != JS_GLOBAL_PROXY_TYPE &&
!current->GetElementsAccessor()->HasAccessors(current);
}

Expand Down Expand Up @@ -421,9 +423,13 @@ void Builtins::Generate_ObjectHasOwnProperty(

{
Label if_objectissimple(assembler);
assembler->Branch(assembler->Int32LessThanOrEqual(
instance_type,
assembler->Int32Constant(LAST_SPECIAL_RECEIVER_TYPE)),
assembler->Branch(assembler->Word32Or(
assembler->Int32LessThanOrEqual(
instance_type, assembler->Int32Constant(
LAST_SPECIAL_RECEIVER_TYPE)),
assembler->Word32Equal(
instance_type, assembler->Int32Constant(
JS_GLOBAL_PROXY_TYPE))),
&call_runtime, &if_objectissimple);
assembler->Bind(&if_objectissimple);
}
Expand Down Expand Up @@ -481,9 +487,13 @@ void Builtins::Generate_ObjectHasOwnProperty(
assembler->Bind(&keyisindex);
{
Label if_objectissimple(assembler);
assembler->Branch(assembler->Int32LessThanOrEqual(
instance_type, assembler->Int32Constant(
assembler->Branch(assembler->Word32Or(
assembler->Int32LessThanOrEqual(
instance_type, assembler->Int32Constant(
LAST_CUSTOM_ELEMENTS_RECEIVER)),
assembler->Word32Equal(
instance_type, assembler->Int32Constant(
JS_GLOBAL_PROXY_TYPE))),
&call_runtime, &if_objectissimple);
assembler->Bind(&if_objectissimple);
}
Expand Down
3 changes: 3 additions & 0 deletions deps/v8/src/code-stubs-hydrogen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,9 @@ HValue* CodeStubGraphBuilder<FastArrayPushStub>::BuildCodeStub() {
check_instance_type.If<HCompareNumericAndBranch>(
instance_type, Add<HConstant>(LAST_CUSTOM_ELEMENTS_RECEIVER),
Token::LTE);
check_instance_type.Or();
check_instance_type.If<HCompareNumericAndBranch>(
instance_type, Add<HConstant>(JS_GLOBAL_PROXY_TYPE), Token::EQ);
check_instance_type.ThenDeopt(Deoptimizer::kFastArrayPushFailed);
check_instance_type.End();

Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/d8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class PredictablePlatform : public Platform {
}

uint64_t AddTraceEvent(char phase, const uint8_t* categoryEnabledFlag,
const char* name, const char* scope, uint64_t id,
const char* name, uint64_t id,
uint64_t bind_id, int numArgs, const char** argNames,
const uint8_t* argTypes, const uint64_t* argValues,
unsigned int flags) override {
Expand Down
27 changes: 27 additions & 0 deletions deps/v8/src/debug/debug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1708,6 +1708,13 @@ MaybeHandle<Object> Debug::MakeCompileEvent(Handle<Script> script,
}


MaybeHandle<Object> Debug::MakePromiseEvent(Handle<JSObject> event_data) {
// Create the promise event object.
Handle<Object> argv[] = { event_data };
return CallFunction("MakePromiseEvent", arraysize(argv), argv);
}


MaybeHandle<Object> Debug::MakeAsyncTaskEvent(Handle<JSObject> task_event) {
// Create the async task event object.
Handle<Object> argv[] = { task_event };
Expand Down Expand Up @@ -1838,6 +1845,25 @@ void Debug::OnAfterCompile(Handle<Script> script) {
}


void Debug::OnPromiseEvent(Handle<JSObject> data) {
if (in_debug_scope() || ignore_events()) return;

HandleScope scope(isolate_);
DebugScope debug_scope(this);
if (debug_scope.failed()) return;

// Create the script collected state object.
Handle<Object> event_data;
// Bail out and don't call debugger if exception.
if (!MakePromiseEvent(data).ToHandle(&event_data)) return;

// Process debug event.
ProcessDebugEvent(v8::PromiseEvent,
Handle<JSObject>::cast(event_data),
true);
}


void Debug::OnAsyncTaskEvent(Handle<JSObject> data) {
if (in_debug_scope() || ignore_events()) return;

Expand Down Expand Up @@ -1987,6 +2013,7 @@ void Debug::NotifyMessageHandler(v8::DebugEvent event,
case v8::NewFunction:
case v8::BeforeCompile:
case v8::CompileError:
case v8::PromiseEvent:
case v8::AsyncTaskEvent:
break;
case v8::Exception:
Expand Down
3 changes: 3 additions & 0 deletions deps/v8/src/debug/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ class Debug {
void OnCompileError(Handle<Script> script);
void OnBeforeCompile(Handle<Script> script);
void OnAfterCompile(Handle<Script> script);
void OnPromiseEvent(Handle<JSObject> data);
void OnAsyncTaskEvent(Handle<JSObject> data);

// API facing.
Expand Down Expand Up @@ -579,6 +580,8 @@ class Debug {
Handle<Object> promise);
MUST_USE_RESULT MaybeHandle<Object> MakeCompileEvent(
Handle<Script> script, v8::DebugEvent type);
MUST_USE_RESULT MaybeHandle<Object> MakePromiseEvent(
Handle<JSObject> promise_event);
MUST_USE_RESULT MaybeHandle<Object> MakeAsyncTaskEvent(
Handle<JSObject> task_event);

Expand Down
37 changes: 36 additions & 1 deletion deps/v8/src/debug/debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ Debug.DebugEvent = { Break: 1,
BeforeCompile: 4,
AfterCompile: 5,
CompileError: 6,
AsyncTaskEvent: 7 };
PromiseEvent: 7,
AsyncTaskEvent: 8 };

// Types of exceptions that can be broken upon.
Debug.ExceptionBreak = { Caught : 0,
Expand Down Expand Up @@ -1140,6 +1141,39 @@ function MakeScriptObject_(script, include_source) {
}


function MakePromiseEvent(event_data) {
return new PromiseEvent(event_data);
}


function PromiseEvent(event_data) {
this.promise_ = event_data.promise;
this.parentPromise_ = event_data.parentPromise;
this.status_ = event_data.status;
this.value_ = event_data.value;
}


PromiseEvent.prototype.promise = function() {
return MakeMirror(this.promise_);
}


PromiseEvent.prototype.parentPromise = function() {
return MakeMirror(this.parentPromise_);
}


PromiseEvent.prototype.status = function() {
return this.status_;
}


PromiseEvent.prototype.value = function() {
return MakeMirror(this.value_);
}


function MakeAsyncTaskEvent(event_data) {
return new AsyncTaskEvent(event_data);
}
Expand Down Expand Up @@ -2483,6 +2517,7 @@ utils.InstallFunctions(utils, DONT_ENUM, [
"MakeExceptionEvent", MakeExceptionEvent,
"MakeBreakEvent", MakeBreakEvent,
"MakeCompileEvent", MakeCompileEvent,
"MakePromiseEvent", MakePromiseEvent,
"MakeAsyncTaskEvent", MakeAsyncTaskEvent,
"IsBreakPointTriggered", IsBreakPointTriggered,
"UpdateScriptBreakPoints", UpdateScriptBreakPoints,
Expand Down
6 changes: 3 additions & 3 deletions deps/v8/src/heap/heap.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ using v8::MemoryPressureLevel;
V(Map, one_pointer_filler_map, OnePointerFillerMap) \
V(Map, two_pointer_filler_map, TwoPointerFillerMap) \
/* Cluster the most popular ones in a few cache lines here at the top. */ \
V(Oddball, uninitialized_value, UninitializedValue) \
V(Oddball, undefined_value, UndefinedValue) \
V(Oddball, the_hole_value, TheHoleValue) \
V(Map, cell_map, CellMap) \
V(Oddball, null_value, NullValue) \
V(Oddball, true_value, TrueValue) \
V(Oddball, false_value, FalseValue) \
V(String, empty_string, empty_string) \
V(Oddball, uninitialized_value, UninitializedValue) \
V(Map, cell_map, CellMap) \
V(Oddball, the_hole_value, TheHoleValue) \
V(Map, global_property_cell_map, GlobalPropertyCellMap) \
V(Map, shared_function_info_map, SharedFunctionInfoMap) \
V(Map, meta_map, MetaMap) \
Expand Down
6 changes: 6 additions & 0 deletions deps/v8/src/js/promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ function PromiseSet(promise, status, value, onResolve, onReject) {
SET_PRIVATE(promise, promiseValueSymbol, value);
SET_PRIVATE(promise, promiseOnResolveSymbol, onResolve);
SET_PRIVATE(promise, promiseOnRejectSymbol, onReject);
if (DEBUG_IS_ACTIVE) {
%DebugPromiseEvent({ promise: promise, status: status, value: value });
}
return promise;
}

Expand Down Expand Up @@ -303,6 +306,9 @@ function PromiseThen(onResolve, onReject) {
}
// Mark this promise as having handler.
SET_PRIVATE(this, promiseHasHandlerSymbol, true);
if (DEBUG_IS_ACTIVE) {
%DebugPromiseEvent({ promise: deferred.promise, parentPromise: this });
}
return deferred.promise;
}

Expand Down
3 changes: 2 additions & 1 deletion deps/v8/src/keys.cc
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,8 @@ MaybeHandle<FixedArray> GetOwnKeysWithUninitializedEnumCache(
}

bool OnlyHasSimpleProperties(Map* map) {
return map->instance_type() > LAST_CUSTOM_ELEMENTS_RECEIVER;
return map->instance_type() > LAST_CUSTOM_ELEMENTS_RECEIVER &&
map->instance_type() != JS_GLOBAL_PROXY_TYPE;
}

} // namespace
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/libplatform/default-platform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ double DefaultPlatform::MonotonicallyIncreasingTime() {

uint64_t DefaultPlatform::AddTraceEvent(
char phase, const uint8_t* category_enabled_flag, const char* name,
const char* scope, uint64_t id, uint64_t bind_id, int num_args,
uint64_t id, uint64_t bind_id, int num_args,
const char** arg_names, const uint8_t* arg_types,
const uint64_t* arg_values, unsigned int flags) {
return 0;
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/libplatform/default-platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class DefaultPlatform : public Platform {
const char* GetCategoryGroupName(
const uint8_t* category_enabled_flag) override;
uint64_t AddTraceEvent(char phase, const uint8_t* category_enabled_flag,
const char* name, const char* scope, uint64_t id,
const char* name, uint64_t id,
uint64_t bind_id, int32_t num_args,
const char** arg_names, const uint8_t* arg_types,
const uint64_t* arg_values,
Expand Down
3 changes: 2 additions & 1 deletion deps/v8/src/lookup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ void LookupIterator::Next() {
JSReceiver* holder = *holder_;
Map* map = holder->map();

if (map->instance_type() <= LAST_SPECIAL_RECEIVER_TYPE) {
if (map->instance_type() <= LAST_SPECIAL_RECEIVER_TYPE ||
map->instance_type() == JS_GLOBAL_PROXY_TYPE) {
state_ = IsElement() ? LookupInSpecialHolder<true>(map, holder)
: LookupInSpecialHolder<false>(map, holder);
if (IsFound()) return;
Expand Down
3 changes: 2 additions & 1 deletion deps/v8/src/lookup.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ class LookupIterator final BASE_EMBEDDED {
void NextInternal(Map* map, JSReceiver* holder);
template <bool is_element>
inline State LookupInHolder(Map* map, JSReceiver* holder) {
return map->instance_type() <= LAST_SPECIAL_RECEIVER_TYPE
return (map->instance_type() <= LAST_SPECIAL_RECEIVER_TYPE ||
map->instance_type() == JS_GLOBAL_PROXY_TYPE)
? LookupInSpecialHolder<is_element>(map, holder)
: LookupInRegularHolder<is_element>(map, holder);
}
Expand Down
3 changes: 2 additions & 1 deletion deps/v8/src/objects.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8371,7 +8371,8 @@ bool Map::OnlyHasSimpleProperties() {
// Wrapped string elements aren't explicitly stored in the elements backing
// store, but are loaded indirectly from the underlying string.
return !IsStringWrapperElementsKind(elements_kind()) &&
instance_type() > LAST_SPECIAL_RECEIVER_TYPE &&
(instance_type() > LAST_SPECIAL_RECEIVER_TYPE &&
instance_type() != JS_GLOBAL_PROXY_TYPE) &&
!has_hidden_prototype() && !is_dictionary_map();
}

Expand Down
Loading