aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest/test-field-type-tracking.cc
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2017-12-05 16:41:55 +0100
committerMichaël Zasso <targos@protonmail.com>2017-12-06 12:52:07 +0100
commit1854ba04e9a68f062beb299dd6e1479279b26363 (patch)
treed5b2df9b8c1deb6388f7a728fca8e1c98c779abe /deps/v8/test/cctest/test-field-type-tracking.cc
parentb52c23b75f96e1c9d2c7b3a7e5619170d0a0d8e1 (diff)
downloadandroid-node-v8-1854ba04e9a68f062beb299dd6e1479279b26363.tar.gz
android-node-v8-1854ba04e9a68f062beb299dd6e1479279b26363.tar.bz2
android-node-v8-1854ba04e9a68f062beb299dd6e1479279b26363.zip
deps: update V8 to 6.3.292.46
PR-URL: https://github.com/nodejs/node/pull/16271 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'deps/v8/test/cctest/test-field-type-tracking.cc')
-rw-r--r--deps/v8/test/cctest/test-field-type-tracking.cc40
1 files changed, 22 insertions, 18 deletions
diff --git a/deps/v8/test/cctest/test-field-type-tracking.cc b/deps/v8/test/cctest/test-field-type-tracking.cc
index 3310c5c1d1..89845e9bf5 100644
--- a/deps/v8/test/cctest/test-field-type-tracking.cc
+++ b/deps/v8/test/cctest/test-field-type-tracking.cc
@@ -24,6 +24,7 @@
namespace v8 {
namespace internal {
+namespace test_field_type_tracking {
// TODO(ishell): fix this once TransitionToPrototype stops generalizing
// all field representations (similar to crbug/448711 where elements kind
@@ -109,6 +110,20 @@ class Expectations {
CHECK(index < MAX_PROPERTIES);
kinds_[index] = kind;
locations_[index] = location;
+ if (kind == kData && location == kField &&
+ IsTransitionableFastElementsKind(elements_kind_) &&
+ Map::IsInplaceGeneralizableField(constness, representation,
+ FieldType::cast(*value))) {
+ // Maps with transitionable elements kinds must have non in-place
+ // generalizable fields.
+ if (FLAG_track_constant_fields && FLAG_modify_map_inplace &&
+ constness == kConst) {
+ constness = kMutable;
+ }
+ if (representation.IsHeapObject() && !FieldType::cast(*value)->IsAny()) {
+ value = FieldType::Any(isolate_);
+ }
+ }
constnesses_[index] = constness;
attributes_[index] = attributes;
representations_[index] = representation;
@@ -317,27 +332,14 @@ class Expectations {
Handle<Map> AddDataField(Handle<Map> map, PropertyAttributes attributes,
PropertyConstness constness,
Representation representation,
- Handle<FieldType> heap_type) {
+ Handle<FieldType> field_type) {
CHECK_EQ(number_of_properties_, map->NumberOfOwnDescriptors());
int property_index = number_of_properties_++;
- PropertyConstness expected_constness = constness;
- Representation expected_representation = representation;
- Handle<FieldType> expected_heap_type = heap_type;
- if (IsTransitionableFastElementsKind(map->elements_kind())) {
- // Maps with transitionable elements kinds must have non in-place
- // generalizable fields.
- if (FLAG_track_constant_fields && FLAG_modify_map_inplace) {
- expected_constness = kMutable;
- }
- if (representation.IsHeapObject() && heap_type->IsClass()) {
- expected_heap_type = FieldType::Any(isolate_);
- }
- }
- SetDataField(property_index, attributes, expected_constness,
- expected_representation, expected_heap_type);
+ SetDataField(property_index, attributes, constness, representation,
+ field_type);
Handle<String> name = MakeName("prop", property_index);
- return Map::CopyWithField(map, name, heap_type, attributes, constness,
+ return Map::CopyWithField(map, name, field_type, attributes, constness,
representation, INSERT_TRANSITION)
.ToHandleChecked();
}
@@ -1715,6 +1717,7 @@ static void TestReconfigureElementsKind_GeneralizeField(
// Create a map, add required properties to it and initialize expectations.
Handle<Map> initial_map = Map::Create(isolate, 0);
+ initial_map->set_instance_type(JS_ARRAY_TYPE);
initial_map->set_elements_kind(PACKED_SMI_ELEMENTS);
Handle<Map> map = initial_map;
@@ -1808,6 +1811,7 @@ static void TestReconfigureElementsKind_GeneralizeFieldTrivial(
// Create a map, add required properties to it and initialize expectations.
Handle<Map> initial_map = Map::Create(isolate, 0);
+ initial_map->set_instance_type(JS_ARRAY_TYPE);
initial_map->set_elements_kind(PACKED_SMI_ELEMENTS);
Handle<Map> map = initial_map;
@@ -1990,7 +1994,6 @@ TEST(ReconfigureElementsKind_GeneralizeHeapObjFieldToHeapObj) {
{kConst, Representation::HeapObject(), current_type},
{kConst, Representation::HeapObject(), new_type},
{kConst, Representation::HeapObject(), expected_type});
-
if (FLAG_modify_map_inplace) {
// kConst to kMutable migration does not create a new map, therefore
// trivial generalization.
@@ -2742,5 +2745,6 @@ TEST(HoleyMutableHeapNumber) {
CHECK_EQ(kHoleNanInt64, HeapNumber::cast(*obj)->value_as_bits());
}
+} // namespace test_field_type_tracking
} // namespace internal
} // namespace v8