OLD | NEW |
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 static Handle<JSFunction> GetJSFunction(v8::Handle<v8::Object> obj, | 106 static Handle<JSFunction> GetJSFunction(v8::Handle<v8::Object> obj, |
107 const char* property_name) { | 107 const char* property_name) { |
108 v8::Local<v8::Function> fun = | 108 v8::Local<v8::Function> fun = |
109 v8::Local<v8::Function>::Cast(obj->Get(v8_str(property_name))); | 109 v8::Local<v8::Function>::Cast(obj->Get(v8_str(property_name))); |
110 return v8::Utils::OpenHandle(*fun); | 110 return v8::Utils::OpenHandle(*fun); |
111 } | 111 } |
112 | 112 |
113 | 113 |
114 TEST(DeoptimizeSimple) { | 114 TEST(DeoptimizeSimple) { |
115 i::FLAG_turbo_deoptimization = true; | |
116 | |
117 LocalContext env; | 115 LocalContext env; |
118 v8::HandleScope scope(env->GetIsolate()); | 116 v8::HandleScope scope(env->GetIsolate()); |
119 | 117 |
120 // Test lazy deoptimization of a simple function. | 118 // Test lazy deoptimization of a simple function. |
121 { | 119 { |
122 AlwaysOptimizeAllowNativesSyntaxNoInlining options; | 120 AlwaysOptimizeAllowNativesSyntaxNoInlining options; |
123 CompileRun( | 121 CompileRun( |
124 "var count = 0;" | 122 "var count = 0;" |
125 "function h() { %DeoptimizeFunction(f); }" | 123 "function h() { %DeoptimizeFunction(f); }" |
126 "function g() { count++; h(); }" | 124 "function g() { count++; h(); }" |
(...skipping 18 matching lines...) Expand all Loading... |
145 } | 143 } |
146 NonIncrementalGC(CcTest::i_isolate()); | 144 NonIncrementalGC(CcTest::i_isolate()); |
147 | 145 |
148 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 146 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
149 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized()); | 147 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized()); |
150 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); | 148 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); |
151 } | 149 } |
152 | 150 |
153 | 151 |
154 TEST(DeoptimizeSimpleWithArguments) { | 152 TEST(DeoptimizeSimpleWithArguments) { |
155 i::FLAG_turbo_deoptimization = true; | |
156 | |
157 LocalContext env; | 153 LocalContext env; |
158 v8::HandleScope scope(env->GetIsolate()); | 154 v8::HandleScope scope(env->GetIsolate()); |
159 | 155 |
160 // Test lazy deoptimization of a simple function with some arguments. | 156 // Test lazy deoptimization of a simple function with some arguments. |
161 { | 157 { |
162 AlwaysOptimizeAllowNativesSyntaxNoInlining options; | 158 AlwaysOptimizeAllowNativesSyntaxNoInlining options; |
163 CompileRun( | 159 CompileRun( |
164 "var count = 0;" | 160 "var count = 0;" |
165 "function h(x) { %DeoptimizeFunction(f); }" | 161 "function h(x) { %DeoptimizeFunction(f); }" |
166 "function g(x, y) { count++; h(x); }" | 162 "function g(x, y) { count++; h(x); }" |
(...skipping 19 matching lines...) Expand all Loading... |
186 } | 182 } |
187 NonIncrementalGC(CcTest::i_isolate()); | 183 NonIncrementalGC(CcTest::i_isolate()); |
188 | 184 |
189 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 185 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
190 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized()); | 186 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized()); |
191 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); | 187 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); |
192 } | 188 } |
193 | 189 |
194 | 190 |
195 TEST(DeoptimizeSimpleNested) { | 191 TEST(DeoptimizeSimpleNested) { |
196 i::FLAG_turbo_deoptimization = true; | |
197 | |
198 LocalContext env; | 192 LocalContext env; |
199 v8::HandleScope scope(env->GetIsolate()); | 193 v8::HandleScope scope(env->GetIsolate()); |
200 | 194 |
201 // Test lazy deoptimization of a simple function. Have a nested function call | 195 // Test lazy deoptimization of a simple function. Have a nested function call |
202 // do the deoptimization. | 196 // do the deoptimization. |
203 { | 197 { |
204 AlwaysOptimizeAllowNativesSyntaxNoInlining options; | 198 AlwaysOptimizeAllowNativesSyntaxNoInlining options; |
205 CompileRun( | 199 CompileRun( |
206 "var count = 0;" | 200 "var count = 0;" |
207 "var result = 0;" | 201 "var result = 0;" |
208 "function h(x, y, z) { return x + y + z; }" | 202 "function h(x, y, z) { return x + y + z; }" |
209 "function g(z) { count++; %DeoptimizeFunction(f); return z;}" | 203 "function g(z) { count++; %DeoptimizeFunction(f); return z;}" |
210 "function f(x,y,z) { return h(x, y, g(z)); };" | 204 "function f(x,y,z) { return h(x, y, g(z)); };" |
211 "result = f(1, 2, 3);"); | 205 "result = f(1, 2, 3);"); |
212 NonIncrementalGC(CcTest::i_isolate()); | 206 NonIncrementalGC(CcTest::i_isolate()); |
213 | 207 |
214 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 208 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
215 CHECK_EQ(6, env->Global()->Get(v8_str("result"))->Int32Value()); | 209 CHECK_EQ(6, env->Global()->Get(v8_str("result"))->Int32Value()); |
216 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized()); | 210 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized()); |
217 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); | 211 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); |
218 } | 212 } |
219 } | 213 } |
220 | 214 |
221 | 215 |
222 TEST(DeoptimizeRecursive) { | 216 TEST(DeoptimizeRecursive) { |
223 i::FLAG_turbo_deoptimization = true; | |
224 LocalContext env; | 217 LocalContext env; |
225 v8::HandleScope scope(env->GetIsolate()); | 218 v8::HandleScope scope(env->GetIsolate()); |
226 | 219 |
227 { | 220 { |
228 // Test lazy deoptimization of a simple function called recursively. Call | 221 // Test lazy deoptimization of a simple function called recursively. Call |
229 // the function recursively a number of times before deoptimizing it. | 222 // the function recursively a number of times before deoptimizing it. |
230 AlwaysOptimizeAllowNativesSyntaxNoInlining options; | 223 AlwaysOptimizeAllowNativesSyntaxNoInlining options; |
231 CompileRun( | 224 CompileRun( |
232 "var count = 0;" | 225 "var count = 0;" |
233 "var calls = 0;" | 226 "var calls = 0;" |
234 "function g() { count++; %DeoptimizeFunction(f); }" | 227 "function g() { count++; %DeoptimizeFunction(f); }" |
235 "function f(x) { calls++; if (x > 0) { f(x - 1); } else { g(); } };" | 228 "function f(x) { calls++; if (x > 0) { f(x - 1); } else { g(); } };" |
236 "f(10);"); | 229 "f(10);"); |
237 } | 230 } |
238 NonIncrementalGC(CcTest::i_isolate()); | 231 NonIncrementalGC(CcTest::i_isolate()); |
239 | 232 |
240 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 233 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
241 CHECK_EQ(11, env->Global()->Get(v8_str("calls"))->Int32Value()); | 234 CHECK_EQ(11, env->Global()->Get(v8_str("calls"))->Int32Value()); |
242 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); | 235 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); |
243 | 236 |
244 v8::Local<v8::Function> fun = v8::Local<v8::Function>::Cast( | 237 v8::Local<v8::Function> fun = v8::Local<v8::Function>::Cast( |
245 env->Global()->Get(v8::String::NewFromUtf8(CcTest::isolate(), "f"))); | 238 env->Global()->Get(v8::String::NewFromUtf8(CcTest::isolate(), "f"))); |
246 CHECK(!fun.IsEmpty()); | 239 CHECK(!fun.IsEmpty()); |
247 } | 240 } |
248 | 241 |
249 | 242 |
250 TEST(DeoptimizeMultiple) { | 243 TEST(DeoptimizeMultiple) { |
251 i::FLAG_turbo_deoptimization = true; | |
252 LocalContext env; | 244 LocalContext env; |
253 v8::HandleScope scope(env->GetIsolate()); | 245 v8::HandleScope scope(env->GetIsolate()); |
254 | 246 |
255 { | 247 { |
256 AlwaysOptimizeAllowNativesSyntaxNoInlining options; | 248 AlwaysOptimizeAllowNativesSyntaxNoInlining options; |
257 CompileRun( | 249 CompileRun( |
258 "var count = 0;" | 250 "var count = 0;" |
259 "var result = 0;" | 251 "var result = 0;" |
260 "function g() { count++;" | 252 "function g() { count++;" |
261 " %DeoptimizeFunction(f1);" | 253 " %DeoptimizeFunction(f1);" |
262 " %DeoptimizeFunction(f2);" | 254 " %DeoptimizeFunction(f2);" |
263 " %DeoptimizeFunction(f3);" | 255 " %DeoptimizeFunction(f3);" |
264 " %DeoptimizeFunction(f4);}" | 256 " %DeoptimizeFunction(f4);}" |
265 "function f4(x) { g(); };" | 257 "function f4(x) { g(); };" |
266 "function f3(x, y, z) { f4(); return x + y + z; };" | 258 "function f3(x, y, z) { f4(); return x + y + z; };" |
267 "function f2(x, y) { return x + f3(y + 1, y + 1, y + 1) + y; };" | 259 "function f2(x, y) { return x + f3(y + 1, y + 1, y + 1) + y; };" |
268 "function f1(x) { return f2(x + 1, x + 1) + x; };" | 260 "function f1(x) { return f2(x + 1, x + 1) + x; };" |
269 "result = f1(1);"); | 261 "result = f1(1);"); |
270 } | 262 } |
271 NonIncrementalGC(CcTest::i_isolate()); | 263 NonIncrementalGC(CcTest::i_isolate()); |
272 | 264 |
273 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 265 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
274 CHECK_EQ(14, env->Global()->Get(v8_str("result"))->Int32Value()); | 266 CHECK_EQ(14, env->Global()->Get(v8_str("result"))->Int32Value()); |
275 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); | 267 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); |
276 } | 268 } |
277 | 269 |
278 | 270 |
279 TEST(DeoptimizeConstructor) { | 271 TEST(DeoptimizeConstructor) { |
280 i::FLAG_turbo_deoptimization = true; | |
281 LocalContext env; | 272 LocalContext env; |
282 v8::HandleScope scope(env->GetIsolate()); | 273 v8::HandleScope scope(env->GetIsolate()); |
283 | 274 |
284 { | 275 { |
285 AlwaysOptimizeAllowNativesSyntaxNoInlining options; | 276 AlwaysOptimizeAllowNativesSyntaxNoInlining options; |
286 CompileRun( | 277 CompileRun( |
287 "var count = 0;" | 278 "var count = 0;" |
288 "function g() { count++;" | 279 "function g() { count++;" |
289 " %DeoptimizeFunction(f); }" | 280 " %DeoptimizeFunction(f); }" |
290 "function f() { g(); };" | 281 "function f() { g(); };" |
(...skipping 18 matching lines...) Expand all Loading... |
309 } | 300 } |
310 NonIncrementalGC(CcTest::i_isolate()); | 301 NonIncrementalGC(CcTest::i_isolate()); |
311 | 302 |
312 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 303 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
313 CHECK_EQ(3, env->Global()->Get(v8_str("result"))->Int32Value()); | 304 CHECK_EQ(3, env->Global()->Get(v8_str("result"))->Int32Value()); |
314 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); | 305 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); |
315 } | 306 } |
316 | 307 |
317 | 308 |
318 TEST(DeoptimizeConstructorMultiple) { | 309 TEST(DeoptimizeConstructorMultiple) { |
319 i::FLAG_turbo_deoptimization = true; | |
320 LocalContext env; | 310 LocalContext env; |
321 v8::HandleScope scope(env->GetIsolate()); | 311 v8::HandleScope scope(env->GetIsolate()); |
322 | 312 |
323 { | 313 { |
324 AlwaysOptimizeAllowNativesSyntaxNoInlining options; | 314 AlwaysOptimizeAllowNativesSyntaxNoInlining options; |
325 CompileRun( | 315 CompileRun( |
326 "var count = 0;" | 316 "var count = 0;" |
327 "var result = 0;" | 317 "var result = 0;" |
328 "function g() { count++;" | 318 "function g() { count++;" |
329 " %DeoptimizeFunction(f1);" | 319 " %DeoptimizeFunction(f1);" |
330 " %DeoptimizeFunction(f2);" | 320 " %DeoptimizeFunction(f2);" |
331 " %DeoptimizeFunction(f3);" | 321 " %DeoptimizeFunction(f3);" |
332 " %DeoptimizeFunction(f4);}" | 322 " %DeoptimizeFunction(f4);}" |
333 "function f4(x) { this.result = x; g(); };" | 323 "function f4(x) { this.result = x; g(); };" |
334 "function f3(x, y, z) { this.result = new f4(x + y + z).result; };" | 324 "function f3(x, y, z) { this.result = new f4(x + y + z).result; };" |
335 "function f2(x, y) {" | 325 "function f2(x, y) {" |
336 " this.result = x + new f3(y + 1, y + 1, y + 1).result + y; };" | 326 " this.result = x + new f3(y + 1, y + 1, y + 1).result + y; };" |
337 "function f1(x) { this.result = new f2(x + 1, x + 1).result + x; };" | 327 "function f1(x) { this.result = new f2(x + 1, x + 1).result + x; };" |
338 "result = new f1(1).result;"); | 328 "result = new f1(1).result;"); |
339 } | 329 } |
340 NonIncrementalGC(CcTest::i_isolate()); | 330 NonIncrementalGC(CcTest::i_isolate()); |
341 | 331 |
342 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 332 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
343 CHECK_EQ(14, env->Global()->Get(v8_str("result"))->Int32Value()); | 333 CHECK_EQ(14, env->Global()->Get(v8_str("result"))->Int32Value()); |
344 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); | 334 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); |
345 } | 335 } |
346 | 336 |
347 | 337 |
348 UNINITIALIZED_TEST(DeoptimizeBinaryOperationADDString) { | 338 UNINITIALIZED_TEST(DeoptimizeBinaryOperationADDString) { |
349 i::FLAG_turbo_deoptimization = true; | |
350 i::FLAG_concurrent_recompilation = false; | 339 i::FLAG_concurrent_recompilation = false; |
351 AllowNativesSyntaxNoInlining options; | 340 AllowNativesSyntaxNoInlining options; |
352 v8::Isolate::CreateParams create_params; | 341 v8::Isolate::CreateParams create_params; |
353 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); | 342 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
354 v8::Isolate* isolate = v8::Isolate::New(create_params); | 343 v8::Isolate* isolate = v8::Isolate::New(create_params); |
355 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 344 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
356 isolate->Enter(); | 345 isolate->Enter(); |
357 { | 346 { |
358 LocalContext env(isolate); | 347 LocalContext env(isolate); |
359 v8::HandleScope scope(env->GetIsolate()); | 348 v8::HandleScope scope(env->GetIsolate()); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 | 433 |
445 // Call f and force deoptimization while processing the binary operation. | 434 // Call f and force deoptimization while processing the binary operation. |
446 CompileRun("deopt = true;" | 435 CompileRun("deopt = true;" |
447 "var result = f(7, new X());"); | 436 "var result = f(7, new X());"); |
448 NonIncrementalGC(i_isolate); | 437 NonIncrementalGC(i_isolate); |
449 CHECK(!GetJSFunction((*env)->Global(), "f")->IsOptimized()); | 438 CHECK(!GetJSFunction((*env)->Global(), "f")->IsOptimized()); |
450 } | 439 } |
451 | 440 |
452 | 441 |
453 UNINITIALIZED_TEST(DeoptimizeBinaryOperationADD) { | 442 UNINITIALIZED_TEST(DeoptimizeBinaryOperationADD) { |
454 i::FLAG_turbo_deoptimization = true; | |
455 i::FLAG_concurrent_recompilation = false; | 443 i::FLAG_concurrent_recompilation = false; |
456 v8::Isolate::CreateParams create_params; | 444 v8::Isolate::CreateParams create_params; |
457 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); | 445 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
458 v8::Isolate* isolate = v8::Isolate::New(create_params); | 446 v8::Isolate* isolate = v8::Isolate::New(create_params); |
459 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 447 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
460 isolate->Enter(); | 448 isolate->Enter(); |
461 { | 449 { |
462 LocalContext env(isolate); | 450 LocalContext env(isolate); |
463 v8::HandleScope scope(env->GetIsolate()); | 451 v8::HandleScope scope(env->GetIsolate()); |
464 | 452 |
465 TestDeoptimizeBinaryOpHelper(&env, "+"); | 453 TestDeoptimizeBinaryOpHelper(&env, "+"); |
466 | 454 |
467 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 455 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
468 CHECK_EQ(15, env->Global()->Get(v8_str("result"))->Int32Value()); | 456 CHECK_EQ(15, env->Global()->Get(v8_str("result"))->Int32Value()); |
469 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate)); | 457 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate)); |
470 } | 458 } |
471 isolate->Exit(); | 459 isolate->Exit(); |
472 isolate->Dispose(); | 460 isolate->Dispose(); |
473 } | 461 } |
474 | 462 |
475 | 463 |
476 UNINITIALIZED_TEST(DeoptimizeBinaryOperationSUB) { | 464 UNINITIALIZED_TEST(DeoptimizeBinaryOperationSUB) { |
477 i::FLAG_turbo_deoptimization = true; | |
478 i::FLAG_concurrent_recompilation = false; | 465 i::FLAG_concurrent_recompilation = false; |
479 v8::Isolate::CreateParams create_params; | 466 v8::Isolate::CreateParams create_params; |
480 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); | 467 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
481 v8::Isolate* isolate = v8::Isolate::New(create_params); | 468 v8::Isolate* isolate = v8::Isolate::New(create_params); |
482 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 469 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
483 isolate->Enter(); | 470 isolate->Enter(); |
484 { | 471 { |
485 LocalContext env(isolate); | 472 LocalContext env(isolate); |
486 v8::HandleScope scope(env->GetIsolate()); | 473 v8::HandleScope scope(env->GetIsolate()); |
487 | 474 |
488 TestDeoptimizeBinaryOpHelper(&env, "-"); | 475 TestDeoptimizeBinaryOpHelper(&env, "-"); |
489 | 476 |
490 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 477 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
491 CHECK_EQ(-1, env->Global()->Get(v8_str("result"))->Int32Value()); | 478 CHECK_EQ(-1, env->Global()->Get(v8_str("result"))->Int32Value()); |
492 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate)); | 479 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate)); |
493 } | 480 } |
494 isolate->Exit(); | 481 isolate->Exit(); |
495 isolate->Dispose(); | 482 isolate->Dispose(); |
496 } | 483 } |
497 | 484 |
498 | 485 |
499 UNINITIALIZED_TEST(DeoptimizeBinaryOperationMUL) { | 486 UNINITIALIZED_TEST(DeoptimizeBinaryOperationMUL) { |
500 i::FLAG_turbo_deoptimization = true; | |
501 i::FLAG_concurrent_recompilation = false; | 487 i::FLAG_concurrent_recompilation = false; |
502 v8::Isolate::CreateParams create_params; | 488 v8::Isolate::CreateParams create_params; |
503 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); | 489 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
504 v8::Isolate* isolate = v8::Isolate::New(create_params); | 490 v8::Isolate* isolate = v8::Isolate::New(create_params); |
505 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 491 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
506 isolate->Enter(); | 492 isolate->Enter(); |
507 { | 493 { |
508 LocalContext env(isolate); | 494 LocalContext env(isolate); |
509 v8::HandleScope scope(env->GetIsolate()); | 495 v8::HandleScope scope(env->GetIsolate()); |
510 | 496 |
511 TestDeoptimizeBinaryOpHelper(&env, "*"); | 497 TestDeoptimizeBinaryOpHelper(&env, "*"); |
512 | 498 |
513 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 499 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
514 CHECK_EQ(56, env->Global()->Get(v8_str("result"))->Int32Value()); | 500 CHECK_EQ(56, env->Global()->Get(v8_str("result"))->Int32Value()); |
515 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate)); | 501 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate)); |
516 } | 502 } |
517 isolate->Exit(); | 503 isolate->Exit(); |
518 isolate->Dispose(); | 504 isolate->Dispose(); |
519 } | 505 } |
520 | 506 |
521 | 507 |
522 UNINITIALIZED_TEST(DeoptimizeBinaryOperationDIV) { | 508 UNINITIALIZED_TEST(DeoptimizeBinaryOperationDIV) { |
523 i::FLAG_turbo_deoptimization = true; | |
524 i::FLAG_concurrent_recompilation = false; | 509 i::FLAG_concurrent_recompilation = false; |
525 v8::Isolate::CreateParams create_params; | 510 v8::Isolate::CreateParams create_params; |
526 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); | 511 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
527 v8::Isolate* isolate = v8::Isolate::New(create_params); | 512 v8::Isolate* isolate = v8::Isolate::New(create_params); |
528 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 513 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
529 isolate->Enter(); | 514 isolate->Enter(); |
530 { | 515 { |
531 LocalContext env(isolate); | 516 LocalContext env(isolate); |
532 v8::HandleScope scope(env->GetIsolate()); | 517 v8::HandleScope scope(env->GetIsolate()); |
533 | 518 |
534 TestDeoptimizeBinaryOpHelper(&env, "/"); | 519 TestDeoptimizeBinaryOpHelper(&env, "/"); |
535 | 520 |
536 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 521 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
537 CHECK_EQ(0, env->Global()->Get(v8_str("result"))->Int32Value()); | 522 CHECK_EQ(0, env->Global()->Get(v8_str("result"))->Int32Value()); |
538 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate)); | 523 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate)); |
539 } | 524 } |
540 isolate->Exit(); | 525 isolate->Exit(); |
541 isolate->Dispose(); | 526 isolate->Dispose(); |
542 } | 527 } |
543 | 528 |
544 | 529 |
545 UNINITIALIZED_TEST(DeoptimizeBinaryOperationMOD) { | 530 UNINITIALIZED_TEST(DeoptimizeBinaryOperationMOD) { |
546 i::FLAG_turbo_deoptimization = true; | |
547 i::FLAG_concurrent_recompilation = false; | 531 i::FLAG_concurrent_recompilation = false; |
548 v8::Isolate::CreateParams create_params; | 532 v8::Isolate::CreateParams create_params; |
549 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); | 533 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
550 v8::Isolate* isolate = v8::Isolate::New(create_params); | 534 v8::Isolate* isolate = v8::Isolate::New(create_params); |
551 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 535 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
552 isolate->Enter(); | 536 isolate->Enter(); |
553 { | 537 { |
554 LocalContext env(isolate); | 538 LocalContext env(isolate); |
555 v8::HandleScope scope(env->GetIsolate()); | 539 v8::HandleScope scope(env->GetIsolate()); |
556 | 540 |
557 TestDeoptimizeBinaryOpHelper(&env, "%"); | 541 TestDeoptimizeBinaryOpHelper(&env, "%"); |
558 | 542 |
559 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 543 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
560 CHECK_EQ(7, env->Global()->Get(v8_str("result"))->Int32Value()); | 544 CHECK_EQ(7, env->Global()->Get(v8_str("result"))->Int32Value()); |
561 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate)); | 545 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate)); |
562 } | 546 } |
563 isolate->Exit(); | 547 isolate->Exit(); |
564 isolate->Dispose(); | 548 isolate->Dispose(); |
565 } | 549 } |
566 | 550 |
567 | 551 |
568 UNINITIALIZED_TEST(DeoptimizeCompare) { | 552 UNINITIALIZED_TEST(DeoptimizeCompare) { |
569 i::FLAG_turbo_deoptimization = true; | |
570 i::FLAG_concurrent_recompilation = false; | 553 i::FLAG_concurrent_recompilation = false; |
571 v8::Isolate::CreateParams create_params; | 554 v8::Isolate::CreateParams create_params; |
572 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); | 555 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
573 v8::Isolate* isolate = v8::Isolate::New(create_params); | 556 v8::Isolate* isolate = v8::Isolate::New(create_params); |
574 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 557 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
575 isolate->Enter(); | 558 isolate->Enter(); |
576 { | 559 { |
577 LocalContext env(isolate); | 560 LocalContext env(isolate); |
578 v8::HandleScope scope(env->GetIsolate()); | 561 v8::HandleScope scope(env->GetIsolate()); |
579 | 562 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 599 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
617 CHECK_EQ(true, env->Global()->Get(v8_str("result"))->BooleanValue()); | 600 CHECK_EQ(true, env->Global()->Get(v8_str("result"))->BooleanValue()); |
618 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate)); | 601 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate)); |
619 } | 602 } |
620 isolate->Exit(); | 603 isolate->Exit(); |
621 isolate->Dispose(); | 604 isolate->Dispose(); |
622 } | 605 } |
623 | 606 |
624 | 607 |
625 UNINITIALIZED_TEST(DeoptimizeLoadICStoreIC) { | 608 UNINITIALIZED_TEST(DeoptimizeLoadICStoreIC) { |
626 i::FLAG_turbo_deoptimization = true; | |
627 i::FLAG_concurrent_recompilation = false; | 609 i::FLAG_concurrent_recompilation = false; |
628 v8::Isolate::CreateParams create_params; | 610 v8::Isolate::CreateParams create_params; |
629 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); | 611 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
630 v8::Isolate* isolate = v8::Isolate::New(create_params); | 612 v8::Isolate* isolate = v8::Isolate::New(create_params); |
631 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 613 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
632 isolate->Enter(); | 614 isolate->Enter(); |
633 { | 615 { |
634 LocalContext env(isolate); | 616 LocalContext env(isolate); |
635 v8::HandleScope scope(env->GetIsolate()); | 617 v8::HandleScope scope(env->GetIsolate()); |
636 | 618 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); | 691 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); |
710 CHECK_EQ(4, env->Global()->Get(v8_str("count"))->Int32Value()); | 692 CHECK_EQ(4, env->Global()->Get(v8_str("count"))->Int32Value()); |
711 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); | 693 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); |
712 } | 694 } |
713 isolate->Exit(); | 695 isolate->Exit(); |
714 isolate->Dispose(); | 696 isolate->Dispose(); |
715 } | 697 } |
716 | 698 |
717 | 699 |
718 UNINITIALIZED_TEST(DeoptimizeLoadICStoreICNested) { | 700 UNINITIALIZED_TEST(DeoptimizeLoadICStoreICNested) { |
719 i::FLAG_turbo_deoptimization = true; | |
720 i::FLAG_concurrent_recompilation = false; | 701 i::FLAG_concurrent_recompilation = false; |
721 v8::Isolate::CreateParams create_params; | 702 v8::Isolate::CreateParams create_params; |
722 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); | 703 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
723 v8::Isolate* isolate = v8::Isolate::New(create_params); | 704 v8::Isolate* isolate = v8::Isolate::New(create_params); |
724 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 705 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
725 isolate->Enter(); | 706 isolate->Enter(); |
726 { | 707 { |
727 LocalContext env(isolate); | 708 LocalContext env(isolate); |
728 v8::HandleScope scope(env->GetIsolate()); | 709 v8::HandleScope scope(env->GetIsolate()); |
729 | 710 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized()); | 781 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized()); |
801 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized()); | 782 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized()); |
802 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized()); | 783 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized()); |
803 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); | 784 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); |
804 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 785 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
805 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); | 786 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); |
806 } | 787 } |
807 isolate->Exit(); | 788 isolate->Exit(); |
808 isolate->Dispose(); | 789 isolate->Dispose(); |
809 } | 790 } |
OLD | NEW |