[GetIsolate] Remove GetIsolate use in Map

Roughly:
    GetIsolate(): -31
    handle(HeapObject): -6

TBR=verwaest@chromium.org

Bug: v8:7786
Change-Id: I3857f8c45f1f93c727d575d5f9244d9811949a7f
Reviewed-on: https://chromium-review.googlesource.com/1111838
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Dan Elphick <delphick@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53997}
This commit is contained in:
Leszek Swirski 2018-06-25 11:54:01 +01:00 committed by Commit Bot
parent 23c4288380
commit 882080c499
31 changed files with 410 additions and 379 deletions

View File

@ -783,7 +783,7 @@ void Genesis::CreateObjectFunction(Handle<JSFunction> empty_function) {
// Complete setting up empty function.
{
Handle<Map> empty_function_map(empty_function->map(), isolate_);
Map::SetPrototype(empty_function_map, object_function_prototype);
Map::SetPrototype(isolate(), empty_function_map, object_function_prototype);
}
native_context()->set_initial_object_prototype(*object_function_prototype);
@ -794,12 +794,12 @@ void Genesis::CreateObjectFunction(Handle<JSFunction> empty_function) {
// properties.
Handle<Map> map(object_fun->initial_map(), isolate_);
map = Map::CopyInitialMapNormalized(isolate(), map);
Map::SetPrototype(map, factory->null_value());
Map::SetPrototype(isolate(), map, factory->null_value());
native_context()->set_slow_object_with_null_prototype_map(*map);
// Set up slow map for literals with too many properties.
map = Map::Copy(isolate(), map, "slow_object_with_object_prototype_map");
Map::SetPrototype(map, object_function_prototype);
Map::SetPrototype(isolate(), map, object_function_prototype);
native_context()->set_slow_object_with_object_prototype_map(*map);
}
}
@ -824,7 +824,7 @@ Handle<Map> CreateNonConstructorMap(Isolate* isolate, Handle<Map> source_map,
map->SetInObjectUnusedPropertyFields(unused_property_fields);
}
map->set_is_constructor(false);
Map::SetPrototype(map, prototype);
Map::SetPrototype(isolate, map, prototype);
return map;
}
@ -912,7 +912,8 @@ void Genesis::CreateIteratorMaps(Handle<JSFunction> empty) {
Handle<JSFunction> object_function(native_context()->object_function(),
isolate());
Handle<Map> generator_object_prototype_map = Map::Create(isolate(), 0);
Map::SetPrototype(generator_object_prototype_map, generator_object_prototype);
Map::SetPrototype(isolate(), generator_object_prototype_map,
generator_object_prototype);
native_context()->set_generator_object_prototype_map(
*generator_object_prototype_map);
}
@ -952,7 +953,7 @@ void Genesis::CreateAsyncIteratorMaps(Handle<JSFunction> empty) {
Handle<Map> async_from_sync_iterator_map = factory()->NewMap(
JS_ASYNC_FROM_SYNC_ITERATOR_TYPE, JSAsyncFromSyncIterator::kSize);
Map::SetPrototype(async_from_sync_iterator_map,
Map::SetPrototype(isolate(), async_from_sync_iterator_map,
async_from_sync_iterator_prototype);
native_context()->set_async_from_sync_iterator_map(
*async_from_sync_iterator_map);
@ -1031,7 +1032,7 @@ void Genesis::CreateAsyncIteratorMaps(Handle<JSFunction> empty) {
Handle<JSFunction> object_function(native_context()->object_function(),
isolate());
Handle<Map> async_generator_object_prototype_map = Map::Create(isolate(), 0);
Map::SetPrototype(async_generator_object_prototype_map,
Map::SetPrototype(isolate(), async_generator_object_prototype_map,
async_generator_object_prototype);
native_context()->set_async_generator_object_prototype_map(
*async_generator_object_prototype_map);
@ -1110,7 +1111,7 @@ void Genesis::CreateJSProxyMaps() {
map->AppendDescriptor(&d);
}
Map::SetPrototype(map, isolate()->initial_object_prototype());
Map::SetPrototype(isolate(), map, isolate()->initial_object_prototype());
map->SetConstructor(native_context()->object_function());
native_context()->set_proxy_revocable_result_map(*map);
@ -3301,7 +3302,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Handle<Map> map = factory->NewMap(
JS_MODULE_NAMESPACE_TYPE, JSModuleNamespace::kSize,
TERMINAL_FAST_ELEMENTS_KIND, JSModuleNamespace::kInObjectFieldCount);
Map::SetPrototype(map, isolate_->factory()->null_value());
Map::SetPrototype(isolate(), map, isolate_->factory()->null_value());
Map::EnsureDescriptorSlack(isolate_, map, 1);
native_context()->set_js_module_namespace_map(*map);
@ -3319,7 +3320,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
{ // -- I t e r a t o r R e s u l t
Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE, JSIteratorResult::kSize,
TERMINAL_FAST_ELEMENTS_KIND, 2);
Map::SetPrototype(map, isolate_->initial_object_prototype());
Map::SetPrototype(isolate(), map, isolate_->initial_object_prototype());
Map::EnsureDescriptorSlack(isolate_, map, 2);
{ // value
@ -3502,7 +3503,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
TERMINAL_FAST_ELEMENTS_KIND, 0);
map->SetConstructor(native_context()->object_function());
map->set_is_callable(true);
Map::SetPrototype(map, empty_function);
Map::SetPrototype(isolate(), map, empty_function);
PropertyAttributes roc_attribs =
static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY);
@ -3607,7 +3608,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
DCHECK_EQ(native_context()->object_function()->prototype(),
*isolate_->initial_object_prototype());
Map::SetPrototype(map, isolate_->initial_object_prototype());
Map::SetPrototype(isolate(), map, isolate_->initial_object_prototype());
// Copy constructor from the sloppy arguments boilerplate.
map->SetConstructor(
@ -4582,7 +4583,7 @@ void Genesis::InitializeGlobal_harmony_await_optimization() {
Handle<Map> async_from_sync_iterator_map = factory()->NewMap(
JS_ASYNC_FROM_SYNC_ITERATOR_TYPE, JSAsyncFromSyncIterator::kSize);
Map::SetPrototype(async_from_sync_iterator_map,
Map::SetPrototype(isolate(), async_from_sync_iterator_map,
async_from_sync_iterator_prototype);
native_context()->set_async_from_sync_iterator_map(
*async_from_sync_iterator_map);
@ -4970,7 +4971,7 @@ bool Genesis::InstallNatives(GlobalContextType context_type) {
map->AppendDescriptor(&d);
}
Map::SetPrototype(map, isolate()->initial_object_prototype());
Map::SetPrototype(isolate(), map, isolate()->initial_object_prototype());
map->SetConstructor(native_context()->object_function());
native_context()->set_accessor_property_descriptor_map(*map);
@ -5015,7 +5016,7 @@ bool Genesis::InstallNatives(GlobalContextType context_type) {
map->AppendDescriptor(&d);
}
Map::SetPrototype(map, isolate()->initial_object_prototype());
Map::SetPrototype(isolate(), map, isolate()->initial_object_prototype());
map->SetConstructor(native_context()->object_function());
native_context()->set_data_property_descriptor_map(*map);
@ -5040,7 +5041,7 @@ bool Genesis::InstallNatives(GlobalContextType context_type) {
// Set prototype on map.
initial_map->set_has_non_instance_prototype(false);
Map::SetPrototype(initial_map, array_prototype);
Map::SetPrototype(isolate(), initial_map, array_prototype);
// Update map with length accessor from Array and add "index", "input" and
// "groups".

View File

@ -135,7 +135,7 @@ MaybeHandle<Object> CreateDynamicFunction(Isolate* isolate,
JSFunction::GetDerivedMap(isolate, target, new_target), Object);
Handle<SharedFunctionInfo> shared_info(function->shared(), isolate);
Handle<Map> map = Map::AsLanguageMode(initial_map, shared_info);
Handle<Map> map = Map::AsLanguageMode(isolate, initial_map, shared_info);
Handle<Context> context(function->context(), isolate);
function = isolate->factory()->NewFunctionFromSharedFunctionInfo(

View File

@ -277,7 +277,7 @@ bool AccessInfoFactory::ComputeElementAccessInfos(
MapHandles possible_transition_targets;
possible_transition_targets.reserve(maps.size());
for (Handle<Map> map : maps) {
if (Map::TryUpdate(map).ToHandle(&map)) {
if (Map::TryUpdate(isolate(), map).ToHandle(&map)) {
if (CanInlineElementAccess(map) &&
IsFastElementsKind(map->elements_kind()) &&
GetInitialFastElementsKind() != map->elements_kind()) {
@ -291,12 +291,12 @@ bool AccessInfoFactory::ComputeElementAccessInfos(
receiver_maps.reserve(maps.size());
MapTransitionList transitions(maps.size());
for (Handle<Map> map : maps) {
if (Map::TryUpdate(map).ToHandle(&map)) {
if (Map::TryUpdate(isolate(), map).ToHandle(&map)) {
// Don't generate elements kind transitions from stable maps.
Map* transition_target = map->is_stable()
? nullptr
: map->FindElementsKindTransitionedMap(
possible_transition_targets);
Map* transition_target =
map->is_stable() ? nullptr
: map->FindElementsKindTransitionedMap(
isolate(), possible_transition_targets);
if (transition_target == nullptr) {
receiver_maps.push_back(map);
} else {
@ -396,8 +396,8 @@ bool AccessInfoFactory::ComputePropertyAccessInfo(
// about the contents now.
} else if (descriptors_field_type->IsClass()) {
// Add proper code dependencies in case of stable field map(s).
Handle<Map> field_owner_map(map->FindFieldOwner(number),
isolate());
Handle<Map> field_owner_map(
map->FindFieldOwner(isolate(), number), isolate());
dependencies()->AssumeFieldOwner(field_owner_map);
// Remember the field map, and try to infer a useful type.
@ -561,7 +561,7 @@ bool AccessInfoFactory::ComputePropertyAccessInfos(
MapHandles const& maps, Handle<Name> name, AccessMode access_mode,
ZoneVector<PropertyAccessInfo>* access_infos) {
for (Handle<Map> map : maps) {
if (Map::TryUpdate(map).ToHandle(&map)) {
if (Map::TryUpdate(isolate(), map).ToHandle(&map)) {
PropertyAccessInfo access_info;
if (!ComputePropertyAccessInfo(map, name, access_mode, &access_info)) {
return false;
@ -702,8 +702,8 @@ bool AccessInfoFactory::LookupTransition(Handle<Map> map, Handle<Name> name,
return false;
} else if (descriptors_field_type->IsClass()) {
// Add proper code dependencies in case of stable field map(s).
Handle<Map> field_owner_map(transition_map->FindFieldOwner(number),
isolate());
Handle<Map> field_owner_map(
transition_map->FindFieldOwner(isolate(), number), isolate());
dependencies()->AssumeFieldOwner(field_owner_map);
// Remember the field map, and try to infer a useful type.

View File

@ -1448,7 +1448,7 @@ Reduction JSCreateLowering::ReduceJSCreateObject(Node* node) {
Handle<Map> instance_map;
Handle<HeapObject> prototype_const = prototype_type.AsHeapConstant()->Value();
MaybeHandle<Map> maybe_instance_map =
Map::TryGetObjectCreateMap(prototype_const);
Map::TryGetObjectCreateMap(isolate(), prototype_const);
if (!maybe_instance_map.ToHandle(&instance_map)) return NoChange();
Node* properties = jsgraph()->EmptyFixedArrayConstant();

View File

@ -2078,7 +2078,8 @@ Reduction JSNativeContextSpecialization::ReduceJSStoreDataPropertyInLiteral(
}
Handle<Map> receiver_map(map, isolate());
if (!Map::TryUpdate(receiver_map).ToHandle(&receiver_map)) return NoChange();
if (!Map::TryUpdate(isolate(), receiver_map).ToHandle(&receiver_map))
return NoChange();
Handle<Name> cached_name = handle(
Name::cast(nexus.GetFeedbackExtra()->ToStrongHeapObject()), isolate());
@ -2842,11 +2843,12 @@ bool JSNativeContextSpecialization::ExtractReceiverMaps(
Handle<Map> receiver_map;
if (InferReceiverRootMap(receiver).ToHandle(&receiver_map)) {
DCHECK(!receiver_map->is_abandoned_prototype_map());
Isolate* isolate = this->isolate();
receiver_maps->erase(
std::remove_if(receiver_maps->begin(), receiver_maps->end(),
[receiver_map](const Handle<Map>& map) {
[receiver_map, isolate](const Handle<Map>& map) {
return map->is_abandoned_prototype_map() ||
map->FindRootMap() != *receiver_map;
map->FindRootMap(isolate) != *receiver_map;
}),
receiver_maps->end());
}
@ -2884,7 +2886,7 @@ MaybeHandle<Map> JSNativeContextSpecialization::InferReceiverRootMap(
Node* receiver) {
HeapObjectMatcher m(receiver);
if (m.HasValue()) {
return handle(m.Value()->map()->FindRootMap(), isolate());
return handle(m.Value()->map()->FindRootMap(isolate()), isolate());
} else if (m.IsJSCreate()) {
HeapObjectMatcher mtarget(m.InputAt(0));
HeapObjectMatcher mnewtarget(m.InputAt(1));
@ -2894,7 +2896,7 @@ MaybeHandle<Map> JSNativeContextSpecialization::InferReceiverRootMap(
if (constructor->has_initial_map()) {
Handle<Map> initial_map(constructor->initial_map(), isolate());
if (initial_map->constructor_or_backpointer() == *mnewtarget.Value()) {
DCHECK_EQ(*initial_map, initial_map->FindRootMap());
DCHECK_EQ(*initial_map, initial_map->FindRootMap(isolate()));
return initial_map;
}
}

View File

@ -879,7 +879,7 @@ void LiveEdit::FixupScript(Isolate* isolate, Handle<Script> script,
Handle<SharedFunctionInfo> info(shared, isolate);
info->set_script(isolate->heap()->undefined_value());
Handle<Object> new_noscript_list = FixedArrayOfWeakCells::Add(
isolate->factory()->noscript_shared_function_infos(), info);
isolate, isolate->factory()->noscript_shared_function_infos(), info);
isolate->heap()->SetRootNoScriptSharedFunctionInfos(*new_noscript_list);
// Put the SharedFunctionInfo at its new, correct location.

View File

@ -1539,7 +1539,8 @@ Handle<Script> Factory::NewScriptWithId(Handle<String> source, int script_id,
SKIP_WRITE_BARRIER);
script->set_flags(0);
script->set_host_defined_options(*empty_fixed_array());
heap->set_script_list(*FixedArrayOfWeakCells::Add(script_list(), script));
heap->set_script_list(
*FixedArrayOfWeakCells::Add(isolate(), script_list(), script));
LOG(isolate(), ScriptEvent("create", script_id));
return script;
}
@ -2689,7 +2690,7 @@ Handle<JSObject> Factory::NewJSObjectWithNullProto(PretenureFlag pretenure) {
NewJSObject(isolate()->object_function(), pretenure);
Handle<Map> new_map = Map::Copy(
isolate(), Handle<Map>(result->map(), isolate()), "ObjectWithNullProto");
Map::SetPrototype(new_map, null_value());
Map::SetPrototype(isolate(), new_map, null_value());
JSObject::MigrateToMap(result, new_map);
return result;
}
@ -2742,7 +2743,7 @@ Handle<JSGlobalObject> Factory::NewJSGlobalObject(
InitializeJSObjectFromMap(global, dictionary, map);
// Create a new map for the global object.
Handle<Map> new_map = Map::CopyDropDescriptors(map);
Handle<Map> new_map = Map::CopyDropDescriptors(isolate(), map);
new_map->set_may_have_interesting_symbols(true);
new_map->set_is_dictionary_map(true);
@ -2793,7 +2794,7 @@ void Factory::InitializeJSObjectBody(Handle<JSObject> obj, Handle<Map> map,
}
obj->InitializeBody(*map, start_offset, *undefined_value(), filler);
if (in_progress) {
map->FindRootMap()->InobjectSlackTrackingStep();
map->FindRootMap(isolate())->InobjectSlackTrackingStep(isolate());
}
}
@ -3444,8 +3445,8 @@ Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo(
share->clear_padding();
}
// Link into the list.
Handle<Object> new_noscript_list =
FixedArrayOfWeakCells::Add(noscript_shared_function_infos(), share);
Handle<Object> new_noscript_list = FixedArrayOfWeakCells::Add(
isolate(), noscript_shared_function_infos(), share);
isolate()->heap()->set_noscript_shared_function_infos(*new_noscript_list);
DCHECK_EQ(SharedFunctionInfo::kNoDebuggingId, share->debugging_id());
@ -3793,7 +3794,7 @@ Handle<Map> Factory::CreateSloppyFunctionMap(
map->set_is_callable(true);
Handle<JSFunction> empty_function;
if (maybe_empty_function.ToHandle(&empty_function)) {
Map::SetPrototype(map, empty_function);
Map::SetPrototype(isolate(), map, empty_function);
}
//
@ -3870,7 +3871,7 @@ Handle<Map> Factory::CreateStrictFunctionMap(
map->set_has_prototype_slot(has_prototype);
map->set_is_constructor(has_prototype);
map->set_is_callable(true);
Map::SetPrototype(map, empty_function);
Map::SetPrototype(isolate(), map, empty_function);
//
// Setup descriptors array.
@ -3935,7 +3936,7 @@ Handle<Map> Factory::CreateClassFunctionMap(Handle<JSFunction> empty_function) {
map->set_is_constructor(true);
map->set_is_prototype_map(true);
map->set_is_callable(true);
Map::SetPrototype(map, empty_function);
Map::SetPrototype(isolate(), map, empty_function);
//
// Setup descriptors array.

View File

@ -498,7 +498,7 @@ void Heap::AddRetainingPathTarget(Handle<HeapObject> object,
} else {
int index = 0;
Handle<FixedArrayOfWeakCells> array = FixedArrayOfWeakCells::Add(
handle(retaining_path_targets(), isolate()), object, &index);
isolate(), handle(retaining_path_targets(), isolate()), object, &index);
set_retaining_path_targets(*array);
retaining_path_target_option_[index] = option;
}

View File

@ -626,7 +626,8 @@ bool IC::IsTransitionOfMonomorphicTarget(Map* source_map, Map* target_map) {
if (more_general_transition) {
MapHandles map_list;
map_list.push_back(handle(target_map, isolate_));
transitioned_map = source_map->FindElementsKindTransitionedMap(map_list);
transitioned_map =
source_map->FindElementsKindTransitionedMap(isolate(), map_list);
}
return transitioned_map == target_map;
}
@ -1132,7 +1133,8 @@ void KeyedLoadIC::LoadElementPolymorphicHandlers(
// among receiver_maps as unstable because the optimizing compilers may
// generate an elements kind transition for this kind of receivers.
if (receiver_map->is_stable()) {
Map* tmap = receiver_map->FindElementsKindTransitionedMap(*receiver_maps);
Map* tmap = receiver_map->FindElementsKindTransitionedMap(isolate(),
*receiver_maps);
if (tmap != nullptr) {
receiver_map->NotifyLeafMapLayoutChange();
}
@ -1809,14 +1811,14 @@ Handle<Map> KeyedStoreIC::ComputeTransitionedMap(
ElementsKind kind = IsHoleyElementsKind(map->elements_kind())
? HOLEY_ELEMENTS
: PACKED_ELEMENTS;
return Map::TransitionElementsTo(map, kind);
return Map::TransitionElementsTo(isolate(), map, kind);
}
case STORE_TRANSITION_TO_DOUBLE:
case STORE_AND_GROW_TRANSITION_TO_DOUBLE: {
ElementsKind kind = IsHoleyElementsKind(map->elements_kind())
? HOLEY_DOUBLE_ELEMENTS
: PACKED_DOUBLE_ELEMENTS;
return Map::TransitionElementsTo(map, kind);
return Map::TransitionElementsTo(isolate(), map, kind);
}
case STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS:
DCHECK(map->has_fixed_typed_array_elements());
@ -1907,8 +1909,8 @@ void KeyedStoreIC::StoreElementPolymorphicHandlers(
} else {
{
Map* tmap =
receiver_map->FindElementsKindTransitionedMap(*receiver_maps);
Map* tmap = receiver_map->FindElementsKindTransitionedMap(
isolate(), *receiver_maps);
if (tmap != nullptr) {
if (receiver_map->is_stable()) {
receiver_map->NotifyLeafMapLayoutChange();
@ -2029,7 +2031,7 @@ MaybeHandle<Object> KeyedStoreIC::Store(Handle<Object> object,
// expect to be able to trap element sets to objects with those maps in
// the runtime to enable optimization of element hole access.
Handle<HeapObject> heap_object = Handle<HeapObject>::cast(object);
if (heap_object->map()->IsMapInArrayPrototypeChain()) {
if (heap_object->map()->IsMapInArrayPrototypeChain(isolate())) {
set_slow_stub_reason("map in array prototype");
use_ic = false;
}
@ -2119,7 +2121,7 @@ void StoreOwnElement(Isolate* isolate, Handle<JSArray> array,
void StoreInArrayLiteralIC::Store(Handle<JSArray> array, Handle<Object> index,
Handle<Object> value) {
DCHECK(!array->map()->IsMapInArrayPrototypeChain());
DCHECK(!array->map()->IsMapInArrayPrototypeChain(isolate()));
DCHECK(index->IsNumber());
if (!FLAG_use_ic || MigrateDeprecated(array)) {

View File

@ -441,8 +441,9 @@ Handle<Object> JsonParser<seq_one_byte>::ParseJsonObject() {
->NowContains(value)) {
Handle<FieldType> value_type(
value->OptimalType(isolate(), expected_representation));
Map::GeneralizeField(target, descriptor, details.constness(),
expected_representation, value_type);
Map::GeneralizeField(isolate(), target, descriptor,
details.constness(), expected_representation,
value_type);
}
DCHECK(target->instance_descriptors()
->GetFieldType(descriptor)

View File

@ -108,8 +108,9 @@ LookupIterator LookupIterator::ForTransitionHandler(
if (!transition_map->is_dictionary_map()) {
int descriptor_number = transition_map->LastAdded();
Handle<Map> new_map = Map::PrepareForDataProperty(
transition_map, descriptor_number, PropertyConstness::kConst, value);
Handle<Map> new_map =
Map::PrepareForDataProperty(isolate, transition_map, descriptor_number,
PropertyConstness::kConst, value);
// Reload information; this is no-op if nothing changed.
it.property_details_ =
new_map->instance_descriptors()->GetDetails(descriptor_number);
@ -428,7 +429,7 @@ void LookupIterator::PrepareForDataProperty(Handle<Object> value) {
Handle<Map> old_map(holder_obj->map(), isolate_);
Handle<Map> new_map = Map::PrepareForDataProperty(
old_map, descriptor_number(), new_constness, value);
isolate(), old_map, descriptor_number(), new_constness, value);
if (old_map.is_identical_to(new_map)) {
// Update the property details if the representation was None.
@ -471,8 +472,9 @@ void LookupIterator::ReconfigureDataProperty(Handle<Object> value,
isolate_, old_map, descriptor_number(), i::kData, attributes);
// Force mutable to avoid changing constant value by reconfiguring
// kData -> kAccessor -> kData.
new_map = Map::PrepareForDataProperty(new_map, descriptor_number(),
PropertyConstness::kMutable, value);
new_map =
Map::PrepareForDataProperty(isolate(), new_map, descriptor_number(),
PropertyConstness::kMutable, value);
JSObject::MigrateToMap(holder_obj, new_map);
ReloadPropertyInformation<false>();
}
@ -908,7 +910,8 @@ Handle<Map> LookupIterator::GetFieldOwnerMap() const {
DCHECK_EQ(kField, property_details_.location());
DCHECK(!IsElement());
Map* holder_map = holder_->map();
return handle(holder_map->FindFieldOwner(descriptor_number()), isolate_);
return handle(holder_map->FindFieldOwner(isolate(), descriptor_number()),
isolate_);
}
FieldIndex LookupIterator::GetFieldIndex() const {

View File

@ -163,8 +163,8 @@ void MapUpdater::GeneralizeField(Handle<Map> map, int modify_index,
PropertyConstness new_constness,
Representation new_representation,
Handle<FieldType> new_field_type) {
Map::GeneralizeField(map, modify_index, new_constness, new_representation,
new_field_type);
Map::GeneralizeField(isolate_, map, modify_index, new_constness,
new_representation, new_field_type);
DCHECK_EQ(*old_descriptors_, old_map_->instance_descriptors());
}
@ -199,13 +199,13 @@ MapUpdater::State MapUpdater::TryRecofigureToDataFieldInplace() {
DCHECK_EQ(kField, old_details.location());
if (FLAG_trace_generalization) {
old_map_->PrintGeneralization(
stdout, "uninitialized field", modified_descriptor_, old_nof_, old_nof_,
false, old_representation, new_representation_,
isolate_, stdout, "uninitialized field", modified_descriptor_, old_nof_,
old_nof_, false, old_representation, new_representation_,
handle(old_descriptors_->GetFieldType(modified_descriptor_), isolate_),
MaybeHandle<Object>(), new_field_type_, MaybeHandle<Object>());
}
Handle<Map> field_owner(old_map_->FindFieldOwner(modified_descriptor_),
isolate_);
Handle<Map> field_owner(
old_map_->FindFieldOwner(isolate_, modified_descriptor_), isolate_);
GeneralizeField(field_owner, modified_descriptor_, new_constness_,
new_representation_, new_field_type_);
@ -224,7 +224,7 @@ MapUpdater::State MapUpdater::TryRecofigureToDataFieldInplace() {
MapUpdater::State MapUpdater::FindRootMap() {
DCHECK_EQ(kInitialized, state_);
// Check the state of the root map.
root_map_ = handle(old_map_->FindRootMap(), isolate_);
root_map_ = handle(old_map_->FindRootMap(isolate_), isolate_);
ElementsKind from_kind = root_map_->elements_kind();
ElementsKind to_kind = new_elements_kind_;
if (root_map_->is_deprecated()) {
@ -645,7 +645,7 @@ MapUpdater::State MapUpdater::ConstructNewMap() {
Map* maybe_transition = transitions.SearchTransition(
GetKey(split_nof), split_details.kind(), split_details.attributes());
if (maybe_transition != nullptr) {
maybe_transition->DeprecateTransitionTree();
maybe_transition->DeprecateTransitionTree(isolate_);
}
// If |maybe_transition| is not nullptr then the transition array already
@ -682,7 +682,7 @@ MapUpdater::State MapUpdater::ConstructNewMap() {
}
old_map_->PrintGeneralization(
stdout, "", modified_descriptor_, split_nof, old_nof_,
isolate_, stdout, "", modified_descriptor_, split_nof, old_nof_,
old_details.location() == kDescriptor && new_location_ == kField,
old_details.representation(), new_details.representation(),
old_field_type, old_value, new_field_type, new_value);
@ -691,13 +691,14 @@ MapUpdater::State MapUpdater::ConstructNewMap() {
Handle<LayoutDescriptor> new_layout_descriptor =
LayoutDescriptor::New(split_map, new_descriptors, old_nof_);
Handle<Map> new_map = Map::AddMissingTransitions(split_map, new_descriptors,
new_layout_descriptor);
Handle<Map> new_map = Map::AddMissingTransitions(
isolate_, split_map, new_descriptors, new_layout_descriptor);
// Deprecated part of the transition tree is no longer reachable, so replace
// current instance descriptors in the "survived" part of the tree with
// the new descriptors to maintain descriptors sharing invariant.
split_map->ReplaceDescriptors(*new_descriptors, *new_layout_descriptor);
split_map->ReplaceDescriptors(isolate_, *new_descriptors,
*new_layout_descriptor);
result_map_ = new_map;
state_ = kEnd;

View File

@ -53,7 +53,9 @@ class MapUpdater {
is_transitionable_fast_elements_kind_(
IsTransitionableFastElementsKind(new_elements_kind_)) {
// We shouldn't try to update remote objects.
DCHECK(!old_map->FindRootMap()->GetConstructor()->IsFunctionTemplateInfo());
DCHECK(!old_map->FindRootMap(isolate)
->GetConstructor()
->IsFunctionTemplateInfo());
}
// Prepares for reconfiguring of a property at |descriptor| to data field

View File

@ -185,7 +185,7 @@ bool HeapObject::IsJSGeneratorObject() const {
bool HeapObject::IsClassBoilerplate() const { return IsFixedArrayExact(); }
bool HeapObject::IsExternal(Isolate* isolate) const {
return map()->FindRootMap() == isolate->heap()->external_map();
return map()->FindRootMap(isolate) == isolate->heap()->external_map();
}
#define IS_TYPE_FUNCTION_DEF(type_) \
@ -2541,7 +2541,7 @@ bool JSFunction::IsInOptimizationQueue() {
void JSFunction::CompleteInobjectSlackTrackingIfActive() {
if (!has_prototype_slot()) return;
if (has_initial_map() && initial_map()->IsInobjectSlackTrackingInProgress()) {
initial_map()->CompleteInobjectSlackTracking();
initial_map()->CompleteInobjectSlackTracking(GetIsolate());
}
}

View File

@ -2923,8 +2923,8 @@ MaybeHandle<JSFunction> Map::GetConstructorFunction(
return MaybeHandle<JSFunction>();
}
void Map::PrintReconfiguration(FILE* file, int modify_index, PropertyKind kind,
void Map::PrintReconfiguration(Isolate* isolate, FILE* file, int modify_index,
PropertyKind kind,
PropertyAttributes attributes) {
OFStream os(file);
os << "[reconfiguring]";
@ -2936,7 +2936,7 @@ void Map::PrintReconfiguration(FILE* file, int modify_index, PropertyKind kind,
}
os << ": " << (kind == kData ? "kData" : "ACCESSORS") << ", attrs: ";
os << attributes << " [";
JavaScriptFrame::PrintTop(GetIsolate(), file, false, true);
JavaScriptFrame::PrintTop(isolate, file, false, true);
os << "]\n";
}
@ -3161,8 +3161,8 @@ VisitorId Map::GetVisitorId(Map* map) {
}
void Map::PrintGeneralization(
FILE* file, const char* reason, int modify_index, int split,
int descriptors, bool descriptor_to_field,
Isolate* isolate, FILE* file, const char* reason, int modify_index,
int split, int descriptors, bool descriptor_to_field,
Representation old_representation, Representation new_representation,
MaybeHandle<FieldType> old_field_type, MaybeHandle<Object> old_value,
MaybeHandle<FieldType> new_field_type, MaybeHandle<Object> new_value) {
@ -3199,7 +3199,7 @@ void Map::PrintGeneralization(
os << "+" << (descriptors - split) << " maps";
}
os << ") [";
JavaScriptFrame::PrintTop(GetIsolate(), file, false, true);
JavaScriptFrame::PrintTop(isolate, file, false, true);
os << "]\n";
}
@ -4370,7 +4370,7 @@ void JSObject::ForceSetPrototype(Handle<JSObject> object,
Handle<Map> old_map = Handle<Map>(object->map(), object->GetIsolate());
Handle<Map> new_map =
Map::Copy(object->GetIsolate(), old_map, "ForceSetPrototype");
Map::SetPrototype(new_map, proto);
Map::SetPrototype(object->GetIsolate(), new_map, proto);
JSObject::MigrateToMap(object, new_map);
}
@ -4415,7 +4415,7 @@ Handle<Map> Map::CopyGeneralizeAllFields(Isolate* isolate, Handle<Map> map,
Handle<LayoutDescriptor> new_layout_descriptor(
LayoutDescriptor::FastPointerLayout(), isolate);
Handle<Map> new_map = CopyReplaceDescriptors(
map, descriptors, new_layout_descriptor, OMIT_TRANSITION,
isolate, map, descriptors, new_layout_descriptor, OMIT_TRANSITION,
MaybeHandle<Name>(), reason, SPECIAL_TRANSITION);
// Unless the instance is being migrated, ensure that modify_index is a field.
@ -4444,25 +4444,24 @@ Handle<Map> Map::CopyGeneralizeAllFields(Isolate* isolate, Handle<Map> map,
map->instance_descriptors()->GetFieldType(modify_index), isolate);
}
map->PrintGeneralization(
stdout, reason, modify_index, new_map->NumberOfOwnDescriptors(),
new_map->NumberOfOwnDescriptors(), details.location() == kDescriptor,
details.representation(), Representation::Tagged(), field_type,
MaybeHandle<Object>(), FieldType::Any(isolate),
MaybeHandle<Object>());
isolate, stdout, reason, modify_index,
new_map->NumberOfOwnDescriptors(), new_map->NumberOfOwnDescriptors(),
details.location() == kDescriptor, details.representation(),
Representation::Tagged(), field_type, MaybeHandle<Object>(),
FieldType::Any(isolate), MaybeHandle<Object>());
}
}
new_map->set_elements_kind(elements_kind);
return new_map;
}
void Map::DeprecateTransitionTree() {
void Map::DeprecateTransitionTree(Isolate* isolate) {
if (is_deprecated()) return;
DisallowHeapAllocation no_gc;
Isolate* isolate = GetIsolate();
TransitionsAccessor transitions(isolate, this, &no_gc);
int num_transitions = transitions.NumberOfTransitions();
for (int i = 0; i < num_transitions; ++i) {
transitions.GetTarget(i)->DeprecateTransitionTree();
transitions.GetTarget(i)->DeprecateTransitionTree(isolate);
}
DCHECK(!constructor_or_backpointer()->IsFunctionTemplateInfo());
set_is_deprecated(true);
@ -4477,9 +4476,8 @@ void Map::DeprecateTransitionTree() {
// Installs |new_descriptors| over the current instance_descriptors to ensure
// proper sharing of descriptor arrays.
void Map::ReplaceDescriptors(DescriptorArray* new_descriptors,
void Map::ReplaceDescriptors(Isolate* isolate, DescriptorArray* new_descriptors,
LayoutDescriptor* new_layout_descriptor) {
Isolate* isolate = GetIsolate();
// Don't overwrite the empty descriptor array or initial map's descriptors.
if (NumberOfOwnDescriptors() == 0 || GetBackPointer()->IsUndefined(isolate)) {
return;
@ -4501,9 +4499,8 @@ void Map::ReplaceDescriptors(DescriptorArray* new_descriptors,
set_owns_descriptors(false);
}
Map* Map::FindRootMap() const {
Map* Map::FindRootMap(Isolate* isolate) const {
const Map* result = this;
Isolate* isolate = GetIsolate();
while (true) {
Object* back = result->GetBackPointer();
if (back->IsUndefined(isolate)) {
@ -4518,11 +4515,10 @@ Map* Map::FindRootMap() const {
}
}
Map* Map::FindFieldOwner(int descriptor) const {
Map* Map::FindFieldOwner(Isolate* isolate, int descriptor) const {
DisallowHeapAllocation no_allocation;
DCHECK_EQ(kField, instance_descriptors()->GetDetails(descriptor).location());
const Map* result = this;
Isolate* isolate = GetIsolate();
while (true) {
Object* back = result->GetBackPointer();
if (back->IsUndefined(isolate)) break;
@ -4533,7 +4529,7 @@ Map* Map::FindFieldOwner(int descriptor) const {
return const_cast<Map*>(result);
}
void Map::UpdateFieldType(int descriptor, Handle<Name> name,
void Map::UpdateFieldType(Isolate* isolate, int descriptor, Handle<Name> name,
PropertyConstness new_constness,
Representation new_representation,
MaybeObjectHandle new_wrapped_type) {
@ -4544,7 +4540,6 @@ void Map::UpdateFieldType(int descriptor, Handle<Name> name,
if (details.location() != kField) return;
DCHECK_EQ(kData, details.kind());
Isolate* isolate = GetIsolate();
Zone zone(isolate->allocator(), ZONE_NAME);
ZoneQueue<Map*> backlog(&zone);
backlog.push(this);
@ -4606,12 +4601,10 @@ Handle<FieldType> Map::GeneralizeFieldType(Representation rep1,
}
// static
void Map::GeneralizeField(Handle<Map> map, int modify_index,
void Map::GeneralizeField(Isolate* isolate, Handle<Map> map, int modify_index,
PropertyConstness new_constness,
Representation new_representation,
Handle<FieldType> new_field_type) {
Isolate* isolate = map->GetIsolate();
// Check if we actually need to generalize the field type at all.
Handle<DescriptorArray> old_descriptors(map->instance_descriptors(), isolate);
PropertyDetails old_details = old_descriptors->GetDetails(modify_index);
@ -4637,7 +4630,7 @@ void Map::GeneralizeField(Handle<Map> map, int modify_index,
}
// Determine the field owner.
Handle<Map> field_owner(map->FindFieldOwner(modify_index), isolate);
Handle<Map> field_owner(map->FindFieldOwner(isolate, modify_index), isolate);
Handle<DescriptorArray> descriptors(field_owner->instance_descriptors(),
isolate);
DCHECK_EQ(*old_field_type, descriptors->GetFieldType(modify_index));
@ -4653,14 +4646,14 @@ void Map::GeneralizeField(Handle<Map> map, int modify_index,
Handle<Name> name(descriptors->GetKey(modify_index), isolate);
MaybeObjectHandle wrapped_type(WrapFieldType(new_field_type));
field_owner->UpdateFieldType(modify_index, name, new_constness,
field_owner->UpdateFieldType(isolate, modify_index, name, new_constness,
new_representation, wrapped_type);
field_owner->dependent_code()->DeoptimizeDependentCodeGroup(
isolate, DependentCode::kFieldOwnerGroup);
if (FLAG_trace_generalization) {
map->PrintGeneralization(
stdout, "field type generalization", modify_index,
isolate, stdout, "field type generalization", modify_index,
map->NumberOfOwnDescriptors(), map->NumberOfOwnDescriptors(), false,
details.representation(), details.representation(), old_field_type,
MaybeHandle<Object>(), new_field_type, MaybeHandle<Object>());
@ -4669,13 +4662,13 @@ void Map::GeneralizeField(Handle<Map> map, int modify_index,
// TODO(ishell): remove.
// static
Handle<Map> Map::ReconfigureProperty(Handle<Map> map, int modify_index,
PropertyKind new_kind,
Handle<Map> Map::ReconfigureProperty(Isolate* isolate, Handle<Map> map,
int modify_index, PropertyKind new_kind,
PropertyAttributes new_attributes,
Representation new_representation,
Handle<FieldType> new_field_type) {
DCHECK_EQ(kData, new_kind); // Only kData case is supported.
MapUpdater mu(map->GetIsolate(), map);
MapUpdater mu(isolate, map);
return mu.ReconfigureToDataField(modify_index, new_attributes,
PropertyConstness::kConst,
new_representation, new_field_type);
@ -4683,15 +4676,14 @@ Handle<Map> Map::ReconfigureProperty(Handle<Map> map, int modify_index,
// TODO(ishell): remove.
// static
Handle<Map> Map::ReconfigureElementsKind(Handle<Map> map,
Handle<Map> Map::ReconfigureElementsKind(Isolate* isolate, Handle<Map> map,
ElementsKind new_elements_kind) {
MapUpdater mu(map->GetIsolate(), map);
MapUpdater mu(isolate, map);
return mu.ReconfigureElementsKind(new_elements_kind);
}
// Generalize all fields and update the transition tree.
Handle<Map> Map::GeneralizeAllFields(Handle<Map> map) {
Isolate* isolate = map->GetIsolate();
Handle<Map> Map::GeneralizeAllFields(Isolate* isolate, Handle<Map> map) {
Handle<FieldType> any_type = FieldType::Any(isolate);
Handle<DescriptorArray> descriptors(map->instance_descriptors(), isolate);
@ -4710,14 +4702,14 @@ Handle<Map> Map::GeneralizeAllFields(Handle<Map> map) {
// static
MaybeHandle<Map> Map::TryUpdate(Handle<Map> old_map) {
MaybeHandle<Map> Map::TryUpdate(Isolate* isolate, Handle<Map> old_map) {
DisallowHeapAllocation no_allocation;
DisallowDeoptimization no_deoptimization(old_map->GetIsolate());
DisallowDeoptimization no_deoptimization(isolate);
if (!old_map->is_deprecated()) return old_map;
// Check the state of the root map.
Map* root_map = old_map->FindRootMap();
Map* root_map = old_map->FindRootMap(isolate);
if (root_map->is_deprecated()) {
JSFunction* constructor = JSFunction::cast(root_map->GetConstructor());
DCHECK(constructor->has_initial_map());
@ -4734,18 +4726,17 @@ MaybeHandle<Map> Map::TryUpdate(Handle<Map> old_map) {
ElementsKind to_kind = old_map->elements_kind();
if (from_kind != to_kind) {
// Try to follow existing elements kind transitions.
root_map = root_map->LookupElementsTransitionMap(to_kind);
root_map = root_map->LookupElementsTransitionMap(isolate, to_kind);
if (root_map == nullptr) return MaybeHandle<Map>();
// From here on, use the map with correct elements kind as root map.
}
Map* new_map = root_map->TryReplayPropertyTransitions(*old_map);
Map* new_map = root_map->TryReplayPropertyTransitions(isolate, *old_map);
if (new_map == nullptr) return MaybeHandle<Map>();
return handle(new_map, new_map->GetIsolate());
return handle(new_map, isolate);
}
Map* Map::TryReplayPropertyTransitions(Map* old_map) {
Map* Map::TryReplayPropertyTransitions(Isolate* isolate, Map* old_map) {
DisallowHeapAllocation no_allocation;
Isolate* isolate = GetIsolate();
DisallowDeoptimization no_deoptimization(isolate);
int root_nof = NumberOfOwnDescriptors();
@ -4821,9 +4812,9 @@ Map* Map::TryReplayPropertyTransitions(Map* old_map) {
// static
Handle<Map> Map::Update(Handle<Map> map) {
Handle<Map> Map::Update(Isolate* isolate, Handle<Map> map) {
if (!map->is_deprecated()) return map;
MapUpdater mu(map->GetIsolate(), map);
MapUpdater mu(isolate, map);
return mu.Update();
}
@ -5266,8 +5257,8 @@ void Map::EnsureDescriptorSlack(Isolate* isolate, Handle<Map> map, int slack) {
}
// static
Handle<Map> Map::GetObjectCreateMap(Handle<HeapObject> prototype) {
Isolate* isolate = prototype->GetIsolate();
Handle<Map> Map::GetObjectCreateMap(Isolate* isolate,
Handle<HeapObject> prototype) {
Handle<Map> map(isolate->native_context()->object_function()->initial_map(),
isolate);
if (map->prototype() == *prototype) return map;
@ -5285,8 +5276,8 @@ Handle<Map> Map::GetObjectCreateMap(Handle<HeapObject> prototype) {
if (info->HasObjectCreateMap()) {
map = handle(info->ObjectCreateMap(), isolate);
} else {
map = Map::CopyInitialMap(map);
Map::SetPrototype(map, prototype);
map = Map::CopyInitialMap(isolate, map);
Map::SetPrototype(isolate, map, prototype);
PrototypeInfo::SetObjectCreateMap(info, map);
}
return map;
@ -5296,8 +5287,8 @@ Handle<Map> Map::GetObjectCreateMap(Handle<HeapObject> prototype) {
}
// static
MaybeHandle<Map> Map::TryGetObjectCreateMap(Handle<HeapObject> prototype) {
Isolate* isolate = prototype->GetIsolate();
MaybeHandle<Map> Map::TryGetObjectCreateMap(Isolate* isolate,
Handle<HeapObject> prototype) {
Handle<Map> map(isolate->native_context()->object_function()->initial_map(),
isolate);
if (map->prototype() == *prototype) return map;
@ -5374,9 +5365,10 @@ static bool ContainsMap(MapHandles const& maps, Map* map) {
return false;
}
Map* Map::FindElementsKindTransitionedMap(MapHandles const& candidates) {
Map* Map::FindElementsKindTransitionedMap(Isolate* isolate,
MapHandles const& candidates) {
DisallowHeapAllocation no_allocation;
DisallowDeoptimization no_deoptimization(GetIsolate());
DisallowDeoptimization no_deoptimization(isolate);
if (is_prototype_map()) return nullptr;
@ -5386,9 +5378,9 @@ Map* Map::FindElementsKindTransitionedMap(MapHandles const& candidates) {
Map* transition = nullptr;
if (IsTransitionableFastElementsKind(kind)) {
// Check the state of the root map.
Map* root_map = FindRootMap();
Map* root_map = FindRootMap(isolate);
if (!EquivalentToForElementsKindTransition(root_map)) return nullptr;
root_map = root_map->LookupElementsTransitionMap(kind);
root_map = root_map->LookupElementsTransitionMap(isolate, kind);
DCHECK_NOT_NULL(root_map);
// Starting from the next existing elements kind transition try to
// replay the property transitions that does not involve instance rewriting
@ -5396,7 +5388,7 @@ Map* Map::FindElementsKindTransitionedMap(MapHandles const& candidates) {
for (root_map = root_map->ElementsTransitionMap();
root_map != nullptr && root_map->has_fast_elements();
root_map = root_map->ElementsTransitionMap()) {
Map* current = root_map->TryReplayPropertyTransitions(this);
Map* current = root_map->TryReplayPropertyTransitions(isolate, this);
if (current == nullptr) continue;
if (InstancesNeedRewriting(current)) continue;
@ -5410,10 +5402,10 @@ Map* Map::FindElementsKindTransitionedMap(MapHandles const& candidates) {
return transition;
}
static Map* FindClosestElementsTransition(Map* map, ElementsKind to_kind) {
static Map* FindClosestElementsTransition(Isolate* isolate, Map* map,
ElementsKind to_kind) {
// Ensure we are requested to search elements kind transition "near the root".
DCHECK_EQ(map->FindRootMap()->NumberOfOwnDescriptors(),
DCHECK_EQ(map->FindRootMap(isolate)->NumberOfOwnDescriptors(),
map->NumberOfOwnDescriptors());
Map* current_map = map;
@ -5429,15 +5421,13 @@ static Map* FindClosestElementsTransition(Map* map, ElementsKind to_kind) {
return current_map;
}
Map* Map::LookupElementsTransitionMap(ElementsKind to_kind) {
Map* to_map = FindClosestElementsTransition(this, to_kind);
Map* Map::LookupElementsTransitionMap(Isolate* isolate, ElementsKind to_kind) {
Map* to_map = FindClosestElementsTransition(isolate, this, to_kind);
if (to_map->elements_kind() == to_kind) return to_map;
return nullptr;
}
bool Map::IsMapInArrayPrototypeChain() const {
Isolate* isolate = GetIsolate();
bool Map::IsMapInArrayPrototypeChain(Isolate* isolate) const {
if (isolate->initial_array_prototype()->map() == this) {
return true;
}
@ -5449,9 +5439,7 @@ bool Map::IsMapInArrayPrototypeChain() const {
return false;
}
Handle<WeakCell> Map::WeakCellForMap(Handle<Map> map) {
Isolate* isolate = map->GetIsolate();
Handle<WeakCell> Map::WeakCellForMap(Isolate* isolate, Handle<Map> map) {
if (map->weak_cell_cache()->IsWeakCell()) {
return Handle<WeakCell>(WeakCell::cast(map->weak_cell_cache()), isolate);
}
@ -5491,13 +5479,11 @@ static Handle<Map> AddMissingElementsTransitions(Isolate* isolate,
return current_map;
}
Handle<Map> Map::TransitionElementsTo(Handle<Map> map,
Handle<Map> Map::TransitionElementsTo(Isolate* isolate, Handle<Map> map,
ElementsKind to_kind) {
ElementsKind from_kind = map->elements_kind();
if (from_kind == to_kind) return map;
Isolate* isolate = map->GetIsolate();
Context* native_context = isolate->context()->native_context();
if (from_kind == FAST_SLOPPY_ARGUMENTS_ELEMENTS) {
if (*map == native_context->fast_aliased_arguments_map()) {
@ -5542,14 +5528,15 @@ Handle<Map> Map::TransitionElementsTo(Handle<Map> map,
return Map::CopyAsElementsKind(isolate, map, to_kind, OMIT_TRANSITION);
}
return Map::ReconfigureElementsKind(map, to_kind);
return Map::ReconfigureElementsKind(isolate, map, to_kind);
}
// static
Handle<Map> Map::AsElementsKind(Isolate* isolate, Handle<Map> map,
ElementsKind kind) {
Handle<Map> closest_map(FindClosestElementsTransition(*map, kind), isolate);
Handle<Map> closest_map(FindClosestElementsTransition(isolate, *map, kind),
isolate);
if (closest_map->elements_kind() == kind) {
return closest_map;
@ -5562,7 +5549,7 @@ Handle<Map> Map::AsElementsKind(Isolate* isolate, Handle<Map> map,
Handle<Map> JSObject::GetElementsTransitionMap(Handle<JSObject> object,
ElementsKind to_kind) {
Handle<Map> map(object->map(), object->GetIsolate());
return Map::TransitionElementsTo(map, to_kind);
return Map::TransitionElementsTo(object->GetIsolate(), map, to_kind);
}
@ -5961,7 +5948,7 @@ void JSObject::AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map) {
} else {
TransitionElementsKind(object, to_kind);
}
map = Map::ReconfigureElementsKind(map, to_kind);
map = Map::ReconfigureElementsKind(object->GetIsolate(), map, to_kind);
}
int number_of_fields = map->NumberOfFields();
int inobject = map->GetInObjectProperties();
@ -6013,7 +6000,7 @@ void JSObject::AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map) {
void JSObject::MigrateInstance(Handle<JSObject> object) {
Handle<Map> original_map(object->map(), object->GetIsolate());
Handle<Map> map = Map::Update(original_map);
Handle<Map> map = Map::Update(object->GetIsolate(), original_map);
map->set_is_migration_target(true);
MigrateToMap(object, map);
if (FLAG_trace_migration) {
@ -6033,7 +6020,7 @@ bool JSObject::TryMigrateInstance(Handle<JSObject> object) {
DisallowDeoptimization no_deoptimization(isolate);
Handle<Map> original_map(object->map(), isolate);
Handle<Map> new_map;
if (!Map::TryUpdate(original_map).ToHandle(&new_map)) {
if (!Map::TryUpdate(isolate, original_map).ToHandle(&new_map)) {
return false;
}
JSObject::MigrateToMap(object, new_map);
@ -6281,7 +6268,7 @@ void JSObject::NormalizeProperties(Handle<JSObject> object,
if (!object->HasFastProperties()) return;
Handle<Map> map(object->map(), object->GetIsolate());
Handle<Map> new_map = Map::Normalize(map, mode, reason);
Handle<Map> new_map = Map::Normalize(object->GetIsolate(), map, mode, reason);
MigrateToMap(object, new_map, expected_additional_properties);
}
@ -6330,7 +6317,7 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object,
int inobject_props = old_map->GetInObjectProperties();
// Allocate new map.
Handle<Map> new_map = Map::CopyDropDescriptors(old_map);
Handle<Map> new_map = Map::CopyDropDescriptors(isolate, old_map);
if (new_map->has_named_interceptor() || new_map->is_access_check_needed()) {
// Force certain slow paths when API interceptors are used, or if an access
// check is required.
@ -9108,14 +9095,13 @@ Object* JSObject::SlowReverseLookup(Object* value) {
}
}
Handle<Map> Map::RawCopy(Handle<Map> map, int instance_size,
Handle<Map> Map::RawCopy(Isolate* isolate, Handle<Map> map, int instance_size,
int inobject_properties) {
Isolate* isolate = map->GetIsolate();
Handle<Map> result = isolate->factory()->NewMap(
map->instance_type(), instance_size, TERMINAL_FAST_ELEMENTS_KIND,
inobject_properties);
Handle<Object> prototype(map->prototype(), isolate);
Map::SetPrototype(result, prototype);
Map::SetPrototype(isolate, result, prototype);
result->set_constructor_or_backpointer(map->GetConstructor());
result->set_bit_field(map->bit_field());
result->set_bit_field2(map->bit_field2());
@ -9132,12 +9118,10 @@ Handle<Map> Map::RawCopy(Handle<Map> map, int instance_size,
return result;
}
Handle<Map> Map::Normalize(Handle<Map> fast_map, PropertyNormalizationMode mode,
const char* reason) {
Handle<Map> Map::Normalize(Isolate* isolate, Handle<Map> fast_map,
PropertyNormalizationMode mode, const char* reason) {
DCHECK(!fast_map->is_dictionary_map());
Isolate* isolate = fast_map->GetIsolate();
Handle<Object> maybe_cache(isolate->native_context()->normalized_map_cache(),
isolate);
bool use_cache =
@ -9187,7 +9171,7 @@ Handle<Map> Map::Normalize(Handle<Map> fast_map, PropertyNormalizationMode mode,
} else {
new_map = Map::CopyNormalized(isolate, fast_map, mode);
if (use_cache) {
Handle<WeakCell> cell = Map::WeakCellForMap(new_map);
Handle<WeakCell> cell = Map::WeakCellForMap(isolate, new_map);
cache->Set(fast_map, new_map, cell);
isolate->counters()->maps_normalized()->Increment();
}
@ -9207,7 +9191,7 @@ Handle<Map> Map::CopyNormalized(Isolate* isolate, Handle<Map> map,
}
Handle<Map> result = RawCopy(
map, new_instance_size,
isolate, map, new_instance_size,
mode == CLEAR_INOBJECT_PROPERTIES ? 0 : map->GetInObjectProperties());
// Clear the unused_property_fields explicitly as this field should not
// be accessed for normalized maps.
@ -9273,11 +9257,12 @@ Handle<Map> Map::CopyInitialMapNormalized(Isolate* isolate, Handle<Map> map,
}
// static
Handle<Map> Map::CopyInitialMap(Handle<Map> map, int instance_size,
int inobject_properties,
Handle<Map> Map::CopyInitialMap(Isolate* isolate, Handle<Map> map,
int instance_size, int inobject_properties,
int unused_property_fields) {
EnsureInitialMap(map);
Handle<Map> result = RawCopy(map, instance_size, inobject_properties);
Handle<Map> result =
RawCopy(isolate, map, instance_size, inobject_properties);
// Please note instance_type and instance_size are set when allocated.
result->SetInObjectUnusedPropertyFields(unused_property_fields);
@ -9296,10 +9281,9 @@ Handle<Map> Map::CopyInitialMap(Handle<Map> map, int instance_size,
return result;
}
Handle<Map> Map::CopyDropDescriptors(Handle<Map> map) {
Handle<Map> Map::CopyDropDescriptors(Isolate* isolate, Handle<Map> map) {
Handle<Map> result =
RawCopy(map, map->instance_size(),
RawCopy(isolate, map, map->instance_size(),
map->IsJSObjectMap() ? map->GetInObjectProperties() : 0);
// Please note instance_type and instance_size are set when allocated.
@ -9319,7 +9303,7 @@ Handle<Map> Map::ShareDescriptor(Isolate* isolate, Handle<Map> map,
DCHECK_EQ(map->NumberOfOwnDescriptors(),
map->instance_descriptors()->number_of_descriptors());
Handle<Map> result = CopyDropDescriptors(map);
Handle<Map> result = CopyDropDescriptors(isolate, map);
Handle<Name> name = descriptor->GetKey();
// Properly mark the {result} if the {name} is an "interesting symbol".
@ -9351,14 +9335,14 @@ Handle<Map> Map::ShareDescriptor(Isolate* isolate, Handle<Map> map,
}
DCHECK(result->NumberOfOwnDescriptors() == map->NumberOfOwnDescriptors() + 1);
ConnectTransition(map, result, name, SIMPLE_PROPERTY_TRANSITION);
ConnectTransition(isolate, map, result, name, SIMPLE_PROPERTY_TRANSITION);
return result;
}
void Map::ConnectTransition(Handle<Map> parent, Handle<Map> child,
Handle<Name> name, SimpleTransitionFlag flag) {
Isolate* isolate = parent->GetIsolate();
void Map::ConnectTransition(Isolate* isolate, Handle<Map> parent,
Handle<Map> child, Handle<Name> name,
SimpleTransitionFlag flag) {
DCHECK_IMPLIES(name->IsInterestingSymbol(),
child->may_have_interesting_symbols());
DCHECK_IMPLIES(parent->may_have_interesting_symbols(),
@ -9395,17 +9379,14 @@ void Map::ConnectTransition(Handle<Map> parent, Handle<Map> child,
}
}
Handle<Map> Map::CopyReplaceDescriptors(
Handle<Map> map, Handle<DescriptorArray> descriptors,
Isolate* isolate, Handle<Map> map, Handle<DescriptorArray> descriptors,
Handle<LayoutDescriptor> layout_descriptor, TransitionFlag flag,
MaybeHandle<Name> maybe_name, const char* reason,
SimpleTransitionFlag simple_flag) {
Isolate* isolate = map->GetIsolate();
DCHECK(descriptors->IsSortedNoDuplicates(isolate));
Handle<Map> result = CopyDropDescriptors(map);
Handle<Map> result = CopyDropDescriptors(isolate, map);
// Properly mark the {result} if the {name} is an "interesting symbol".
Handle<Name> name;
@ -9419,7 +9400,7 @@ Handle<Map> Map::CopyReplaceDescriptors(
result->InitializeDescriptors(*descriptors, *layout_descriptor);
DCHECK(!maybe_name.is_null());
ConnectTransition(map, result, name, simple_flag);
ConnectTransition(isolate, map, result, name, simple_flag);
} else {
descriptors->GeneralizeAllFields();
result->InitializeDescriptors(*descriptors,
@ -9445,9 +9426,10 @@ Handle<Map> Map::CopyReplaceDescriptors(
// The way how it is done is tricky because of GC and special descriptors
// marking logic.
Handle<Map> Map::AddMissingTransitions(
Handle<Map> split_map, Handle<DescriptorArray> descriptors,
Isolate* isolate, Handle<Map> split_map,
Handle<DescriptorArray> descriptors,
Handle<LayoutDescriptor> full_layout_descriptor) {
DCHECK(descriptors->IsSortedNoDuplicates(split_map->GetIsolate()));
DCHECK(descriptors->IsSortedNoDuplicates(isolate));
int split_nof = split_map->NumberOfOwnDescriptors();
int nof_descriptors = descriptors->number_of_descriptors();
DCHECK_LT(split_nof, nof_descriptors);
@ -9461,7 +9443,7 @@ Handle<Map> Map::AddMissingTransitions(
// Also the last map might have interesting symbols, we temporarily set
// the flag and clear it right before the descriptors are installed. This
// makes heap verification happy and ensures the flag ends up accurate.
Handle<Map> last_map = CopyDropDescriptors(split_map);
Handle<Map> last_map = CopyDropDescriptors(isolate, split_map);
last_map->InitializeDescriptors(*descriptors, *full_layout_descriptor);
last_map->SetInObjectUnusedPropertyFields(0);
last_map->set_may_have_interesting_symbols(true);
@ -9473,13 +9455,14 @@ Handle<Map> Map::AddMissingTransitions(
// case for all the intermediate maps we create here.
Handle<Map> map = split_map;
for (int i = split_nof; i < nof_descriptors - 1; ++i) {
Handle<Map> new_map = CopyDropDescriptors(map);
InstallDescriptors(map, new_map, i, descriptors, full_layout_descriptor);
Handle<Map> new_map = CopyDropDescriptors(isolate, map);
InstallDescriptors(isolate, map, new_map, i, descriptors,
full_layout_descriptor);
map = new_map;
}
map->NotifyLeafMapLayoutChange();
last_map->set_may_have_interesting_symbols(false);
InstallDescriptors(map, last_map, nof_descriptors - 1, descriptors,
InstallDescriptors(isolate, map, last_map, nof_descriptors - 1, descriptors,
full_layout_descriptor);
return last_map;
}
@ -9487,11 +9470,11 @@ Handle<Map> Map::AddMissingTransitions(
// Since this method is used to rewrite an existing transition tree, it can
// always insert transitions without checking.
void Map::InstallDescriptors(Handle<Map> parent, Handle<Map> child,
int new_descriptor,
void Map::InstallDescriptors(Isolate* isolate, Handle<Map> parent,
Handle<Map> child, int new_descriptor,
Handle<DescriptorArray> descriptors,
Handle<LayoutDescriptor> full_layout_descriptor) {
DCHECK(descriptors->IsSortedNoDuplicates(parent->GetIsolate()));
DCHECK(descriptors->IsSortedNoDuplicates(isolate));
child->set_instance_descriptors(*descriptors);
child->SetNumberOfOwnDescriptors(new_descriptor + 1);
@ -9517,11 +9500,11 @@ void Map::InstallDescriptors(Handle<Map> parent, Handle<Map> child,
child->set_visitor_id(Map::GetVisitorId(*child));
}
Handle<Name> name = handle(descriptors->GetKey(new_descriptor));
Handle<Name> name = handle(descriptors->GetKey(new_descriptor), isolate);
if (parent->may_have_interesting_symbols() || name->IsInterestingSymbol()) {
child->set_may_have_interesting_symbols(true);
}
ConnectTransition(parent, child, name, SIMPLE_PROPERTY_TRANSITION);
ConnectTransition(isolate, parent, child, name, SIMPLE_PROPERTY_TRANSITION);
}
Handle<Map> Map::CopyAsElementsKind(Isolate* isolate, Handle<Map> map,
@ -9536,7 +9519,7 @@ Handle<Map> Map::CopyAsElementsKind(Isolate* isolate, Handle<Map> map,
Map* maybe_elements_transition_map = nullptr;
if (flag == INSERT_TRANSITION) {
// Ensure we are requested to add elements kind transition "near the root".
DCHECK_EQ(map->FindRootMap()->NumberOfOwnDescriptors(),
DCHECK_EQ(map->FindRootMap(isolate)->NumberOfOwnDescriptors(),
map->NumberOfOwnDescriptors());
maybe_elements_transition_map = map->ElementsTransitionMap();
@ -9559,7 +9542,7 @@ Handle<Map> Map::CopyAsElementsKind(Isolate* isolate, Handle<Map> map,
new_map->set_elements_kind(kind);
Handle<Name> name = isolate->factory()->elements_transition_symbol();
ConnectTransition(map, new_map, name, SPECIAL_TRANSITION);
ConnectTransition(isolate, map, new_map, name, SPECIAL_TRANSITION);
return new_map;
}
@ -9569,14 +9552,13 @@ Handle<Map> Map::CopyAsElementsKind(Isolate* isolate, Handle<Map> map,
return new_map;
}
Handle<Map> Map::AsLanguageMode(Handle<Map> initial_map,
Handle<Map> Map::AsLanguageMode(Isolate* isolate, Handle<Map> initial_map,
Handle<SharedFunctionInfo> shared_info) {
DCHECK_EQ(JS_FUNCTION_TYPE, initial_map->instance_type());
// Initial map for sloppy mode function is stored in the function
// constructor. Initial maps for strict mode are cached as special transitions
// using |strict_function_transition_symbol| as a key.
if (is_sloppy(shared_info->language_mode())) return initial_map;
Isolate* isolate = initial_map->GetIsolate();
Handle<Map> function_map(Map::cast(isolate->native_context()->get(
shared_info->function_map_index())),
@ -9596,7 +9578,7 @@ Handle<Map> Map::AsLanguageMode(Handle<Map> initial_map,
// Create new map taking descriptors from the |function_map| and all
// the other details from the |initial_map|.
Handle<Map> map =
Map::CopyInitialMap(function_map, initial_map->instance_size(),
Map::CopyInitialMap(isolate, function_map, initial_map->instance_size(),
initial_map->GetInObjectProperties(),
initial_map->UnusedPropertyFields());
map->SetConstructor(initial_map->GetConstructor());
@ -9604,7 +9586,7 @@ Handle<Map> Map::AsLanguageMode(Handle<Map> initial_map,
map->set_construction_counter(initial_map->construction_counter());
if (TransitionsAccessor(isolate, initial_map).CanHaveMoreTransitions()) {
Map::ConnectTransition(initial_map, map, transition_symbol,
Map::ConnectTransition(isolate, initial_map, map, transition_symbol,
SPECIAL_TRANSITION);
}
return map;
@ -9613,7 +9595,7 @@ Handle<Map> Map::AsLanguageMode(Handle<Map> initial_map,
Handle<Map> Map::CopyForTransition(Isolate* isolate, Handle<Map> map,
const char* reason) {
DCHECK(!map->is_prototype_map());
Handle<Map> new_map = CopyDropDescriptors(map);
Handle<Map> new_map = CopyDropDescriptors(isolate, map);
if (map->owns_descriptors()) {
// In case the map owned its own descriptors, share the descriptors and
@ -9646,9 +9628,9 @@ Handle<Map> Map::Copy(Isolate* isolate, Handle<Map> map, const char* reason) {
isolate, descriptors, number_of_own_descriptors);
Handle<LayoutDescriptor> new_layout_descriptor(map->GetLayoutDescriptor(),
isolate);
return CopyReplaceDescriptors(map, new_descriptors, new_layout_descriptor,
OMIT_TRANSITION, MaybeHandle<Name>(), reason,
SPECIAL_TRANSITION);
return CopyReplaceDescriptors(
isolate, map, new_descriptors, new_layout_descriptor, OMIT_TRANSITION,
MaybeHandle<Name>(), reason, SPECIAL_TRANSITION);
}
@ -9687,7 +9669,7 @@ Handle<Map> Map::CopyForPreventExtensions(Isolate* isolate, Handle<Map> map,
Handle<LayoutDescriptor> new_layout_descriptor(map->GetLayoutDescriptor(),
isolate);
Handle<Map> new_map = CopyReplaceDescriptors(
map, new_desc, new_layout_descriptor, INSERT_TRANSITION,
isolate, map, new_desc, new_layout_descriptor, INSERT_TRANSITION,
transition_marker, reason, SPECIAL_TRANSITION);
new_map->set_is_extensible(false);
if (!IsFixedTypedArrayElementsKind(map->elements_kind())) {
@ -9752,13 +9734,15 @@ Handle<Map> UpdateDescriptorForValue(Handle<Map> map, int descriptor,
} // namespace
// static
Handle<Map> Map::PrepareForDataProperty(Handle<Map> map, int descriptor,
Handle<Map> Map::PrepareForDataProperty(Isolate* isolate, Handle<Map> map,
int descriptor,
PropertyConstness constness,
Handle<Object> value) {
// Dictionaries can store any property value.
DCHECK(!map->is_dictionary_map());
// Update to the newest map before storing the property.
return UpdateDescriptorForValue(Update(map), descriptor, constness, value);
return UpdateDescriptorForValue(Update(isolate, map), descriptor, constness,
value);
}
Handle<Map> Map::TransitionToDataProperty(Isolate* isolate, Handle<Map> map,
@ -9776,7 +9760,7 @@ Handle<Map> Map::TransitionToDataProperty(Isolate* isolate, Handle<Map> map,
DCHECK(!map->is_dictionary_map());
// Migrate to the newest map before storing the property.
map = Update(map);
map = Update(isolate, map);
Map* maybe_transition = TransitionsAccessor(isolate, map)
.SearchTransition(*name, kData, attributes);
@ -9827,8 +9811,9 @@ Handle<Map> Map::TransitionToDataProperty(Isolate* isolate, Handle<Map> map,
DCHECK_NE(*constructor,
constructor->context()->native_context()->object_function());
Handle<Map> initial_map(constructor->initial_map(), isolate);
result = Map::Normalize(initial_map, CLEAR_INOBJECT_PROPERTIES, reason);
initial_map->DeprecateTransitionTree();
result = Map::Normalize(isolate, initial_map, CLEAR_INOBJECT_PROPERTIES,
reason);
initial_map->DeprecateTransitionTree(isolate);
Handle<Object> prototype(result->prototype(), isolate);
JSFunction::SetInitialMap(constructor, result, prototype);
@ -9837,10 +9822,11 @@ Handle<Map> Map::TransitionToDataProperty(Isolate* isolate, Handle<Map> map,
isolate, DependentCode::kInitialMapChangedGroup);
if (!result->EquivalentToForNormalization(*map,
CLEAR_INOBJECT_PROPERTIES)) {
result = Map::Normalize(map, CLEAR_INOBJECT_PROPERTIES, reason);
result =
Map::Normalize(isolate, map, CLEAR_INOBJECT_PROPERTIES, reason);
}
} else {
result = Map::Normalize(map, CLEAR_INOBJECT_PROPERTIES, reason);
result = Map::Normalize(isolate, map, CLEAR_INOBJECT_PROPERTIES, reason);
}
}
@ -9862,7 +9848,7 @@ Handle<Map> Map::ReconfigureExistingProperty(Isolate* isolate, Handle<Map> map,
}
if (FLAG_trace_generalization) {
map->PrintReconfiguration(stdout, descriptor, kind, attributes);
map->PrintReconfiguration(isolate, stdout, descriptor, kind, attributes);
}
MapUpdater mu(isolate, map);
@ -9892,7 +9878,7 @@ Handle<Map> Map::TransitionToAccessorProperty(Isolate* isolate, Handle<Map> map,
if (map->is_dictionary_map()) return map;
// Migrate to the newest map before transitioning to the new property.
map = Update(map);
map = Update(isolate, map);
PropertyNormalizationMode mode = map->is_prototype_map()
? KEEP_INOBJECT_PROPERTIES
@ -9911,12 +9897,14 @@ Handle<Map> Map::TransitionToAccessorProperty(Isolate* isolate, Handle<Map> map,
Handle<Object> maybe_pair(descriptors->GetStrongValue(descriptor), isolate);
if (!maybe_pair->IsAccessorPair()) {
return Map::Normalize(map, mode, "TransitionToAccessorFromNonPair");
return Map::Normalize(isolate, map, mode,
"TransitionToAccessorFromNonPair");
}
Handle<AccessorPair> pair = Handle<AccessorPair>::cast(maybe_pair);
if (!pair->Equals(*getter, *setter)) {
return Map::Normalize(map, mode, "TransitionToDifferentAccessor");
return Map::Normalize(isolate, map, mode,
"TransitionToDifferentAccessor");
}
return transition;
@ -9926,21 +9914,22 @@ Handle<Map> Map::TransitionToAccessorProperty(Isolate* isolate, Handle<Map> map,
DescriptorArray* old_descriptors = map->instance_descriptors();
if (descriptor != DescriptorArray::kNotFound) {
if (descriptor != map->LastAdded()) {
return Map::Normalize(map, mode, "AccessorsOverwritingNonLast");
return Map::Normalize(isolate, map, mode, "AccessorsOverwritingNonLast");
}
PropertyDetails old_details = old_descriptors->GetDetails(descriptor);
if (old_details.kind() != kAccessor) {
return Map::Normalize(map, mode, "AccessorsOverwritingNonAccessors");
return Map::Normalize(isolate, map, mode,
"AccessorsOverwritingNonAccessors");
}
if (old_details.attributes() != attributes) {
return Map::Normalize(map, mode, "AccessorsWithAttributes");
return Map::Normalize(isolate, map, mode, "AccessorsWithAttributes");
}
Handle<Object> maybe_pair(old_descriptors->GetStrongValue(descriptor),
isolate);
if (!maybe_pair->IsAccessorPair()) {
return Map::Normalize(map, mode, "AccessorsOverwritingNonPair");
return Map::Normalize(isolate, map, mode, "AccessorsOverwritingNonPair");
}
Handle<AccessorPair> current_pair = Handle<AccessorPair>::cast(maybe_pair);
@ -9958,13 +9947,15 @@ Handle<Map> Map::TransitionToAccessorProperty(Isolate* isolate, Handle<Map> map,
overwriting_accessor = true;
}
if (overwriting_accessor) {
return Map::Normalize(map, mode, "AccessorsOverwritingAccessors");
return Map::Normalize(isolate, map, mode,
"AccessorsOverwritingAccessors");
}
pair = AccessorPair::Copy(Handle<AccessorPair>::cast(maybe_pair));
} else if (map->NumberOfOwnDescriptors() >= kMaxNumberOfDescriptors ||
map->TooManyFastProperties(CERTAINLY_NOT_STORE_FROM_KEYED)) {
return Map::Normalize(map, CLEAR_INOBJECT_PROPERTIES, "TooManyAccessors");
return Map::Normalize(isolate, map, CLEAR_INOBJECT_PROPERTIES,
"TooManyAccessors");
} else {
pair = isolate->factory()->NewAccessorPair();
}
@ -9998,9 +9989,9 @@ Handle<Map> Map::CopyAddDescriptor(Isolate* isolate, Handle<Map> map,
? LayoutDescriptor::New(map, new_descriptors, nof + 1)
: handle(LayoutDescriptor::FastPointerLayout(), isolate);
return CopyReplaceDescriptors(map, new_descriptors, new_layout_descriptor,
flag, descriptor->GetKey(), "CopyAddDescriptor",
SIMPLE_PROPERTY_TRANSITION);
return CopyReplaceDescriptors(
isolate, map, new_descriptors, new_layout_descriptor, flag,
descriptor->GetKey(), "CopyAddDescriptor", SIMPLE_PROPERTY_TRANSITION);
}
Handle<Map> Map::CopyInsertDescriptor(Isolate* isolate, Handle<Map> map,
@ -10109,9 +10100,9 @@ Handle<Map> Map::CopyReplaceDescriptor(Isolate* isolate, Handle<Map> map,
(insertion_index == descriptors->number_of_descriptors() - 1)
? SIMPLE_PROPERTY_TRANSITION
: PROPERTY_TRANSITION;
return CopyReplaceDescriptors(map, new_descriptors, new_layout_descriptor,
flag, key, "CopyReplaceDescriptor",
simple_flag);
return CopyReplaceDescriptors(isolate, map, new_descriptors,
new_layout_descriptor, flag, key,
"CopyReplaceDescriptor", simple_flag);
}
Handle<FixedArray> FixedArray::SetAndGrow(Handle<FixedArray> array, int index,
@ -10185,11 +10176,12 @@ bool FixedArray::IsEqualTo(FixedArray* other) {
#endif
// static
void FixedArrayOfWeakCells::Set(Handle<FixedArrayOfWeakCells> array, int index,
void FixedArrayOfWeakCells::Set(Isolate* isolate,
Handle<FixedArrayOfWeakCells> array, int index,
Handle<HeapObject> value) {
DCHECK(array->IsEmptySlot(index)); // Don't overwrite anything.
Handle<WeakCell> cell =
value->IsMap() ? Map::WeakCellForMap(Handle<Map>::cast(value))
value->IsMap() ? Map::WeakCellForMap(isolate, Handle<Map>::cast(value))
: array->GetIsolate()->factory()->NewWeakCell(value);
Handle<FixedArray>::cast(array)->set(index + kFirstIndex, *cell);
array->set_last_used_index(index);
@ -10198,7 +10190,8 @@ void FixedArrayOfWeakCells::Set(Handle<FixedArrayOfWeakCells> array, int index,
// static
Handle<FixedArrayOfWeakCells> FixedArrayOfWeakCells::Add(
Handle<Object> maybe_array, Handle<HeapObject> value, int* assigned_index) {
Isolate* isolate, Handle<Object> maybe_array, Handle<HeapObject> value,
int* assigned_index) {
Handle<FixedArrayOfWeakCells> array =
(maybe_array.is_null() || !maybe_array->IsFixedArrayOfWeakCells())
? Allocate(value->GetIsolate(), 1,
@ -10211,7 +10204,7 @@ Handle<FixedArrayOfWeakCells> FixedArrayOfWeakCells::Add(
if (length > 0) {
for (int i = first_index;;) {
if (array->IsEmptySlot((i))) {
FixedArrayOfWeakCells::Set(array, i, value);
FixedArrayOfWeakCells::Set(isolate, array, i, value);
if (assigned_index != nullptr) *assigned_index = i;
return array;
}
@ -10224,7 +10217,7 @@ Handle<FixedArrayOfWeakCells> FixedArrayOfWeakCells::Add(
int new_length = length == 0 ? 1 : length + (length >> 1) + 4;
Handle<FixedArrayOfWeakCells> new_array =
Allocate(array->GetIsolate(), new_length, array);
FixedArrayOfWeakCells::Set(new_array, length, value);
FixedArrayOfWeakCells::Set(isolate, new_array, length, value);
if (assigned_index != nullptr) *assigned_index = length;
return new_array;
}
@ -12397,9 +12390,8 @@ static void StopSlackTracking(Map* map, void* data) {
map->set_construction_counter(Map::kNoSlackTracking);
}
void Map::CompleteInobjectSlackTracking() {
void Map::CompleteInobjectSlackTracking(Isolate* isolate) {
DisallowHeapAllocation no_gc;
Isolate* isolate = GetIsolate();
// Has to be an initial map.
DCHECK(GetBackPointer()->IsUndefined(isolate));
@ -12515,8 +12507,8 @@ void JSObject::LazyRegisterPrototypeUser(Handle<Map> user, Isolate* isolate) {
Map::GetOrCreatePrototypeInfo(proto, isolate);
Handle<Object> maybe_registry(proto_info->prototype_users(), isolate);
int slot = 0;
Handle<FixedArrayOfWeakCells> new_array =
FixedArrayOfWeakCells::Add(maybe_registry, current_user, &slot);
Handle<FixedArrayOfWeakCells> new_array = FixedArrayOfWeakCells::Add(
isolate, maybe_registry, current_user, &slot);
current_user_info->set_registry_slot(slot);
if (!maybe_registry.is_identical_to(new_array)) {
proto_info->set_prototype_users(*new_array);
@ -12734,7 +12726,8 @@ Handle<WeakCell> Map::GetOrCreatePrototypeWeakCell(Handle<JSReceiver> prototype,
}
// static
void Map::SetPrototype(Handle<Map> map, Handle<Object> prototype,
void Map::SetPrototype(Isolate* isolate, Handle<Map> map,
Handle<Object> prototype,
bool enable_prototype_setup_mode) {
RuntimeCallTimerScope stats_scope(*map,
RuntimeCallCounterId::kMap_SetPrototype);
@ -12759,9 +12752,8 @@ void Map::SetPrototype(Handle<Map> map, Handle<Object> prototype,
}
map->set_has_hidden_prototype(is_hidden);
WriteBarrierMode wb_mode = prototype->IsNull(map->GetIsolate())
? SKIP_WRITE_BARRIER
: UPDATE_WRITE_BARRIER;
WriteBarrierMode wb_mode =
prototype->IsNull(isolate) ? SKIP_WRITE_BARRIER : UPDATE_WRITE_BARRIER;
map->set_prototype(*prototype, wb_mode);
}
@ -12891,7 +12883,8 @@ void JSFunction::SetPrototype(Handle<JSFunction> function,
void JSFunction::SetInitialMap(Handle<JSFunction> function, Handle<Map> map,
Handle<Object> prototype) {
if (map->prototype() != *prototype) Map::SetPrototype(map, prototype);
if (map->prototype() != *prototype)
Map::SetPrototype(function->GetIsolate(), map, prototype);
function->set_prototype_or_initial_map(*map);
map->SetConstructor(*function);
if (FLAG_trace_maps) {
@ -13067,10 +13060,10 @@ bool FastInitializeDerivedMap(Isolate* isolate, Handle<JSFunction> new_target,
constructor_initial_map->UnusedPropertyFields();
CHECK_LE(constructor_initial_map->UsedInstanceSize(), instance_size);
int unused_property_fields = in_object_properties - pre_allocated;
map = Map::CopyInitialMap(constructor_initial_map, instance_size,
map = Map::CopyInitialMap(isolate, constructor_initial_map, instance_size,
in_object_properties, unused_property_fields);
} else {
map = Map::CopyInitialMap(constructor_initial_map);
map = Map::CopyInitialMap(isolate, constructor_initial_map);
}
map->set_new_target_is_base(false);
Handle<Object> prototype(new_target->instance_prototype(), isolate);
@ -13143,10 +13136,11 @@ MaybeHandle<Map> JSFunction::GetDerivedMap(Isolate* isolate,
prototype = handle(realm_constructor->prototype(), isolate);
}
Handle<Map> map = Map::CopyInitialMap(constructor_initial_map);
Handle<Map> map = Map::CopyInitialMap(isolate, constructor_initial_map);
map->set_new_target_is_base(false);
CHECK(prototype->IsJSReceiver());
if (map->prototype() != *prototype) Map::SetPrototype(map, prototype);
if (map->prototype() != *prototype)
Map::SetPrototype(isolate, map, prototype);
map->SetConstructor(*constructor);
return map;
}
@ -13655,7 +13649,7 @@ void SharedFunctionInfo::SetScript(Handle<SharedFunctionInfo> shared,
}
#endif // DEBUG
list = FixedArrayOfWeakCells::Add(list, shared);
list = FixedArrayOfWeakCells::Add(isolate, list, shared);
isolate->heap()->SetRootNoScriptSharedFunctionInfos(*list);
}
@ -14889,12 +14883,12 @@ void JSArray::SetLength(Handle<JSArray> array, uint32_t new_length) {
// static
void Map::AddDependentCode(Handle<Map> map,
void Map::AddDependentCode(Isolate* isolate, Handle<Map> map,
DependentCode::DependencyGroup group,
Handle<Code> code) {
Handle<WeakCell> cell = Code::WeakCellFor(code);
Handle<DependentCode> codes = DependentCode::InsertWeakCode(
Handle<DependentCode>(map->dependent_code()), group, cell);
Handle<DependentCode>(map->dependent_code(), isolate), group, cell);
if (*codes != map->dependent_code()) map->set_dependent_code(*codes);
}
@ -15185,7 +15179,7 @@ Handle<Map> Map::TransitionToPrototype(Isolate* isolate, Handle<Map> map,
new_map = Copy(isolate, map, "TransitionToPrototype");
TransitionsAccessor(isolate, map)
.PutPrototypeTransition(prototype, new_map);
Map::SetPrototype(new_map, prototype);
Map::SetPrototype(isolate, new_map, prototype);
}
return new_map;
}

View File

@ -372,7 +372,8 @@ class FixedArrayOfWeakCells : public FixedArray {
// If |maybe_array| is not a FixedArrayOfWeakCells, a fresh one will be
// allocated. This function does not check if the value exists already,
// callers must ensure this themselves if necessary.
static Handle<FixedArrayOfWeakCells> Add(Handle<Object> maybe_array,
static Handle<FixedArrayOfWeakCells> Add(Isolate* isolate,
Handle<Object> maybe_array,
Handle<HeapObject> value,
int* assigned_index = nullptr);
@ -424,8 +425,8 @@ class FixedArrayOfWeakCells : public FixedArray {
Isolate* isolate, int size,
Handle<FixedArrayOfWeakCells> initialize_from);
static void Set(Handle<FixedArrayOfWeakCells> array, int index,
Handle<HeapObject> value);
static void Set(Isolate* isolate, Handle<FixedArrayOfWeakCells> array,
int index, Handle<HeapObject> value);
inline void clear(int index);
inline int last_used_index() const;

View File

@ -267,9 +267,11 @@ int Map::GetInObjectPropertyOffset(int index) const {
}
Handle<Map> Map::AddMissingTransitionsForTesting(
Handle<Map> split_map, Handle<DescriptorArray> descriptors,
Isolate* isolate, Handle<Map> split_map,
Handle<DescriptorArray> descriptors,
Handle<LayoutDescriptor> full_layout_descriptor) {
return AddMissingTransitions(split_map, descriptors, full_layout_descriptor);
return AddMissingTransitions(isolate, split_map, descriptors,
full_layout_descriptor);
}
InstanceType Map::instance_type() const {
@ -700,8 +702,9 @@ void Map::SetConstructor(Object* constructor, WriteBarrierMode mode) {
set_constructor_or_backpointer(constructor, mode);
}
Handle<Map> Map::CopyInitialMap(Handle<Map> map) {
return CopyInitialMap(map, map->instance_size(), map->GetInObjectProperties(),
Handle<Map> Map::CopyInitialMap(Isolate* isolate, Handle<Map> map) {
return CopyInitialMap(isolate, map, map->instance_size(),
map->GetInObjectProperties(),
map->UnusedPropertyFields());
}
@ -709,14 +712,14 @@ bool Map::IsInobjectSlackTrackingInProgress() const {
return construction_counter() != Map::kNoSlackTracking;
}
void Map::InobjectSlackTrackingStep() {
void Map::InobjectSlackTrackingStep(Isolate* isolate) {
// Slack tracking should only be performed on an initial map.
DCHECK(GetBackPointer()->IsUndefined());
if (!IsInobjectSlackTrackingInProgress()) return;
int counter = construction_counter();
set_construction_counter(counter - 1);
if (counter == kSlackTrackingCounterEnd) {
CompleteInobjectSlackTracking();
CompleteInobjectSlackTracking(isolate);
}
}

View File

@ -324,11 +324,11 @@ class Map : public HeapObject {
inline bool IsInobjectSlackTrackingInProgress() const;
// Does the tracking step.
inline void InobjectSlackTrackingStep();
inline void InobjectSlackTrackingStep(Isolate* isolate);
// Completes inobject slack tracking for the transition tree starting at this
// initial map.
void CompleteInobjectSlackTracking();
void CompleteInobjectSlackTracking(Isolate* isolate);
// Tells whether the object in the prototype property will be used
// for instances created from this function. If the prototype
@ -444,8 +444,8 @@ class Map : public HeapObject {
static Handle<WeakCell> GetOrCreatePrototypeWeakCell(
Handle<JSReceiver> prototype, Isolate* isolate);
Map* FindRootMap() const;
Map* FindFieldOwner(int descriptor) const;
Map* FindRootMap(Isolate* isolate) const;
Map* FindFieldOwner(Isolate* isolate, int descriptor) const;
inline int GetInObjectPropertyOffset(int index) const;
@ -469,12 +469,12 @@ class Map : public HeapObject {
int target_inobject, int target_unused,
int* old_number_of_fields) const;
// TODO(ishell): moveit!
static Handle<Map> GeneralizeAllFields(Handle<Map> map);
static Handle<Map> GeneralizeAllFields(Isolate* isolate, Handle<Map> map);
V8_WARN_UNUSED_RESULT static Handle<FieldType> GeneralizeFieldType(
Representation rep1, Handle<FieldType> type1, Representation rep2,
Handle<FieldType> type2, Isolate* isolate);
static void GeneralizeField(Handle<Map> map, int modify_index,
PropertyConstness new_constness,
static void GeneralizeField(Isolate* isolate, Handle<Map> map,
int modify_index, PropertyConstness new_constness,
Representation new_representation,
Handle<FieldType> new_field_type);
// Returns true if |descriptor|'th property is a field that may be generalized
@ -495,21 +495,24 @@ class Map : public HeapObject {
PropertyConstness* constness, Representation* representation,
Handle<FieldType>* field_type);
static Handle<Map> ReconfigureProperty(Handle<Map> map, int modify_index,
static Handle<Map> ReconfigureProperty(Isolate* isolate, Handle<Map> map,
int modify_index,
PropertyKind new_kind,
PropertyAttributes new_attributes,
Representation new_representation,
Handle<FieldType> new_field_type);
static Handle<Map> ReconfigureElementsKind(Handle<Map> map,
static Handle<Map> ReconfigureElementsKind(Isolate* isolate, Handle<Map> map,
ElementsKind new_elements_kind);
static Handle<Map> PrepareForDataProperty(Handle<Map> old_map,
static Handle<Map> PrepareForDataProperty(Isolate* isolate,
Handle<Map> old_map,
int descriptor_number,
PropertyConstness constness,
Handle<Object> value);
static Handle<Map> Normalize(Handle<Map> map, PropertyNormalizationMode mode,
static Handle<Map> Normalize(Isolate* isolate, Handle<Map> map,
PropertyNormalizationMode mode,
const char* reason);
// Tells whether the map is used for JSObjects in dictionary mode (ie
@ -525,7 +528,8 @@ class Map : public HeapObject {
// [prototype]: implicit prototype object.
DECL_ACCESSORS(prototype, Object)
// TODO(jkummerow): make set_prototype private.
static void SetPrototype(Handle<Map> map, Handle<Object> prototype,
static void SetPrototype(Isolate* isolate, Handle<Map> map,
Handle<Object> prototype,
bool enable_prototype_setup_mode = true);
// [constructor]: points back to the function or FunctionTemplateInfo
@ -630,21 +634,22 @@ class Map : public HeapObject {
// is found by re-transitioning from the root of the transition tree using the
// descriptor array of the map. Returns MaybeHandle<Map>() if no updated map
// is found.
static MaybeHandle<Map> TryUpdate(Handle<Map> map) V8_WARN_UNUSED_RESULT;
static MaybeHandle<Map> TryUpdate(Isolate* isolate,
Handle<Map> map) V8_WARN_UNUSED_RESULT;
// Returns a non-deprecated version of the input. This method may deprecate
// existing maps along the way if encodings conflict. Not for use while
// gathering type feedback. Use TryUpdate in those cases instead.
static Handle<Map> Update(Handle<Map> map);
static Handle<Map> Update(Isolate* isolate, Handle<Map> map);
static inline Handle<Map> CopyInitialMap(Handle<Map> map);
static Handle<Map> CopyInitialMap(Handle<Map> map, int instance_size,
int in_object_properties,
static inline Handle<Map> CopyInitialMap(Isolate* isolate, Handle<Map> map);
static Handle<Map> CopyInitialMap(Isolate* isolate, Handle<Map> map,
int instance_size, int in_object_properties,
int unused_property_fields);
static Handle<Map> CopyInitialMapNormalized(
Isolate* isolate, Handle<Map> map,
PropertyNormalizationMode mode = CLEAR_INOBJECT_PROPERTIES);
static Handle<Map> CopyDropDescriptors(Handle<Map> map);
static Handle<Map> CopyDropDescriptors(Isolate* isolate, Handle<Map> map);
static Handle<Map> CopyInsertDescriptor(Isolate* isolate, Handle<Map> map,
Descriptor* descriptor,
TransitionFlag flag);
@ -665,7 +670,7 @@ class Map : public HeapObject {
// Returns a new map with all transitions dropped from the given map and
// the ElementsKind set.
static Handle<Map> TransitionElementsTo(Handle<Map> map,
static Handle<Map> TransitionElementsTo(Isolate* isolate, Handle<Map> map,
ElementsKind to_kind);
static Handle<Map> AsElementsKind(Isolate* isolate, Handle<Map> map,
@ -674,7 +679,7 @@ class Map : public HeapObject {
static Handle<Map> CopyAsElementsKind(Isolate* isolate, Handle<Map> map,
ElementsKind kind, TransitionFlag flag);
static Handle<Map> AsLanguageMode(Handle<Map> initial_map,
static Handle<Map> AsLanguageMode(Isolate* isolate, Handle<Map> initial_map,
Handle<SharedFunctionInfo> shared_info);
static Handle<Map> CopyForPreventExtensions(Isolate* isolate, Handle<Map> map,
@ -733,11 +738,13 @@ class Map : public HeapObject {
// Returns the map to be used for instances when the given {prototype} is
// passed to an Object.create call. Might transition the given {prototype}.
static Handle<Map> GetObjectCreateMap(Handle<HeapObject> prototype);
static Handle<Map> GetObjectCreateMap(Isolate* isolate,
Handle<HeapObject> prototype);
// Similar to {GetObjectCreateMap} but does not transition {prototype} and
// fails gracefully by returning an empty handle instead.
static MaybeHandle<Map> TryGetObjectCreateMap(Handle<HeapObject> prototype);
static MaybeHandle<Map> TryGetObjectCreateMap(Isolate* isolate,
Handle<HeapObject> prototype);
// Computes a hash value for this map, to be used in HashTables and such.
int Hash();
@ -745,7 +752,8 @@ class Map : public HeapObject {
// Returns the transitioned map for this map with the most generic
// elements_kind that's found in |candidates|, or |nullptr| if no match is
// found at all.
Map* FindElementsKindTransitionedMap(MapHandles const& candidates);
Map* FindElementsKindTransitionedMap(Isolate* isolate,
MapHandles const& candidates);
inline static bool IsJSObject(InstanceType type);
@ -770,13 +778,13 @@ class Map : public HeapObject {
inline bool IsCustomElementsReceiverMap() const;
static void AddDependentCode(Handle<Map> map,
static void AddDependentCode(Isolate* isolate, Handle<Map> map,
DependentCode::DependencyGroup group,
Handle<Code> code);
bool IsMapInArrayPrototypeChain() const;
bool IsMapInArrayPrototypeChain(Isolate* isolate) const;
static Handle<WeakCell> WeakCellForMap(Handle<Map> map);
static Handle<WeakCell> WeakCellForMap(Isolate* isolate, Handle<Map> map);
// Dispatched behavior.
DECL_PRINTER(Map)
@ -842,7 +850,8 @@ class Map : public HeapObject {
void PrintMapDetails(std::ostream& os, JSObject* holder = nullptr);
static inline Handle<Map> AddMissingTransitionsForTesting(
Handle<Map> split_map, Handle<DescriptorArray> descriptors,
Isolate* isolate, Handle<Map> split_map,
Handle<DescriptorArray> descriptors,
Handle<LayoutDescriptor> full_layout_descriptor);
// Fires when the layout of an object with a leaf map changes.
@ -878,37 +887,39 @@ class Map : public HeapObject {
// Returns the map that this (root) map transitions to if its elements_kind
// is changed to |elements_kind|, or |nullptr| if no such map is cached yet.
Map* LookupElementsTransitionMap(ElementsKind elements_kind);
Map* LookupElementsTransitionMap(Isolate* isolate,
ElementsKind elements_kind);
// Tries to replay property transitions starting from this (root) map using
// the descriptor array of the |map|. The |root_map| is expected to have
// proper elements kind and therefore elements kinds transitions are not
// taken by this function. Returns |nullptr| if matching transition map is
// not found.
Map* TryReplayPropertyTransitions(Map* map);
Map* TryReplayPropertyTransitions(Isolate* isolate, Map* map);
static void ConnectTransition(Handle<Map> parent, Handle<Map> child,
Handle<Name> name, SimpleTransitionFlag flag);
static void ConnectTransition(Isolate* isolate, Handle<Map> parent,
Handle<Map> child, Handle<Name> name,
SimpleTransitionFlag flag);
bool EquivalentToForTransition(const Map* other) const;
bool EquivalentToForElementsKindTransition(const Map* other) const;
static Handle<Map> RawCopy(Handle<Map> map, int instance_size,
int inobject_properties);
static Handle<Map> RawCopy(Isolate* isolate, Handle<Map> map,
int instance_size, int inobject_properties);
static Handle<Map> ShareDescriptor(Isolate* isolate, Handle<Map> map,
Handle<DescriptorArray> descriptors,
Descriptor* descriptor);
static Handle<Map> AddMissingTransitions(
Handle<Map> map, Handle<DescriptorArray> descriptors,
Isolate* isolate, Handle<Map> map, Handle<DescriptorArray> descriptors,
Handle<LayoutDescriptor> full_layout_descriptor);
static void InstallDescriptors(
Handle<Map> parent_map, Handle<Map> child_map, int new_descriptor,
Handle<DescriptorArray> descriptors,
Isolate* isolate, Handle<Map> parent_map, Handle<Map> child_map,
int new_descriptor, Handle<DescriptorArray> descriptors,
Handle<LayoutDescriptor> full_layout_descriptor);
static Handle<Map> CopyAddDescriptor(Isolate* isolate, Handle<Map> map,
Descriptor* descriptor,
TransitionFlag flag);
static Handle<Map> CopyReplaceDescriptors(
Handle<Map> map, Handle<DescriptorArray> descriptors,
Isolate* isolate, Handle<Map> map, Handle<DescriptorArray> descriptors,
Handle<LayoutDescriptor> layout_descriptor, TransitionFlag flag,
MaybeHandle<Name> maybe_name, const char* reason,
SimpleTransitionFlag simple_flag);
@ -932,31 +943,29 @@ class Map : public HeapObject {
PropertyAttributes attributes,
const char* reason);
void DeprecateTransitionTree();
void DeprecateTransitionTree(Isolate* isolate);
void ReplaceDescriptors(DescriptorArray* new_descriptors,
void ReplaceDescriptors(Isolate* isolate, DescriptorArray* new_descriptors,
LayoutDescriptor* new_layout_descriptor);
// Update field type of the given descriptor to new representation and new
// type. The type must be prepared for storing in descriptor array:
// it must be either a simple type or a map wrapped in a weak cell.
void UpdateFieldType(int descriptor_number, Handle<Name> name,
PropertyConstness new_constness,
void UpdateFieldType(Isolate* isolate, int descriptor_number,
Handle<Name> name, PropertyConstness new_constness,
Representation new_representation,
MaybeObjectHandle new_wrapped_type);
// TODO(ishell): Move to MapUpdater.
void PrintReconfiguration(FILE* file, int modify_index, PropertyKind kind,
PropertyAttributes attributes);
void PrintReconfiguration(Isolate* isolate, FILE* file, int modify_index,
PropertyKind kind, PropertyAttributes attributes);
// TODO(ishell): Move to MapUpdater.
void PrintGeneralization(FILE* file, const char* reason, int modify_index,
int split, int descriptors, bool constant_to_field,
Representation old_representation,
Representation new_representation,
MaybeHandle<FieldType> old_field_type,
MaybeHandle<Object> old_value,
MaybeHandle<FieldType> new_field_type,
MaybeHandle<Object> new_value);
void PrintGeneralization(
Isolate* isolate, FILE* file, const char* reason, int modify_index,
int split, int descriptors, bool constant_to_field,
Representation old_representation, Representation new_representation,
MaybeHandle<FieldType> old_field_type, MaybeHandle<Object> old_value,
MaybeHandle<FieldType> new_field_type, MaybeHandle<Object> new_value);
static const int kFastPropertiesSoftLimit = 12;
static const int kMaxFastProperties = 128;

View File

@ -449,9 +449,9 @@ bool InitClassPrototype(Isolate* isolate,
Handle<Object> prototype_parent,
Handle<JSFunction> constructor, Arguments& args) {
Handle<Map> map(prototype->map(), isolate);
map = Map::CopyDropDescriptors(map);
map = Map::CopyDropDescriptors(isolate, map);
map->set_is_prototype_map(true);
Map::SetPrototype(map, prototype_parent);
Map::SetPrototype(isolate, map, prototype_parent);
constructor->set_prototype_or_initial_map(*prototype);
map->SetConstructor(*constructor);
Handle<FixedArray> computed_properties(
@ -496,13 +496,13 @@ bool InitClassConstructor(Isolate* isolate,
Handle<Object> constructor_parent,
Handle<JSFunction> constructor, Arguments& args) {
Handle<Map> map(constructor->map(), isolate);
map = Map::CopyDropDescriptors(map);
map = Map::CopyDropDescriptors(isolate, map);
DCHECK(map->is_prototype_map());
if (!constructor_parent.is_null()) {
// Set map's prototype without enabling prototype setup mode for superclass
// because it does not make sense.
Map::SetPrototype(map, constructor_parent, false);
Map::SetPrototype(isolate, map, constructor_parent, false);
}
Handle<NumberDictionary> elements_dictionary_template(

View File

@ -414,7 +414,7 @@ RUNTIME_FUNCTION(Runtime_ObjectCreate) {
// TODO(bmeurer): Use a dedicated cache for Object.create; think about
// slack tracking for Object.create.
Handle<Map> map =
Map::GetObjectCreateMap(Handle<HeapObject>::cast(prototype));
Map::GetObjectCreateMap(isolate, Handle<HeapObject>::cast(prototype));
// Actually allocate the object.
Handle<JSObject> object;
@ -770,7 +770,7 @@ RUNTIME_FUNCTION(Runtime_CompleteInobjectSlackTrackingForMap) {
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(Map, initial_map, 0);
initial_map->CompleteInobjectSlackTracking();
initial_map->CompleteInobjectSlackTracking(isolate);
return isolate->heap()->undefined_value();
}

View File

@ -1064,7 +1064,7 @@ RUNTIME_FUNCTION(Runtime_CompleteInobjectSlackTracking) {
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
object->map()->CompleteInobjectSlackTracking();
object->map()->CompleteInobjectSlackTracking(isolate);
return isolate->heap()->undefined_value();
}

View File

@ -116,7 +116,7 @@ void ObjectDeserializer::CommitPostProcessedObjects() {
script->set_id(isolate()->heap()->NextScriptId());
// Add script to list.
Handle<Object> list =
FixedArrayOfWeakCells::Add(factory->script_list(), script);
FixedArrayOfWeakCells::Add(isolate(), factory->script_list(), script);
heap->SetRootScriptList(*list);
}
}

View File

@ -1943,8 +1943,9 @@ Maybe<uint32_t> ValueDeserializer::ReadJSObjectProperties(
->NowContains(value)) {
Handle<FieldType> value_type =
value->OptimalType(isolate_, expected_representation);
Map::GeneralizeField(target, descriptor, details.constness(),
expected_representation, value_type);
Map::GeneralizeField(isolate_, target, descriptor,
details.constness(), expected_representation,
value_type);
}
DCHECK(target->instance_descriptors()
->GetFieldType(descriptor)

View File

@ -1114,7 +1114,7 @@ void WasmMemoryObject::AddInstance(Isolate* isolate,
? Handle<FixedArrayOfWeakCells>(memory->instances(), isolate)
: Handle<FixedArrayOfWeakCells>::null();
Handle<FixedArrayOfWeakCells> new_instances =
FixedArrayOfWeakCells::Add(old_instances, instance);
FixedArrayOfWeakCells::Add(isolate, old_instances, instance);
memory->set_instances(*new_instances);
Handle<JSArrayBuffer> buffer(memory->array_buffer(), isolate);
SetInstanceMemory(isolate, instance, buffer);

View File

@ -242,7 +242,6 @@ class ApiTestFuzzer: public v8::base::Thread {
RegisterThreadedTest register_##Name(Test##Name, #Name); \
/* */ TEST(Name)
class RegisterThreadedTest {
public:
explicit RegisterThreadedTest(CcTest::TestFunction* callback,

View File

@ -4699,7 +4699,7 @@ Handle<WeakFixedArray> AddRetainedMap(Isolate* isolate, Heap* heap) {
CompileRun("(function () { return {x : 10}; })();");
Handle<JSReceiver> proto =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(result));
Map::SetPrototype(map, proto);
Map::SetPrototype(isolate, map, proto);
heap->AddRetainedMap(map);
Handle<WeakFixedArray> array = isolate->factory()->NewWeakFixedArray(1);
array->Set(0, HeapObjectReference::Weak(*map));
@ -4748,13 +4748,14 @@ TEST(WritableVsImmortalRoots) {
TEST(FixedArrayOfWeakCells) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
Isolate* isolate = CcTest::i_isolate();
Handle<HeapNumber> number = CcTest::i_isolate()->factory()->NewHeapNumber(1);
Handle<HeapNumber> number = isolate->factory()->NewHeapNumber(1);
Handle<FixedArrayOfWeakCells> array =
FixedArrayOfWeakCells::Add(Handle<Object>(), number);
FixedArrayOfWeakCells::Add(isolate, Handle<Object>(), number);
array->Remove(number);
array->Compact<FixedArrayOfWeakCells::NullCallback>();
FixedArrayOfWeakCells::Add(array, number);
FixedArrayOfWeakCells::Add(isolate, array, number);
}

View File

@ -99,7 +99,6 @@ using ::v8::Value;
} \
THREADED_TEST(Name)
void RunWithProfiler(void (*test)()) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
@ -2742,6 +2741,7 @@ THREADED_TEST(InternalFields) {
TEST(InternalFieldsSubclassing) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
v8::HandleScope scope(isolate);
for (int nof_embedder_fields = 0;
nof_embedder_fields < i::JSObject::kMaxEmbedderFields;
@ -2819,9 +2819,9 @@ TEST(InternalFieldsSubclassing) {
i::Handle<i::JSObject> i_value =
i::Handle<i::JSObject>::cast(v8::Utils::OpenHandle(*value));
#ifdef VERIFY_HEAP
i_value->HeapObjectVerify(i_value->GetIsolate());
i_value->map()->HeapObjectVerify(i_value->GetIsolate());
i_value->map()->FindRootMap()->HeapObjectVerify(i_value->GetIsolate());
i_value->HeapObjectVerify(i_isolate);
i_value->map()->HeapObjectVerify(i_isolate);
i_value->map()->FindRootMap(i_isolate)->HeapObjectVerify(i_isolate);
#endif
CHECK_EQ(nof_embedder_fields, value->InternalFieldCount());
if (in_object_only) {
@ -2831,7 +2831,8 @@ TEST(InternalFieldsSubclassing) {
}
// Make Sure we get the precise property count.
i_value->map()->FindRootMap()->CompleteInobjectSlackTracking();
i_value->map()->FindRootMap(i_isolate)->CompleteInobjectSlackTracking(
i_isolate);
// TODO(cbruni): fix accounting to make this condition true.
// CHECK_EQ(0, i_value->map()->UnusedPropertyFields());
if (in_object_only) {

View File

@ -493,7 +493,7 @@ TEST(ReconfigureAccessorToNonExistingDataField) {
CHECK(expectations.Check(*map));
Handle<Map> new_map = Map::ReconfigureProperty(
map, 0, kData, NONE, Representation::None(), none_type);
isolate, map, 0, kData, NONE, Representation::None(), none_type);
// |map| did not change except marked unstable.
CHECK(!map->is_deprecated());
CHECK(!map->is_stable());
@ -508,12 +508,12 @@ TEST(ReconfigureAccessorToNonExistingDataField) {
CHECK(expectations.Check(*new_map));
Handle<Map> new_map2 = Map::ReconfigureProperty(
map, 0, kData, NONE, Representation::None(), none_type);
isolate, map, 0, kData, NONE, Representation::None(), none_type);
CHECK_EQ(*new_map, *new_map2);
Handle<Object> value(Smi::kZero, isolate);
Handle<Map> prepared_map =
Map::PrepareForDataProperty(new_map, 0, PropertyConstness::kConst, value);
Handle<Map> prepared_map = Map::PrepareForDataProperty(
isolate, new_map, 0, PropertyConstness::kConst, value);
// None to Smi generalization is trivial, map does not change.
CHECK_EQ(*new_map, *prepared_map);
@ -640,7 +640,7 @@ static void TestGeneralizeField(int detach_property_at_index,
if (is_detached_map) {
detach_point_map = Map::ReconfigureProperty(
detach_point_map, detach_property_at_index, kData, NONE,
isolate, detach_point_map, detach_property_at_index, kData, NONE,
Representation::Tagged(), any_type);
expectations.SetDataField(detach_property_at_index, kDefaultFieldConstness,
Representation::Tagged(), any_type);
@ -650,14 +650,15 @@ static void TestGeneralizeField(int detach_property_at_index,
}
// Create new maps by generalizing representation of propX field.
Handle<Map> field_owner(map->FindFieldOwner(property_index), isolate);
Handle<Map> field_owner(map->FindFieldOwner(isolate, property_index),
isolate);
CompilationDependencies dependencies(isolate, &zone);
CHECK(!dependencies.HasAborted());
dependencies.AssumeFieldOwner(field_owner);
Handle<Map> new_map = Map::ReconfigureProperty(
map, property_index, kData, NONE, to.representation, to.type);
isolate, map, property_index, kData, NONE, to.representation, to.type);
expectations.SetDataField(property_index, expected.constness,
expected.representation, expected.type);
@ -701,7 +702,7 @@ static void TestGeneralizeField(int detach_property_at_index,
dependencies.Rollback(); // Properly cleanup compilation info.
// Update all deprecated maps and check that they are now the same.
Handle<Map> updated_map = Map::Update(map);
Handle<Map> updated_map = Map::Update(isolate, map);
CHECK_EQ(*new_map, *updated_map);
}
@ -932,7 +933,7 @@ TEST(GeneralizeFieldWithAccessorProperties) {
continue;
}
Handle<Map> new_map = Map::ReconfigureProperty(
map, i, kData, NONE, Representation::Double(), any_type);
isolate, map, i, kData, NONE, Representation::Double(), any_type);
maps[i] = new_map;
expectations.SetDataField(i, PropertyConstness::kMutable,
@ -951,10 +952,10 @@ TEST(GeneralizeFieldWithAccessorProperties) {
CHECK(!active_map->is_deprecated());
// Update all deprecated maps and check that they are now the same.
Handle<Map> updated_map = Map::Update(map);
Handle<Map> updated_map = Map::Update(isolate, map);
CHECK_EQ(*active_map, *updated_map);
for (int i = 0; i < kPropCount; i++) {
updated_map = Map::Update(maps[i]);
updated_map = Map::Update(isolate, maps[i]);
CHECK_EQ(*active_map, *updated_map);
}
}
@ -1013,7 +1014,7 @@ static void TestReconfigureDataFieldAttribute_GeneralizeField(
CHECK(expectations2.Check(*map2));
Zone zone(isolate->allocator(), ZONE_NAME);
Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate);
Handle<Map> field_owner(map->FindFieldOwner(isolate, kSplitProp), isolate);
CompilationDependencies dependencies(isolate, &zone);
CHECK(!dependencies.HasAborted());
dependencies.AssumeFieldOwner(field_owner);
@ -1043,7 +1044,7 @@ static void TestReconfigureDataFieldAttribute_GeneralizeField(
CHECK(expectations.Check(*new_map));
// Update deprecated |map|, it should become |new_map|.
Handle<Map> updated_map = Map::Update(map);
Handle<Map> updated_map = Map::Update(isolate, map);
CHECK_EQ(*new_map, *updated_map);
}
@ -1098,7 +1099,7 @@ static void TestReconfigureDataFieldAttribute_GeneralizeFieldTrivial(
CHECK(expectations2.Check(*map2));
Zone zone(isolate->allocator(), ZONE_NAME);
Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate);
Handle<Map> field_owner(map->FindFieldOwner(isolate, kSplitProp), isolate);
CompilationDependencies dependencies(isolate, &zone);
CHECK(!dependencies.HasAborted());
dependencies.AssumeFieldOwner(field_owner);
@ -1130,7 +1131,7 @@ static void TestReconfigureDataFieldAttribute_GeneralizeFieldTrivial(
CHECK(!new_map->is_deprecated());
CHECK(expectations.Check(*new_map));
Handle<Map> updated_map = Map::Update(map);
Handle<Map> updated_map = Map::Update(isolate, map);
CHECK_EQ(*new_map, *updated_map);
}
@ -1338,7 +1339,7 @@ TEST(ReconfigureDataFieldAttribute_GeneralizeHeapObjectFieldToTagged) {
// Checks that given |map| is deprecated and that it updates to given |new_map|
// which in turn should match expectations.
struct CheckDeprecated {
void Check(Handle<Map> map, Handle<Map> new_map,
void Check(Isolate* isolate, Handle<Map> map, Handle<Map> new_map,
const Expectations& expectations) {
CHECK(map->is_deprecated());
CHECK_NE(*map, *new_map);
@ -1347,7 +1348,7 @@ struct CheckDeprecated {
CHECK(expectations.Check(*new_map));
// Update deprecated |map|, it should become |new_map|.
Handle<Map> updated_map = Map::Update(map);
Handle<Map> updated_map = Map::Update(isolate, map);
CHECK_EQ(*new_map, *updated_map);
}
};
@ -1356,7 +1357,7 @@ struct CheckDeprecated {
// Checks that given |map| is NOT deprecated, equals to given |new_map| and
// matches expectations.
struct CheckSameMap {
void Check(Handle<Map> map, Handle<Map> new_map,
void Check(Isolate* isolate, Handle<Map> map, Handle<Map> new_map,
const Expectations& expectations) {
// |map| was not reconfigured, therefore it should stay stable.
CHECK(map->is_stable());
@ -1367,7 +1368,7 @@ struct CheckSameMap {
CHECK(expectations.Check(*new_map));
// Update deprecated |map|, it should become |new_map|.
Handle<Map> updated_map = Map::Update(map);
Handle<Map> updated_map = Map::Update(isolate, map);
CHECK_EQ(*new_map, *updated_map);
}
};
@ -1376,7 +1377,7 @@ struct CheckSameMap {
// Checks that given |map| is NOT deprecated and matches expectations.
// |new_map| is unrelated to |map|.
struct CheckUnrelated {
void Check(Handle<Map> map, Handle<Map> new_map,
void Check(Isolate* isolate, Handle<Map> map, Handle<Map> new_map,
const Expectations& expectations) {
CHECK(!map->is_deprecated());
CHECK_NE(*map, *new_map);
@ -1391,7 +1392,8 @@ struct CheckUnrelated {
// Checks that given |map| is NOT deprecated, and |new_map| is a result of
// copy-generalize-all-representations.
struct CheckCopyGeneralizeAllFields {
void Check(Handle<Map> map, Handle<Map> new_map, Expectations& expectations) {
void Check(Isolate* isolate, Handle<Map> map, Handle<Map> new_map,
Expectations& expectations) {
CHECK(!map->is_deprecated());
CHECK_NE(*map, *new_map);
@ -1494,7 +1496,7 @@ static void TestReconfigureProperty_CustomPropertyAfterTargetMap(
CHECK(expectations2.Check(*map2));
config.UpdateExpectations(kCustomPropIndex, expectations1);
checker.Check(map1, new_map, expectations1);
checker.Check(isolate, map1, new_map, expectations1);
}
@ -1542,7 +1544,7 @@ TEST(ReconfigureDataFieldAttribute_DataConstantToDataFieldAfterTargetMap) {
Factory* factory = isolate->factory();
Handle<String> name = factory->empty_string();
Handle<Map> sloppy_map =
Map::CopyInitialMap(isolate->sloppy_function_map());
Map::CopyInitialMap(isolate, isolate->sloppy_function_map());
Handle<SharedFunctionInfo> info =
factory->NewSharedFunctionInfoForBuiltin(name, Builtins::kIllegal);
function_type_ = FieldType::Class(sloppy_map, isolate);
@ -1774,14 +1776,15 @@ static void TestReconfigureElementsKind_GeneralizeField(
CHECK(expectations2.Check(*map2));
Zone zone(isolate->allocator(), ZONE_NAME);
Handle<Map> field_owner(map->FindFieldOwner(kDiffProp), isolate);
Handle<Map> field_owner(map->FindFieldOwner(isolate, kDiffProp), isolate);
CompilationDependencies dependencies(isolate, &zone);
CHECK(!dependencies.HasAborted());
dependencies.AssumeFieldOwner(field_owner);
// Reconfigure elements kinds of |map2|, which should generalize
// representations in |map|.
Handle<Map> new_map = Map::ReconfigureElementsKind(map2, PACKED_ELEMENTS);
Handle<Map> new_map =
Map::ReconfigureElementsKind(isolate, map2, PACKED_ELEMENTS);
// |map2| should be left unchanged but marked unstable.
CHECK(!map2->is_stable());
@ -1802,7 +1805,7 @@ static void TestReconfigureElementsKind_GeneralizeField(
CHECK(expectations.Check(*new_map));
// Update deprecated |map|, it should become |new_map|.
Handle<Map> updated_map = Map::Update(map);
Handle<Map> updated_map = Map::Update(isolate, map);
CHECK_EQ(*new_map, *updated_map);
// Ensure Map::FindElementsKindTransitionedMap() is able to find the
@ -1810,7 +1813,8 @@ static void TestReconfigureElementsKind_GeneralizeField(
{
MapHandles map_list;
map_list.push_back(updated_map);
Map* transitioned_map = map2->FindElementsKindTransitionedMap(map_list);
Map* transitioned_map =
map2->FindElementsKindTransitionedMap(isolate, map_list);
CHECK_EQ(*updated_map, transitioned_map);
}
}
@ -1868,14 +1872,15 @@ static void TestReconfigureElementsKind_GeneralizeFieldTrivial(
CHECK(expectations2.Check(*map2));
Zone zone(isolate->allocator(), ZONE_NAME);
Handle<Map> field_owner(map->FindFieldOwner(kDiffProp), isolate);
Handle<Map> field_owner(map->FindFieldOwner(isolate, kDiffProp), isolate);
CompilationDependencies dependencies(isolate, &zone);
CHECK(!dependencies.HasAborted());
dependencies.AssumeFieldOwner(field_owner);
// Reconfigure elements kinds of |map2|, which should generalize
// representations in |map|.
Handle<Map> new_map = Map::ReconfigureElementsKind(map2, PACKED_ELEMENTS);
Handle<Map> new_map =
Map::ReconfigureElementsKind(isolate, map2, PACKED_ELEMENTS);
// |map2| should be left unchanged but marked unstable.
CHECK(!map2->is_stable());
@ -1897,7 +1902,7 @@ static void TestReconfigureElementsKind_GeneralizeFieldTrivial(
CHECK(!new_map->is_deprecated());
CHECK(expectations.Check(*new_map));
Handle<Map> updated_map = Map::Update(map);
Handle<Map> updated_map = Map::Update(isolate, map);
CHECK_EQ(*new_map, *updated_map);
// Ensure Map::FindElementsKindTransitionedMap() is able to find the
@ -1905,7 +1910,8 @@ static void TestReconfigureElementsKind_GeneralizeFieldTrivial(
{
MapHandles map_list;
map_list.push_back(updated_map);
Map* transitioned_map = map2->FindElementsKindTransitionedMap(map_list);
Map* transitioned_map =
map2->FindElementsKindTransitionedMap(isolate, map_list);
CHECK_EQ(*updated_map, transitioned_map);
}
}
@ -2159,7 +2165,7 @@ TEST(ReconfigurePropertySplitMapTransitionsOverflow) {
map2 = handle(target, isolate);
}
map2 = Map::ReconfigureProperty(map2, kSplitProp, kData, NONE,
map2 = Map::ReconfigureProperty(isolate, map2, kSplitProp, kData, NONE,
Representation::Double(), any_type);
expectations.SetDataField(kSplitProp, PropertyConstness::kMutable,
Representation::Double(), any_type);
@ -2188,7 +2194,7 @@ TEST(ReconfigurePropertySplitMapTransitionsOverflow) {
// Try to update |map|, since there is no place for propX transition at |map2|
// |map| should become "copy-generalized".
Handle<Map> updated_map = Map::Update(map);
Handle<Map> updated_map = Map::Update(isolate, map);
CHECK(updated_map->GetBackPointer()->IsUndefined(isolate));
for (int i = 0; i < kPropCount; i++) {
@ -2262,7 +2268,7 @@ static void TestGeneralizeFieldWithSpecialTransition(TestConfig& config,
// Create new maps by generalizing representation of propX field.
Handle<Map> maps[kPropCount];
for (int i = 0; i < kPropCount; i++) {
Handle<Map> new_map = Map::ReconfigureProperty(map, i, kData, NONE,
Handle<Map> new_map = Map::ReconfigureProperty(isolate, map, i, kData, NONE,
to.representation, to.type);
maps[i] = new_map;
@ -2274,12 +2280,12 @@ static void TestGeneralizeFieldWithSpecialTransition(TestConfig& config,
CHECK(i == 0 || maps[i - 1]->is_deprecated());
CHECK(expectations.Check(*new_map));
Handle<Map> new_map2 = Map::Update(map2);
Handle<Map> new_map2 = Map::Update(isolate, map2);
CHECK(!new_map2->is_deprecated());
CHECK(!new_map2->is_dictionary_map());
Handle<Map> tmp_map;
if (Map::TryUpdate(map2).ToHandle(&tmp_map)) {
if (Map::TryUpdate(isolate, map2).ToHandle(&tmp_map)) {
// If Map::TryUpdate() manages to succeed the result must match the result
// of Map::Update().
CHECK_EQ(*new_map2, *tmp_map);
@ -2303,10 +2309,10 @@ static void TestGeneralizeFieldWithSpecialTransition(TestConfig& config,
CHECK(!active_map->is_deprecated());
// Update all deprecated maps and check that they are now the same.
Handle<Map> updated_map = Map::Update(map);
Handle<Map> updated_map = Map::Update(isolate, map);
CHECK_EQ(*active_map, *updated_map);
for (int i = 0; i < kPropCount; i++) {
updated_map = Map::Update(maps[i]);
updated_map = Map::Update(isolate, maps[i]);
CHECK_EQ(*active_map, *updated_map);
}
}
@ -2577,12 +2583,13 @@ struct FieldGeneralizationChecker {
attributes_(attributes),
heap_type_(heap_type) {}
void Check(Expectations& expectations2, Handle<Map> map1, Handle<Map> map2) {
void Check(Isolate* isolate, Expectations& expectations2, Handle<Map> map1,
Handle<Map> map2) {
CHECK(!map2->is_deprecated());
CHECK(map1->is_deprecated());
CHECK_NE(*map1, *map2);
Handle<Map> updated_map = Map::Update(map1);
Handle<Map> updated_map = Map::Update(isolate, map1);
CHECK_EQ(*map2, *updated_map);
expectations2.SetDataField(descriptor_, attributes_, constness_,
@ -2594,7 +2601,8 @@ struct FieldGeneralizationChecker {
// Checks that existing transition was taken as is.
struct SameMapChecker {
void Check(Expectations& expectations, Handle<Map> map1, Handle<Map> map2) {
void Check(Isolate* isolate, Expectations& expectations, Handle<Map> map1,
Handle<Map> map2) {
CHECK(!map2->is_deprecated());
CHECK_EQ(*map1, *map2);
CHECK(expectations.Check(*map2));
@ -2605,7 +2613,8 @@ struct SameMapChecker {
// Checks that both |map1| and |map2| should stays non-deprecated, this is
// the case when property kind is change.
struct PropertyKindReconfigurationChecker {
void Check(Expectations& expectations, Handle<Map> map1, Handle<Map> map2) {
void Check(Isolate* isolate, Expectations& expectations, Handle<Map> map1,
Handle<Map> map2) {
CHECK(!map1->is_deprecated());
CHECK(!map2->is_deprecated());
CHECK_NE(*map1, *map2);
@ -2654,7 +2663,7 @@ static void TestTransitionTo(TransitionOp1& transition_op1,
Handle<Map> map2 = transition_op2.DoTransition(expectations2, map);
// Let the test customization do the check.
checker.Check(expectations2, map1, map2);
checker.Check(isolate, expectations2, map1, map2);
}
@ -2699,7 +2708,8 @@ TEST(TransitionDataConstantToAnotherDataConstant) {
Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory();
Handle<String> name = factory->empty_string();
Handle<Map> sloppy_map = Map::CopyInitialMap(isolate->sloppy_function_map());
Handle<Map> sloppy_map =
Map::CopyInitialMap(isolate, isolate->sloppy_function_map());
Handle<SharedFunctionInfo> info =
factory->NewSharedFunctionInfoForBuiltin(name, Builtins::kIllegal);
Handle<FieldType> function_type = FieldType::Class(sloppy_map, isolate);

View File

@ -42,7 +42,6 @@ TEST(Default) {
CHECK_EQ(0, strcmp(FLAG_testing_string_flag, "Hello, world!"));
}
static void SetFlagsToDefault() {
FlagList::ResetAllFlags();
TestDefault();

View File

@ -342,7 +342,7 @@ UNINITIALIZED_TEST(StartupSerializerRootMapDependencies) {
v8::internal::Handle<Map> map(
internal_isolate->heap()->one_byte_internalized_string_map(),
internal_isolate);
Map::WeakCellForMap(map);
Map::WeakCellForMap(internal_isolate, map);
// Need to avoid DCHECKs inside SnapshotCreator.
snapshot_creator.SetDefaultContext(v8::Context::New(isolate));
}

View File

@ -771,7 +771,7 @@ static Handle<LayoutDescriptor> TestLayoutDescriptorAppendIfFastOrUseFull(
// This method calls LayoutDescriptor::AppendIfFastOrUseFull() internally
// and does all the required map-descriptors related book keeping.
Handle<Map> last_map = Map::AddMissingTransitionsForTesting(
initial_map, descriptors, full_layout_descriptor);
isolate, initial_map, descriptors, full_layout_descriptor);
// Follow back pointers to construct a sequence of maps from |map|
// to |last_map|.
@ -952,7 +952,7 @@ TEST(Regress436816) {
CHECK(!object->map()->HasFastPointerLayout());
Handle<Map> normalized_map =
Map::Normalize(map, KEEP_INOBJECT_PROPERTIES, "testing");
Map::Normalize(isolate, map, KEEP_INOBJECT_PROPERTIES, "testing");
JSObject::MigrateToMap(object, normalized_map);
CHECK(!object->HasFastProperties());
CHECK(object->map()->HasFastPointerLayout());
@ -1584,7 +1584,7 @@ static void TestWriteBarrierObjectShiftFieldsRight(
// Shift fields right by turning constant property to a field.
Handle<Map> new_map = Map::ReconfigureProperty(
map, 0, kData, NONE, Representation::Tagged(), any_type);
isolate, map, 0, kData, NONE, Representation::Tagged(), any_type);
if (write_barrier_kind == OLD_TO_NEW_WRITE_BARRIER) {
TestWriteBarrier(map, new_map, 2, 1);