Index: test/cctest/compiler/test-run-inlining.cc |
diff --git a/test/cctest/compiler/test-run-inlining.cc b/test/cctest/compiler/test-run-inlining.cc |
index c4e3aeaccb07e2ea4eb40bfe5b3815e216c77ed5..add2f943ec3ed494a72d9ab8df9e436dd2e1b40d 100644 |
--- a/test/cctest/compiler/test-run-inlining.cc |
+++ b/test/cctest/compiler/test-run-inlining.cc |
@@ -191,4 +191,57 @@ TEST(InlineTwiceDependentDiamondReal) { |
T.CheckCall(T.Val(-11), 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.defineProperty(x, \"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.defineProperty(obj1, \"y\", { value: 42, writable: false });" |
Michael Starzinger
2014/08/28 09:49:00
It seems "obj1" is never defined. This means that
sigurds
2014/08/28 11:05:37
That's a mistake, thanks for catching!
|
+ "function foo(s) { x.y = 9; return 42; };" |
Michael Starzinger
2014/08/28 09:49:00
You could use "return x.y" here as an additional v
sigurds
2014/08/28 11:05:37
Done.
|
+ "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 |