From 9beef23b605a0eaaccf9d0ba680f6c5ada3e8c4f Mon Sep 17 00:00:00 2001 From: Matt Loring Date: Mon, 6 Jun 2016 17:13:05 -0700 Subject: [PATCH] deps: bring in V8 5.1 - 5.0 ABI compatibility Ref: https://github.com/ofrobots/node/pull/23 PR-URL: https://github.com/nodejs/node/pull/7016 Reviewed-By: Ali Ijaz Sheikh Reviewed-By: Ben Noordhuis --- deps/v8/include/v8-platform.h | 6 ++--- deps/v8/include/v8.h | 18 +++++++-------- deps/v8/src/api.cc | 4 ++-- deps/v8/src/builtins.cc | 22 ++++++++++++++----- deps/v8/src/code-stubs-hydrogen.cc | 3 +++ deps/v8/src/d8.cc | 2 +- deps/v8/src/heap/heap.h | 6 ++--- deps/v8/src/keys.cc | 3 ++- deps/v8/src/libplatform/default-platform.cc | 2 +- deps/v8/src/libplatform/default-platform.h | 2 +- deps/v8/src/lookup.cc | 3 ++- deps/v8/src/lookup.h | 3 ++- deps/v8/src/objects.cc | 3 ++- deps/v8/src/objects.h | 10 ++++----- deps/v8/src/tracing/trace-event.h | 6 ++--- .../cctest/heap/test-incremental-marking.cc | 2 +- deps/v8/test/cctest/test-trace-event.cc | 2 +- 17 files changed, 57 insertions(+), 40 deletions(-) diff --git a/deps/v8/include/v8-platform.h b/deps/v8/include/v8-platform.h index 4023a5b234fd4b..11f8d51f02573e 100644 --- a/deps/v8/include/v8-platform.h +++ b/deps/v8/include/v8-platform.h @@ -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; } diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index 703a4f4f4ad575..ad2e5f60c2a68a 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -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; @@ -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; @@ -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. @@ -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; diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc index 5d326981cd6320..dc954d3f143595 100644 --- a/deps/v8/src/api.cc +++ b/deps/v8/src/api.cc @@ -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), diff --git a/deps/v8/src/builtins.cc b/deps/v8/src/builtins.cc index 9c3ff5956b29d7..1ad19946cb0acd 100644 --- a/deps/v8/src/builtins.cc +++ b/deps/v8/src/builtins.cc @@ -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()); } @@ -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); } @@ -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); } @@ -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); } diff --git a/deps/v8/src/code-stubs-hydrogen.cc b/deps/v8/src/code-stubs-hydrogen.cc index 1d2fb811fbb2c2..c08be58945837b 100644 --- a/deps/v8/src/code-stubs-hydrogen.cc +++ b/deps/v8/src/code-stubs-hydrogen.cc @@ -923,6 +923,9 @@ HValue* CodeStubGraphBuilder::BuildCodeStub() { check_instance_type.If( instance_type, Add(LAST_CUSTOM_ELEMENTS_RECEIVER), Token::LTE); + check_instance_type.Or(); + check_instance_type.If( + instance_type, Add(JS_GLOBAL_PROXY_TYPE), Token::EQ); check_instance_type.ThenDeopt(Deoptimizer::kFastArrayPushFailed); check_instance_type.End(); diff --git a/deps/v8/src/d8.cc b/deps/v8/src/d8.cc index 06883803f90091..967d1e4fd43c62 100644 --- a/deps/v8/src/d8.cc +++ b/deps/v8/src/d8.cc @@ -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 { diff --git a/deps/v8/src/heap/heap.h b/deps/v8/src/heap/heap.h index 77c10b24d2abe6..bbe1f05e4f2659 100644 --- a/deps/v8/src/heap/heap.h +++ b/deps/v8/src/heap/heap.h @@ -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) \ diff --git a/deps/v8/src/keys.cc b/deps/v8/src/keys.cc index f8b606ca4bf1cd..86456816927a30 100644 --- a/deps/v8/src/keys.cc +++ b/deps/v8/src/keys.cc @@ -406,7 +406,8 @@ MaybeHandle 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 diff --git a/deps/v8/src/libplatform/default-platform.cc b/deps/v8/src/libplatform/default-platform.cc index 71ee6bee980372..6035c9d91ea833 100644 --- a/deps/v8/src/libplatform/default-platform.cc +++ b/deps/v8/src/libplatform/default-platform.cc @@ -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; diff --git a/deps/v8/src/libplatform/default-platform.h b/deps/v8/src/libplatform/default-platform.h index ea39abc28bd4c3..fe214c69633388 100644 --- a/deps/v8/src/libplatform/default-platform.h +++ b/deps/v8/src/libplatform/default-platform.h @@ -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, diff --git a/deps/v8/src/lookup.cc b/deps/v8/src/lookup.cc index 3df8752c01a710..713ea069487d4f 100644 --- a/deps/v8/src/lookup.cc +++ b/deps/v8/src/lookup.cc @@ -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(map, holder) : LookupInSpecialHolder(map, holder); if (IsFound()) return; diff --git a/deps/v8/src/lookup.h b/deps/v8/src/lookup.h index 8005f32eb95766..abd073284d4a82 100644 --- a/deps/v8/src/lookup.h +++ b/deps/v8/src/lookup.h @@ -289,7 +289,8 @@ class LookupIterator final BASE_EMBEDDED { void NextInternal(Map* map, JSReceiver* holder); template 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(map, holder) : LookupInRegularHolder(map, holder); } diff --git a/deps/v8/src/objects.cc b/deps/v8/src/objects.cc index 74b5d85aa2c1b1..6dec886a194a82 100644 --- a/deps/v8/src/objects.cc +++ b/deps/v8/src/objects.cc @@ -8411,7 +8411,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(); } diff --git a/deps/v8/src/objects.h b/deps/v8/src/objects.h index e44154618088e1..c825b42d844104 100644 --- a/deps/v8/src/objects.h +++ b/deps/v8/src/objects.h @@ -707,13 +707,13 @@ enum InstanceType { // compares for checking the JS_RECEIVER and the NONCALLABLE_JS_OBJECT range. JS_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE JS_GLOBAL_OBJECT_TYPE, // FIRST_JS_OBJECT_TYPE - JS_GLOBAL_PROXY_TYPE, // Like JS_OBJECT_TYPE, but requires access checks and/or has interceptors. JS_SPECIAL_API_OBJECT_TYPE, // LAST_SPECIAL_RECEIVER_TYPE JS_VALUE_TYPE, // LAST_CUSTOM_ELEMENTS_RECEIVER + JS_OBJECT_TYPE, + JS_GLOBAL_PROXY_TYPE, JS_MESSAGE_OBJECT_TYPE, JS_DATE_TYPE, - JS_OBJECT_TYPE, JS_CONTEXT_EXTENSION_OBJECT_TYPE, JS_GENERATOR_OBJECT_TYPE, JS_MODULE_TYPE, @@ -9638,9 +9638,9 @@ class Oddball: public HeapObject { static const int kToStringOffset = HeapObject::kHeaderSize; static const int kToNumberOffset = kToStringOffset + kPointerSize; static const int kToBooleanOffset = kToNumberOffset + kPointerSize; - static const int kTypeOfOffset = kToBooleanOffset + kPointerSize; - static const int kKindOffset = kTypeOfOffset + kPointerSize; - static const int kSize = kKindOffset + kPointerSize; + static const int kKindOffset = kToBooleanOffset + kPointerSize; + static const int kTypeOfOffset = kKindOffset + kPointerSize; + static const int kSize = kTypeOfOffset + kPointerSize; static const byte kFalse = 0; static const byte kTrue = 1; diff --git a/deps/v8/src/tracing/trace-event.h b/deps/v8/src/tracing/trace-event.h index 2b3bf9bf92cca8..246ddd3aba3bd7 100644 --- a/deps/v8/src/tracing/trace-event.h +++ b/deps/v8/src/tracing/trace-event.h @@ -478,7 +478,7 @@ static V8_INLINE uint64_t AddTraceEvent(char phase, uint64_t id, uint64_t bind_id, unsigned int flags) { return TRACE_EVENT_API_ADD_TRACE_EVENT(phase, category_group_enabled, name, - scope, id, bind_id, kZeroNumArgs, NULL, + id, bind_id, kZeroNumArgs, NULL, NULL, NULL, flags); } @@ -492,7 +492,7 @@ static V8_INLINE uint64_t AddTraceEvent( uint64_t arg_values[1]; SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]); return TRACE_EVENT_API_ADD_TRACE_EVENT( - phase, category_group_enabled, name, scope, id, bind_id, num_args, + phase, category_group_enabled, name, id, bind_id, num_args, &arg1_name, arg_types, arg_values, flags); } @@ -509,7 +509,7 @@ static V8_INLINE uint64_t AddTraceEvent( SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]); SetTraceValue(arg2_val, &arg_types[1], &arg_values[1]); return TRACE_EVENT_API_ADD_TRACE_EVENT( - phase, category_group_enabled, name, scope, id, bind_id, num_args, + phase, category_group_enabled, name, id, bind_id, num_args, arg_names, arg_types, arg_values, flags); } diff --git a/deps/v8/test/cctest/heap/test-incremental-marking.cc b/deps/v8/test/cctest/heap/test-incremental-marking.cc index 74cbf2cb34ed56..765ae53afbf260 100644 --- a/deps/v8/test/cctest/heap/test-incremental-marking.cc +++ b/deps/v8/test/cctest/heap/test-incremental-marking.cc @@ -86,7 +86,7 @@ class MockPlatform : public v8::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 { diff --git a/deps/v8/test/cctest/test-trace-event.cc b/deps/v8/test/cctest/test-trace-event.cc index 190cb4078296a3..4678147931d3d0 100644 --- a/deps/v8/test/cctest/test-trace-event.cc +++ b/deps/v8/test/cctest/test-trace-event.cc @@ -72,7 +72,7 @@ class MockTracingPlatform : public v8::Platform { void PerformDelayedTask() {} 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, int num_args, const char** arg_names, const uint8_t* arg_types, const uint64_t* arg_values, unsigned int flags) override {