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

Side by Side Diff: test/unittests/compiler/scheduler-unittest.cc

Issue 1114163005: [turbofan] Fix tail call optimization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/compiler/access-builder.h" 5 #include "src/compiler/access-builder.h"
6 #include "src/compiler/common-operator.h" 6 #include "src/compiler/common-operator.h"
7 #include "src/compiler/graph.h" 7 #include "src/compiler/graph.h"
8 #include "src/compiler/graph-visualizer.h" 8 #include "src/compiler/graph-visualizer.h"
9 #include "src/compiler/js-operator.h" 9 #include "src/compiler/js-operator.h"
10 #include "src/compiler/node.h" 10 #include "src/compiler/node.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 131
132 132
133 namespace { 133 namespace {
134 134
135 const Operator kHeapConstant(IrOpcode::kHeapConstant, Operator::kPure, 135 const Operator kHeapConstant(IrOpcode::kHeapConstant, Operator::kPure,
136 "HeapConstant", 0, 0, 0, 1, 0, 0); 136 "HeapConstant", 0, 0, 0, 1, 0, 0);
137 const Operator kIntAdd(IrOpcode::kInt32Add, Operator::kPure, "Int32Add", 2, 0, 137 const Operator kIntAdd(IrOpcode::kInt32Add, Operator::kPure, "Int32Add", 2, 0,
138 0, 1, 0, 0); 138 0, 1, 0, 0);
139 const Operator kMockCall(IrOpcode::kCall, Operator::kNoProperties, "MockCall", 139 const Operator kMockCall(IrOpcode::kCall, Operator::kNoProperties, "MockCall",
140 0, 0, 1, 1, 0, 2); 140 0, 0, 1, 1, 0, 2);
141 const Operator kMockTailCall(IrOpcode::kTailCall, Operator::kNoProperties,
142 "MockTailCall", 1, 1, 1, 0, 0, 1);
141 143
142 } // namespace 144 } // namespace
143 145
144 146
145 // ----------------------------------------------------------------------------- 147 // -----------------------------------------------------------------------------
146 // Special reverse-post-order block ordering. 148 // Special reverse-post-order block ordering.
147 149
148 150
149 TEST_F(SchedulerRPOTest, Degenerate1) { 151 TEST_F(SchedulerRPOTest, Degenerate1) {
150 Schedule schedule(zone()); 152 Schedule schedule(zone());
(...skipping 2248 matching lines...) Expand 10 before | Expand all | Expand 10 after
2399 2401
2400 Schedule* schedule = ComputeAndVerifySchedule(17); 2402 Schedule* schedule = ComputeAndVerifySchedule(17);
2401 // Make sure the exception blocks as well as the handler are deferred. 2403 // Make sure the exception blocks as well as the handler are deferred.
2402 EXPECT_TRUE(schedule->block(ex1)->deferred()); 2404 EXPECT_TRUE(schedule->block(ex1)->deferred());
2403 EXPECT_TRUE(schedule->block(ex2)->deferred()); 2405 EXPECT_TRUE(schedule->block(ex2)->deferred());
2404 EXPECT_TRUE(schedule->block(hdl)->deferred()); 2406 EXPECT_TRUE(schedule->block(hdl)->deferred());
2405 EXPECT_FALSE(schedule->block(m)->deferred()); 2407 EXPECT_FALSE(schedule->block(m)->deferred());
2406 } 2408 }
2407 2409
2408 2410
2411 TARGET_TEST_F(SchedulerTest, TailCall) {
2412 Node* start = graph()->NewNode(common()->Start(1));
2413 graph()->SetStart(start);
2414
2415 Node* p0 = graph()->NewNode(common()->Parameter(0), start);
2416 Node* call = graph()->NewNode(&kMockTailCall, p0, start, start);
2417 Node* end = graph()->NewNode(common()->End(), call);
2418
2419 graph()->SetEnd(end);
2420
2421 ComputeAndVerifySchedule(4);
2422 }
2423
2424
2409 TARGET_TEST_F(SchedulerTest, Switch) { 2425 TARGET_TEST_F(SchedulerTest, Switch) {
2410 Node* start = graph()->NewNode(common()->Start(1)); 2426 Node* start = graph()->NewNode(common()->Start(1));
2411 graph()->SetStart(start); 2427 graph()->SetStart(start);
2412 2428
2413 Node* p0 = graph()->NewNode(common()->Parameter(0), start); 2429 Node* p0 = graph()->NewNode(common()->Parameter(0), start);
2414 Node* sw = graph()->NewNode(common()->Switch(3), p0, start); 2430 Node* sw = graph()->NewNode(common()->Switch(3), p0, start);
2415 Node* c0 = graph()->NewNode(common()->IfValue(0), sw); 2431 Node* c0 = graph()->NewNode(common()->IfValue(0), sw);
2416 Node* v0 = graph()->NewNode(common()->Int32Constant(11)); 2432 Node* v0 = graph()->NewNode(common()->Int32Constant(11));
2417 Node* c1 = graph()->NewNode(common()->IfValue(1), sw); 2433 Node* c1 = graph()->NewNode(common()->IfValue(1), sw);
2418 Node* v1 = graph()->NewNode(common()->Int32Constant(22)); 2434 Node* v1 = graph()->NewNode(common()->Int32Constant(22));
(...skipping 28 matching lines...) Expand all
2447 Node* end = graph()->NewNode(common()->End(), ret); 2463 Node* end = graph()->NewNode(common()->End(), ret);
2448 2464
2449 graph()->SetEnd(end); 2465 graph()->SetEnd(end);
2450 2466
2451 ComputeAndVerifySchedule(16); 2467 ComputeAndVerifySchedule(16);
2452 } 2468 }
2453 2469
2454 } // namespace compiler 2470 } // namespace compiler
2455 } // namespace internal 2471 } // namespace internal
2456 } // namespace v8 2472 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698