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

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

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