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

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

Issue 2209633002: [Interpreter] Assign feedback slots for binary operations and use them in ignition. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased the patch. Created 4 years, 4 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
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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 CcTest::InitializeVM(); 358 CcTest::InitializeVM();
359 LocalContext context; 359 LocalContext context;
360 v8::HandleScope scope(context->GetIsolate()); 360 v8::HandleScope scope(context->GetIsolate());
361 Isolate* isolate = CcTest::i_isolate(); 361 Isolate* isolate = CcTest::i_isolate();
362 362
363 // Function f has 3 LoadICs, one for each o, but the ICs share the same 363 // Function f has 3 LoadICs, one for each o, but the ICs share the same
364 // feedback vector IC slot. 364 // feedback vector IC slot.
365 CompileRun( 365 CompileRun(
366 "o = 10;" 366 "o = 10;"
367 "function f() {" 367 "function f() {"
368 " var x = o + 10;" 368 " var x = o || 10;"
369 " return o + x + o;" 369 " return o , x , o;"
370 "}" 370 "}"
371 "f();"); 371 "f();");
372 Handle<JSFunction> f = GetFunction("f"); 372 Handle<JSFunction> f = GetFunction("f");
373 // There should be one IC slot. 373 // There should be one IC slot.
374 Handle<TypeFeedbackVector> feedback_vector = 374 Handle<TypeFeedbackVector> feedback_vector =
375 Handle<TypeFeedbackVector>(f->feedback_vector(), isolate); 375 Handle<TypeFeedbackVector>(f->feedback_vector(), isolate);
376 FeedbackVectorHelper helper(feedback_vector); 376 FeedbackVectorHelper helper(feedback_vector);
377 CHECK_EQ(1, helper.slot_count()); 377 CHECK_EQ(1, helper.slot_count());
378 FeedbackVectorSlot slot(0); 378 FeedbackVectorSlot slot(0);
379 LoadGlobalICNexus nexus(feedback_vector, slot); 379 LoadGlobalICNexus nexus(feedback_vector, slot);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 " return x.old + x.young;" 537 " return x.old + x.young;"
538 "}" 538 "}"
539 "testcompound({ old: 3, young: 3, in_between: 3 });"); 539 "testcompound({ old: 3, young: 3, in_between: 3 });");
540 540
541 Handle<JSFunction> f = GetFunction("testcompound"); 541 Handle<JSFunction> f = GetFunction("testcompound");
542 542
543 // There should be 1 LOAD_GLOBAL_IC for load of a and 2 LOAD_ICs, for load 543 // There should be 1 LOAD_GLOBAL_IC for load of a and 2 LOAD_ICs, for load
544 // of x.old and x.young. 544 // of x.old and x.young.
545 Handle<TypeFeedbackVector> feedback_vector(f->feedback_vector()); 545 Handle<TypeFeedbackVector> feedback_vector(f->feedback_vector());
546 FeedbackVectorHelper helper(feedback_vector); 546 FeedbackVectorHelper helper(feedback_vector);
547 CHECK_EQ(6, helper.slot_count()); 547 CHECK_EQ(7, helper.slot_count());
548 CHECK_SLOT_KIND(helper, 0, FeedbackVectorSlotKind::LOAD_GLOBAL_IC); 548 CHECK_SLOT_KIND(helper, 0, FeedbackVectorSlotKind::LOAD_GLOBAL_IC);
549 CHECK_SLOT_KIND(helper, 1, FeedbackVectorSlotKind::STORE_IC); 549 CHECK_SLOT_KIND(helper, 1, FeedbackVectorSlotKind::STORE_IC);
550 CHECK_SLOT_KIND(helper, 2, FeedbackVectorSlotKind::STORE_IC); 550 CHECK_SLOT_KIND(helper, 2, FeedbackVectorSlotKind::STORE_IC);
551 CHECK_SLOT_KIND(helper, 3, FeedbackVectorSlotKind::STORE_IC); 551 CHECK_SLOT_KIND(helper, 3, FeedbackVectorSlotKind::STORE_IC);
552 CHECK_SLOT_KIND(helper, 4, FeedbackVectorSlotKind::LOAD_IC); 552 CHECK_SLOT_KIND(helper, 4, FeedbackVectorSlotKind::LOAD_IC);
553 CHECK_SLOT_KIND(helper, 5, FeedbackVectorSlotKind::LOAD_IC); 553 CHECK_SLOT_KIND(helper, 5, FeedbackVectorSlotKind::LOAD_IC);
554 // Binary operation feedback is a general slot.
555 CHECK_SLOT_KIND(helper, 6, FeedbackVectorSlotKind::GENERAL);
554 } 556 }
555 } 557 }
556 558
557 559
558 TEST(VectorStoreICBasic) { 560 TEST(VectorStoreICBasic) {
559 if (i::FLAG_always_opt) return; 561 if (i::FLAG_always_opt) return;
560 562
561 CcTest::InitializeVM(); 563 CcTest::InitializeVM();
562 LocalContext context; 564 LocalContext context;
563 v8::HandleScope scope(context->GetIsolate()); 565 v8::HandleScope scope(context->GetIsolate());
(...skipping 10 matching lines...) Expand all
574 // There should be one IC slot. 576 // There should be one IC slot.
575 Handle<TypeFeedbackVector> feedback_vector(f->feedback_vector()); 577 Handle<TypeFeedbackVector> feedback_vector(f->feedback_vector());
576 FeedbackVectorHelper helper(feedback_vector); 578 FeedbackVectorHelper helper(feedback_vector);
577 CHECK_EQ(1, helper.slot_count()); 579 CHECK_EQ(1, helper.slot_count());
578 FeedbackVectorSlot slot(0); 580 FeedbackVectorSlot slot(0);
579 StoreICNexus nexus(feedback_vector, slot); 581 StoreICNexus nexus(feedback_vector, slot);
580 CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); 582 CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
581 } 583 }
582 584
583 } // namespace 585 } // namespace
OLDNEW
« no previous file with comments | « test/cctest/interpreter/test-interpreter.cc ('k') | test/unittests/interpreter/bytecode-array-builder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698