diff options
Diffstat (limited to 'deps/v8/src/objects/js-objects.cc')
-rw-r--r-- | deps/v8/src/objects/js-objects.cc | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/deps/v8/src/objects/js-objects.cc b/deps/v8/src/objects/js-objects.cc index e3ea252693..13741c4f62 100644 --- a/deps/v8/src/objects/js-objects.cc +++ b/deps/v8/src/objects/js-objects.cc @@ -12,6 +12,7 @@ #include "src/execution/isolate.h" #include "src/handles/handles-inl.h" #include "src/handles/maybe-handles.h" +#include "src/heap/factory-inl.h" #include "src/heap/heap-inl.h" #include "src/ic/ic.h" #include "src/init/bootstrapper.h" @@ -2137,10 +2138,10 @@ int JSObject::GetHeaderSize(InstanceType type, return JSMapIterator::kHeaderSize; case JS_WEAK_REF_TYPE: return JSWeakRef::kHeaderSize; - case JS_FINALIZATION_GROUP_TYPE: - return JSFinalizationGroup::kHeaderSize; - case JS_FINALIZATION_GROUP_CLEANUP_ITERATOR_TYPE: - return JSFinalizationGroupCleanupIterator::kHeaderSize; + case JS_FINALIZATION_REGISTRY_TYPE: + return JSFinalizationRegistry::kHeaderSize; + case JS_FINALIZATION_REGISTRY_CLEANUP_ITERATOR_TYPE: + return JSFinalizationRegistryCleanupIterator::kHeaderSize; case JS_WEAK_MAP_TYPE: return JSWeakMap::kHeaderSize; case JS_WEAK_SET_TYPE: @@ -2376,7 +2377,7 @@ void JSObject::SetNormalizedProperty(Handle<JSObject> object, Handle<Name> name, int enumeration_index = original_details.dictionary_index(); DCHECK_GT(enumeration_index, 0); details = details.set_index(enumeration_index); - dictionary->SetEntry(isolate, entry, *name, *value, details); + dictionary->SetEntry(entry, *name, *value, details); } } } @@ -3375,7 +3376,7 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object, // Check that it really works. DCHECK(object->HasFastProperties()); if (FLAG_trace_maps) { - LOG(isolate, MapEvent("SlowToFast", *old_map, *new_map, reason)); + LOG(isolate, MapEvent("SlowToFast", old_map, new_map, reason)); } return; } @@ -3465,7 +3466,7 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object, } if (FLAG_trace_maps) { - LOG(isolate, MapEvent("SlowToFast", *old_map, *new_map, reason)); + LOG(isolate, MapEvent("SlowToFast", old_map, new_map, reason)); } // Transform the object. object->synchronized_set_map(*new_map); @@ -3796,7 +3797,7 @@ void JSObject::ApplyAttributesToDictionary( if (v.IsAccessorPair()) attrs &= ~READ_ONLY; } details = details.CopyAddAttributes(static_cast<PropertyAttributes>(attrs)); - dictionary->DetailsAtPut(isolate, i, details); + dictionary->DetailsAtPut(i, details); } } @@ -4563,14 +4564,10 @@ void JSObject::SetImmutableProto(Handle<JSObject> object) { } void JSObject::EnsureCanContainElements(Handle<JSObject> object, - Arguments* args, uint32_t first_arg, + JavaScriptArguments* args, uint32_t arg_count, EnsureElementsMode mode) { - // Elements in |Arguments| are ordered backwards (because they're on the - // stack), but the method that's called here iterates over them in forward - // direction. - return EnsureCanContainElements( - object, args->slot_at(first_arg + arg_count - 1), arg_count, mode); + return EnsureCanContainElements(object, args->first_slot(), arg_count, mode); } void JSObject::ValidateElements(JSObject object) { @@ -5038,6 +5035,7 @@ void JSFunction::EnsureFeedbackVector(Handle<JSFunction> function) { DCHECK(function->raw_feedback_cell() != isolate->heap()->many_closures_cell()); function->raw_feedback_cell().set_value(*feedback_vector); + function->raw_feedback_cell().SetInterruptBudget(); } // static @@ -5105,7 +5103,7 @@ void SetInstancePrototype(Isolate* isolate, Handle<JSFunction> function, // Deoptimize all code that embeds the previous initial map. initial_map->dependent_code().DeoptimizeDependentCodeGroup( - isolate, DependentCode::kInitialMapChangedGroup); + DependentCode::kInitialMapChangedGroup); } else { // Put the value in the initial map field until an initial map is // needed. At that point, a new initial map is created and the @@ -5168,8 +5166,9 @@ void JSFunction::SetInitialMap(Handle<JSFunction> function, Handle<Map> map, function->set_prototype_or_initial_map(*map); map->SetConstructor(*function); if (FLAG_trace_maps) { - LOG(function->GetIsolate(), MapEvent("InitialMap", Map(), *map, "", - function->shared().DebugName())); + LOG(function->GetIsolate(), MapEvent("InitialMap", Handle<Map>(), map, "", + handle(function->shared().DebugName(), + function->GetIsolate()))); } } @@ -5250,7 +5249,7 @@ bool CanSubclassHaveInobjectProperties(InstanceType instance_type) { case JS_MESSAGE_OBJECT_TYPE: case JS_OBJECT_TYPE: case JS_ERROR_TYPE: - case JS_FINALIZATION_GROUP_TYPE: + case JS_FINALIZATION_REGISTRY_TYPE: case JS_ARGUMENTS_OBJECT_TYPE: case JS_PROMISE_TYPE: case JS_REG_EXP_TYPE: @@ -5347,8 +5346,15 @@ bool FastInitializeDerivedMap(Isolate* isolate, Handle<JSFunction> new_target, int in_object_properties; int embedder_fields = JSObject::GetEmbedderFieldCount(*constructor_initial_map); + // Constructor expects certain number of in-object properties to be in the + // object. However, CalculateExpectedNofProperties() may return smaller value + // if 1) the constructor is not in the prototype chain of new_target, or + // 2) the prototype chain is modified during iteration, or 3) compilation + // failure occur during prototype chain iteration. + // So we take the maximum of two values. int expected_nof_properties = - JSFunction::CalculateExpectedNofProperties(isolate, new_target); + Max(static_cast<int>(constructor->shared().expected_nof_properties()), + JSFunction::CalculateExpectedNofProperties(isolate, new_target)); JSFunction::CalculateInstanceSizeHelper( instance_type, true, embedder_fields, expected_nof_properties, &instance_size, &in_object_properties); @@ -5596,9 +5602,10 @@ int JSFunction::CalculateExpectedNofProperties(Isolate* isolate, return JSObject::kMaxInObjectProperties; } } else { - // In case there was a compilation error for the constructor we will - // throw an error during instantiation. - break; + // In case there was a compilation error proceed iterating in case there + // will be a builtin function in the prototype chain that requires + // certain number of in-object properties. + continue; } } // Inobject slack tracking will reclaim redundant inobject space @@ -5890,7 +5897,7 @@ void JSMessageObject::EnsureSourcePositionsAvailable( Isolate* isolate, Handle<JSMessageObject> message) { if (!message->DidEnsureSourcePositionsAvailable()) { DCHECK_EQ(message->start_position(), -1); - DCHECK_GE(message->bytecode_offset().value(), 0); + DCHECK_GE(message->bytecode_offset().value(), kFunctionEntryBytecodeOffset); Handle<SharedFunctionInfo> shared_info( SharedFunctionInfo::cast(message->shared_info()), isolate); SharedFunctionInfo::EnsureSourcePositionsAvailable(isolate, shared_info); |