| OLD | NEW |
| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 InstallAssertStackDepthHelper(CcTest::isolate()); | 157 InstallAssertStackDepthHelper(CcTest::isolate()); |
| 158 T.CheckCall(T.Val(42 + 42 + 12), T.Val(12), T.Val(4)); | 158 T.CheckCall(T.Val(42 + 42 + 12), T.Val(12), T.Val(4)); |
| 159 } | 159 } |
| 160 | 160 |
| 161 | 161 |
| 162 TEST(InlineTwiceDependentDiamond) { | 162 TEST(InlineTwiceDependentDiamond) { |
| 163 FLAG_context_specialization = true; | 163 FLAG_context_specialization = true; |
| 164 FLAG_turbo_inlining = true; | 164 FLAG_turbo_inlining = true; |
| 165 FunctionTester T( | 165 FunctionTester T( |
| 166 "(function () {" | 166 "(function () {" |
| 167 "function foo(s) { if (true) {" | |
| 168 " return 12 } else { return 13; } };" | |
| 169 "function bar(s,t) { return foo(foo(1)); };" | |
| 170 "return bar;" | |
| 171 "})();"); | |
| 172 | |
| 173 InstallAssertStackDepthHelper(CcTest::isolate()); | |
| 174 T.CheckCall(T.Val(12), T.undefined(), T.undefined()); | |
| 175 } | |
| 176 | |
| 177 | |
| 178 TEST(InlineTwiceDependentDiamondReal) { | |
| 179 FLAG_context_specialization = true; | |
| 180 FLAG_turbo_inlining = true; | |
| 181 FunctionTester T( | |
| 182 "(function () {" | |
| 183 "var x = 41;" | 167 "var x = 41;" |
| 184 "function foo(s) { AssertStackDepth(1); if (s % 2 == 0) {" | 168 "function foo(s) { AssertStackDepth(1); if (s % 2 == 0) {" |
| 185 " return x - s } else { return x + s; } };" | 169 " return x - s } else { return x + s; } };" |
| 186 "function bar(s,t) { return foo(foo(s)); };" | 170 "function bar(s,t) { return foo(foo(s)); };" |
| 187 "return bar;" | 171 "return bar;" |
| 188 "})();"); | 172 "})();"); |
| 189 | 173 |
| 190 InstallAssertStackDepthHelper(CcTest::isolate()); | 174 InstallAssertStackDepthHelper(CcTest::isolate()); |
| 191 T.CheckCall(T.Val(-11), T.Val(11), T.Val(4)); | 175 T.CheckCall(T.Val(-11), T.Val(11), T.Val(4)); |
| 192 } | 176 } |
| 193 | 177 |
| 178 |
| 179 TEST(InlineTwiceDependentDiamondDifferent) { |
| 180 FLAG_context_specialization = true; |
| 181 FLAG_turbo_inlining = true; |
| 182 FunctionTester T( |
| 183 "(function () {" |
| 184 "var x = 41;" |
| 185 "function foo(s,t) { AssertStackDepth(1); if (s % 2 == 0) {" |
| 186 " return x - s * t } else { return x + s * t; } };" |
| 187 "function bar(s,t) { return foo(foo(s, 3), 5); };" |
| 188 "return bar;" |
| 189 "})();"); |
| 190 |
| 191 InstallAssertStackDepthHelper(CcTest::isolate()); |
| 192 T.CheckCall(T.Val(-329), T.Val(11), T.Val(4)); |
| 193 } |
| 194 |
| 194 #endif // V8_TURBOFAN_TARGET | 195 #endif // V8_TURBOFAN_TARGET |
| OLD | NEW |