Commit be91c6c5 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[compiler][cleanup] Move Make(String|Name) helper methods to cctest.h

Several tests were using them and we can dedup code.

Change-Id: I4ef5ae5772856d1f36e965b6b62ff5895b4e04fb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2215173Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67974}
parent a79a9185
......@@ -150,6 +150,18 @@ void CcTest::PreciseCollectAllGarbage(i::Isolate* isolate) {
i::GarbageCollectionReason::kTesting);
}
i::Handle<i::String> CcTest::MakeString(const char* str) {
i::Isolate* isolate = CcTest::i_isolate();
i::Factory* factory = isolate->factory();
return factory->InternalizeUtf8String(str);
}
i::Handle<i::String> CcTest::MakeName(const char* str, int suffix) {
i::EmbeddedVector<char, 128> buffer;
SNPrintF(buffer, "%s%d", str, suffix);
return CcTest::MakeString(buffer.begin());
}
v8::base::RandomNumberGenerator* CcTest::random_number_generator() {
return InitIsolateOnce()->random_number_generator();
}
......
......@@ -141,6 +141,9 @@ class CcTest {
static void CollectAllAvailableGarbage(i::Isolate* isolate = nullptr);
static void PreciseCollectAllGarbage(i::Isolate* isolate = nullptr);
static i::Handle<i::String> MakeString(const char* str);
static i::Handle<i::String> MakeName(const char* str, int suffix);
static v8::base::RandomNumberGenerator* random_number_generator();
static v8::Local<v8::Object> global();
......
......@@ -42,18 +42,6 @@ template <class T>
using TVariable = TypedCodeAssemblerVariable<T>;
using PromiseResolvingFunctions = TorqueStructPromiseResolvingFunctions;
Handle<String> MakeString(const char* str) {
Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory();
return factory->InternalizeUtf8String(str);
}
Handle<String> MakeName(const char* str, int suffix) {
EmbeddedVector<char, 128> buffer;
SNPrintF(buffer, "%s%d", str, suffix);
return MakeString(buffer.begin());
}
int sum10(int a0, int a1, int a2, int a3, int a4, int a5, int a6, int a7,
int a8, int a9) {
return a0 + a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9;
......@@ -1090,7 +1078,7 @@ TEST(TransitionLookup) {
name = factory->NewSymbol();
} else {
int random_key = rand_gen.NextInt(Smi::kMaxValue);
name = MakeName("p", random_key);
name = CcTest::MakeName("p", random_key);
}
keys[i] = name;
......@@ -3572,8 +3560,8 @@ TEST(TestCallBuiltinInlineTrampoline) {
options.use_pc_relative_calls_and_jumps = false;
options.isolate_independent_code = false;
FunctionTester ft(asm_tester.GenerateCode(options), kNumParams);
MaybeHandle<Object> result = ft.Call(MakeString("abcdef"));
CHECK(String::Equals(isolate, MakeString("abcdefabcdef"),
MaybeHandle<Object> result = ft.Call(CcTest::MakeString("abcdef"));
CHECK(String::Equals(isolate, CcTest::MakeString("abcdefabcdef"),
Handle<String>::cast(result.ToHandleChecked())));
}
......@@ -3598,8 +3586,8 @@ DISABLED_TEST(TestCallBuiltinIndirectLoad) {
options.use_pc_relative_calls_and_jumps = false;
options.isolate_independent_code = true;
FunctionTester ft(asm_tester.GenerateCode(options), kNumParams);
MaybeHandle<Object> result = ft.Call(MakeString("abcdef"));
CHECK(String::Equals(isolate, MakeString("abcdefabcdef"),
MaybeHandle<Object> result = ft.Call(CcTest::MakeString("abcdef"));
CHECK(String::Equals(isolate, CcTest::MakeString("abcdefabcdef"),
Handle<String>::cast(result.ToHandleChecked())));
}
......
......@@ -27,19 +27,6 @@ namespace test_elements_kind {
namespace {
Handle<String> MakeString(const char* str) {
Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory();
return factory->InternalizeUtf8String(str);
}
Handle<String> MakeName(const char* str, int suffix) {
EmbeddedVector<char, 128> buffer;
SNPrintF(buffer, "%s%d", str, suffix);
return MakeString(buffer.begin());
}
template <typename T, typename M>
bool EQUALS(Isolate* isolate, Handle<T> left, Handle<M> right) {
if (*left == *right) return true;
......@@ -127,7 +114,7 @@ TEST(JSObjectAddingProperties) {
// for the default constructor function no in-object properties are reserved
// hence adding a single property will initialize the property-array
Handle<String> name = MakeName("property", 0);
Handle<String> name = CcTest::MakeName("property", 0);
JSObject::DefinePropertyOrElementIgnoreAttributes(object, name, value, NONE)
.Check();
CHECK_NE(object->map(), *previous_map);
......@@ -162,7 +149,7 @@ TEST(JSObjectInObjectAddingProperties) {
// we have reserved space for in-object properties, hence adding up to
// |nof_inobject_properties| will not create a property store
for (int i = 0; i < nof_inobject_properties; i++) {
Handle<String> name = MakeName("property", i);
Handle<String> name = CcTest::MakeName("property", i);
JSObject::DefinePropertyOrElementIgnoreAttributes(object, name, value, NONE)
.Check();
}
......@@ -174,7 +161,7 @@ TEST(JSObjectInObjectAddingProperties) {
// adding one more property will not fit in the in-object properties, thus
// creating a property store
int index = nof_inobject_properties + 1;
Handle<String> name = MakeName("property", index);
Handle<String> name = CcTest::MakeName("property", index);
JSObject::DefinePropertyOrElementIgnoreAttributes(object, name, value, NONE)
.Check();
CHECK_NE(object->map(), *previous_map);
......@@ -205,7 +192,7 @@ TEST(JSObjectAddingElements) {
CHECK(EQUALS(isolate, object->elements(), empty_fixed_array));
// Adding an indexed element initializes the elements array
name = MakeString("0");
name = CcTest::MakeString("0");
JSObject::DefinePropertyOrElementIgnoreAttributes(object, name, value, NONE)
.Check();
// no change in elements_kind => no map transition
......@@ -217,7 +204,7 @@ TEST(JSObjectAddingElements) {
// Adding more consecutive elements without a change in the backing store
int non_dict_backing_store_limit = 100;
for (int i = 1; i < non_dict_backing_store_limit; i++) {
name = MakeName("", i);
name = CcTest::MakeName("", i);
JSObject::DefinePropertyOrElementIgnoreAttributes(object, name, value, NONE)
.Check();
}
......@@ -229,7 +216,7 @@ TEST(JSObjectAddingElements) {
// Adding an element at an very large index causes a change to
// DICTIONARY_ELEMENTS
name = MakeString("100000000");
name = CcTest::MakeString("100000000");
JSObject::DefinePropertyOrElementIgnoreAttributes(object, name, value, NONE)
.Check();
// change in elements_kind => map transition
......@@ -260,7 +247,7 @@ TEST(JSArrayAddingProperties) {
// for the default constructor function no in-object properties are reserved
// hence adding a single property will initialize the property-array
Handle<String> name = MakeName("property", 0);
Handle<String> name = CcTest::MakeName("property", 0);
JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value, NONE)
.Check();
// No change in elements_kind but added property => new map
......@@ -292,7 +279,7 @@ TEST(JSArrayAddingElements) {
CHECK_EQ(0, Smi::ToInt(array->length()));
// Adding an indexed element initializes the elements array
name = MakeString("0");
name = CcTest::MakeString("0");
JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value, NONE)
.Check();
// no change in elements_kind => no map transition
......@@ -305,7 +292,7 @@ TEST(JSArrayAddingElements) {
// Adding more consecutive elements without a change in the backing store
int non_dict_backing_store_limit = 100;
for (int i = 1; i < non_dict_backing_store_limit; i++) {
name = MakeName("", i);
name = CcTest::MakeName("", i);
JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value, NONE)
.Check();
}
......@@ -319,7 +306,7 @@ TEST(JSArrayAddingElements) {
// Adding an element at an very large index causes a change to
// DICTIONARY_ELEMENTS
int index = 100000000;
name = MakeName("", index);
name = CcTest::MakeName("", index);
JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value, NONE)
.Check();
// change in elements_kind => map transition
......@@ -340,7 +327,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastSmiElements) {
Handle<String> name;
Handle<Object> value_smi(Smi::FromInt(42), isolate);
Handle<Object> value_string(MakeString("value"));
Handle<Object> value_string(CcTest::MakeString("value"));
Handle<Object> value_double = factory->NewNumber(3.1415);
Handle<JSArray> array =
......@@ -350,7 +337,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastSmiElements) {
CHECK_EQ(0, Smi::ToInt(array->length()));
// `array[0] = smi_value` doesn't change the elements_kind
name = MakeString("0");
name = CcTest::MakeString("0");
JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_smi,
NONE)
.Check();
......@@ -360,7 +347,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastSmiElements) {
CHECK_EQ(1, Smi::ToInt(array->length()));
// `delete array[0]` does not alter length, but changes the elments_kind
name = MakeString("0");
name = CcTest::MakeString("0");
CHECK(JSReceiver::DeletePropertyOrElement(array, name).FromMaybe(false));
CHECK_NE(array->map(), *previous_map);
CHECK_EQ(HOLEY_SMI_ELEMENTS, array->map().elements_kind());
......@@ -368,11 +355,11 @@ TEST(JSArrayAddingElementsGeneralizingiFastSmiElements) {
previous_map = handle(array->map(), isolate);
// add a couple of elements again
name = MakeString("0");
name = CcTest::MakeString("0");
JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_smi,
NONE)
.Check();
name = MakeString("1");
name = CcTest::MakeString("1");
JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_smi,
NONE)
.Check();
......@@ -381,7 +368,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastSmiElements) {
CHECK_EQ(2, Smi::ToInt(array->length()));
// Adding a string to the array changes from FAST_HOLEY_SMI to FAST_HOLEY
name = MakeString("0");
name = CcTest::MakeString("0");
JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_string,
NONE)
.Check();
......@@ -391,14 +378,14 @@ TEST(JSArrayAddingElementsGeneralizingiFastSmiElements) {
previous_map = handle(array->map(), isolate);
// We don't transition back to FAST_SMI even if we remove the string
name = MakeString("0");
name = CcTest::MakeString("0");
JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_smi,
NONE)
.Check();
CHECK_EQ(array->map(), *previous_map);
// Adding a double doesn't change the map either
name = MakeString("0");
name = CcTest::MakeString("0");
JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_double,
NONE)
.Check();
......@@ -414,7 +401,7 @@ TEST(JSArrayAddingElementsGeneralizingFastElements) {
Handle<String> name;
Handle<Object> value_smi(Smi::FromInt(42), isolate);
Handle<Object> value_string(MakeString("value"));
Handle<Object> value_string(CcTest::MakeString("value"));
Handle<JSArray> array =
factory->NewJSArray(ElementsKind::PACKED_ELEMENTS, 0, 0);
......@@ -423,7 +410,7 @@ TEST(JSArrayAddingElementsGeneralizingFastElements) {
CHECK_EQ(0, Smi::ToInt(array->length()));
// `array[0] = smi_value` doesn't change the elements_kind
name = MakeString("0");
name = CcTest::MakeString("0");
JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_smi,
NONE)
.Check();
......@@ -433,7 +420,7 @@ TEST(JSArrayAddingElementsGeneralizingFastElements) {
CHECK_EQ(1, Smi::ToInt(array->length()));
// `delete array[0]` does not alter length, but changes the elments_kind
name = MakeString("0");
name = CcTest::MakeString("0");
CHECK(JSReceiver::DeletePropertyOrElement(array, name).FromMaybe(false));
CHECK_NE(array->map(), *previous_map);
CHECK_EQ(HOLEY_ELEMENTS, array->map().elements_kind());
......@@ -441,11 +428,11 @@ TEST(JSArrayAddingElementsGeneralizingFastElements) {
previous_map = handle(array->map(), isolate);
// add a couple of elements, elements_kind stays HOLEY
name = MakeString("0");
name = CcTest::MakeString("0");
JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_string,
NONE)
.Check();
name = MakeString("1");
name = CcTest::MakeString("1");
JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_smi,
NONE)
.Check();
......@@ -463,7 +450,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastDoubleElements) {
Handle<String> name;
Handle<Object> value_smi(Smi::FromInt(42), isolate);
Handle<Object> value_string(MakeString("value"));
Handle<Object> value_string(CcTest::MakeString("value"));
Handle<Object> value_double = factory->NewNumber(3.1415);
Handle<JSArray> array =
......@@ -471,7 +458,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastDoubleElements) {
Handle<Map> previous_map(array->map(), isolate);
// `array[0] = value_double` changes |elements_kind| to PACKED_DOUBLE_ELEMENTS
name = MakeString("0");
name = CcTest::MakeString("0");
JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_double,
NONE)
.Check();
......@@ -481,7 +468,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastDoubleElements) {
previous_map = handle(array->map(), isolate);
// `array[1] = value_smi` doesn't alter the |elements_kind|
name = MakeString("1");
name = CcTest::MakeString("1");
JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_smi,
NONE)
.Check();
......@@ -490,7 +477,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastDoubleElements) {
CHECK_EQ(2, Smi::ToInt(array->length()));
// `delete array[0]` does not alter length, but changes the elments_kind
name = MakeString("0");
name = CcTest::MakeString("0");
CHECK(JSReceiver::DeletePropertyOrElement(array, name).FromMaybe(false));
CHECK_NE(array->map(), *previous_map);
CHECK_EQ(HOLEY_DOUBLE_ELEMENTS, array->map().elements_kind());
......@@ -498,7 +485,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastDoubleElements) {
previous_map = handle(array->map(), isolate);
// filling the hole `array[0] = value_smi` again doesn't transition back
name = MakeString("0");
name = CcTest::MakeString("0");
JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_double,
NONE)
.Check();
......@@ -507,7 +494,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastDoubleElements) {
CHECK_EQ(2, Smi::ToInt(array->length()));
// Adding a string to the array changes to elements_kind PACKED_ELEMENTS
name = MakeString("1");
name = CcTest::MakeString("1");
JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_string,
NONE)
.Check();
......@@ -517,7 +504,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastDoubleElements) {
previous_map = handle(array->map(), isolate);
// Adding a double doesn't change the map
name = MakeString("0");
name = CcTest::MakeString("0");
JSObject::DefinePropertyOrElementIgnoreAttributes(array, name, value_double,
NONE)
.Check();
......
......@@ -43,20 +43,6 @@ const int kPropCount = 7;
// Helper functions.
//
static Handle<String> MakeString(const char* str) {
Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory();
return factory->InternalizeUtf8String(str);
}
static Handle<String> MakeName(const char* str, int suffix) {
EmbeddedVector<char, 128> buffer;
SNPrintF(buffer, "%s%d", str, suffix);
return MakeString(buffer.begin());
}
static Handle<AccessorPair> CreateAccessorPair(bool with_getter,
bool with_setter) {
Isolate* isolate = CcTest::i_isolate();
......@@ -339,7 +325,7 @@ class Expectations {
SetDataField(property_index, attributes, constness, representation,
field_type);
Handle<String> name = MakeName("prop", property_index);
Handle<String> name = CcTest::MakeName("prop", property_index);
return Map::CopyWithField(isolate_, map, name, field_type, attributes,
constness, representation, INSERT_TRANSITION)
.ToHandleChecked();
......@@ -351,7 +337,7 @@ class Expectations {
int property_index = number_of_properties_++;
SetDataConstant(property_index, attributes, value);
Handle<String> name = MakeName("prop", property_index);
Handle<String> name = CcTest::MakeName("prop", property_index);
return Map::CopyWithConstant(isolate_, map, name, value, attributes,
INSERT_TRANSITION)
.ToHandleChecked();
......@@ -368,7 +354,7 @@ class Expectations {
SetDataField(property_index, attributes, constness, representation,
heap_type);
Handle<String> name = MakeName("prop", property_index);
Handle<String> name = CcTest::MakeName("prop", property_index);
return Map::TransitionToDataProperty(isolate_, map, name, value, attributes,
constness, StoreOrigin::kNamed);
}
......@@ -380,7 +366,7 @@ class Expectations {
int property_index = number_of_properties_++;
SetDataConstant(property_index, attributes, value);
Handle<String> name = MakeName("prop", property_index);
Handle<String> name = CcTest::MakeName("prop", property_index);
return Map::TransitionToDataProperty(isolate_, map, name, value, attributes,
PropertyConstness::kConst,
StoreOrigin::kNamed);
......@@ -396,7 +382,7 @@ class Expectations {
SetDataField(property_index, attributes, constness, representation,
heap_type);
Handle<String> name = MakeName("prop", property_index);
Handle<String> name = CcTest::MakeName("prop", property_index);
Map target = TransitionsAccessor(isolate_, map)
.SearchTransition(*name, kData, attributes);
CHECK(!target.is_null());
......@@ -410,7 +396,7 @@ class Expectations {
int property_index = number_of_properties_++;
SetAccessorConstant(property_index, attributes, pair);
Handle<String> name = MakeName("prop", property_index);
Handle<String> name = CcTest::MakeName("prop", property_index);
Descriptor d = Descriptor::AccessorConstant(name, pair, attributes);
return Map::CopyInsertDescriptor(isolate_, map, &d, INSERT_TRANSITION);
......@@ -424,7 +410,7 @@ class Expectations {
int property_index = number_of_properties_++;
SetAccessorConstant(property_index, attributes, getter, setter);
Handle<String> name = MakeName("prop", property_index);
Handle<String> name = CcTest::MakeName("prop", property_index);
CHECK(!getter->IsNull(isolate_) || !setter->IsNull(isolate_));
Factory* factory = isolate_->factory();
......@@ -451,7 +437,7 @@ class Expectations {
int property_index = number_of_properties_++;
SetAccessorConstant(property_index, attributes, pair);
Handle<String> name = MakeName("prop", property_index);
Handle<String> name = CcTest::MakeName("prop", property_index);
Isolate* isolate = CcTest::i_isolate();
Handle<Object> getter(pair->getter(), isolate);
......@@ -2121,7 +2107,7 @@ TEST(ReconfigurePropertySplitMapTransitionsOverflow) {
split_map = map2;
}
Handle<String> name = MakeName("prop", i);
Handle<String> name = CcTest::MakeName("prop", i);
Map target = TransitionsAccessor(isolate, map2)
.SearchTransition(*name, kData, NONE);
CHECK(!target.is_null());
......@@ -2148,7 +2134,7 @@ 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(isolate, map2).CanHaveMoreTransitions());
Handle<String> name = MakeName("foo", i);
Handle<String> name = CcTest::MakeName("foo", i);
Map::CopyWithField(isolate, map2, name, any_type, NONE,
PropertyConstness::kMutable, Representation::Smi(),
INSERT_TRANSITION)
......@@ -2367,9 +2353,9 @@ TEST(ElementsKindTransitionFromMapNotOwningDescriptor) {
// Add one more transition to |map| in order to prevent descriptors
// ownership.
CHECK(map->owns_descriptors());
Map::CopyWithField(isolate, map, MakeString("foo"), any_type, NONE,
PropertyConstness::kMutable, Representation::Smi(),
INSERT_TRANSITION)
Map::CopyWithField(isolate, map, CcTest::MakeString("foo"), any_type,
NONE, PropertyConstness::kMutable,
Representation::Smi(), INSERT_TRANSITION)
.ToHandleChecked();
CHECK(!map->owns_descriptors());
......@@ -2480,9 +2466,9 @@ TEST(PrototypeTransitionFromMapNotOwningDescriptor) {
// Add one more transition to |map| in order to prevent descriptors
// ownership.
CHECK(map->owns_descriptors());
Map::CopyWithField(isolate, map, MakeString("foo"), any_type, NONE,
PropertyConstness::kMutable, Representation::Smi(),
INSERT_TRANSITION)
Map::CopyWithField(isolate, map, CcTest::MakeString("foo"), any_type,
NONE, PropertyConstness::kMutable,
Representation::Smi(), INSERT_TRANSITION)
.ToHandleChecked();
CHECK(!map->owns_descriptors());
......
......@@ -45,20 +45,6 @@ static void InitializeVerifiedMapDescriptors(
CHECK(layout_descriptor.IsConsistentWithMap(map, true));
}
static Handle<String> MakeString(const char* str) {
Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory();
return factory->InternalizeUtf8String(str);
}
static Handle<String> MakeName(const char* str, int suffix) {
EmbeddedVector<char, 128> buffer;
SNPrintF(buffer, "%s%d", str, suffix);
return MakeString(buffer.begin());
}
Handle<JSObject> GetObject(const char* name) {
return Handle<JSObject>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(
......@@ -995,13 +981,14 @@ TEST(DescriptorArrayTrimming) {
Handle<FieldType> any_type = FieldType::Any(isolate);
Handle<Map> map = Map::Create(isolate, kFieldCount);
for (int i = 0; i < kSplitFieldIndex; i++) {
map = Map::CopyWithField(isolate, map, MakeName("prop", i), any_type, NONE,
PropertyConstness::kMutable, Representation::Smi(),
INSERT_TRANSITION)
map = Map::CopyWithField(isolate, map, CcTest::MakeName("prop", i),
any_type, NONE, PropertyConstness::kMutable,
Representation::Smi(), INSERT_TRANSITION)
.ToHandleChecked();
}
map = Map::CopyWithField(isolate, map, MakeName("dbl", kSplitFieldIndex),
any_type, NONE, PropertyConstness::kMutable,
map = Map::CopyWithField(isolate, map,
CcTest::MakeName("dbl", kSplitFieldIndex), any_type,
NONE, PropertyConstness::kMutable,
Representation::Double(), INSERT_TRANSITION)
.ToHandleChecked();
CHECK(map->layout_descriptor().IsConsistentWithMap(*map, true));
......@@ -1015,7 +1002,7 @@ TEST(DescriptorArrayTrimming) {
Handle<Map> tmp_map = map;
for (int i = kSplitFieldIndex + 1; i < kFieldCount; i++) {
tmp_map = Map::CopyWithField(isolate, tmp_map, MakeName("dbl", i),
tmp_map = Map::CopyWithField(isolate, tmp_map, CcTest::MakeName("dbl", i),
any_type, NONE, PropertyConstness::kMutable,
Representation::Double(), INSERT_TRANSITION)
.ToHandleChecked();
......@@ -1055,14 +1042,15 @@ TEST(DescriptorArrayTrimming) {
Handle<Map> tmp_map = map;
for (int i = kSplitFieldIndex + 1; i < kFieldCount - 1; i++) {
tmp_map = Map::CopyWithField(isolate, tmp_map, MakeName("tagged", i),
any_type, NONE, PropertyConstness::kMutable,
Representation::Tagged(), INSERT_TRANSITION)
.ToHandleChecked();
tmp_map =
Map::CopyWithField(isolate, tmp_map, CcTest::MakeName("tagged", i),
any_type, NONE, PropertyConstness::kMutable,
Representation::Tagged(), INSERT_TRANSITION)
.ToHandleChecked();
CHECK(tmp_map->layout_descriptor().IsConsistentWithMap(*tmp_map, true));
}
tmp_map = Map::CopyWithField(isolate, tmp_map, MakeString("dbl"), any_type,
NONE, PropertyConstness::kMutable,
tmp_map = Map::CopyWithField(isolate, tmp_map, CcTest::MakeString("dbl"),
any_type, NONE, PropertyConstness::kMutable,
Representation::Double(), INSERT_TRANSITION)
.ToHandleChecked();
CHECK(tmp_map->layout_descriptor().IsConsistentWithMap(*tmp_map, true));
......@@ -1087,8 +1075,8 @@ TEST(DoScavenge) {
Handle<FieldType> any_type = FieldType::Any(isolate);
Handle<Map> map = Map::Create(isolate, 10);
map = Map::CopyWithField(isolate, map, MakeName("prop", 0), any_type, NONE,
PropertyConstness::kMutable,
map = Map::CopyWithField(isolate, map, CcTest::MakeName("prop", 0), any_type,
NONE, PropertyConstness::kMutable,
Representation::Double(), INSERT_TRANSITION)
.ToHandleChecked();
......@@ -1153,12 +1141,12 @@ TEST(DoScavengeWithIncrementalWriteBarrier) {
Handle<FieldType> any_type = FieldType::Any(isolate);
Handle<Map> map = Map::Create(isolate, 10);
map = Map::CopyWithField(isolate, map, MakeName("prop", 0), any_type, NONE,
PropertyConstness::kMutable,
map = Map::CopyWithField(isolate, map, CcTest::MakeName("prop", 0), any_type,
NONE, PropertyConstness::kMutable,
Representation::Double(), INSERT_TRANSITION)
.ToHandleChecked();
map = Map::CopyWithField(isolate, map, MakeName("prop", 1), any_type, NONE,
PropertyConstness::kMutable,
map = Map::CopyWithField(isolate, map, CcTest::MakeName("prop", 1), any_type,
NONE, PropertyConstness::kMutable,
Representation::Tagged(), INSERT_TRANSITION)
.ToHandleChecked();
......@@ -1390,14 +1378,14 @@ TEST(LayoutDescriptorSharing) {
{
Handle<Map> map = Map::Create(isolate, 64);
for (int i = 0; i < 32; i++) {
Handle<String> name = MakeName("prop", i);
Handle<String> name = CcTest::MakeName("prop", i);
map = Map::CopyWithField(isolate, map, name, any_type, NONE,
PropertyConstness::kMutable,
Representation::Smi(), INSERT_TRANSITION)
.ToHandleChecked();
}
split_map = Map::CopyWithField(isolate, map, MakeString("dbl"), any_type,
NONE, PropertyConstness::kMutable,
split_map = Map::CopyWithField(isolate, map, CcTest::MakeString("dbl"),
any_type, NONE, PropertyConstness::kMutable,
Representation::Double(), INSERT_TRANSITION)
.ToHandleChecked();
}
......@@ -1408,9 +1396,9 @@ TEST(LayoutDescriptorSharing) {
CHECK(split_map->owns_descriptors());
Handle<Map> map1 =
Map::CopyWithField(isolate, split_map, MakeString("foo"), any_type, NONE,
PropertyConstness::kMutable, Representation::Double(),
INSERT_TRANSITION)
Map::CopyWithField(isolate, split_map, CcTest::MakeString("foo"),
any_type, NONE, PropertyConstness::kMutable,
Representation::Double(), INSERT_TRANSITION)
.ToHandleChecked();
CHECK(!split_map->owns_descriptors());
CHECK_EQ(*split_layout_descriptor, split_map->layout_descriptor());
......@@ -1421,9 +1409,9 @@ TEST(LayoutDescriptorSharing) {
CHECK(map1->layout_descriptor().IsConsistentWithMap(*map1, true));
Handle<Map> map2 =
Map::CopyWithField(isolate, split_map, MakeString("bar"), any_type, NONE,
PropertyConstness::kMutable, Representation::Tagged(),
INSERT_TRANSITION)
Map::CopyWithField(isolate, split_map, CcTest::MakeString("bar"),
any_type, NONE, PropertyConstness::kMutable,
Representation::Tagged(), INSERT_TRANSITION)
.ToHandleChecked();
// Layout descriptors should not be shared with |split_map|.
......@@ -1595,15 +1583,15 @@ static void TestWriteBarrierObjectShiftFieldsRight(
Handle<JSObject> func = GetObject("func");
Handle<Map> map = Map::Create(isolate, 10);
map = Map::CopyWithConstant(isolate, map, MakeName("prop", 0), func, NONE,
INSERT_TRANSITION)
map = Map::CopyWithConstant(isolate, map, CcTest::MakeName("prop", 0), func,
NONE, INSERT_TRANSITION)
.ToHandleChecked();
map = Map::CopyWithField(isolate, map, MakeName("prop", 1), any_type, NONE,
PropertyConstness::kMutable,
map = Map::CopyWithField(isolate, map, CcTest::MakeName("prop", 1), any_type,
NONE, PropertyConstness::kMutable,
Representation::Double(), INSERT_TRANSITION)
.ToHandleChecked();
map = Map::CopyWithField(isolate, map, MakeName("prop", 2), any_type, NONE,
PropertyConstness::kMutable,
map = Map::CopyWithField(isolate, map, CcTest::MakeName("prop", 2), any_type,
NONE, PropertyConstness::kMutable,
Representation::Tagged(), INSERT_TRANSITION)
.ToHandleChecked();
......
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