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 22 matching lines...) Expand all Loading... |
33 CHECK_EQ(0, vector->ic_generic_count()); | 33 CHECK_EQ(0, vector->ic_generic_count()); |
34 CHECK_EQ(0, vector->Slots()); | 34 CHECK_EQ(0, vector->Slots()); |
35 CHECK_EQ(0, vector->ICSlots()); | 35 CHECK_EQ(0, vector->ICSlots()); |
36 | 36 |
37 FeedbackVectorSpec one_slot(1, 0); | 37 FeedbackVectorSpec one_slot(1, 0); |
38 vector = factory->NewTypeFeedbackVector(one_slot); | 38 vector = factory->NewTypeFeedbackVector(one_slot); |
39 CHECK_EQ(1, vector->Slots()); | 39 CHECK_EQ(1, vector->Slots()); |
40 CHECK_EQ(0, vector->ICSlots()); | 40 CHECK_EQ(0, vector->ICSlots()); |
41 | 41 |
42 FeedbackVectorSpec one_icslot(0, 1); | 42 FeedbackVectorSpec one_icslot(0, 1); |
| 43 if (FLAG_vector_ics) { |
| 44 one_icslot.SetKind(0, Code::CALL_IC); |
| 45 } |
43 vector = factory->NewTypeFeedbackVector(one_icslot); | 46 vector = factory->NewTypeFeedbackVector(one_icslot); |
44 CHECK_EQ(0, vector->Slots()); | 47 CHECK_EQ(0, vector->Slots()); |
45 CHECK_EQ(1, vector->ICSlots()); | 48 CHECK_EQ(1, vector->ICSlots()); |
46 | 49 |
47 FeedbackVectorSpec spec(3, 5); | 50 FeedbackVectorSpec spec(3, 5); |
| 51 if (FLAG_vector_ics) { |
| 52 for (int i = 0; i < 5; i++) spec.SetKind(i, Code::CALL_IC); |
| 53 } |
48 vector = factory->NewTypeFeedbackVector(spec); | 54 vector = factory->NewTypeFeedbackVector(spec); |
49 CHECK_EQ(3, vector->Slots()); | 55 CHECK_EQ(3, vector->Slots()); |
50 CHECK_EQ(5, vector->ICSlots()); | 56 CHECK_EQ(5, vector->ICSlots()); |
51 | 57 |
52 int metadata_length = vector->ic_metadata_length(); | 58 int metadata_length = vector->ic_metadata_length(); |
53 if (!FLAG_vector_ics) { | 59 if (!FLAG_vector_ics) { |
54 CHECK_EQ(0, metadata_length); | 60 CHECK_EQ(0, metadata_length); |
55 } else { | 61 } else { |
56 CHECK(metadata_length > 0); | 62 CHECK(metadata_length > 0); |
57 } | 63 } |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback()); | 294 CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback()); |
289 MapHandleList maps; | 295 MapHandleList maps; |
290 nexus.FindAllMaps(&maps); | 296 nexus.FindAllMaps(&maps); |
291 CHECK_EQ(4, maps.length()); | 297 CHECK_EQ(4, maps.length()); |
292 | 298 |
293 // Finally driven megamorphic. | 299 // Finally driven megamorphic. |
294 CompileRun("f({ blarg: 3, gran: 3, torino: 10, foo: 2 })"); | 300 CompileRun("f({ blarg: 3, gran: 3, torino: 10, foo: 2 })"); |
295 CHECK_EQ(MEGAMORPHIC, nexus.StateFromFeedback()); | 301 CHECK_EQ(MEGAMORPHIC, nexus.StateFromFeedback()); |
296 CHECK_EQ(NULL, nexus.FindFirstMap()); | 302 CHECK_EQ(NULL, nexus.FindFirstMap()); |
297 | 303 |
298 // After a collection, state should be reset to PREMONOMORPHIC. | 304 // After a collection, state should not be reset to PREMONOMORPHIC. |
299 heap->CollectAllGarbage(i::Heap::kNoGCFlags); | 305 heap->CollectAllGarbage(i::Heap::kNoGCFlags); |
300 CHECK_EQ(PREMONOMORPHIC, nexus.StateFromFeedback()); | 306 CHECK_EQ(MEGAMORPHIC, nexus.StateFromFeedback()); |
301 } | 307 } |
302 } | 308 } |
OLD | NEW |