OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include "test/cctest/cctest.h" | 6 #include "test/cctest/cctest.h" |
7 | 7 |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/execution.h" | 10 #include "src/execution.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 } | 31 } |
32 | 32 |
33 | 33 |
34 TEST(VectorStructure) { | 34 TEST(VectorStructure) { |
35 LocalContext context; | 35 LocalContext context; |
36 v8::HandleScope scope(context->GetIsolate()); | 36 v8::HandleScope scope(context->GetIsolate()); |
37 Isolate* isolate = CcTest::i_isolate(); | 37 Isolate* isolate = CcTest::i_isolate(); |
38 Factory* factory = isolate->factory(); | 38 Factory* factory = isolate->factory(); |
39 Zone zone(isolate->allocator(), ZONE_NAME); | 39 Zone zone(isolate->allocator(), ZONE_NAME); |
40 | 40 |
41 // Empty vectors are the empty fixed array. | 41 Handle<FeedbackVector> vector; |
42 StaticFeedbackVectorSpec empty; | |
43 Handle<FeedbackVector> vector = NewFeedbackVector(isolate, &empty); | |
44 CHECK(Handle<FixedArray>::cast(vector).is_identical_to( | |
45 factory->empty_feedback_vector())); | |
46 // Which can nonetheless be queried. | |
47 CHECK(vector->is_empty()); | |
48 | 42 |
49 { | 43 { |
50 FeedbackVectorSpec one_slot(&zone); | 44 FeedbackVectorSpec one_slot(&zone); |
51 one_slot.AddGeneralSlot(); | 45 one_slot.AddGeneralSlot(); |
52 vector = NewFeedbackVector(isolate, &one_slot); | 46 vector = NewFeedbackVector(isolate, &one_slot); |
53 FeedbackVectorHelper helper(vector); | 47 FeedbackVectorHelper helper(vector); |
54 CHECK_EQ(1, helper.slot_count()); | 48 CHECK_EQ(1, helper.slot_count()); |
55 } | 49 } |
56 | 50 |
57 { | 51 { |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 // There should be one IC slot. | 626 // There should be one IC slot. |
633 Handle<FeedbackVector> feedback_vector(f->feedback_vector()); | 627 Handle<FeedbackVector> feedback_vector(f->feedback_vector()); |
634 FeedbackVectorHelper helper(feedback_vector); | 628 FeedbackVectorHelper helper(feedback_vector); |
635 CHECK_EQ(1, helper.slot_count()); | 629 CHECK_EQ(1, helper.slot_count()); |
636 FeedbackSlot slot(0); | 630 FeedbackSlot slot(0); |
637 StoreICNexus nexus(feedback_vector, slot); | 631 StoreICNexus nexus(feedback_vector, slot); |
638 CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); | 632 CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); |
639 } | 633 } |
640 | 634 |
641 } // namespace | 635 } // namespace |
OLD | NEW |