| 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.h" | 9 #include "src/debug.h" |
| 10 #include "src/execution.h" | 10 #include "src/execution.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 Factory* factory = isolate->factory(); | 64 Factory* factory = isolate->factory(); |
| 65 | 65 |
| 66 // We only test clearing FeedbackVectorSlots, not FeedbackVectorICSlots. | 66 // We only test clearing FeedbackVectorSlots, not FeedbackVectorICSlots. |
| 67 // The reason is that FeedbackVectorICSlots need a full code environment | 67 // The reason is that FeedbackVectorICSlots need a full code environment |
| 68 // to fully test (See VectorICProfilerStatistics test below). | 68 // to fully test (See VectorICProfilerStatistics test below). |
| 69 Handle<TypeFeedbackVector> vector = factory->NewTypeFeedbackVector(5, 0); | 69 Handle<TypeFeedbackVector> vector = factory->NewTypeFeedbackVector(5, 0); |
| 70 | 70 |
| 71 // Fill with information | 71 // Fill with information |
| 72 vector->Set(FeedbackVectorSlot(0), Smi::FromInt(1)); | 72 vector->Set(FeedbackVectorSlot(0), Smi::FromInt(1)); |
| 73 vector->Set(FeedbackVectorSlot(1), *factory->fixed_array_map()); | 73 vector->Set(FeedbackVectorSlot(1), *factory->fixed_array_map()); |
| 74 vector->Set(FeedbackVectorSlot(2), *factory->NewAllocationSite()); | 74 Handle<AllocationSite> site = factory->NewAllocationSite(); |
| 75 vector->Set(FeedbackVectorSlot(2), *site); |
| 75 | 76 |
| 76 vector->ClearSlots(NULL); | 77 vector->ClearSlots(NULL); |
| 77 | 78 |
| 78 // The feedback vector slots are cleared. AllocationSites are granted | 79 // The feedback vector slots are cleared. AllocationSites are granted |
| 79 // an exemption from clearing, as are smis. | 80 // an exemption from clearing, as are smis. |
| 80 CHECK_EQ(Smi::FromInt(1), vector->Get(FeedbackVectorSlot(0))); | 81 CHECK_EQ(Smi::FromInt(1), vector->Get(FeedbackVectorSlot(0))); |
| 81 CHECK_EQ(*TypeFeedbackVector::UninitializedSentinel(isolate), | 82 CHECK_EQ(*TypeFeedbackVector::UninitializedSentinel(isolate), |
| 82 vector->Get(FeedbackVectorSlot(1))); | 83 vector->Get(FeedbackVectorSlot(1))); |
| 83 CHECK(vector->Get(FeedbackVectorSlot(2))->IsAllocationSite()); | 84 CHECK(vector->Get(FeedbackVectorSlot(2))->IsAllocationSite()); |
| 84 } | 85 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 CHECK_EQ(0, feedback_vector->ic_generic_count()); | 130 CHECK_EQ(0, feedback_vector->ic_generic_count()); |
| 130 | 131 |
| 131 CHECK(feedback_vector->Get(FeedbackVectorICSlot(0))->IsAllocationSite()); | 132 CHECK(feedback_vector->Get(FeedbackVectorICSlot(0))->IsAllocationSite()); |
| 132 heap->CollectAllGarbage(i::Heap::kNoGCFlags); | 133 heap->CollectAllGarbage(i::Heap::kNoGCFlags); |
| 133 feedback_vector = f->shared()->feedback_vector(); | 134 feedback_vector = f->shared()->feedback_vector(); |
| 134 CHECK_EQ(1, feedback_vector->ic_with_type_info_count()); | 135 CHECK_EQ(1, feedback_vector->ic_with_type_info_count()); |
| 135 CHECK_EQ(0, feedback_vector->ic_generic_count()); | 136 CHECK_EQ(0, feedback_vector->ic_generic_count()); |
| 136 CHECK(feedback_vector->Get(FeedbackVectorICSlot(0))->IsAllocationSite()); | 137 CHECK(feedback_vector->Get(FeedbackVectorICSlot(0))->IsAllocationSite()); |
| 137 } | 138 } |
| 138 } | 139 } |
| OLD | NEW |