Commit 4ce2adc3 authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[explicit isolates] Eliminate GetIsolate from transitions.cc

Removes all explicit calls to GetIsolate() in transitions.cc by passing
it through calling functions and implicit calls via the single argument
Handle constructor and handle function.

Unfortunately in the interests of making these changes vaguely
manageable, I've also pushed some new GetIsolates down into
objects-debug.cc, objects-printer.cc and objects.cc.

Bug: v8:7786
Change-Id: I1f98530dec6c004e17dc3336f3cef09fbb446bae
Reviewed-on: https://chromium-review.googlesource.com/1085451
Commit-Queue: Dan Elphick <delphick@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53518}
parent 5eaa03b2
......@@ -663,7 +663,7 @@ bool AccessInfoFactory::LookupTransition(Handle<Map> map, Handle<Name> name,
PropertyAccessInfo* access_info) {
// Check if the {map} has a data transition with the given {name}.
Map* transition =
TransitionsAccessor(map).SearchTransition(*name, kData, NONE);
TransitionsAccessor(isolate_, map).SearchTransition(*name, kData, NONE);
if (transition == nullptr) return false;
Handle<Map> transition_map(transition);
......
......@@ -1708,7 +1708,7 @@ void MarkCompactCollector::ClearPotentialSimpleMapTransition(Map* dead_target) {
Map* parent = Map::cast(potential_parent);
DisallowHeapAllocation no_gc_obviously;
if (non_atomic_marking_state()->IsBlackOrGrey(parent) &&
TransitionsAccessor(parent, &no_gc_obviously)
TransitionsAccessor(isolate(), parent, &no_gc_obviously)
.HasSimpleTransitionTo(dead_target)) {
ClearPotentialSimpleMapTransition(parent, dead_target);
}
......
......@@ -404,7 +404,7 @@ Handle<Object> JsonParser<seq_one_byte>::ParseJsonObject() {
Handle<Map> target;
if (seq_one_byte) {
DisallowHeapAllocation no_gc;
TransitionsAccessor transitions(*map, &no_gc);
TransitionsAccessor transitions(isolate(), *map, &no_gc);
key = transitions.ExpectedTransitionKey();
follow_expected = !key.is_null() && ParseJsonString(key);
// If the expected transition hits, follow it.
......@@ -419,9 +419,9 @@ Handle<Object> JsonParser<seq_one_byte>::ParseJsonObject() {
if (key.is_null()) return ReportUnexpectedCharacter();
// If a transition was found, follow it and continue.
transitioning =
TransitionsAccessor(map).FindTransitionToField(key).ToHandle(
&target);
transitioning = TransitionsAccessor(isolate(), map)
.FindTransitionToField(key)
.ToHandle(&target);
}
if (c0_ != ':') return ReportUnexpectedCharacter();
......
......@@ -307,7 +307,7 @@ MapUpdater::State MapUpdater::FindTargetMap() {
int root_nof = root_map_->NumberOfOwnDescriptors();
for (int i = root_nof; i < old_nof_; ++i) {
PropertyDetails old_details = GetDetails(i);
Map* transition = TransitionsAccessor(target_map_)
Map* transition = TransitionsAccessor(isolate_, target_map_)
.SearchTransition(GetKey(i), old_details.kind(),
old_details.attributes());
if (transition == nullptr) break;
......@@ -393,7 +393,7 @@ MapUpdater::State MapUpdater::FindTargetMap() {
// Find the last compatible target map in the transition tree.
for (int i = target_nof; i < old_nof_; ++i) {
PropertyDetails old_details = GetDetails(i);
Map* transition = TransitionsAccessor(target_map_)
Map* transition = TransitionsAccessor(isolate_, target_map_)
.SearchTransition(GetKey(i), old_details.kind(),
old_details.attributes());
if (transition == nullptr) break;
......@@ -603,7 +603,7 @@ Handle<Map> MapUpdater::FindSplitMap(Handle<DescriptorArray> descriptors) {
Name* name = descriptors->GetKey(i);
PropertyDetails details = descriptors->GetDetails(i);
Map* next =
TransitionsAccessor(current, &no_allocation)
TransitionsAccessor(isolate_, current, &no_allocation)
.SearchTransition(name, details.kind(), details.attributes());
if (next == nullptr) break;
DescriptorArray* next_descriptors = next->instance_descriptors();
......@@ -639,7 +639,7 @@ MapUpdater::State MapUpdater::ConstructNewMap() {
DCHECK_NE(old_nof_, split_nof);
PropertyDetails split_details = GetDetails(split_nof);
TransitionsAccessor transitions(split_map);
TransitionsAccessor transitions(isolate_, split_map);
// Invalidate a transition target at |key|.
Map* maybe_transition = transitions.SearchTransition(
......
......@@ -542,7 +542,8 @@ void JSObject::JSObjectVerify() {
void Map::MapVerify() {
Heap* heap = GetHeap();
Isolate* isolate = GetIsolate();
Heap* heap = isolate->heap();
CHECK(!heap->InNewSpace(this));
CHECK(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE);
CHECK(instance_size() == kVariableSizeSentinel ||
......@@ -554,8 +555,10 @@ void Map::MapVerify() {
VerifyHeapPointer(instance_descriptors());
SLOW_DCHECK(instance_descriptors()->IsSortedNoDuplicates());
DisallowHeapAllocation no_gc;
SLOW_DCHECK(TransitionsAccessor(this, &no_gc).IsSortedNoDuplicates());
SLOW_DCHECK(TransitionsAccessor(this, &no_gc).IsConsistentWithBackPointers());
SLOW_DCHECK(
TransitionsAccessor(isolate, this, &no_gc).IsSortedNoDuplicates());
SLOW_DCHECK(TransitionsAccessor(isolate, this, &no_gc)
.IsConsistentWithBackPointers());
SLOW_DCHECK(!FLAG_unbox_double_fields ||
layout_descriptor()->IsConsistentWithMap(this));
if (!may_have_interesting_symbols()) {
......@@ -1966,15 +1969,16 @@ bool TransitionArray::IsSortedNoDuplicates(int valid_entries) {
PropertyKind prev_kind = kData;
PropertyAttributes prev_attributes = NONE;
uint32_t prev_hash = 0;
Isolate* isolate = GetIsolate();
for (int i = 0; i < number_of_transitions(); i++) {
Name* key = GetSortedKey(i);
uint32_t hash = key->Hash();
PropertyKind kind = kData;
PropertyAttributes attributes = NONE;
if (!TransitionsAccessor::IsSpecialTransition(key)) {
if (!TransitionsAccessor::IsSpecialTransition(isolate, key)) {
Map* target = GetTarget(i);
PropertyDetails details =
TransitionsAccessor::GetTargetDetails(key, target);
TransitionsAccessor::GetTargetDetails(isolate, key, target);
kind = details.kind();
attributes = details.attributes();
} else {
......
......@@ -769,7 +769,7 @@ void Map::MapPrint(std::ostream& os) { // NOLINT
}
{
DisallowHeapAllocation no_gc;
TransitionsAccessor transitions(this, &no_gc);
TransitionsAccessor transitions(GetIsolate(), this, &no_gc);
int nof_transitions = transitions.NumberOfTransitions();
if (nof_transitions > 0) {
os << "\n - transitions #" << nof_transitions << ": ";
......@@ -2237,7 +2237,7 @@ void TransitionsAccessor::PrintOneTransition(std::ostream& os, Name* key,
} else if (key == heap->strict_function_transition_symbol()) {
os << " (transition to strict function)";
} else {
DCHECK(!IsSpecialTransition(key));
DCHECK(!IsSpecialTransition(key->GetIsolate(), key));
os << "(transition to ";
int descriptor = target->LastAdded();
DescriptorArray* descriptors = target->instance_descriptors();
......@@ -2302,7 +2302,7 @@ void TransitionsAccessor::PrintTransitionTree(std::ostream& os, int level,
ss << Brief(target);
os << std::left << std::setw(50) << ss.str() << ": ";
Heap* heap = key->GetHeap();
Heap* heap = isolate_->heap();
if (key == heap->nonextensible_symbol()) {
os << "to non-extensible";
} else if (key == heap->sealed_symbol()) {
......@@ -2320,21 +2320,21 @@ void TransitionsAccessor::PrintTransitionTree(std::ostream& os, int level,
key->ShortPrint(os);
#endif
os << " ";
DCHECK(!IsSpecialTransition(key));
DCHECK(!IsSpecialTransition(isolate_, key));
os << "to ";
int descriptor = target->LastAdded();
DescriptorArray* descriptors = target->instance_descriptors();
descriptors->PrintDescriptorDetails(os, descriptor,
PropertyDetails::kForTransitions);
}
TransitionsAccessor transitions(target, no_gc);
TransitionsAccessor transitions(isolate_, target, no_gc);
transitions.PrintTransitionTree(os, level + 1, no_gc);
}
}
void JSObject::PrintTransitions(std::ostream& os) { // NOLINT
DisallowHeapAllocation no_gc;
TransitionsAccessor ta(map(), &no_gc);
TransitionsAccessor ta(GetIsolate(), map(), &no_gc);
if (ta.NumberOfTransitions() == 0) return;
os << "\n - transitions";
ta.PrintTransitions(os);
......@@ -2437,8 +2437,8 @@ extern void _v8_internal_Print_TransitionTree(void* object) {
} else {
#if defined(DEBUG) || defined(OBJECT_PRINT)
i::DisallowHeapAllocation no_gc;
i::TransitionsAccessor transitions(reinterpret_cast<i::Map*>(object),
&no_gc);
i::Map* map = reinterpret_cast<i::Map*>(object);
i::TransitionsAccessor transitions(map->GetIsolate(), map, &no_gc);
transitions.PrintTransitionTree();
#endif
}
......
This diff is collapsed.
......@@ -636,7 +636,7 @@ Object* Map::GetBackPointer() const {
Map* Map::ElementsTransitionMap() {
DisallowHeapAllocation no_gc;
return TransitionsAccessor(this, &no_gc)
return TransitionsAccessor(GetIsolate(), this, &no_gc)
.SearchSpecial(GetHeap()->elements_transition_symbol());
}
......
......@@ -89,8 +89,9 @@ HeapObjectReference** TransitionArray::GetTargetSlot(int transition_number) {
}
// static
PropertyDetails TransitionsAccessor::GetTargetDetails(Name* name, Map* target) {
DCHECK(!IsSpecialTransition(name));
PropertyDetails TransitionsAccessor::GetTargetDetails(Isolate* isolate,
Name* name, Map* target) {
DCHECK(!IsSpecialTransition(isolate, name));
int descriptor = target->LastAdded();
DescriptorArray* descriptors = target->instance_descriptors();
// Transitions are allowed only for the last added property.
......
This diff is collapsed.
......@@ -37,11 +37,13 @@ namespace internal {
// cleared when the map they refer to is not otherwise reachable.
class TransitionsAccessor {
public:
TransitionsAccessor(Map* map, DisallowHeapAllocation* no_gc) : map_(map) {
TransitionsAccessor(Isolate* isolate, Map* map, DisallowHeapAllocation* no_gc)
: isolate_(isolate), map_(map) {
Initialize();
USE(no_gc);
}
explicit TransitionsAccessor(Handle<Map> map) : map_handle_(map), map_(*map) {
TransitionsAccessor(Isolate* isolate, Handle<Map> map)
: isolate_(isolate), map_handle_(map), map_(*map) {
Initialize();
}
......@@ -57,7 +59,7 @@ class TransitionsAccessor {
Map* SearchSpecial(Symbol* name);
// Returns true for non-property transitions like elements kind, or
// or frozen/sealed transitions.
static bool IsSpecialTransition(Name* name);
static bool IsSpecialTransition(Isolate* isolate, Name* name);
enum RequestedLocation { kAnyLocation, kFieldOnly };
MaybeHandle<Map> FindTransitionToDataProperty(
......@@ -78,7 +80,8 @@ class TransitionsAccessor {
bool CanHaveMoreTransitions();
inline Name* GetKey(int transition_number);
inline Map* GetTarget(int transition_number);
static inline PropertyDetails GetTargetDetails(Name* name, Map* target);
static inline PropertyDetails GetTargetDetails(Isolate* isolate, Name* name,
Map* target);
static bool IsMatchingMap(Map* target, Name* name, PropertyKind kind,
PropertyAttributes attributes);
......@@ -177,6 +180,7 @@ class TransitionsAccessor {
inline TransitionArray* transitions();
Isolate* isolate_;
Handle<Map> map_handle_;
Map* map_;
MaybeObject* raw_transitions_;
......@@ -230,7 +234,7 @@ class TransitionArray : public WeakFixedArray {
bool IsSortedNoDuplicates(int valid_entries = -1);
#endif
void Sort();
void Sort(Isolate* isolate);
#if defined(DEBUG) || defined(OBJECT_PRINT)
// For our gdb macros.
......@@ -298,8 +302,8 @@ class TransitionArray : public WeakFixedArray {
}
// Search a transition for a given kind, property name and attributes.
int Search(PropertyKind kind, Name* name, PropertyAttributes attributes,
int* out_insertion_index = nullptr);
int Search(Isolate* isolate, PropertyKind kind, Name* name,
PropertyAttributes attributes, int* out_insertion_index = nullptr);
// Search a non-property transition (like elements kind, observe or frozen
// transitions).
......@@ -308,12 +312,13 @@ class TransitionArray : public WeakFixedArray {
}
// Search a first transition for a given property name.
inline int SearchName(Name* name, int* out_insertion_index = nullptr);
int SearchDetails(int transition, PropertyKind kind,
int SearchDetails(Isolate* isolate, int transition, PropertyKind kind,
PropertyAttributes attributes, int* out_insertion_index);
inline int number_of_transitions() const;
static bool CompactPrototypeTransitionArray(WeakFixedArray* array);
static bool CompactPrototypeTransitionArray(Isolate* isolate,
WeakFixedArray* array);
static Handle<WeakFixedArray> GrowPrototypeTransitionArray(
Handle<WeakFixedArray> array, int new_capacity, Isolate* isolate);
......@@ -339,7 +344,7 @@ class TransitionArray : public WeakFixedArray {
inline void Set(int transition_number, Name* key, MaybeObject* target);
void Zap();
void Zap(Isolate* isolate);
DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray);
};
......
......@@ -1904,7 +1904,7 @@ Maybe<uint32_t> ValueDeserializer::ReadJSObjectProperties(
// transition was found.
Handle<Object> key;
Handle<Map> target;
TransitionsAccessor transitions(map);
TransitionsAccessor transitions(isolate_, map);
Handle<String> expected_key = transitions.ExpectedTransitionKey();
if (!expected_key.is_null() && ReadExpectedString(expected_key)) {
key = expected_key;
......@@ -1917,7 +1917,7 @@ Maybe<uint32_t> ValueDeserializer::ReadJSObjectProperties(
key =
isolate_->factory()->InternalizeString(Handle<String>::cast(key));
// Don't reuse |transitions| because it could be stale.
transitioning = TransitionsAccessor(map)
transitioning = TransitionsAccessor(isolate_, map)
.FindTransitionToField(Handle<String>::cast(key))
.ToHandle(&target);
} else {
......
......@@ -2703,10 +2703,9 @@ TEST(OptimizedAllocationArrayLiterals) {
CHECK(CcTest::heap()->InNewSpace(o->elements()));
}
static int CountMapTransitions(Map* map) {
static int CountMapTransitions(i::Isolate* isolate, Map* map) {
DisallowHeapAllocation no_gc;
return TransitionsAccessor(map, &no_gc).NumberOfTransitions();
return TransitionsAccessor(isolate, map, &no_gc).NumberOfTransitions();
}
......@@ -2720,8 +2719,10 @@ TEST(Regress1465) {
FLAG_trace_incremental_marking = true;
FLAG_retain_maps_for_n_gc = 0;
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext();
v8::Isolate* isolate = CcTest::isolate();
i::Isolate* i_isolate = CcTest::i_isolate();
v8::HandleScope scope(isolate);
v8::Local<v8::Context> ctx = isolate->GetCurrentContext();
static const int transitions_count = 256;
CompileRun("function F() {}");
......@@ -2740,7 +2741,7 @@ TEST(Regress1465) {
CcTest::global()->Get(ctx, v8_str("root")).ToLocalChecked()));
// Count number of live transitions before marking.
int transitions_before = CountMapTransitions(root->map());
int transitions_before = CountMapTransitions(i_isolate, root->map());
CompileRun("%DebugPrint(root);");
CHECK_EQ(transitions_count, transitions_before);
......@@ -2749,7 +2750,7 @@ TEST(Regress1465) {
// Count number of live transitions after marking. Note that one transition
// is left, because 'o' still holds an instance of one transition target.
int transitions_after = CountMapTransitions(root->map());
int transitions_after = CountMapTransitions(i_isolate, root->map());
CompileRun("%DebugPrint(root);");
CHECK_EQ(1, transitions_after);
}
......@@ -2796,6 +2797,7 @@ TEST(TransitionArrayShrinksDuringAllocToZero) {
FLAG_stress_incremental_marking = false;
FLAG_allow_natives_syntax = true;
CcTest::InitializeVM();
i::Isolate* i_isolate = CcTest::i_isolate();
v8::HandleScope scope(CcTest::isolate());
static const int transitions_count = 10;
CompileRun("function F() { }");
......@@ -2804,7 +2806,7 @@ TEST(TransitionArrayShrinksDuringAllocToZero) {
Handle<JSObject> root = GetByName("root");
// Count number of live transitions before marking.
int transitions_before = CountMapTransitions(root->map());
int transitions_before = CountMapTransitions(i_isolate, root->map());
CHECK_EQ(transitions_count, transitions_before);
// Get rid of o
......@@ -2816,8 +2818,8 @@ TEST(TransitionArrayShrinksDuringAllocToZero) {
// Count number of live transitions after marking. Note that one transition
// is left, because 'o' still holds an instance of one transition target.
int transitions_after = CountMapTransitions(
Map::cast(root->map()->GetBackPointer()));
int transitions_after =
CountMapTransitions(i_isolate, Map::cast(root->map()->GetBackPointer()));
CHECK_EQ(1, transitions_after);
}
......@@ -2827,6 +2829,7 @@ TEST(TransitionArrayShrinksDuringAllocToOne) {
FLAG_stress_incremental_marking = false;
FLAG_allow_natives_syntax = true;
CcTest::InitializeVM();
i::Isolate* i_isolate = CcTest::i_isolate();
v8::HandleScope scope(CcTest::isolate());
static const int transitions_count = 10;
CompileRun("function F() {}");
......@@ -2835,7 +2838,7 @@ TEST(TransitionArrayShrinksDuringAllocToOne) {
Handle<JSObject> root = GetByName("root");
// Count number of live transitions before marking.
int transitions_before = CountMapTransitions(root->map());
int transitions_before = CountMapTransitions(i_isolate, root->map());
CHECK_EQ(transitions_count, transitions_before);
root = GetByName("root");
......@@ -2844,8 +2847,8 @@ TEST(TransitionArrayShrinksDuringAllocToOne) {
// Count number of live transitions after marking. Note that one transition
// is left, because 'o' still holds an instance of one transition target.
int transitions_after = CountMapTransitions(
Map::cast(root->map()->GetBackPointer()));
int transitions_after =
CountMapTransitions(i_isolate, Map::cast(root->map()->GetBackPointer()));
CHECK_EQ(2, transitions_after);
}
......@@ -2855,6 +2858,7 @@ TEST(TransitionArrayShrinksDuringAllocToOnePropertyFound) {
FLAG_stress_incremental_marking = false;
FLAG_allow_natives_syntax = true;
CcTest::InitializeVM();
i::Isolate* i_isolate = CcTest::i_isolate();
v8::HandleScope scope(CcTest::isolate());
static const int transitions_count = 10;
CompileRun("function F() {}");
......@@ -2863,7 +2867,7 @@ TEST(TransitionArrayShrinksDuringAllocToOnePropertyFound) {
Handle<JSObject> root = GetByName("root");
// Count number of live transitions before marking.
int transitions_before = CountMapTransitions(root->map());
int transitions_before = CountMapTransitions(i_isolate, root->map());
CHECK_EQ(transitions_count, transitions_before);
root = GetByName("root");
......@@ -2872,8 +2876,8 @@ TEST(TransitionArrayShrinksDuringAllocToOnePropertyFound) {
// Count number of live transitions after marking. Note that one transition
// is left, because 'o' still holds an instance of one transition target.
int transitions_after = CountMapTransitions(
Map::cast(root->map()->GetBackPointer()));
int transitions_after =
CountMapTransitions(i_isolate, Map::cast(root->map()->GetBackPointer()));
CHECK_EQ(1, transitions_after);
}
#endif // DEBUG
......
......@@ -909,7 +909,7 @@ TEST(TransitionLookup) {
// Ensure we didn't overflow transition array and therefore all the
// combinations of cases are covered.
CHECK(TransitionsAccessor(root_map).CanHaveMoreTransitions());
CHECK(TransitionsAccessor(isolate, root_map).CanHaveMoreTransitions());
// Now try querying keys.
bool positive_lookup_tested = false;
......
......@@ -397,8 +397,8 @@ class Expectations {
heap_type);
Handle<String> name = MakeName("prop", property_index);
Map* target =
TransitionsAccessor(map).SearchTransition(*name, kData, attributes);
Map* target = TransitionsAccessor(isolate_, map)
.SearchTransition(*name, kData, attributes);
CHECK_NOT_NULL(target);
return handle(target);
}
......@@ -2153,8 +2153,8 @@ TEST(ReconfigurePropertySplitMapTransitionsOverflow) {
}
Handle<String> name = MakeName("prop", i);
Map* target =
TransitionsAccessor(map2).SearchTransition(*name, kData, NONE);
Map* target = TransitionsAccessor(isolate, map2)
.SearchTransition(*name, kData, NONE);
CHECK_NOT_NULL(target);
map2 = handle(target);
}
......@@ -2177,13 +2177,13 @@ TEST(ReconfigurePropertySplitMapTransitionsOverflow) {
// Fill in transition tree of |map2| so that it can't have more transitions.
for (int i = 0; i < TransitionsAccessor::kMaxNumberOfTransitions; i++) {
CHECK(TransitionsAccessor(map2).CanHaveMoreTransitions());
CHECK(TransitionsAccessor(isolate, map2).CanHaveMoreTransitions());
Handle<String> name = MakeName("foo", i);
Map::CopyWithField(map2, name, any_type, NONE, PropertyConstness::kMutable,
Representation::Smi(), INSERT_TRANSITION)
.ToHandleChecked();
}
CHECK(!TransitionsAccessor(map2).CanHaveMoreTransitions());
CHECK(!TransitionsAccessor(isolate, map2).CanHaveMoreTransitions());
// Try to update |map|, since there is no place for propX transition at |map2|
// |map| should become "copy-generalized".
......
......@@ -45,11 +45,11 @@ TEST(TransitionArray_SimpleFieldTransitions) {
CHECK(map0->raw_transitions()->IsSmi());
{
TestTransitionsAccessor transitions(map0);
TestTransitionsAccessor transitions(isolate, map0);
transitions.Insert(name1, map1, SIMPLE_PROPERTY_TRANSITION);
}
{
TestTransitionsAccessor transitions(map0);
TestTransitionsAccessor transitions(isolate, map0);
CHECK(transitions.IsWeakRefEncoding());
CHECK_EQ(*map1, transitions.SearchTransition(*name1, kData, attributes));
CHECK_EQ(1, transitions.NumberOfTransitions());
......@@ -59,7 +59,7 @@ TEST(TransitionArray_SimpleFieldTransitions) {
transitions.Insert(name2, map2, SIMPLE_PROPERTY_TRANSITION);
}
{
TestTransitionsAccessor transitions(map0);
TestTransitionsAccessor transitions(isolate, map0);
CHECK(transitions.IsFullTransitionArrayEncoding());
CHECK_EQ(*map1, transitions.SearchTransition(*name1, kData, attributes));
......@@ -102,11 +102,11 @@ TEST(TransitionArray_FullFieldTransitions) {
CHECK(map0->raw_transitions()->IsSmi());
{
TestTransitionsAccessor transitions(map0);
TestTransitionsAccessor transitions(isolate, map0);
transitions.Insert(name1, map1, PROPERTY_TRANSITION);
}
{
TestTransitionsAccessor transitions(map0);
TestTransitionsAccessor transitions(isolate, map0);
CHECK(transitions.IsFullTransitionArrayEncoding());
CHECK_EQ(*map1, transitions.SearchTransition(*name1, kData, attributes));
CHECK_EQ(1, transitions.NumberOfTransitions());
......@@ -116,7 +116,7 @@ TEST(TransitionArray_FullFieldTransitions) {
transitions.Insert(name2, map2, PROPERTY_TRANSITION);
}
{
TestTransitionsAccessor transitions(map0);
TestTransitionsAccessor transitions(isolate, map0);
CHECK(transitions.IsFullTransitionArrayEncoding());
CHECK_EQ(*map1, transitions.SearchTransition(*name1, kData, attributes));
......@@ -160,10 +160,10 @@ TEST(TransitionArray_DifferentFieldNames) {
names[i] = name;
maps[i] = map;
TransitionsAccessor(map0).Insert(name, map, PROPERTY_TRANSITION);
TransitionsAccessor(isolate, map0).Insert(name, map, PROPERTY_TRANSITION);
}
TransitionsAccessor transitions(map0);
TransitionsAccessor transitions(isolate, map0);
for (int i = 0; i < PROPS_COUNT; i++) {
CHECK_EQ(*maps[i],
transitions.SearchTransition(*names[i], kData, attributes));
......@@ -208,11 +208,11 @@ TEST(TransitionArray_SameFieldNamesDifferentAttributesSimple) {
.ToHandleChecked();
attr_maps[i] = map;
TransitionsAccessor(map0).Insert(name, map, PROPERTY_TRANSITION);
TransitionsAccessor(isolate, map0).Insert(name, map, PROPERTY_TRANSITION);
}
// Ensure that transitions for |name| field are valid.
TransitionsAccessor transitions(map0);
TransitionsAccessor transitions(isolate, map0);
for (int i = 0; i < ATTRS_COUNT; i++) {
PropertyAttributes attributes = static_cast<PropertyAttributes>(i);
CHECK_EQ(*attr_maps[i],
......@@ -252,7 +252,7 @@ TEST(TransitionArray_SameFieldNamesDifferentAttributes) {
names[i] = name;
maps[i] = map;
TransitionsAccessor(map0).Insert(name, map, PROPERTY_TRANSITION);
TransitionsAccessor(isolate, map0).Insert(name, map, PROPERTY_TRANSITION);
}
const int ATTRS_COUNT = (READ_ONLY | DONT_ENUM | DONT_DELETE) + 1;
......@@ -271,11 +271,11 @@ TEST(TransitionArray_SameFieldNamesDifferentAttributes) {
.ToHandleChecked();
attr_maps[i] = map;
TransitionsAccessor(map0).Insert(name, map, PROPERTY_TRANSITION);
TransitionsAccessor(isolate, map0).Insert(name, map, PROPERTY_TRANSITION);
}
// Ensure that transitions for |name| field are valid.
TransitionsAccessor transitions(map0);
TransitionsAccessor transitions(isolate, map0);
for (int i = 0; i < ATTRS_COUNT; i++) {
PropertyAttributes attr = static_cast<PropertyAttributes>(i);
CHECK_EQ(*attr_maps[i], transitions.SearchTransition(*name, kData, attr));
......
......@@ -12,10 +12,11 @@ namespace internal {
class TestTransitionsAccessor : public TransitionsAccessor {
public:
TestTransitionsAccessor(Map* map, DisallowHeapAllocation* no_gc)
: TransitionsAccessor(map, no_gc) {}
explicit TestTransitionsAccessor(Handle<Map> map)
: TransitionsAccessor(map) {}
TestTransitionsAccessor(Isolate* isolate, Map* map,
DisallowHeapAllocation* no_gc)
: TransitionsAccessor(isolate, map, no_gc) {}
TestTransitionsAccessor(Isolate* isolate, Handle<Map> map)
: TransitionsAccessor(isolate, map) {}
// Expose internals for tests.
bool IsWeakRefEncoding() { return encoding() == kWeakRef; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment