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

Side by Side Diff: test/cctest/compiler/test-run-inlining.cc

Issue 962963006: [turbofan] Support inlining of unguarded loops. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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/compiler/js-inlining.cc ('k') | no next file » | 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 6
7 #include "test/cctest/compiler/function-tester.h" 7 #include "test/cctest/compiler/function-tester.h"
8 8
9 #if V8_TURBOFAN_TARGET 9 #if V8_TURBOFAN_TARGET
10 10
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 " function bar(s,t) { return foo(foo(s,t),t); };" 313 " function bar(s,t) { return foo(foo(s,t),t); };"
314 " return bar;" 314 " return bar;"
315 "})();", 315 "})();",
316 kInlineFlags); 316 kInlineFlags);
317 317
318 InstallAssertInlineCountHelper(CcTest::isolate()); 318 InstallAssertInlineCountHelper(CcTest::isolate());
319 T.CheckCall(T.Val(0.0), T.Val(11), T.Val(4)); 319 T.CheckCall(T.Val(0.0), T.Val(11), T.Val(4));
320 } 320 }
321 321
322 322
323 TEST(InlineLoopUnguardedEmpty) {
324 FLAG_turbo_deoptimization = true;
325 FunctionTester T(
326 "(function () {"
327 " function foo(s) { AssertInlineCount(2); while (s); return s; };"
328 " function bar(s, t) { return foo(s); };"
329 " return bar;"
330 "})();",
331 kInlineFlags);
332
333 InstallAssertInlineCountHelper(CcTest::isolate());
334 T.CheckCall(T.Val(0.0), T.Val(0.0), T.Val(4));
335 }
336
337
338 TEST(InlineLoopUnguardedOnce) {
339 FLAG_turbo_deoptimization = true;
340 FunctionTester T(
341 "(function () {"
342 " function foo(s) { AssertInlineCount(2); while (s) {"
343 " s = s - 1; }; return s; };"
344 " function bar(s, t) { return foo(s); };"
345 " return bar;"
346 "})();",
347 kInlineFlags);
348
349 InstallAssertInlineCountHelper(CcTest::isolate());
350 T.CheckCall(T.Val(0.0), T.Val(0.0), T.Val(4));
351 }
352
353
354 TEST(InlineLoopUnguardedTwice) {
355 FLAG_turbo_deoptimization = true;
356 FunctionTester T(
357 "(function () {"
358 " function foo(s) { AssertInlineCount(2); while (s > 0) {"
359 " s = s - 1; }; return s; };"
360 " function bar(s,t) { return foo(foo(s,t),t); };"
361 " return bar;"
362 "})();",
363 kInlineFlags);
364
365 InstallAssertInlineCountHelper(CcTest::isolate());
366 T.CheckCall(T.Val(0.0), T.Val(0.0), T.Val(4));
367 }
368
369
323 TEST(InlineStrictIntoNonStrict) { 370 TEST(InlineStrictIntoNonStrict) {
324 FLAG_turbo_deoptimization = true; 371 FLAG_turbo_deoptimization = true;
325 FunctionTester T( 372 FunctionTester T(
326 "(function () {" 373 "(function () {"
327 " var x = Object.create({}, { y: { value:42, writable:false } });" 374 " var x = Object.create({}, { y: { value:42, writable:false } });"
328 " function foo(s) { 'use strict';" 375 " function foo(s) { 'use strict';"
329 " x.y = 9; };" 376 " x.y = 9; };"
330 " function bar(s,t) { return foo(s); };" 377 " function bar(s,t) { return foo(s); };"
331 " return bar;" 378 " return bar;"
332 "})();", 379 "})();",
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 " function bar() { return foo(13, 14, 15); };" 478 " function bar() { return foo(13, 14, 15); };"
432 " return bar;" 479 " return bar;"
433 "})();", 480 "})();",
434 kInlineFlags); 481 kInlineFlags);
435 482
436 InstallAssertInlineCountHelper(CcTest::isolate()); 483 InstallAssertInlineCountHelper(CcTest::isolate());
437 T.CheckCall(T.true_value(), T.Val(12), T.Val(14)); 484 T.CheckCall(T.true_value(), T.Val(12), T.Val(14));
438 } 485 }
439 486
440 #endif // V8_TURBOFAN_TARGET 487 #endif // V8_TURBOFAN_TARGET
OLDNEW
« no previous file with comments | « src/compiler/js-inlining.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698