OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdlib.h> | 5 #include <stdlib.h> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "test/cctest/test-api.h" | 8 #include "test/cctest/test-api.h" |
9 | 9 |
10 #include "src/v8.h" | 10 #include "src/v8.h" |
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1230 CHECK(expectations.Check(*map)); | 1230 CHECK(expectations.Check(*map)); |
1231 | 1231 |
1232 CHECK(new_map->is_stable()); | 1232 CHECK(new_map->is_stable()); |
1233 CHECK(!new_map->is_deprecated()); | 1233 CHECK(!new_map->is_deprecated()); |
1234 } | 1234 } |
1235 }; | 1235 }; |
1236 | 1236 |
1237 | 1237 |
1238 // Checks that given |map| is NOT deprecated, and |new_map| is a result of | 1238 // Checks that given |map| is NOT deprecated, and |new_map| is a result of |
1239 // copy-generalize-all-representations. | 1239 // copy-generalize-all-representations. |
1240 struct CheckCopyGeneralizeAllRepresentations { | 1240 struct CheckCopyGeneralizeAllFields { |
1241 void Check(Handle<Map> map, Handle<Map> new_map, Expectations& expectations) { | 1241 void Check(Handle<Map> map, Handle<Map> new_map, Expectations& expectations) { |
1242 CHECK(!map->is_deprecated()); | 1242 CHECK(!map->is_deprecated()); |
1243 CHECK_NE(*map, *new_map); | 1243 CHECK_NE(*map, *new_map); |
1244 | 1244 |
1245 CHECK(new_map->GetBackPointer()->IsUndefined(map->GetIsolate())); | 1245 CHECK(new_map->GetBackPointer()->IsUndefined(map->GetIsolate())); |
1246 for (int i = 0; i < kPropCount; i++) { | 1246 for (int i = 0; i < kPropCount; i++) { |
1247 expectations.GeneralizeRepresentation(i); | 1247 expectations.GeneralizeRepresentation(i); |
1248 } | 1248 } |
1249 | 1249 |
1250 CHECK(!new_map->is_deprecated()); | 1250 CHECK(!new_map->is_deprecated()); |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1502 } else { | 1502 } else { |
1503 // Currently we have a copy-generalize-all-representations case and | 1503 // Currently we have a copy-generalize-all-representations case and |
1504 // ACCESSOR property becomes ACCESSOR_CONSTANT. | 1504 // ACCESSOR property becomes ACCESSOR_CONSTANT. |
1505 expectations.SetAccessorConstant(property_index, pair2_); | 1505 expectations.SetAccessorConstant(property_index, pair2_); |
1506 } | 1506 } |
1507 } | 1507 } |
1508 }; | 1508 }; |
1509 | 1509 |
1510 TestConfig config; | 1510 TestConfig config; |
1511 if (IS_ACCESSOR_FIELD_SUPPORTED) { | 1511 if (IS_ACCESSOR_FIELD_SUPPORTED) { |
1512 CheckCopyGeneralizeAllRepresentations checker; | 1512 CheckCopyGeneralizeAllFields checker; |
1513 TestReconfigureProperty_CustomPropertyAfterTargetMap(config, checker); | 1513 TestReconfigureProperty_CustomPropertyAfterTargetMap(config, checker); |
1514 } else { | 1514 } else { |
1515 // Currently we have a copy-generalize-all-representations case. | 1515 // Currently we have a copy-generalize-all-representations case. |
1516 CheckCopyGeneralizeAllRepresentations checker; | 1516 CheckCopyGeneralizeAllFields checker; |
1517 TestReconfigureProperty_CustomPropertyAfterTargetMap(config, checker); | 1517 TestReconfigureProperty_CustomPropertyAfterTargetMap(config, checker); |
1518 } | 1518 } |
1519 } | 1519 } |
1520 | 1520 |
1521 | 1521 |
1522 TEST(ReconfigureDataFieldAttribute_AccConstantToDataFieldAfterTargetMap) { | 1522 TEST(ReconfigureDataFieldAttribute_AccConstantToDataFieldAfterTargetMap) { |
1523 CcTest::InitializeVM(); | 1523 CcTest::InitializeVM(); |
1524 v8::HandleScope scope(CcTest::isolate()); | 1524 v8::HandleScope scope(CcTest::isolate()); |
1525 | 1525 |
1526 struct TestConfig { | 1526 struct TestConfig { |
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2431 Isolate* isolate = CcTest::i_isolate(); | 2431 Isolate* isolate = CcTest::i_isolate(); |
2432 | 2432 |
2433 Zone zone(isolate->allocator(), ZONE_NAME); | 2433 Zone zone(isolate->allocator(), ZONE_NAME); |
2434 | 2434 |
2435 CHECK_EQ(FieldType::Any()->Convert(&zone), AstType::NonInternal()); | 2435 CHECK_EQ(FieldType::Any()->Convert(&zone), AstType::NonInternal()); |
2436 CHECK_EQ(FieldType::None()->Convert(&zone), AstType::None()); | 2436 CHECK_EQ(FieldType::None()->Convert(&zone), AstType::None()); |
2437 } | 2437 } |
2438 | 2438 |
2439 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported. | 2439 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported. |
2440 // TEST(TransitionAccessorConstantToAnotherAccessorConstant) | 2440 // TEST(TransitionAccessorConstantToAnotherAccessorConstant) |
OLD | NEW |