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

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

Issue 2325083003: Record call counts also for megamorphic calls. (Closed)
Patch Set: Code comments. Created 4 years, 3 months 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 | « src/x64/code-stubs-x64.cc ('k') | test/mjsunit/regress/regress-353551.js » ('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/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/execution.h" 10 #include "src/execution.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 // There should be one IC. 262 // There should be one IC.
263 Handle<TypeFeedbackVector> feedback_vector = 263 Handle<TypeFeedbackVector> feedback_vector =
264 Handle<TypeFeedbackVector>(f->feedback_vector(), isolate); 264 Handle<TypeFeedbackVector>(f->feedback_vector(), isolate);
265 FeedbackVectorSlot slot(0); 265 FeedbackVectorSlot slot(0);
266 CallICNexus nexus(feedback_vector, slot); 266 CallICNexus nexus(feedback_vector, slot);
267 CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); 267 CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
268 268
269 CompileRun("f(foo); f(foo);"); 269 CompileRun("f(foo); f(foo);");
270 CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); 270 CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
271 CHECK_EQ(3, nexus.ExtractCallCount()); 271 CHECK_EQ(3, nexus.ExtractCallCount());
272
273 // Send the IC megamorphic, but we should still have incrementing counts.
274 CompileRun("f(function() { return 12; });");
275 CHECK_EQ(GENERIC, nexus.StateFromFeedback());
276 CHECK_EQ(4, nexus.ExtractCallCount());
272 } 277 }
273 278
274 TEST(VectorConstructCounts) { 279 TEST(VectorConstructCounts) {
275 if (i::FLAG_always_opt) return; 280 if (i::FLAG_always_opt) return;
276 CcTest::InitializeVM(); 281 CcTest::InitializeVM();
277 LocalContext context; 282 LocalContext context;
278 v8::HandleScope scope(context->GetIsolate()); 283 v8::HandleScope scope(context->GetIsolate());
279 Isolate* isolate = CcTest::i_isolate(); 284 Isolate* isolate = CcTest::i_isolate();
280 285
281 // Make sure function f has a call that uses a type feedback slot. 286 // Make sure function f has a call that uses a type feedback slot.
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 // There should be one IC slot. 576 // There should be one IC slot.
572 Handle<TypeFeedbackVector> feedback_vector(f->feedback_vector()); 577 Handle<TypeFeedbackVector> feedback_vector(f->feedback_vector());
573 FeedbackVectorHelper helper(feedback_vector); 578 FeedbackVectorHelper helper(feedback_vector);
574 CHECK_EQ(1, helper.slot_count()); 579 CHECK_EQ(1, helper.slot_count());
575 FeedbackVectorSlot slot(0); 580 FeedbackVectorSlot slot(0);
576 StoreICNexus nexus(feedback_vector, slot); 581 StoreICNexus nexus(feedback_vector, slot);
577 CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); 582 CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
578 } 583 }
579 584
580 } // namespace 585 } // namespace
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | test/mjsunit/regress/regress-353551.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698