| 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 "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/execution.h" | 7 #include "src/execution.h" |
| 8 #include "src/handles.h" | 8 #include "src/handles.h" |
| 9 #include "src/interpreter/bytecode-array-builder.h" | 9 #include "src/interpreter/bytecode-array-builder.h" |
| 10 #include "src/interpreter/interpreter.h" | 10 #include "src/interpreter/interpreter.h" |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 Handle<i::Object> global_obj = | 571 Handle<i::Object> global_obj = |
| 572 Object::GetProperty(isolate->global_object(), name).ToHandleChecked(); | 572 Object::GetProperty(isolate->global_object(), name).ToHandleChecked(); |
| 573 CHECK_EQ(Smi::cast(*global_obj), Smi::FromInt(999)); | 573 CHECK_EQ(Smi::cast(*global_obj), Smi::FromInt(999)); |
| 574 } | 574 } |
| 575 | 575 |
| 576 | 576 |
| 577 TEST(InterpreterLoadNamedProperty) { | 577 TEST(InterpreterLoadNamedProperty) { |
| 578 HandleAndZoneScope handles; | 578 HandleAndZoneScope handles; |
| 579 i::Isolate* isolate = handles.main_isolate(); | 579 i::Isolate* isolate = handles.main_isolate(); |
| 580 i::Factory* factory = isolate->factory(); | 580 i::Factory* factory = isolate->factory(); |
| 581 i::Zone zone; | 581 i::Zone zone(isolate->allocator()); |
| 582 | 582 |
| 583 i::FeedbackVectorSpec feedback_spec(&zone); | 583 i::FeedbackVectorSpec feedback_spec(&zone); |
| 584 i::FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot(); | 584 i::FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot(); |
| 585 | 585 |
| 586 Handle<i::TypeFeedbackVector> vector = | 586 Handle<i::TypeFeedbackVector> vector = |
| 587 i::NewTypeFeedbackVector(isolate, &feedback_spec); | 587 i::NewTypeFeedbackVector(isolate, &feedback_spec); |
| 588 | 588 |
| 589 Handle<i::String> name = factory->NewStringFromAsciiChecked("val"); | 589 Handle<i::String> name = factory->NewStringFromAsciiChecked("val"); |
| 590 name = factory->string_table()->LookupString(isolate, name); | 590 name = factory->string_table()->LookupString(isolate, name); |
| 591 | 591 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 InterpreterTester::NewObject("({ val : 789, val4 : 123 })"); | 624 InterpreterTester::NewObject("({ val : 789, val4 : 123 })"); |
| 625 return_val = callable(object5).ToHandleChecked(); | 625 return_val = callable(object5).ToHandleChecked(); |
| 626 CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(789)); | 626 CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(789)); |
| 627 } | 627 } |
| 628 | 628 |
| 629 | 629 |
| 630 TEST(InterpreterLoadKeyedProperty) { | 630 TEST(InterpreterLoadKeyedProperty) { |
| 631 HandleAndZoneScope handles; | 631 HandleAndZoneScope handles; |
| 632 i::Isolate* isolate = handles.main_isolate(); | 632 i::Isolate* isolate = handles.main_isolate(); |
| 633 i::Factory* factory = isolate->factory(); | 633 i::Factory* factory = isolate->factory(); |
| 634 i::Zone zone; | 634 i::Zone zone(isolate->allocator()); |
| 635 | 635 |
| 636 i::FeedbackVectorSpec feedback_spec(&zone); | 636 i::FeedbackVectorSpec feedback_spec(&zone); |
| 637 i::FeedbackVectorSlot slot = feedback_spec.AddKeyedLoadICSlot(); | 637 i::FeedbackVectorSlot slot = feedback_spec.AddKeyedLoadICSlot(); |
| 638 | 638 |
| 639 Handle<i::TypeFeedbackVector> vector = | 639 Handle<i::TypeFeedbackVector> vector = |
| 640 i::NewTypeFeedbackVector(isolate, &feedback_spec); | 640 i::NewTypeFeedbackVector(isolate, &feedback_spec); |
| 641 | 641 |
| 642 Handle<i::String> key = factory->NewStringFromAsciiChecked("key"); | 642 Handle<i::String> key = factory->NewStringFromAsciiChecked("key"); |
| 643 key = factory->string_table()->LookupString(isolate, key); | 643 key = factory->string_table()->LookupString(isolate, key); |
| 644 | 644 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 666 InterpreterTester::NewObject("({ key : 789, val2 : 123 })"); | 666 InterpreterTester::NewObject("({ key : 789, val2 : 123 })"); |
| 667 return_val = callable(object3).ToHandleChecked(); | 667 return_val = callable(object3).ToHandleChecked(); |
| 668 CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(789)); | 668 CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(789)); |
| 669 } | 669 } |
| 670 | 670 |
| 671 | 671 |
| 672 TEST(InterpreterStoreNamedProperty) { | 672 TEST(InterpreterStoreNamedProperty) { |
| 673 HandleAndZoneScope handles; | 673 HandleAndZoneScope handles; |
| 674 i::Isolate* isolate = handles.main_isolate(); | 674 i::Isolate* isolate = handles.main_isolate(); |
| 675 i::Factory* factory = isolate->factory(); | 675 i::Factory* factory = isolate->factory(); |
| 676 i::Zone zone; | 676 i::Zone zone(isolate->allocator()); |
| 677 | 677 |
| 678 i::FeedbackVectorSpec feedback_spec(&zone); | 678 i::FeedbackVectorSpec feedback_spec(&zone); |
| 679 i::FeedbackVectorSlot slot = feedback_spec.AddStoreICSlot(); | 679 i::FeedbackVectorSlot slot = feedback_spec.AddStoreICSlot(); |
| 680 | 680 |
| 681 Handle<i::TypeFeedbackVector> vector = | 681 Handle<i::TypeFeedbackVector> vector = |
| 682 i::NewTypeFeedbackVector(isolate, &feedback_spec); | 682 i::NewTypeFeedbackVector(isolate, &feedback_spec); |
| 683 | 683 |
| 684 Handle<i::String> name = factory->NewStringFromAsciiChecked("val"); | 684 Handle<i::String> name = factory->NewStringFromAsciiChecked("val"); |
| 685 name = factory->string_table()->LookupString(isolate, name); | 685 name = factory->string_table()->LookupString(isolate, name); |
| 686 | 686 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 callable(object5).ToHandleChecked(); | 725 callable(object5).ToHandleChecked(); |
| 726 CHECK(Runtime::GetObjectProperty(isolate, object5, name).ToHandle(&result)); | 726 CHECK(Runtime::GetObjectProperty(isolate, object5, name).ToHandle(&result)); |
| 727 CHECK_EQ(Smi::cast(*result), Smi::FromInt(999)); | 727 CHECK_EQ(Smi::cast(*result), Smi::FromInt(999)); |
| 728 } | 728 } |
| 729 | 729 |
| 730 | 730 |
| 731 TEST(InterpreterStoreKeyedProperty) { | 731 TEST(InterpreterStoreKeyedProperty) { |
| 732 HandleAndZoneScope handles; | 732 HandleAndZoneScope handles; |
| 733 i::Isolate* isolate = handles.main_isolate(); | 733 i::Isolate* isolate = handles.main_isolate(); |
| 734 i::Factory* factory = isolate->factory(); | 734 i::Factory* factory = isolate->factory(); |
| 735 i::Zone zone; | 735 i::Zone zone(isolate->allocator()); |
| 736 | 736 |
| 737 i::FeedbackVectorSpec feedback_spec(&zone); | 737 i::FeedbackVectorSpec feedback_spec(&zone); |
| 738 i::FeedbackVectorSlot slot = feedback_spec.AddKeyedStoreICSlot(); | 738 i::FeedbackVectorSlot slot = feedback_spec.AddKeyedStoreICSlot(); |
| 739 | 739 |
| 740 Handle<i::TypeFeedbackVector> vector = | 740 Handle<i::TypeFeedbackVector> vector = |
| 741 i::NewTypeFeedbackVector(isolate, &feedback_spec); | 741 i::NewTypeFeedbackVector(isolate, &feedback_spec); |
| 742 | 742 |
| 743 Handle<i::String> name = factory->NewStringFromAsciiChecked("val"); | 743 Handle<i::String> name = factory->NewStringFromAsciiChecked("val"); |
| 744 name = factory->string_table()->LookupString(isolate, name); | 744 name = factory->string_table()->LookupString(isolate, name); |
| 745 | 745 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 772 InterpreterTester::NewObject("({ val : 456, other : 123 })"); | 772 InterpreterTester::NewObject("({ val : 456, other : 123 })"); |
| 773 callable(object2).ToHandleChecked(); | 773 callable(object2).ToHandleChecked(); |
| 774 CHECK(Runtime::GetObjectProperty(isolate, object2, name).ToHandle(&result)); | 774 CHECK(Runtime::GetObjectProperty(isolate, object2, name).ToHandle(&result)); |
| 775 CHECK_EQ(Smi::cast(*result), Smi::FromInt(999)); | 775 CHECK_EQ(Smi::cast(*result), Smi::FromInt(999)); |
| 776 } | 776 } |
| 777 | 777 |
| 778 static void TestInterpreterCall(TailCallMode tail_call_mode) { | 778 static void TestInterpreterCall(TailCallMode tail_call_mode) { |
| 779 HandleAndZoneScope handles; | 779 HandleAndZoneScope handles; |
| 780 i::Isolate* isolate = handles.main_isolate(); | 780 i::Isolate* isolate = handles.main_isolate(); |
| 781 i::Factory* factory = isolate->factory(); | 781 i::Factory* factory = isolate->factory(); |
| 782 i::Zone zone; | 782 i::Zone zone(isolate->allocator()); |
| 783 | 783 |
| 784 i::FeedbackVectorSpec feedback_spec(&zone); | 784 i::FeedbackVectorSpec feedback_spec(&zone); |
| 785 i::FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot(); | 785 i::FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot(); |
| 786 | 786 |
| 787 Handle<i::TypeFeedbackVector> vector = | 787 Handle<i::TypeFeedbackVector> vector = |
| 788 i::NewTypeFeedbackVector(isolate, &feedback_spec); | 788 i::NewTypeFeedbackVector(isolate, &feedback_spec); |
| 789 int slot_index = vector->GetIndex(slot); | 789 int slot_index = vector->GetIndex(slot); |
| 790 | 790 |
| 791 Handle<i::String> name = factory->NewStringFromAsciiChecked("func"); | 791 Handle<i::String> name = factory->NewStringFromAsciiChecked("func"); |
| 792 name = factory->string_table()->LookupString(isolate, name); | 792 name = factory->string_table()->LookupString(isolate, name); |
| (...skipping 3256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4049 v8::Local<v8::String> expected_string = v8_str(const_decl[i].second); | 4049 v8::Local<v8::String> expected_string = v8_str(const_decl[i].second); |
| 4050 CHECK( | 4050 CHECK( |
| 4051 message->Equals(CcTest::isolate()->GetCurrentContext(), expected_string) | 4051 message->Equals(CcTest::isolate()->GetCurrentContext(), expected_string) |
| 4052 .FromJust()); | 4052 .FromJust()); |
| 4053 } | 4053 } |
| 4054 } | 4054 } |
| 4055 | 4055 |
| 4056 } // namespace interpreter | 4056 } // namespace interpreter |
| 4057 } // namespace internal | 4057 } // namespace internal |
| 4058 } // namespace v8 | 4058 } // namespace v8 |
| OLD | NEW |