Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: test/cctest/test-feedback-vector.cc

Issue 767743002: Hydrogen code stubs for vector-based ICs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698