| 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 |
| 11 using namespace v8::internal; | 11 using namespace v8::internal; |
| 12 using namespace v8::internal::compiler; | 12 using namespace v8::internal::compiler; |
| 13 | 13 |
| 14 // Helper to determine inline count via JavaScriptFrame::GetInlineCount. | 14 // TODO(sigurds) At the moment we do not write optimization frames when |
| 15 // Note that a count of 1 indicates that no inlining has occured. | 15 // inlining, thus the reported stack depth changes depending on inlining. |
| 16 static void AssertInlineCount(const v8::FunctionCallbackInfo<v8::Value>& args) { | 16 // AssertStackDepth checks the stack depth actually changes as a simple way |
| 17 StackTraceFrameIterator it(CcTest::i_isolate()); | 17 // to ensure that inlining actually occurs. |
| 18 int frames_seen = 0; | 18 // Once inlining creates optimization frames, all these unit tests need to |
| 19 JavaScriptFrame* topmost = it.frame(); | 19 // check that the optimization frame is there. |
| 20 while (!it.done()) { | 20 |
| 21 JavaScriptFrame* frame = it.frame(); | 21 |
| 22 PrintF("%d %s, inline count: %d\n", frames_seen, | 22 static void AssertStackDepth(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 23 frame->function()->shared()->DebugName()->ToCString().get(), | 23 v8::HandleScope scope(args.GetIsolate()); |
| 24 frame->GetInlineCount()); | 24 v8::Handle<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace( |
| 25 frames_seen++; | 25 args.GetIsolate(), 10, v8::StackTrace::kDetailed); |
| 26 it.Advance(); | 26 CHECK_EQ(args[0]->ToInt32()->Value(), stackTrace->GetFrameCount()); |
| 27 } | |
| 28 CHECK_EQ(args[0]->ToInt32()->Value(), topmost->GetInlineCount()); | |
| 29 } | 27 } |
| 30 | 28 |
| 31 | 29 |
| 32 static void InstallAssertInlineCountHelper(v8::Isolate* isolate) { | 30 static void InstallAssertStackDepthHelper(v8::Isolate* isolate) { |
| 33 v8::Local<v8::Context> context = isolate->GetCurrentContext(); | 31 v8::Local<v8::Context> context = isolate->GetCurrentContext(); |
| 34 v8::Local<v8::FunctionTemplate> t = | 32 v8::Local<v8::FunctionTemplate> t = |
| 35 v8::FunctionTemplate::New(isolate, AssertInlineCount); | 33 v8::FunctionTemplate::New(isolate, AssertStackDepth); |
| 36 context->Global()->Set(v8_str("AssertInlineCount"), t->GetFunction()); | 34 context->Global()->Set(v8_str("AssertStackDepth"), t->GetFunction()); |
| 37 } | 35 } |
| 38 | 36 |
| 39 | 37 |
| 40 TEST(SimpleInlining) { | 38 TEST(SimpleInlining) { |
| 41 FLAG_turbo_deoptimization = true; | |
| 42 FunctionTester T( | 39 FunctionTester T( |
| 43 "(function(){" | 40 "(function(){" |
| 44 "function foo(s) { AssertInlineCount(2); return s; };" | 41 "function foo(s) { AssertStackDepth(1); return s; };" |
| 45 "function bar(s, t) { return foo(s); };" | 42 "function bar(s, t) { return foo(s); };" |
| 46 "return bar;})();", | 43 "return bar;})();", |
| 47 CompilationInfo::kInliningEnabled | | 44 CompilationInfo::kInliningEnabled | |
| 48 CompilationInfo::kContextSpecializing | | 45 CompilationInfo::kContextSpecializing | |
| 49 CompilationInfo::kTypingEnabled); | 46 CompilationInfo::kTypingEnabled); |
| 50 | 47 |
| 51 InstallAssertInlineCountHelper(CcTest::isolate()); | 48 InstallAssertStackDepthHelper(CcTest::isolate()); |
| 52 T.CheckCall(T.Val(1), T.Val(1), T.Val(2)); | |
| 53 } | |
| 54 | |
| 55 | |
| 56 TEST(SimpleInliningDeopt) { | |
| 57 FLAG_turbo_deoptimization = true; | |
| 58 FunctionTester T( | |
| 59 "(function(){" | |
| 60 "function foo(s) { %DeoptimizeFunction(bar); return " | |
| 61 "s; };" | |
| 62 "function bar(s, t) { return foo(s); };" | |
| 63 "return bar;})();", | |
| 64 CompilationInfo::kInliningEnabled | | |
| 65 CompilationInfo::kContextSpecializing | | |
| 66 CompilationInfo::kTypingEnabled); | |
| 67 | |
| 68 InstallAssertInlineCountHelper(CcTest::isolate()); | |
| 69 T.CheckCall(T.Val(1), T.Val(1), T.Val(2)); | 49 T.CheckCall(T.Val(1), T.Val(1), T.Val(2)); |
| 70 } | 50 } |
| 71 | 51 |
| 72 | 52 |
| 73 TEST(SimpleInliningContext) { | 53 TEST(SimpleInliningContext) { |
| 74 FLAG_turbo_deoptimization = true; | |
| 75 FunctionTester T( | 54 FunctionTester T( |
| 76 "(function () {" | 55 "(function () {" |
| 77 "function foo(s) { AssertInlineCount(2); var x = 12; return s + x; };" | 56 "function foo(s) { AssertStackDepth(1); var x = 12; return s + x; };" |
| 78 "function bar(s, t) { return foo(s); };" | 57 "function bar(s, t) { return foo(s); };" |
| 79 "return bar;" | 58 "return bar;" |
| 80 "})();", | 59 "})();", |
| 81 CompilationInfo::kInliningEnabled | | 60 CompilationInfo::kInliningEnabled | |
| 82 CompilationInfo::kContextSpecializing | | 61 CompilationInfo::kContextSpecializing | |
| 83 CompilationInfo::kTypingEnabled); | 62 CompilationInfo::kTypingEnabled); |
| 84 | 63 |
| 85 InstallAssertInlineCountHelper(CcTest::isolate()); | 64 InstallAssertStackDepthHelper(CcTest::isolate()); |
| 86 T.CheckCall(T.Val(13), T.Val(1), T.Val(2)); | |
| 87 } | |
| 88 | |
| 89 | |
| 90 TEST(SimpleInliningContextDeopt) { | |
| 91 FLAG_turbo_deoptimization = true; | |
| 92 FunctionTester T( | |
| 93 "(function () {" | |
| 94 "function foo(s) { " | |
| 95 " AssertInlineCount(2); %DeoptimizeFunction(bar); var x = 12;" | |
| 96 " return s + x;" | |
| 97 "};" | |
| 98 "function bar(s, t) { return foo(s); };" | |
| 99 "return bar;" | |
| 100 "})();", | |
| 101 CompilationInfo::kInliningEnabled | | |
| 102 CompilationInfo::kContextSpecializing | | |
| 103 CompilationInfo::kTypingEnabled); | |
| 104 | |
| 105 InstallAssertInlineCountHelper(CcTest::isolate()); | |
| 106 T.CheckCall(T.Val(13), T.Val(1), T.Val(2)); | 65 T.CheckCall(T.Val(13), T.Val(1), T.Val(2)); |
| 107 } | 66 } |
| 108 | 67 |
| 109 | 68 |
| 110 TEST(CaptureContext) { | 69 TEST(CaptureContext) { |
| 111 FLAG_turbo_deoptimization = true; | |
| 112 FunctionTester T( | 70 FunctionTester T( |
| 113 "var f = (function () {" | 71 "var f = (function () {" |
| 114 "var x = 42;" | 72 "var x = 42;" |
| 115 "function bar(s) { return x + s; };" | 73 "function bar(s) { return x + s; };" |
| 116 "return (function (s) { return bar(s); });" | 74 "return (function (s) { return bar(s); });" |
| 117 "})();" | 75 "})();" |
| 118 "(function (s) { return f(s)})", | 76 "(function (s) { return f(s)})", |
| 119 CompilationInfo::kInliningEnabled | | 77 CompilationInfo::kInliningEnabled | |
| 120 CompilationInfo::kContextSpecializing | | 78 CompilationInfo::kContextSpecializing | |
| 121 CompilationInfo::kTypingEnabled); | 79 CompilationInfo::kTypingEnabled); |
| 122 | 80 |
| 123 InstallAssertInlineCountHelper(CcTest::isolate()); | 81 InstallAssertStackDepthHelper(CcTest::isolate()); |
| 124 T.CheckCall(T.Val(42 + 12), T.Val(12), T.undefined()); | 82 T.CheckCall(T.Val(42 + 12), T.Val(12), T.undefined()); |
| 125 } | 83 } |
| 126 | 84 |
| 127 | 85 |
| 128 // TODO(sigurds) For now we do not inline any native functions. If we do at | 86 // TODO(sigurds) For now we do not inline any native functions. If we do at |
| 129 // some point, change this test. | 87 // some point, change this test. |
| 130 TEST(DontInlineEval) { | 88 TEST(DontInlineEval) { |
| 131 FLAG_turbo_deoptimization = true; | |
| 132 FunctionTester T( | 89 FunctionTester T( |
| 133 "var x = 42;" | 90 "var x = 42;" |
| 134 "(function () {" | 91 "(function () {" |
| 135 "function bar(s, t) { return eval(\"AssertInlineCount(1); x\") };" | 92 "function bar(s, t) { return eval(\"AssertStackDepth(2); x\") };" |
| 136 "return bar;" | 93 "return bar;" |
| 137 "})();", | 94 "})();", |
| 138 CompilationInfo::kInliningEnabled | | 95 CompilationInfo::kInliningEnabled | |
| 139 CompilationInfo::kContextSpecializing | | 96 CompilationInfo::kContextSpecializing | |
| 140 CompilationInfo::kTypingEnabled); | 97 CompilationInfo::kTypingEnabled); |
| 141 | 98 |
| 142 InstallAssertInlineCountHelper(CcTest::isolate()); | 99 InstallAssertStackDepthHelper(CcTest::isolate()); |
| 143 T.CheckCall(T.Val(42), T.Val("x"), T.undefined()); | 100 T.CheckCall(T.Val(42), T.Val("x"), T.undefined()); |
| 144 } | 101 } |
| 145 | 102 |
| 146 | 103 |
| 147 TEST(InlineOmitArguments) { | 104 TEST(InlineOmitArguments) { |
| 148 FLAG_turbo_deoptimization = true; | |
| 149 FunctionTester T( | 105 FunctionTester T( |
| 150 "(function () {" | 106 "(function () {" |
| 151 "var x = 42;" | 107 "var x = 42;" |
| 152 "function bar(s, t, u, v) { AssertInlineCount(2); return x + s; };" | 108 "function bar(s, t, u, v) { AssertStackDepth(1); return x + s; };" |
| 153 "return (function (s,t) { return bar(s); });" | 109 "return (function (s,t) { return bar(s); });" |
| 154 "})();", | 110 "})();", |
| 155 CompilationInfo::kInliningEnabled | | 111 CompilationInfo::kInliningEnabled | |
| 156 CompilationInfo::kContextSpecializing | | 112 CompilationInfo::kContextSpecializing | |
| 157 CompilationInfo::kTypingEnabled); | 113 CompilationInfo::kTypingEnabled); |
| 158 | 114 |
| 159 InstallAssertInlineCountHelper(CcTest::isolate()); | 115 InstallAssertStackDepthHelper(CcTest::isolate()); |
| 160 T.CheckCall(T.Val(42 + 12), T.Val(12), T.undefined()); | 116 T.CheckCall(T.Val(42 + 12), T.Val(12), T.undefined()); |
| 161 } | 117 } |
| 162 | 118 |
| 163 | 119 |
| 164 TEST(InlineOmitArgumentsDeopt) { | |
| 165 FLAG_turbo_deoptimization = true; | |
| 166 FunctionTester T( | |
| 167 "(function () {" | |
| 168 "function foo(s,t,u,v) { AssertInlineCount(2); %DeoptimizeFunction(bar); " | |
| 169 "return baz(); };" | |
| 170 "function bar() { return foo(11); };" | |
| 171 "function baz() { return foo.arguments.length == 1 && " | |
| 172 " foo.arguments[0] == 11 ; }" | |
| 173 "return bar;" | |
| 174 "})();", | |
| 175 CompilationInfo::kInliningEnabled | | |
| 176 CompilationInfo::kContextSpecializing | | |
| 177 CompilationInfo::kTypingEnabled); | |
| 178 | |
| 179 InstallAssertInlineCountHelper(CcTest::isolate()); | |
| 180 T.CheckCall(T.true_value(), T.Val(12), T.Val(14)); | |
| 181 } | |
| 182 | |
| 183 | |
| 184 TEST(InlineSurplusArguments) { | 120 TEST(InlineSurplusArguments) { |
| 185 FLAG_turbo_deoptimization = true; | |
| 186 FunctionTester T( | 121 FunctionTester T( |
| 187 "(function () {" | 122 "(function () {" |
| 188 "var x = 42;" | 123 "var x = 42;" |
| 189 "function foo(s) { AssertInlineCount(2); return x + s; };" | 124 "function foo(s) { AssertStackDepth(1); return x + s; };" |
| 190 "function bar(s,t) { return foo(s,t,13); };" | 125 "function bar(s,t) { return foo(s,t,13); };" |
| 191 "return bar;" | 126 "return bar;" |
| 192 "})();", | 127 "})();", |
| 193 CompilationInfo::kInliningEnabled | | 128 CompilationInfo::kInliningEnabled | |
| 194 CompilationInfo::kContextSpecializing | | 129 CompilationInfo::kContextSpecializing | |
| 195 CompilationInfo::kTypingEnabled); | 130 CompilationInfo::kTypingEnabled); |
| 196 | 131 |
| 197 InstallAssertInlineCountHelper(CcTest::isolate()); | 132 InstallAssertStackDepthHelper(CcTest::isolate()); |
| 198 T.CheckCall(T.Val(42 + 12), T.Val(12), T.undefined()); | 133 T.CheckCall(T.Val(42 + 12), T.Val(12), T.undefined()); |
| 199 } | 134 } |
| 200 | 135 |
| 201 | 136 |
| 202 TEST(InlineSurplusArgumentsDeopt) { | |
| 203 FLAG_turbo_deoptimization = true; | |
| 204 FunctionTester T( | |
| 205 "(function () {" | |
| 206 "function foo(s) { AssertInlineCount(2); %DeoptimizeFunction(bar); " | |
| 207 "return baz(); };" | |
| 208 "function bar() { return foo(13, 14, 15); };" | |
| 209 "function baz() { return foo.arguments.length == 3 && " | |
| 210 " foo.arguments[0] == 13 && " | |
| 211 " foo.arguments[1] == 14 && " | |
| 212 " foo.arguments[2] == 15; }" | |
| 213 "return bar;" | |
| 214 "})();", | |
| 215 CompilationInfo::kInliningEnabled | | |
| 216 CompilationInfo::kContextSpecializing | | |
| 217 CompilationInfo::kTypingEnabled); | |
| 218 | |
| 219 InstallAssertInlineCountHelper(CcTest::isolate()); | |
| 220 T.CheckCall(T.true_value(), T.Val(12), T.Val(14)); | |
| 221 } | |
| 222 | |
| 223 | |
| 224 TEST(InlineTwice) { | 137 TEST(InlineTwice) { |
| 225 FLAG_turbo_deoptimization = true; | |
| 226 FunctionTester T( | 138 FunctionTester T( |
| 227 "(function () {" | 139 "(function () {" |
| 228 "var x = 42;" | 140 "var x = 42;" |
| 229 "function bar(s) { AssertInlineCount(2); return x + s; };" | 141 "function bar(s) { AssertStackDepth(1); return x + s; };" |
| 230 "return (function (s,t) { return bar(s) + bar(t); });" | 142 "return (function (s,t) { return bar(s) + bar(t); });" |
| 231 "})();", | 143 "})();", |
| 232 CompilationInfo::kInliningEnabled | | 144 CompilationInfo::kInliningEnabled | |
| 233 CompilationInfo::kContextSpecializing | | 145 CompilationInfo::kContextSpecializing | |
| 234 CompilationInfo::kTypingEnabled); | 146 CompilationInfo::kTypingEnabled); |
| 235 | 147 |
| 236 InstallAssertInlineCountHelper(CcTest::isolate()); | 148 InstallAssertStackDepthHelper(CcTest::isolate()); |
| 237 T.CheckCall(T.Val(2 * 42 + 12 + 4), T.Val(12), T.Val(4)); | 149 T.CheckCall(T.Val(2 * 42 + 12 + 4), T.Val(12), T.Val(4)); |
| 238 } | 150 } |
| 239 | 151 |
| 240 | 152 |
| 241 TEST(InlineTwiceDependent) { | 153 TEST(InlineTwiceDependent) { |
| 242 FLAG_turbo_deoptimization = true; | |
| 243 FunctionTester T( | 154 FunctionTester T( |
| 244 "(function () {" | 155 "(function () {" |
| 245 "var x = 42;" | 156 "var x = 42;" |
| 246 "function foo(s) { AssertInlineCount(2); return x + s; };" | 157 "function foo(s) { AssertStackDepth(1); return x + s; };" |
| 247 "function bar(s,t) { return foo(foo(s)); };" | 158 "function bar(s,t) { return foo(foo(s)); };" |
| 248 "return bar;" | 159 "return bar;" |
| 249 "})();", | 160 "})();", |
| 250 CompilationInfo::kInliningEnabled | | 161 CompilationInfo::kInliningEnabled | |
| 251 CompilationInfo::kContextSpecializing | | 162 CompilationInfo::kContextSpecializing | |
| 252 CompilationInfo::kTypingEnabled); | 163 CompilationInfo::kTypingEnabled); |
| 253 | 164 |
| 254 InstallAssertInlineCountHelper(CcTest::isolate()); | 165 InstallAssertStackDepthHelper(CcTest::isolate()); |
| 255 T.CheckCall(T.Val(42 + 42 + 12), T.Val(12), T.Val(4)); | 166 T.CheckCall(T.Val(42 + 42 + 12), T.Val(12), T.Val(4)); |
| 256 } | 167 } |
| 257 | 168 |
| 258 | 169 |
| 259 TEST(InlineTwiceDependentDiamond) { | 170 TEST(InlineTwiceDependentDiamond) { |
| 260 FLAG_turbo_deoptimization = true; | |
| 261 FunctionTester T( | 171 FunctionTester T( |
| 262 "(function () {" | 172 "(function () {" |
| 263 "var x = 41;" | 173 "var x = 41;" |
| 264 "function foo(s) { AssertInlineCount(2); if (s % 2 == 0) {" | 174 "function foo(s) { AssertStackDepth(1); if (s % 2 == 0) {" |
| 265 " return x - s } else { return x + s; } };" | 175 " return x - s } else { return x + s; } };" |
| 266 "function bar(s,t) { return foo(foo(s)); };" | 176 "function bar(s,t) { return foo(foo(s)); };" |
| 267 "return bar;" | 177 "return bar;" |
| 268 "})();", | 178 "})();", |
| 269 CompilationInfo::kInliningEnabled | | 179 CompilationInfo::kInliningEnabled | |
| 270 CompilationInfo::kContextSpecializing | | 180 CompilationInfo::kContextSpecializing | |
| 271 CompilationInfo::kTypingEnabled); | 181 CompilationInfo::kTypingEnabled); |
| 272 | 182 |
| 273 InstallAssertInlineCountHelper(CcTest::isolate()); | 183 InstallAssertStackDepthHelper(CcTest::isolate()); |
| 274 T.CheckCall(T.Val(-11), T.Val(11), T.Val(4)); | 184 T.CheckCall(T.Val(-11), T.Val(11), T.Val(4)); |
| 275 } | 185 } |
| 276 | 186 |
| 277 | 187 |
| 278 TEST(InlineTwiceDependentDiamondDifferent) { | 188 TEST(InlineTwiceDependentDiamondDifferent) { |
| 279 FLAG_turbo_deoptimization = true; | |
| 280 FunctionTester T( | 189 FunctionTester T( |
| 281 "(function () {" | 190 "(function () {" |
| 282 "var x = 41;" | 191 "var x = 41;" |
| 283 "function foo(s,t) { AssertInlineCount(2); if (s % 2 == 0) {" | 192 "function foo(s,t) { AssertStackDepth(1); if (s % 2 == 0) {" |
| 284 " return x - s * t } else { return x + s * t; } };" | 193 " return x - s * t } else { return x + s * t; } };" |
| 285 "function bar(s,t) { return foo(foo(s, 3), 5); };" | 194 "function bar(s,t) { return foo(foo(s, 3), 5); };" |
| 286 "return bar;" | 195 "return bar;" |
| 287 "})();", | 196 "})();", |
| 288 CompilationInfo::kInliningEnabled | | 197 CompilationInfo::kInliningEnabled | |
| 289 CompilationInfo::kContextSpecializing | | 198 CompilationInfo::kContextSpecializing | |
| 290 CompilationInfo::kTypingEnabled); | 199 CompilationInfo::kTypingEnabled); |
| 291 | 200 |
| 292 InstallAssertInlineCountHelper(CcTest::isolate()); | 201 InstallAssertStackDepthHelper(CcTest::isolate()); |
| 293 T.CheckCall(T.Val(-329), T.Val(11), T.Val(4)); | 202 T.CheckCall(T.Val(-329), T.Val(11), T.Val(4)); |
| 294 } | 203 } |
| 295 | 204 |
| 296 | 205 |
| 297 TEST(InlineLoop) { | 206 TEST(InlineLoop) { |
| 298 FLAG_turbo_deoptimization = true; | |
| 299 FunctionTester T( | 207 FunctionTester T( |
| 300 "(function () {" | 208 "(function () {" |
| 301 "var x = 41;" | 209 "var x = 41;" |
| 302 "function foo(s) { AssertInlineCount(2); while (s > 0) {" | 210 "function foo(s) { AssertStackDepth(1); while (s > 0) {" |
| 303 " s = s - 1; }; return s; };" | 211 " s = s - 1; }; return s; };" |
| 304 "function bar(s,t) { return foo(foo(s)); };" | 212 "function bar(s,t) { return foo(foo(s)); };" |
| 305 "return bar;" | 213 "return bar;" |
| 306 "})();", | 214 "})();", |
| 307 CompilationInfo::kInliningEnabled | | 215 CompilationInfo::kInliningEnabled | |
| 308 CompilationInfo::kContextSpecializing | | 216 CompilationInfo::kContextSpecializing | |
| 309 CompilationInfo::kTypingEnabled); | 217 CompilationInfo::kTypingEnabled); |
| 310 | 218 |
| 311 InstallAssertInlineCountHelper(CcTest::isolate()); | 219 InstallAssertStackDepthHelper(CcTest::isolate()); |
| 312 T.CheckCall(T.Val(0.0), T.Val(11), T.Val(4)); | 220 T.CheckCall(T.Val(0.0), T.Val(11), T.Val(4)); |
| 313 } | 221 } |
| 314 | 222 |
| 315 | 223 |
| 316 TEST(InlineStrictIntoNonStrict) { | 224 TEST(InlineStrictIntoNonStrict) { |
| 317 FLAG_turbo_deoptimization = true; | |
| 318 FunctionTester T( | 225 FunctionTester T( |
| 319 "(function () {" | 226 "(function () {" |
| 320 "var x = Object.create({}, { y: { value:42, writable:false } });" | 227 "var x = Object.create({}, { y: { value:42, writable:false } });" |
| 321 "function foo(s) { 'use strict';" | 228 "function foo(s) { 'use strict';" |
| 322 " x.y = 9; };" | 229 " x.y = 9; };" |
| 323 "function bar(s,t) { return foo(s); };" | 230 "function bar(s,t) { return foo(s); };" |
| 324 "return bar;" | 231 "return bar;" |
| 325 "})();", | 232 "})();", |
| 326 CompilationInfo::kInliningEnabled | | 233 CompilationInfo::kInliningEnabled | |
| 327 CompilationInfo::kContextSpecializing | | 234 CompilationInfo::kContextSpecializing | |
| 328 CompilationInfo::kTypingEnabled); | 235 CompilationInfo::kTypingEnabled); |
| 329 | 236 |
| 330 InstallAssertInlineCountHelper(CcTest::isolate()); | 237 InstallAssertStackDepthHelper(CcTest::isolate()); |
| 331 T.CheckThrows(T.undefined(), T.undefined()); | 238 T.CheckThrows(T.undefined(), T.undefined()); |
| 332 } | 239 } |
| 333 | 240 |
| 334 | 241 |
| 335 TEST(InlineNonStrictIntoStrict) { | 242 TEST(InlineNonStrictIntoStrict) { |
| 336 FLAG_turbo_deoptimization = true; | |
| 337 FunctionTester T( | 243 FunctionTester T( |
| 338 "(function () {" | 244 "(function () {" |
| 339 "var x = Object.create({}, { y: { value:42, writable:false } });" | 245 "var x = Object.create({}, { y: { value:42, writable:false } });" |
| 340 "function foo(s) { x.y = 9; return x.y; };" | 246 "function foo(s) { x.y = 9; return x.y; };" |
| 341 "function bar(s,t) { \'use strict\'; return foo(s); };" | 247 "function bar(s,t) { \'use strict\'; return foo(s); };" |
| 342 "return bar;" | 248 "return bar;" |
| 343 "})();", | 249 "})();", |
| 344 CompilationInfo::kInliningEnabled | | 250 CompilationInfo::kInliningEnabled | |
| 345 CompilationInfo::kContextSpecializing | | 251 CompilationInfo::kContextSpecializing | |
| 346 CompilationInfo::kTypingEnabled); | 252 CompilationInfo::kTypingEnabled); |
| 347 | 253 |
| 348 InstallAssertInlineCountHelper(CcTest::isolate()); | 254 InstallAssertStackDepthHelper(CcTest::isolate()); |
| 349 T.CheckCall(T.Val(42), T.undefined(), T.undefined()); | 255 T.CheckCall(T.Val(42), T.undefined(), T.undefined()); |
| 350 } | 256 } |
| 351 | 257 |
| 352 | 258 |
| 353 #endif // V8_TURBOFAN_TARGET | 259 #endif // V8_TURBOFAN_TARGET |
| OLD | NEW |