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

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

Issue 612043003: Add inlining for intrinsics. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Move decls. Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/flag-definitions.h ('k') | test/cctest/compiler/test-run-intrinsics.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 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 "})();", 343 "})();",
344 CompilationInfo::kInliningEnabled | 344 CompilationInfo::kInliningEnabled |
345 CompilationInfo::kContextSpecializing | 345 CompilationInfo::kContextSpecializing |
346 CompilationInfo::kTypingEnabled); 346 CompilationInfo::kTypingEnabled);
347 347
348 InstallAssertInlineCountHelper(CcTest::isolate()); 348 InstallAssertInlineCountHelper(CcTest::isolate());
349 T.CheckCall(T.Val(42), T.undefined(), T.undefined()); 349 T.CheckCall(T.Val(42), T.undefined(), T.undefined());
350 } 350 }
351 351
352 352
353 TEST(InlineIntrinsicIsSmi) {
354 FLAG_turbo_deoptimization = true;
355 FunctionTester T(
356 "(function () {"
357 "var x = 42;"
358 "function bar(s,t) { return %_IsSmi(x); };"
359 "return bar;"
360 "})();",
361 CompilationInfo::kInliningEnabled |
362 CompilationInfo::kContextSpecializing |
363 CompilationInfo::kTypingEnabled);
364
365 InstallAssertInlineCountHelper(CcTest::isolate());
366 T.CheckCall(T.true_value(), T.Val(12), T.Val(4));
367 }
368
369
370 TEST(InlineIntrinsicIsNonNegativeSmi) {
371 FLAG_turbo_deoptimization = true;
372 FunctionTester T(
373 "(function () {"
374 "var x = 42;"
375 "function bar(s,t) { return %_IsNonNegativeSmi(x); };"
376 "return bar;"
377 "})();",
378 CompilationInfo::kInliningEnabled |
379 CompilationInfo::kContextSpecializing |
380 CompilationInfo::kTypingEnabled);
381
382 InstallAssertInlineCountHelper(CcTest::isolate());
383 T.CheckCall(T.true_value(), T.Val(12), T.Val(4));
384 }
385
386
387 TEST(InlineIntrinsicIsArray) {
388 FLAG_turbo_deoptimization = true;
389 FunctionTester T(
390 "(function () {"
391 "var x = [1,2,3];"
392 "function bar(s,t) { return %_IsArray(x); };"
393 "return bar;"
394 "})();",
395 CompilationInfo::kInliningEnabled |
396 CompilationInfo::kContextSpecializing |
397 CompilationInfo::kTypingEnabled);
398
399 InstallAssertInlineCountHelper(CcTest::isolate());
400 T.CheckCall(T.true_value(), T.Val(12), T.Val(4));
401
402 FunctionTester T2(
403 "(function () {"
404 "var x = 32;"
405 "function bar(s,t) { return %_IsArray(x); };"
406 "return bar;"
407 "})();",
408 CompilationInfo::kInliningEnabled |
409 CompilationInfo::kContextSpecializing |
410 CompilationInfo::kTypingEnabled);
411
412 T2.CheckCall(T.false_value(), T.Val(12), T.Val(4));
413
414 FunctionTester T3(
415 "(function () {"
416 "var x = bar;"
417 "function bar(s,t) { return %_IsArray(x); };"
418 "return bar;"
419 "})();",
420 CompilationInfo::kInliningEnabled |
421 CompilationInfo::kContextSpecializing |
422 CompilationInfo::kTypingEnabled);
423
424 T3.CheckCall(T.false_value(), T.Val(12), T.Val(4));
425 }
426
427
428 TEST(InlineWithArguments) {
429 FLAG_turbo_deoptimization = true;
430 FunctionTester T(
431 "(function () {"
432 " function foo(s,t,u) { AssertInlineCount(2); "
433 " return foo.arguments.length == 3 && "
434 " foo.arguments[0] == 13 && "
435 " foo.arguments[1] == 14 && "
436 " foo.arguments[2] == 15; "
437 " }"
438 " function bar() { return foo(13, 14, 15); };"
439 " return bar;"
440 "}"
441 ")();",
442 CompilationInfo::kInliningEnabled |
443 CompilationInfo::kContextSpecializing |
444 CompilationInfo::kTypingEnabled);
445
446 InstallAssertInlineCountHelper(CcTest::isolate());
447 T.CheckCall(T.true_value(), T.Val(12), T.Val(14));
448 }
449
353 #endif // V8_TURBOFAN_TARGET 450 #endif // V8_TURBOFAN_TARGET
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | test/cctest/compiler/test-run-intrinsics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698