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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 expectations.SetDataField(0, NONE, Representation::None(), none_type); | 466 expectations.SetDataField(0, NONE, Representation::None(), none_type); |
467 | 467 |
468 CHECK(!new_map->is_deprecated()); | 468 CHECK(!new_map->is_deprecated()); |
469 CHECK(new_map->is_stable()); | 469 CHECK(new_map->is_stable()); |
470 CHECK(expectations.Check(*new_map)); | 470 CHECK(expectations.Check(*new_map)); |
471 | 471 |
472 Handle<Map> new_map2 = Map::ReconfigureProperty( | 472 Handle<Map> new_map2 = Map::ReconfigureProperty( |
473 map, 0, kData, NONE, Representation::None(), none_type, FORCE_FIELD); | 473 map, 0, kData, NONE, Representation::None(), none_type, FORCE_FIELD); |
474 CHECK_EQ(*new_map, *new_map2); | 474 CHECK_EQ(*new_map, *new_map2); |
475 | 475 |
476 Handle<Object> value(Smi::kZero, isolate); | 476 Handle<Object> value(Smi::FromInt(0), isolate); |
477 Handle<Map> prepared_map = Map::PrepareForDataProperty(new_map, 0, value); | 477 Handle<Map> prepared_map = Map::PrepareForDataProperty(new_map, 0, value); |
478 // None to Smi generalization is trivial, map does not change. | 478 // None to Smi generalization is trivial, map does not change. |
479 CHECK_EQ(*new_map, *prepared_map); | 479 CHECK_EQ(*new_map, *prepared_map); |
480 | 480 |
481 expectations.SetDataField(0, NONE, Representation::Smi(), any_type); | 481 expectations.SetDataField(0, NONE, Representation::Smi(), any_type); |
482 CHECK(prepared_map->is_stable()); | 482 CHECK(prepared_map->is_stable()); |
483 CHECK(expectations.Check(*prepared_map)); | 483 CHECK(expectations.Check(*prepared_map)); |
484 | 484 |
485 // Now create an object with |map|, migrate it to |prepared_map| and ensure | 485 // Now create an object with |map|, migrate it to |prepared_map| and ensure |
486 // that the data property is uninitialized. | 486 // that the data property is uninitialized. |
(...skipping 1838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2325 checker.Check(expectations2, map1, map2); | 2325 checker.Check(expectations2, map1, map2); |
2326 } | 2326 } |
2327 | 2327 |
2328 | 2328 |
2329 TEST(TransitionDataFieldToDataField) { | 2329 TEST(TransitionDataFieldToDataField) { |
2330 CcTest::InitializeVM(); | 2330 CcTest::InitializeVM(); |
2331 v8::HandleScope scope(CcTest::isolate()); | 2331 v8::HandleScope scope(CcTest::isolate()); |
2332 Isolate* isolate = CcTest::i_isolate(); | 2332 Isolate* isolate = CcTest::i_isolate(); |
2333 Handle<FieldType> any_type = FieldType::Any(isolate); | 2333 Handle<FieldType> any_type = FieldType::Any(isolate); |
2334 | 2334 |
2335 Handle<Object> value1 = handle(Smi::kZero, isolate); | 2335 Handle<Object> value1 = handle(Smi::FromInt(0), isolate); |
2336 TransitionToDataFieldOperator transition_op1(Representation::Smi(), any_type, | 2336 TransitionToDataFieldOperator transition_op1(Representation::Smi(), any_type, |
2337 value1); | 2337 value1); |
2338 | 2338 |
2339 Handle<Object> value2 = isolate->factory()->NewHeapNumber(0); | 2339 Handle<Object> value2 = isolate->factory()->NewHeapNumber(0); |
2340 TransitionToDataFieldOperator transition_op2(Representation::Double(), | 2340 TransitionToDataFieldOperator transition_op2(Representation::Double(), |
2341 any_type, value2); | 2341 any_type, value2); |
2342 | 2342 |
2343 FieldGeneralizationChecker checker(kPropCount - 1, Representation::Double(), | 2343 FieldGeneralizationChecker checker(kPropCount - 1, Representation::Double(), |
2344 any_type); | 2344 any_type); |
2345 TestTransitionTo(transition_op1, transition_op2, checker); | 2345 TestTransitionTo(transition_op1, transition_op2, checker); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2417 Isolate* isolate = CcTest::i_isolate(); | 2417 Isolate* isolate = CcTest::i_isolate(); |
2418 | 2418 |
2419 Zone zone(isolate->allocator()); | 2419 Zone zone(isolate->allocator()); |
2420 | 2420 |
2421 CHECK_EQ(FieldType::Any()->Convert(&zone), AstType::NonInternal()); | 2421 CHECK_EQ(FieldType::Any()->Convert(&zone), AstType::NonInternal()); |
2422 CHECK_EQ(FieldType::None()->Convert(&zone), AstType::None()); | 2422 CHECK_EQ(FieldType::None()->Convert(&zone), AstType::None()); |
2423 } | 2423 } |
2424 | 2424 |
2425 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported. | 2425 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported. |
2426 // TEST(TransitionAccessorConstantToAnotherAccessorConstant) | 2426 // TEST(TransitionAccessorConstantToAnotherAccessorConstant) |
OLD | NEW |