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

Side by Side Diff: test/cctest/test-deoptimization.cc

Issue 453383002: More lazy deoptimization in Turbofan (binops, loads/stores) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Attempt to fix the 64-bit Windows build Created 6 years, 4 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 | « test/cctest/compiler/test-scheduler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 static Handle<JSFunction> GetJSFunction(v8::Handle<v8::Object> obj, 107 static Handle<JSFunction> GetJSFunction(v8::Handle<v8::Object> obj,
108 const char* property_name) { 108 const char* property_name) {
109 v8::Local<v8::Function> fun = 109 v8::Local<v8::Function> fun =
110 v8::Local<v8::Function>::Cast(obj->Get(v8_str(property_name))); 110 v8::Local<v8::Function>::Cast(obj->Get(v8_str(property_name)));
111 return v8::Utils::OpenHandle(*fun); 111 return v8::Utils::OpenHandle(*fun);
112 } 112 }
113 113
114 114
115 TEST(DeoptimizeSimple) { 115 TEST(DeoptimizeSimple) {
116 i::FLAG_turbo_deoptimization = true;
117
116 LocalContext env; 118 LocalContext env;
117 v8::HandleScope scope(env->GetIsolate()); 119 v8::HandleScope scope(env->GetIsolate());
118 120
119 // Test lazy deoptimization of a simple function. 121 // Test lazy deoptimization of a simple function.
120 { 122 {
121 AlwaysOptimizeAllowNativesSyntaxNoInlining options; 123 AlwaysOptimizeAllowNativesSyntaxNoInlining options;
122 CompileRun( 124 CompileRun(
123 "var count = 0;" 125 "var count = 0;"
124 "function h() { %DeoptimizeFunction(f); }" 126 "function h() { %DeoptimizeFunction(f); }"
125 "function g() { count++; h(); }" 127 "function g() { count++; h(); }"
(...skipping 18 matching lines...) Expand all
144 } 146 }
145 NonIncrementalGC(); 147 NonIncrementalGC();
146 148
147 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); 149 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
148 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized()); 150 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized());
149 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); 151 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate()));
150 } 152 }
151 153
152 154
153 TEST(DeoptimizeSimpleWithArguments) { 155 TEST(DeoptimizeSimpleWithArguments) {
156 i::FLAG_turbo_deoptimization = true;
157
154 LocalContext env; 158 LocalContext env;
155 v8::HandleScope scope(env->GetIsolate()); 159 v8::HandleScope scope(env->GetIsolate());
156 160
157 // Test lazy deoptimization of a simple function with some arguments. 161 // Test lazy deoptimization of a simple function with some arguments.
158 { 162 {
159 AlwaysOptimizeAllowNativesSyntaxNoInlining options; 163 AlwaysOptimizeAllowNativesSyntaxNoInlining options;
160 CompileRun( 164 CompileRun(
161 "var count = 0;" 165 "var count = 0;"
162 "function h(x) { %DeoptimizeFunction(f); }" 166 "function h(x) { %DeoptimizeFunction(f); }"
163 "function g(x, y) { count++; h(x); }" 167 "function g(x, y) { count++; h(x); }"
(...skipping 19 matching lines...) Expand all
183 } 187 }
184 NonIncrementalGC(); 188 NonIncrementalGC();
185 189
186 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); 190 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
187 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized()); 191 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized());
188 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); 192 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate()));
189 } 193 }
190 194
191 195
192 TEST(DeoptimizeSimpleNested) { 196 TEST(DeoptimizeSimpleNested) {
197 i::FLAG_turbo_deoptimization = true;
198
193 LocalContext env; 199 LocalContext env;
194 v8::HandleScope scope(env->GetIsolate()); 200 v8::HandleScope scope(env->GetIsolate());
195 201
196 // Test lazy deoptimization of a simple function. Have a nested function call 202 // Test lazy deoptimization of a simple function. Have a nested function call
197 // do the deoptimization. 203 // do the deoptimization.
198 { 204 {
199 AlwaysOptimizeAllowNativesSyntaxNoInlining options; 205 AlwaysOptimizeAllowNativesSyntaxNoInlining options;
200 CompileRun( 206 CompileRun(
201 "var count = 0;" 207 "var count = 0;"
202 "var result = 0;" 208 "var result = 0;"
203 "function h(x, y, z) { return x + y + z; }" 209 "function h(x, y, z) { return x + y + z; }"
204 "function g(z) { count++; %DeoptimizeFunction(f); return z;}" 210 "function g(z) { count++; %DeoptimizeFunction(f); return z;}"
205 "function f(x,y,z) { return h(x, y, g(z)); };" 211 "function f(x,y,z) { return h(x, y, g(z)); };"
206 "result = f(1, 2, 3);"); 212 "result = f(1, 2, 3);");
207 NonIncrementalGC(); 213 NonIncrementalGC();
208 214
209 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); 215 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
210 CHECK_EQ(6, env->Global()->Get(v8_str("result"))->Int32Value()); 216 CHECK_EQ(6, env->Global()->Get(v8_str("result"))->Int32Value());
211 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized()); 217 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized());
212 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); 218 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate()));
213 } 219 }
214 } 220 }
215 221
216 222
217 TEST(DeoptimizeRecursive) { 223 TEST(DeoptimizeRecursive) {
224 i::FLAG_turbo_deoptimization = true;
218 LocalContext env; 225 LocalContext env;
219 v8::HandleScope scope(env->GetIsolate()); 226 v8::HandleScope scope(env->GetIsolate());
220 227
221 { 228 {
222 // Test lazy deoptimization of a simple function called recursively. Call 229 // Test lazy deoptimization of a simple function called recursively. Call
223 // the function recursively a number of times before deoptimizing it. 230 // the function recursively a number of times before deoptimizing it.
224 AlwaysOptimizeAllowNativesSyntaxNoInlining options; 231 AlwaysOptimizeAllowNativesSyntaxNoInlining options;
225 CompileRun( 232 CompileRun(
226 "var count = 0;" 233 "var count = 0;"
227 "var calls = 0;" 234 "var calls = 0;"
228 "function g() { count++; %DeoptimizeFunction(f); }" 235 "function g() { count++; %DeoptimizeFunction(f); }"
229 "function f(x) { calls++; if (x > 0) { f(x - 1); } else { g(); } };" 236 "function f(x) { calls++; if (x > 0) { f(x - 1); } else { g(); } };"
230 "f(10);"); 237 "f(10);");
231 } 238 }
232 NonIncrementalGC(); 239 NonIncrementalGC();
233 240
234 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); 241 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
235 CHECK_EQ(11, env->Global()->Get(v8_str("calls"))->Int32Value()); 242 CHECK_EQ(11, env->Global()->Get(v8_str("calls"))->Int32Value());
236 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); 243 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate()));
237 244
238 v8::Local<v8::Function> fun = v8::Local<v8::Function>::Cast( 245 v8::Local<v8::Function> fun = v8::Local<v8::Function>::Cast(
239 env->Global()->Get(v8::String::NewFromUtf8(CcTest::isolate(), "f"))); 246 env->Global()->Get(v8::String::NewFromUtf8(CcTest::isolate(), "f")));
240 CHECK(!fun.IsEmpty()); 247 CHECK(!fun.IsEmpty());
241 } 248 }
242 249
243 250
244 TEST(DeoptimizeMultiple) { 251 TEST(DeoptimizeMultiple) {
252 i::FLAG_turbo_deoptimization = true;
245 LocalContext env; 253 LocalContext env;
246 v8::HandleScope scope(env->GetIsolate()); 254 v8::HandleScope scope(env->GetIsolate());
247 255
248 { 256 {
249 AlwaysOptimizeAllowNativesSyntaxNoInlining options; 257 AlwaysOptimizeAllowNativesSyntaxNoInlining options;
250 CompileRun( 258 CompileRun(
251 "var count = 0;" 259 "var count = 0;"
252 "var result = 0;" 260 "var result = 0;"
253 "function g() { count++;" 261 "function g() { count++;"
254 " %DeoptimizeFunction(f1);" 262 " %DeoptimizeFunction(f1);"
255 " %DeoptimizeFunction(f2);" 263 " %DeoptimizeFunction(f2);"
256 " %DeoptimizeFunction(f3);" 264 " %DeoptimizeFunction(f3);"
257 " %DeoptimizeFunction(f4);}" 265 " %DeoptimizeFunction(f4);}"
258 "function f4(x) { g(); };" 266 "function f4(x) { g(); };"
259 "function f3(x, y, z) { f4(); return x + y + z; };" 267 "function f3(x, y, z) { f4(); return x + y + z; };"
260 "function f2(x, y) { return x + f3(y + 1, y + 1, y + 1) + y; };" 268 "function f2(x, y) { return x + f3(y + 1, y + 1, y + 1) + y; };"
261 "function f1(x) { return f2(x + 1, x + 1) + x; };" 269 "function f1(x) { return f2(x + 1, x + 1) + x; };"
262 "result = f1(1);"); 270 "result = f1(1);");
263 } 271 }
264 NonIncrementalGC(); 272 NonIncrementalGC();
265 273
266 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); 274 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
267 CHECK_EQ(14, env->Global()->Get(v8_str("result"))->Int32Value()); 275 CHECK_EQ(14, env->Global()->Get(v8_str("result"))->Int32Value());
268 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); 276 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate()));
269 } 277 }
270 278
271 279
272 TEST(DeoptimizeConstructor) { 280 TEST(DeoptimizeConstructor) {
281 i::FLAG_turbo_deoptimization = true;
273 LocalContext env; 282 LocalContext env;
274 v8::HandleScope scope(env->GetIsolate()); 283 v8::HandleScope scope(env->GetIsolate());
275 284
276 { 285 {
277 AlwaysOptimizeAllowNativesSyntaxNoInlining options; 286 AlwaysOptimizeAllowNativesSyntaxNoInlining options;
278 CompileRun( 287 CompileRun(
279 "var count = 0;" 288 "var count = 0;"
280 "function g() { count++;" 289 "function g() { count++;"
281 " %DeoptimizeFunction(f); }" 290 " %DeoptimizeFunction(f); }"
282 "function f() { g(); };" 291 "function f() { g(); };"
(...skipping 18 matching lines...) Expand all
301 } 310 }
302 NonIncrementalGC(); 311 NonIncrementalGC();
303 312
304 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); 313 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
305 CHECK_EQ(3, env->Global()->Get(v8_str("result"))->Int32Value()); 314 CHECK_EQ(3, env->Global()->Get(v8_str("result"))->Int32Value());
306 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); 315 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate()));
307 } 316 }
308 317
309 318
310 TEST(DeoptimizeConstructorMultiple) { 319 TEST(DeoptimizeConstructorMultiple) {
320 i::FLAG_turbo_deoptimization = true;
311 LocalContext env; 321 LocalContext env;
312 v8::HandleScope scope(env->GetIsolate()); 322 v8::HandleScope scope(env->GetIsolate());
313 323
314 { 324 {
315 AlwaysOptimizeAllowNativesSyntaxNoInlining options; 325 AlwaysOptimizeAllowNativesSyntaxNoInlining options;
316 CompileRun( 326 CompileRun(
317 "var count = 0;" 327 "var count = 0;"
318 "var result = 0;" 328 "var result = 0;"
319 "function g() { count++;" 329 "function g() { count++;"
320 " %DeoptimizeFunction(f1);" 330 " %DeoptimizeFunction(f1);"
321 " %DeoptimizeFunction(f2);" 331 " %DeoptimizeFunction(f2);"
322 " %DeoptimizeFunction(f3);" 332 " %DeoptimizeFunction(f3);"
323 " %DeoptimizeFunction(f4);}" 333 " %DeoptimizeFunction(f4);}"
324 "function f4(x) { this.result = x; g(); };" 334 "function f4(x) { this.result = x; g(); };"
325 "function f3(x, y, z) { this.result = new f4(x + y + z).result; };" 335 "function f3(x, y, z) { this.result = new f4(x + y + z).result; };"
326 "function f2(x, y) {" 336 "function f2(x, y) {"
327 " this.result = x + new f3(y + 1, y + 1, y + 1).result + y; };" 337 " this.result = x + new f3(y + 1, y + 1, y + 1).result + y; };"
328 "function f1(x) { this.result = new f2(x + 1, x + 1).result + x; };" 338 "function f1(x) { this.result = new f2(x + 1, x + 1).result + x; };"
329 "result = new f1(1).result;"); 339 "result = new f1(1).result;");
330 } 340 }
331 NonIncrementalGC(); 341 NonIncrementalGC();
332 342
333 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); 343 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
334 CHECK_EQ(14, env->Global()->Get(v8_str("result"))->Int32Value()); 344 CHECK_EQ(14, env->Global()->Get(v8_str("result"))->Int32Value());
335 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); 345 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate()));
336 } 346 }
337 347
338 348
339 TEST(DeoptimizeBinaryOperationADDString) { 349 TEST(DeoptimizeBinaryOperationADDString) {
350 i::FLAG_turbo_deoptimization = true;
340 i::FLAG_concurrent_recompilation = false; 351 i::FLAG_concurrent_recompilation = false;
341 AllowNativesSyntaxNoInlining options; 352 AllowNativesSyntaxNoInlining options;
342 LocalContext env; 353 LocalContext env;
343 v8::HandleScope scope(env->GetIsolate()); 354 v8::HandleScope scope(env->GetIsolate());
344 355
345 const char* f_source = "function f(x, y) { return x + y; };"; 356 const char* f_source = "function f(x, y) { return x + y; };";
346 357
347 { 358 {
348 // Compile function f and collect to type feedback to insert binary op stub 359 // Compile function f and collect to type feedback to insert binary op stub
349 // call in the optimized code. 360 // call in the optimized code.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 432
422 // Call f and force deoptimization while processing the binary operation. 433 // Call f and force deoptimization while processing the binary operation.
423 CompileRun("deopt = true;" 434 CompileRun("deopt = true;"
424 "var result = f(7, new X());"); 435 "var result = f(7, new X());");
425 NonIncrementalGC(); 436 NonIncrementalGC();
426 CHECK(!GetJSFunction((*env)->Global(), "f")->IsOptimized()); 437 CHECK(!GetJSFunction((*env)->Global(), "f")->IsOptimized());
427 } 438 }
428 439
429 440
430 TEST(DeoptimizeBinaryOperationADD) { 441 TEST(DeoptimizeBinaryOperationADD) {
442 i::FLAG_turbo_deoptimization = true;
431 i::FLAG_concurrent_recompilation = false; 443 i::FLAG_concurrent_recompilation = false;
432 LocalContext env; 444 LocalContext env;
433 v8::HandleScope scope(env->GetIsolate()); 445 v8::HandleScope scope(env->GetIsolate());
434 446
435 TestDeoptimizeBinaryOpHelper(&env, "+"); 447 TestDeoptimizeBinaryOpHelper(&env, "+");
436 448
437 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); 449 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
438 CHECK_EQ(15, env->Global()->Get(v8_str("result"))->Int32Value()); 450 CHECK_EQ(15, env->Global()->Get(v8_str("result"))->Int32Value());
439 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); 451 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate()));
440 } 452 }
441 453
442 454
443 TEST(DeoptimizeBinaryOperationSUB) { 455 TEST(DeoptimizeBinaryOperationSUB) {
456 i::FLAG_turbo_deoptimization = true;
444 i::FLAG_concurrent_recompilation = false; 457 i::FLAG_concurrent_recompilation = false;
445 LocalContext env; 458 LocalContext env;
446 v8::HandleScope scope(env->GetIsolate()); 459 v8::HandleScope scope(env->GetIsolate());
447 460
448 TestDeoptimizeBinaryOpHelper(&env, "-"); 461 TestDeoptimizeBinaryOpHelper(&env, "-");
449 462
450 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); 463 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
451 CHECK_EQ(-1, env->Global()->Get(v8_str("result"))->Int32Value()); 464 CHECK_EQ(-1, env->Global()->Get(v8_str("result"))->Int32Value());
452 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); 465 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate()));
453 } 466 }
454 467
455 468
456 TEST(DeoptimizeBinaryOperationMUL) { 469 TEST(DeoptimizeBinaryOperationMUL) {
470 i::FLAG_turbo_deoptimization = true;
457 i::FLAG_concurrent_recompilation = false; 471 i::FLAG_concurrent_recompilation = false;
458 LocalContext env; 472 LocalContext env;
459 v8::HandleScope scope(env->GetIsolate()); 473 v8::HandleScope scope(env->GetIsolate());
460 474
461 TestDeoptimizeBinaryOpHelper(&env, "*"); 475 TestDeoptimizeBinaryOpHelper(&env, "*");
462 476
463 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); 477 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
464 CHECK_EQ(56, env->Global()->Get(v8_str("result"))->Int32Value()); 478 CHECK_EQ(56, env->Global()->Get(v8_str("result"))->Int32Value());
465 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); 479 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate()));
466 } 480 }
467 481
468 482
469 TEST(DeoptimizeBinaryOperationDIV) { 483 TEST(DeoptimizeBinaryOperationDIV) {
484 i::FLAG_turbo_deoptimization = true;
470 i::FLAG_concurrent_recompilation = false; 485 i::FLAG_concurrent_recompilation = false;
471 LocalContext env; 486 LocalContext env;
472 v8::HandleScope scope(env->GetIsolate()); 487 v8::HandleScope scope(env->GetIsolate());
473 488
474 TestDeoptimizeBinaryOpHelper(&env, "/"); 489 TestDeoptimizeBinaryOpHelper(&env, "/");
475 490
476 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); 491 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
477 CHECK_EQ(0, env->Global()->Get(v8_str("result"))->Int32Value()); 492 CHECK_EQ(0, env->Global()->Get(v8_str("result"))->Int32Value());
478 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); 493 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate()));
479 } 494 }
480 495
481 496
482 TEST(DeoptimizeBinaryOperationMOD) { 497 TEST(DeoptimizeBinaryOperationMOD) {
498 i::FLAG_turbo_deoptimization = true;
483 i::FLAG_concurrent_recompilation = false; 499 i::FLAG_concurrent_recompilation = false;
484 LocalContext env; 500 LocalContext env;
485 v8::HandleScope scope(env->GetIsolate()); 501 v8::HandleScope scope(env->GetIsolate());
486 502
487 TestDeoptimizeBinaryOpHelper(&env, "%"); 503 TestDeoptimizeBinaryOpHelper(&env, "%");
488 504
489 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); 505 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
490 CHECK_EQ(7, env->Global()->Get(v8_str("result"))->Int32Value()); 506 CHECK_EQ(7, env->Global()->Get(v8_str("result"))->Int32Value());
491 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); 507 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate()));
492 } 508 }
493 509
494 510
495 TEST(DeoptimizeCompare) { 511 TEST(DeoptimizeCompare) {
512 i::FLAG_turbo_deoptimization = true;
496 i::FLAG_concurrent_recompilation = false; 513 i::FLAG_concurrent_recompilation = false;
497 LocalContext env; 514 LocalContext env;
498 v8::HandleScope scope(env->GetIsolate()); 515 v8::HandleScope scope(env->GetIsolate());
499 516
500 const char* f_source = "function f(x, y) { return x < y; };"; 517 const char* f_source = "function f(x, y) { return x < y; };";
501 518
502 { 519 {
503 AllowNativesSyntaxNoInlining options; 520 AllowNativesSyntaxNoInlining options;
504 // Compile function f and collect to type feedback to insert compare ic 521 // Compile function f and collect to type feedback to insert compare ic
505 // call in the optimized code. 522 // call in the optimized code.
(...skipping 24 matching lines...) Expand all
530 NonIncrementalGC(); 547 NonIncrementalGC();
531 548
532 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized()); 549 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized());
533 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); 550 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
534 CHECK_EQ(true, env->Global()->Get(v8_str("result"))->BooleanValue()); 551 CHECK_EQ(true, env->Global()->Get(v8_str("result"))->BooleanValue());
535 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); 552 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate()));
536 } 553 }
537 554
538 555
539 TEST(DeoptimizeLoadICStoreIC) { 556 TEST(DeoptimizeLoadICStoreIC) {
557 i::FLAG_turbo_deoptimization = true;
540 i::FLAG_concurrent_recompilation = false; 558 i::FLAG_concurrent_recompilation = false;
541 LocalContext env; 559 LocalContext env;
542 v8::HandleScope scope(env->GetIsolate()); 560 v8::HandleScope scope(env->GetIsolate());
543 561
544 // Functions to generate load/store/keyed load/keyed store IC calls. 562 // Functions to generate load/store/keyed load/keyed store IC calls.
545 const char* f1_source = "function f1(x) { return x.y; };"; 563 const char* f1_source = "function f1(x) { return x.y; };";
546 const char* g1_source = "function g1(x) { x.y = 1; };"; 564 const char* g1_source = "function g1(x) { x.y = 1; };";
547 const char* f2_source = "function f2(x, y) { return x[y]; };"; 565 const char* f2_source = "function f2(x, y) { return x[y]; };";
548 const char* g2_source = "function g2(x, y) { x[y] = 1; };"; 566 const char* g2_source = "function g2(x, y) { x[y] = 1; };";
549 567
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized()); 628 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized());
611 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized()); 629 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized());
612 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized()); 630 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized());
613 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); 631 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized());
614 CHECK_EQ(4, env->Global()->Get(v8_str("count"))->Int32Value()); 632 CHECK_EQ(4, env->Global()->Get(v8_str("count"))->Int32Value());
615 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); 633 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value());
616 } 634 }
617 635
618 636
619 TEST(DeoptimizeLoadICStoreICNested) { 637 TEST(DeoptimizeLoadICStoreICNested) {
638 i::FLAG_turbo_deoptimization = true;
620 i::FLAG_concurrent_recompilation = false; 639 i::FLAG_concurrent_recompilation = false;
621 LocalContext env; 640 LocalContext env;
622 v8::HandleScope scope(env->GetIsolate()); 641 v8::HandleScope scope(env->GetIsolate());
623 642
624 // Functions to generate load/store/keyed load/keyed store IC calls. 643 // Functions to generate load/store/keyed load/keyed store IC calls.
625 const char* f1_source = "function f1(x) { return x.y; };"; 644 const char* f1_source = "function f1(x) { return x.y; };";
626 const char* g1_source = "function g1(x) { x.y = 1; };"; 645 const char* g1_source = "function g1(x) { x.y = 1; };";
627 const char* f2_source = "function f2(x, y) { return x[y]; };"; 646 const char* f2_source = "function f2(x, y) { return x[y]; };";
628 const char* g2_source = "function g2(x, y) { x[y] = 1; };"; 647 const char* g2_source = "function g2(x, y) { x[y] = 1; };";
629 648
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 } 707 }
689 NonIncrementalGC(); 708 NonIncrementalGC();
690 709
691 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized()); 710 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized());
692 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized()); 711 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized());
693 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized()); 712 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized());
694 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); 713 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized());
695 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); 714 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
696 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); 715 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value());
697 } 716 }
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-scheduler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698