| 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 <sstream> | 6 #include <sstream> |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/objects.h" | 10 #include "src/objects.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 CHECK(!func->has_initial_map()); | 148 CHECK(!func->has_initial_map()); |
| 149 | 149 |
| 150 v8::Local<v8::Script> new_A_script = v8_compile("new A();"); | 150 v8::Local<v8::Script> new_A_script = v8_compile("new A();"); |
| 151 | 151 |
| 152 Handle<JSObject> obj = Run<JSObject>(new_A_script); | 152 Handle<JSObject> obj = Run<JSObject>(new_A_script); |
| 153 | 153 |
| 154 CHECK(func->has_initial_map()); | 154 CHECK(func->has_initial_map()); |
| 155 Handle<Map> initial_map(func->initial_map()); | 155 Handle<Map> initial_map(func->initial_map()); |
| 156 | 156 |
| 157 // One instance created. | 157 // One instance created. |
| 158 CHECK_EQ(Map::kSlackTrackingCounterStart - 1, initial_map->counter()); | 158 CHECK_EQ(Map::kSlackTrackingCounterStart - 1, |
| 159 initial_map->construction_counter()); |
| 159 CHECK(initial_map->IsInobjectSlackTrackingInProgress()); | 160 CHECK(initial_map->IsInobjectSlackTrackingInProgress()); |
| 160 | 161 |
| 161 // There must be at least some slack. | 162 // There must be at least some slack. |
| 162 CHECK_LT(5, obj->map()->GetInObjectProperties()); | 163 CHECK_LT(5, obj->map()->GetInObjectProperties()); |
| 163 CHECK_EQ(Smi::FromInt(42), GetFieldValue(*obj, 0)); | 164 CHECK_EQ(Smi::FromInt(42), GetFieldValue(*obj, 0)); |
| 164 CHECK_EQ(4.2, GetDoubleFieldValue(*obj, 1)); | 165 CHECK_EQ(4.2, GetDoubleFieldValue(*obj, 1)); |
| 165 CHECK_EQ(*obj, GetFieldValue(*obj, 2)); | 166 CHECK_EQ(*obj, GetFieldValue(*obj, 2)); |
| 166 CHECK(IsObjectShrinkable(*obj)); | 167 CHECK(IsObjectShrinkable(*obj)); |
| 167 | 168 |
| 168 // Create several objects to complete the tracking. | 169 // Create several objects to complete the tracking. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 CHECK(!func->has_initial_map()); | 210 CHECK(!func->has_initial_map()); |
| 210 | 211 |
| 211 Handle<JSObject> obj1 = CompileRun<JSObject>("new A(1);"); | 212 Handle<JSObject> obj1 = CompileRun<JSObject>("new A(1);"); |
| 212 Handle<JSObject> obj3 = CompileRun<JSObject>("new A(3);"); | 213 Handle<JSObject> obj3 = CompileRun<JSObject>("new A(3);"); |
| 213 Handle<JSObject> obj5 = CompileRun<JSObject>("new A(5);"); | 214 Handle<JSObject> obj5 = CompileRun<JSObject>("new A(5);"); |
| 214 | 215 |
| 215 CHECK(func->has_initial_map()); | 216 CHECK(func->has_initial_map()); |
| 216 Handle<Map> initial_map(func->initial_map()); | 217 Handle<Map> initial_map(func->initial_map()); |
| 217 | 218 |
| 218 // Three instances created. | 219 // Three instances created. |
| 219 CHECK_EQ(Map::kSlackTrackingCounterStart - 3, initial_map->counter()); | 220 CHECK_EQ(Map::kSlackTrackingCounterStart - 3, |
| 221 initial_map->construction_counter()); |
| 220 CHECK(initial_map->IsInobjectSlackTrackingInProgress()); | 222 CHECK(initial_map->IsInobjectSlackTrackingInProgress()); |
| 221 | 223 |
| 222 // There must be at least some slack. | 224 // There must be at least some slack. |
| 223 CHECK_LT(5, obj3->map()->GetInObjectProperties()); | 225 CHECK_LT(5, obj3->map()->GetInObjectProperties()); |
| 224 CHECK_EQ(Smi::FromInt(42), GetFieldValue(*obj3, 0)); | 226 CHECK_EQ(Smi::FromInt(42), GetFieldValue(*obj3, 0)); |
| 225 CHECK_EQ(4.2, GetDoubleFieldValue(*obj3, 1)); | 227 CHECK_EQ(4.2, GetDoubleFieldValue(*obj3, 1)); |
| 226 CHECK_EQ(*obj3, GetFieldValue(*obj3, 2)); | 228 CHECK_EQ(*obj3, GetFieldValue(*obj3, 2)); |
| 227 CHECK(IsObjectShrinkable(*obj1)); | 229 CHECK(IsObjectShrinkable(*obj1)); |
| 228 CHECK(IsObjectShrinkable(*obj3)); | 230 CHECK(IsObjectShrinkable(*obj3)); |
| 229 CHECK(IsObjectShrinkable(*obj5)); | 231 CHECK(IsObjectShrinkable(*obj5)); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 CHECK(!func->has_initial_map()); | 296 CHECK(!func->has_initial_map()); |
| 295 | 297 |
| 296 v8::Local<v8::Script> new_A_script = v8_compile("CreateGenerator();"); | 298 v8::Local<v8::Script> new_A_script = v8_compile("CreateGenerator();"); |
| 297 | 299 |
| 298 Handle<JSObject> obj = Run<JSObject>(new_A_script); | 300 Handle<JSObject> obj = Run<JSObject>(new_A_script); |
| 299 | 301 |
| 300 CHECK(func->has_initial_map()); | 302 CHECK(func->has_initial_map()); |
| 301 Handle<Map> initial_map(func->initial_map()); | 303 Handle<Map> initial_map(func->initial_map()); |
| 302 | 304 |
| 303 // One instance created. | 305 // One instance created. |
| 304 CHECK_EQ(Map::kSlackTrackingCounterStart - 1, initial_map->counter()); | 306 CHECK_EQ(Map::kSlackTrackingCounterStart - 1, |
| 307 initial_map->construction_counter()); |
| 305 CHECK(initial_map->IsInobjectSlackTrackingInProgress()); | 308 CHECK(initial_map->IsInobjectSlackTrackingInProgress()); |
| 306 | 309 |
| 307 // There must be at least some slack. | 310 // There must be at least some slack. |
| 308 CHECK_LT(5, obj->map()->GetInObjectProperties()); | 311 CHECK_LT(5, obj->map()->GetInObjectProperties()); |
| 309 CHECK_EQ(Smi::FromInt(42), GetFieldValue(*obj, 0)); | 312 CHECK_EQ(Smi::FromInt(42), GetFieldValue(*obj, 0)); |
| 310 CHECK_EQ(4.2, GetDoubleFieldValue(*obj, 1)); | 313 CHECK_EQ(4.2, GetDoubleFieldValue(*obj, 1)); |
| 311 CHECK_EQ(*obj, GetFieldValue(*obj, 2)); | 314 CHECK_EQ(*obj, GetFieldValue(*obj, 2)); |
| 312 CHECK(IsObjectShrinkable(*obj)); | 315 CHECK(IsObjectShrinkable(*obj)); |
| 313 | 316 |
| 314 // Create several objects to complete the tracking. | 317 // Create several objects to complete the tracking. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 | 376 |
| 374 Handle<JSObject> obj = Run<JSObject>(new_B_script); | 377 Handle<JSObject> obj = Run<JSObject>(new_B_script); |
| 375 | 378 |
| 376 CHECK(a_func->has_initial_map()); | 379 CHECK(a_func->has_initial_map()); |
| 377 Handle<Map> a_initial_map(a_func->initial_map()); | 380 Handle<Map> a_initial_map(a_func->initial_map()); |
| 378 | 381 |
| 379 CHECK(b_func->has_initial_map()); | 382 CHECK(b_func->has_initial_map()); |
| 380 Handle<Map> b_initial_map(b_func->initial_map()); | 383 Handle<Map> b_initial_map(b_func->initial_map()); |
| 381 | 384 |
| 382 // Zero instances of A created. | 385 // Zero instances of A created. |
| 383 CHECK_EQ(Map::kSlackTrackingCounterStart, a_initial_map->counter()); | 386 CHECK_EQ(Map::kSlackTrackingCounterStart, |
| 387 a_initial_map->construction_counter()); |
| 384 CHECK(a_initial_map->IsInobjectSlackTrackingInProgress()); | 388 CHECK(a_initial_map->IsInobjectSlackTrackingInProgress()); |
| 385 | 389 |
| 386 // One instance of B created. | 390 // One instance of B created. |
| 387 CHECK_EQ(Map::kSlackTrackingCounterStart - 1, b_initial_map->counter()); | 391 CHECK_EQ(Map::kSlackTrackingCounterStart - 1, |
| 392 b_initial_map->construction_counter()); |
| 388 CHECK(b_initial_map->IsInobjectSlackTrackingInProgress()); | 393 CHECK(b_initial_map->IsInobjectSlackTrackingInProgress()); |
| 389 | 394 |
| 390 // There must be at least some slack. | 395 // There must be at least some slack. |
| 391 CHECK_LT(10, obj->map()->GetInObjectProperties()); | 396 CHECK_LT(10, obj->map()->GetInObjectProperties()); |
| 392 CHECK_EQ(Smi::FromInt(42), GetFieldValue(*obj, 0)); | 397 CHECK_EQ(Smi::FromInt(42), GetFieldValue(*obj, 0)); |
| 393 CHECK_EQ(4.2, GetDoubleFieldValue(*obj, 1)); | 398 CHECK_EQ(4.2, GetDoubleFieldValue(*obj, 1)); |
| 394 CHECK_EQ(*obj, GetFieldValue(*obj, 2)); | 399 CHECK_EQ(*obj, GetFieldValue(*obj, 2)); |
| 395 CHECK_EQ(Smi::FromInt(142), GetFieldValue(*obj, 3)); | 400 CHECK_EQ(Smi::FromInt(142), GetFieldValue(*obj, 3)); |
| 396 CHECK_EQ(14.2, GetDoubleFieldValue(*obj, 4)); | 401 CHECK_EQ(14.2, GetDoubleFieldValue(*obj, 4)); |
| 397 CHECK_EQ(*obj, GetFieldValue(*obj, 5)); | 402 CHECK_EQ(*obj, GetFieldValue(*obj, 5)); |
| 398 CHECK(IsObjectShrinkable(*obj)); | 403 CHECK(IsObjectShrinkable(*obj)); |
| 399 | 404 |
| 400 // Create several subclass instances to complete the tracking. | 405 // Create several subclass instances to complete the tracking. |
| 401 for (int i = 1; i < Map::kGenerousAllocationCount; i++) { | 406 for (int i = 1; i < Map::kGenerousAllocationCount; i++) { |
| 402 CHECK(b_initial_map->IsInobjectSlackTrackingInProgress()); | 407 CHECK(b_initial_map->IsInobjectSlackTrackingInProgress()); |
| 403 Handle<JSObject> tmp = Run<JSObject>(new_B_script); | 408 Handle<JSObject> tmp = Run<JSObject>(new_B_script); |
| 404 CHECK_EQ(b_initial_map->IsInobjectSlackTrackingInProgress(), | 409 CHECK_EQ(b_initial_map->IsInobjectSlackTrackingInProgress(), |
| 405 IsObjectShrinkable(*tmp)); | 410 IsObjectShrinkable(*tmp)); |
| 406 } | 411 } |
| 407 CHECK(!b_initial_map->IsInobjectSlackTrackingInProgress()); | 412 CHECK(!b_initial_map->IsInobjectSlackTrackingInProgress()); |
| 408 CHECK(!IsObjectShrinkable(*obj)); | 413 CHECK(!IsObjectShrinkable(*obj)); |
| 409 | 414 |
| 410 // Zero instances of A created. | 415 // Zero instances of A created. |
| 411 CHECK_EQ(Map::kSlackTrackingCounterStart, a_initial_map->counter()); | 416 CHECK_EQ(Map::kSlackTrackingCounterStart, |
| 417 a_initial_map->construction_counter()); |
| 412 CHECK(a_initial_map->IsInobjectSlackTrackingInProgress()); | 418 CHECK(a_initial_map->IsInobjectSlackTrackingInProgress()); |
| 413 | 419 |
| 414 // No slack left. | 420 // No slack left. |
| 415 CHECK_EQ(6, obj->map()->GetInObjectProperties()); | 421 CHECK_EQ(6, obj->map()->GetInObjectProperties()); |
| 416 } | 422 } |
| 417 | 423 |
| 418 | 424 |
| 419 TEST(SubclassBasicNoBaseClassInstancesNoInlineNew) { | 425 TEST(SubclassBasicNoBaseClassInstancesNoInlineNew) { |
| 420 FLAG_inline_new = false; | 426 FLAG_inline_new = false; |
| 421 TestSubclassBasicNoBaseClassInstances(); | 427 TestSubclassBasicNoBaseClassInstances(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 Handle<JSObject> a_obj = Run<JSObject>(new_A_script); | 472 Handle<JSObject> a_obj = Run<JSObject>(new_A_script); |
| 467 Handle<JSObject> b_obj = Run<JSObject>(new_B_script); | 473 Handle<JSObject> b_obj = Run<JSObject>(new_B_script); |
| 468 | 474 |
| 469 CHECK(a_func->has_initial_map()); | 475 CHECK(a_func->has_initial_map()); |
| 470 Handle<Map> a_initial_map(a_func->initial_map()); | 476 Handle<Map> a_initial_map(a_func->initial_map()); |
| 471 | 477 |
| 472 CHECK(b_func->has_initial_map()); | 478 CHECK(b_func->has_initial_map()); |
| 473 Handle<Map> b_initial_map(b_func->initial_map()); | 479 Handle<Map> b_initial_map(b_func->initial_map()); |
| 474 | 480 |
| 475 // One instance of a base class created. | 481 // One instance of a base class created. |
| 476 CHECK_EQ(Map::kSlackTrackingCounterStart - 1, a_initial_map->counter()); | 482 CHECK_EQ(Map::kSlackTrackingCounterStart - 1, |
| 483 a_initial_map->construction_counter()); |
| 477 CHECK(a_initial_map->IsInobjectSlackTrackingInProgress()); | 484 CHECK(a_initial_map->IsInobjectSlackTrackingInProgress()); |
| 478 | 485 |
| 479 // One instance of a subclass created. | 486 // One instance of a subclass created. |
| 480 CHECK_EQ(Map::kSlackTrackingCounterStart - 1, b_initial_map->counter()); | 487 CHECK_EQ(Map::kSlackTrackingCounterStart - 1, |
| 488 b_initial_map->construction_counter()); |
| 481 CHECK(b_initial_map->IsInobjectSlackTrackingInProgress()); | 489 CHECK(b_initial_map->IsInobjectSlackTrackingInProgress()); |
| 482 | 490 |
| 483 // Create several base class instances to complete the tracking. | 491 // Create several base class instances to complete the tracking. |
| 484 for (int i = 1; i < Map::kGenerousAllocationCount; i++) { | 492 for (int i = 1; i < Map::kGenerousAllocationCount; i++) { |
| 485 CHECK(a_initial_map->IsInobjectSlackTrackingInProgress()); | 493 CHECK(a_initial_map->IsInobjectSlackTrackingInProgress()); |
| 486 Handle<JSObject> tmp = Run<JSObject>(new_A_script); | 494 Handle<JSObject> tmp = Run<JSObject>(new_A_script); |
| 487 CHECK_EQ(a_initial_map->IsInobjectSlackTrackingInProgress(), | 495 CHECK_EQ(a_initial_map->IsInobjectSlackTrackingInProgress(), |
| 488 IsObjectShrinkable(*tmp)); | 496 IsObjectShrinkable(*tmp)); |
| 489 } | 497 } |
| 490 CHECK(!a_initial_map->IsInobjectSlackTrackingInProgress()); | 498 CHECK(!a_initial_map->IsInobjectSlackTrackingInProgress()); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 | 595 |
| 588 Handle<JSObject> obj = Run<JSObject>(new_script); | 596 Handle<JSObject> obj = Run<JSObject>(new_script); |
| 589 | 597 |
| 590 CHECK(func->has_initial_map()); | 598 CHECK(func->has_initial_map()); |
| 591 Handle<Map> initial_map(func->initial_map()); | 599 Handle<Map> initial_map(func->initial_map()); |
| 592 | 600 |
| 593 // There must be at least some slack. | 601 // There must be at least some slack. |
| 594 CHECK_LT(fields_count, obj->map()->GetInObjectProperties()); | 602 CHECK_LT(fields_count, obj->map()->GetInObjectProperties()); |
| 595 | 603 |
| 596 // One instance was created. | 604 // One instance was created. |
| 597 CHECK_EQ(Map::kSlackTrackingCounterStart - 1, initial_map->counter()); | 605 CHECK_EQ(Map::kSlackTrackingCounterStart - 1, |
| 606 initial_map->construction_counter()); |
| 598 CHECK(initial_map->IsInobjectSlackTrackingInProgress()); | 607 CHECK(initial_map->IsInobjectSlackTrackingInProgress()); |
| 599 | 608 |
| 600 // Create several instances to complete the tracking. | 609 // Create several instances to complete the tracking. |
| 601 for (int i = 1; i < Map::kGenerousAllocationCount; i++) { | 610 for (int i = 1; i < Map::kGenerousAllocationCount; i++) { |
| 602 CHECK(initial_map->IsInobjectSlackTrackingInProgress()); | 611 CHECK(initial_map->IsInobjectSlackTrackingInProgress()); |
| 603 Handle<JSObject> tmp = Run<JSObject>(new_script); | 612 Handle<JSObject> tmp = Run<JSObject>(new_script); |
| 604 CHECK_EQ(initial_map->IsInobjectSlackTrackingInProgress(), | 613 CHECK_EQ(initial_map->IsInobjectSlackTrackingInProgress(), |
| 605 IsObjectShrinkable(*tmp)); | 614 IsObjectShrinkable(*tmp)); |
| 606 } | 615 } |
| 607 CHECK(!initial_map->IsInobjectSlackTrackingInProgress()); | 616 CHECK(!initial_map->IsInobjectSlackTrackingInProgress()); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 Handle<JSObject> obj = Run<JSObject>(new_script); | 693 Handle<JSObject> obj = Run<JSObject>(new_script); |
| 685 | 694 |
| 686 CHECK(func->has_initial_map()); | 695 CHECK(func->has_initial_map()); |
| 687 Handle<Map> initial_map(func->initial_map()); | 696 Handle<Map> initial_map(func->initial_map()); |
| 688 | 697 |
| 689 // There must be no slack left. | 698 // There must be no slack left. |
| 690 CHECK_EQ(JSObject::kMaxInstanceSize, obj->map()->instance_size()); | 699 CHECK_EQ(JSObject::kMaxInstanceSize, obj->map()->instance_size()); |
| 691 CHECK_EQ(kMaxInobjectProperties, obj->map()->GetInObjectProperties()); | 700 CHECK_EQ(kMaxInobjectProperties, obj->map()->GetInObjectProperties()); |
| 692 | 701 |
| 693 // One instance was created. | 702 // One instance was created. |
| 694 CHECK_EQ(Map::kSlackTrackingCounterStart - 1, initial_map->counter()); | 703 CHECK_EQ(Map::kSlackTrackingCounterStart - 1, |
| 704 initial_map->construction_counter()); |
| 695 CHECK(initial_map->IsInobjectSlackTrackingInProgress()); | 705 CHECK(initial_map->IsInobjectSlackTrackingInProgress()); |
| 696 | 706 |
| 697 // Create several instances to complete the tracking. | 707 // Create several instances to complete the tracking. |
| 698 for (int i = 1; i < Map::kGenerousAllocationCount; i++) { | 708 for (int i = 1; i < Map::kGenerousAllocationCount; i++) { |
| 699 CHECK(initial_map->IsInobjectSlackTrackingInProgress()); | 709 CHECK(initial_map->IsInobjectSlackTrackingInProgress()); |
| 700 Handle<JSObject> tmp = Run<JSObject>(new_script); | 710 Handle<JSObject> tmp = Run<JSObject>(new_script); |
| 701 CHECK(!IsObjectShrinkable(*tmp)); | 711 CHECK(!IsObjectShrinkable(*tmp)); |
| 702 } | 712 } |
| 703 CHECK(!initial_map->IsInobjectSlackTrackingInProgress()); | 713 CHECK(!initial_map->IsInobjectSlackTrackingInProgress()); |
| 704 CHECK(!IsObjectShrinkable(*obj)); | 714 CHECK(!IsObjectShrinkable(*obj)); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 Handle<JSObject> obj = Run<JSObject>(new_script); | 752 Handle<JSObject> obj = Run<JSObject>(new_script); |
| 743 | 753 |
| 744 CHECK(func->has_initial_map()); | 754 CHECK(func->has_initial_map()); |
| 745 Handle<Map> initial_map(func->initial_map()); | 755 Handle<Map> initial_map(func->initial_map()); |
| 746 | 756 |
| 747 // Object should go dictionary mode. | 757 // Object should go dictionary mode. |
| 748 CHECK_EQ(JSObject::kHeaderSize, obj->map()->instance_size()); | 758 CHECK_EQ(JSObject::kHeaderSize, obj->map()->instance_size()); |
| 749 CHECK(obj->map()->is_dictionary_map()); | 759 CHECK(obj->map()->is_dictionary_map()); |
| 750 | 760 |
| 751 // One instance was created. | 761 // One instance was created. |
| 752 CHECK_EQ(Map::kSlackTrackingCounterStart - 1, initial_map->counter()); | 762 CHECK_EQ(Map::kSlackTrackingCounterStart - 1, |
| 763 initial_map->construction_counter()); |
| 753 CHECK(initial_map->IsInobjectSlackTrackingInProgress()); | 764 CHECK(initial_map->IsInobjectSlackTrackingInProgress()); |
| 754 | 765 |
| 755 // Create several instances to complete the tracking. | 766 // Create several instances to complete the tracking. |
| 756 for (int i = 1; i < Map::kGenerousAllocationCount; i++) { | 767 for (int i = 1; i < Map::kGenerousAllocationCount; i++) { |
| 757 CHECK(initial_map->IsInobjectSlackTrackingInProgress()); | 768 CHECK(initial_map->IsInobjectSlackTrackingInProgress()); |
| 758 Handle<JSObject> tmp = Run<JSObject>(new_script); | 769 Handle<JSObject> tmp = Run<JSObject>(new_script); |
| 759 CHECK(!IsObjectShrinkable(*tmp)); | 770 CHECK(!IsObjectShrinkable(*tmp)); |
| 760 } | 771 } |
| 761 CHECK(!initial_map->IsInobjectSlackTrackingInProgress()); | 772 CHECK(!initial_map->IsInobjectSlackTrackingInProgress()); |
| 762 CHECK(!IsObjectShrinkable(*obj)); | 773 CHECK(!IsObjectShrinkable(*obj)); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 } | 816 } |
| 806 | 817 |
| 807 Run<JSObject>(new_script); | 818 Run<JSObject>(new_script); |
| 808 | 819 |
| 809 CHECK(func->has_initial_map()); | 820 CHECK(func->has_initial_map()); |
| 810 Handle<Map> initial_map(func->initial_map()); | 821 Handle<Map> initial_map(func->initial_map()); |
| 811 | 822 |
| 812 CHECK_EQ(instance_type, initial_map->instance_type()); | 823 CHECK_EQ(instance_type, initial_map->instance_type()); |
| 813 | 824 |
| 814 // One instance of a subclass created. | 825 // One instance of a subclass created. |
| 815 CHECK_EQ(Map::kSlackTrackingCounterStart - 1, initial_map->counter()); | 826 CHECK_EQ(Map::kSlackTrackingCounterStart - 1, |
| 827 initial_map->construction_counter()); |
| 816 CHECK(initial_map->IsInobjectSlackTrackingInProgress()); | 828 CHECK(initial_map->IsInobjectSlackTrackingInProgress()); |
| 817 | 829 |
| 818 // Create two instances in order to ensure that |obj|.o is a data field | 830 // Create two instances in order to ensure that |obj|.o is a data field |
| 819 // in case of Function subclassing. | 831 // in case of Function subclassing. |
| 820 Handle<JSObject> obj = Run<JSObject>(new_script); | 832 Handle<JSObject> obj = Run<JSObject>(new_script); |
| 821 | 833 |
| 822 // Two instances of a subclass created. | 834 // Two instances of a subclass created. |
| 823 CHECK_EQ(Map::kSlackTrackingCounterStart - 2, initial_map->counter()); | 835 CHECK_EQ(Map::kSlackTrackingCounterStart - 2, |
| 836 initial_map->construction_counter()); |
| 824 CHECK(initial_map->IsInobjectSlackTrackingInProgress()); | 837 CHECK(initial_map->IsInobjectSlackTrackingInProgress()); |
| 825 | 838 |
| 826 // There must be at least some slack. | 839 // There must be at least some slack. |
| 827 CHECK_LT(builtin_properties_count + 5, obj->map()->GetInObjectProperties()); | 840 CHECK_LT(builtin_properties_count + 5, obj->map()->GetInObjectProperties()); |
| 828 CHECK_EQ(Smi::FromInt(42), GetFieldValue(*obj, builtin_properties_count + 0)); | 841 CHECK_EQ(Smi::FromInt(42), GetFieldValue(*obj, builtin_properties_count + 0)); |
| 829 CHECK_EQ(4.2, GetDoubleFieldValue(*obj, builtin_properties_count + 1)); | 842 CHECK_EQ(4.2, GetDoubleFieldValue(*obj, builtin_properties_count + 1)); |
| 830 CHECK_EQ(*obj, GetFieldValue(*obj, builtin_properties_count + 2)); | 843 CHECK_EQ(*obj, GetFieldValue(*obj, builtin_properties_count + 2)); |
| 831 CHECK(IsObjectShrinkable(*obj)); | 844 CHECK(IsObjectShrinkable(*obj)); |
| 832 | 845 |
| 833 // Create several subclass instances to complete the tracking. | 846 // Create several subclass instances to complete the tracking. |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 TestSubclassBuiltin("A1", JS_PROMISE_TYPE, "Promise", | 1102 TestSubclassBuiltin("A1", JS_PROMISE_TYPE, "Promise", |
| 1090 "function(resolve, reject) { resolve('ok'); }", | 1103 "function(resolve, reject) { resolve('ok'); }", |
| 1091 first_field); | 1104 first_field); |
| 1092 } | 1105 } |
| 1093 | 1106 |
| 1094 | 1107 |
| 1095 TEST(SubclassPromiseBuiltinNoInlineNew) { | 1108 TEST(SubclassPromiseBuiltinNoInlineNew) { |
| 1096 FLAG_inline_new = false; | 1109 FLAG_inline_new = false; |
| 1097 TestSubclassPromiseBuiltin(); | 1110 TestSubclassPromiseBuiltin(); |
| 1098 } | 1111 } |
| OLD | NEW |