Revision: 23511
Author: [email protected]
Date: Fri Aug 29 08:58:51 2014 UTC
Log: Add more inlining unit tests.
- Scheduler can inline a function with a loop.
- Inlining strict into non-strict works correctly.
- Inlining non-strict into strict works correctly.
[email protected]
Review URL: https://codereview.chromium.org/515103002
https://code.google.com/p/v8/source/detail?r=23511
Modified:
/branches/bleeding_edge/test/cctest/cctest.status
/branches/bleeding_edge/test/cctest/compiler/test-run-inlining.cc
=======================================
--- /branches/bleeding_edge/test/cctest/cctest.status Fri Aug 29 05:37:55
2014 UTC
+++ /branches/bleeding_edge/test/cctest/cctest.status Fri Aug 29 08:58:51
2014 UTC
@@ -80,6 +80,9 @@
##############################################################################
# TurboFan compiler failures.
+ # Scheduler cannot handle free-floating loops yet
+ 'test-run-inlining/InlineLoop': [SKIP],
+
# TODO(mstarzinger): Sometimes the try-catch blacklist fails.
'test-debug/DebugEvaluateWithoutStack': [PASS, NO_VARIANTS],
'test-debug/MessageQueues': [PASS, NO_VARIANTS],
=======================================
--- /branches/bleeding_edge/test/cctest/compiler/test-run-inlining.cc Thu
Aug 28 12:18:25 2014 UTC
+++ /branches/bleeding_edge/test/cctest/compiler/test-run-inlining.cc Fri
Aug 29 08:58:51 2014 UTC
@@ -191,5 +191,56 @@
InstallAssertStackDepthHelper(CcTest::isolate());
T.CheckCall(T.Val(-329), T.Val(11), T.Val(4));
}
+
+
+TEST(InlineLoop) {
+ FunctionTester T(
+ "(function () {"
+ "var x = 41;"
+ "function foo(s) { AssertStackDepth(1); while (s > 0) {"
+ " s = s - 1; }; return s; };"
+ "function bar(s,t) { return foo(foo(s)); };"
+ "return bar;"
+ "})();",
+ CompilationInfo::kInliningEnabled |
+ CompilationInfo::kContextSpecializing);
+
+ InstallAssertStackDepthHelper(CcTest::isolate());
+ T.CheckCall(T.Val(0.0), T.Val(11), T.Val(4));
+}
+
+
+TEST(InlineStrictIntoNonStrict) {
+ FunctionTester T(
+ "(function () {"
+ "var x = Object.create({}, { y: { value:42, writable:false } });"
+ "function foo(s) { 'use strict';"
+ " x.y = 9; };"
+ "function bar(s,t) { return foo(s); };"
+ "return bar;"
+ "})();",
+ CompilationInfo::kInliningEnabled |
+ CompilationInfo::kContextSpecializing);
+
+ InstallAssertStackDepthHelper(CcTest::isolate());
+ T.CheckThrows(T.undefined(), T.undefined());
+}
+
+
+TEST(InlineNonStrictIntoStrict) {
+ FunctionTester T(
+ "(function () {"
+ "var x = Object.create({}, { y: { value:42, writable:false } });"
+ "function foo(s) { x.y = 9; return x.y; };"
+ "function bar(s,t) { \'use strict\'; return foo(s); };"
+ "return bar;"
+ "})();",
+ CompilationInfo::kInliningEnabled |
+ CompilationInfo::kContextSpecializing);
+
+ InstallAssertStackDepthHelper(CcTest::isolate());
+ T.CheckCall(T.Val(42), T.undefined(), T.undefined());
+}
+
#endif // V8_TURBOFAN_TARGET
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.