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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 "var closure0 = MakeClosure();" | 370 "var closure0 = MakeClosure();" |
371 "%DebugPrint(closure0());" | 371 "%DebugPrint(closure0());" |
372 "%OptimizeFunctionOnNextCall(closure0);" | 372 "%OptimizeFunctionOnNextCall(closure0);" |
373 "%DebugPrint(closure0());" | 373 "%DebugPrint(closure0());" |
374 "var closure1 = MakeClosure();" | 374 "var closure1 = MakeClosure();" |
375 "var closure2 = MakeClosure();"); | 375 "var closure2 = MakeClosure();"); |
376 Handle<JSFunction> fun1 = v8::Utils::OpenHandle( | 376 Handle<JSFunction> fun1 = v8::Utils::OpenHandle( |
377 *v8::Local<v8::Function>::Cast(env->Global()->Get(v8_str("closure1")))); | 377 *v8::Local<v8::Function>::Cast(env->Global()->Get(v8_str("closure1")))); |
378 Handle<JSFunction> fun2 = v8::Utils::OpenHandle( | 378 Handle<JSFunction> fun2 = v8::Utils::OpenHandle( |
379 *v8::Local<v8::Function>::Cast(env->Global()->Get(v8_str("closure2")))); | 379 *v8::Local<v8::Function>::Cast(env->Global()->Get(v8_str("closure2")))); |
380 CHECK(fun1->IsOptimized() || !fun1->IsOptimizable()); | 380 CHECK(fun1->IsOptimized() |
381 CHECK(fun2->IsOptimized() || !fun2->IsOptimizable()); | 381 || !CcTest::i_isolate()->use_crankshaft() || !fun1->IsOptimizable()); |
| 382 CHECK(fun2->IsOptimized() |
| 383 || !CcTest::i_isolate()->use_crankshaft() || !fun2->IsOptimizable()); |
382 CHECK_EQ(fun1->code(), fun2->code()); | 384 CHECK_EQ(fun1->code(), fun2->code()); |
383 } | 385 } |
384 } | 386 } |
385 | 387 |
386 | 388 |
387 #ifdef ENABLE_DISASSEMBLER | 389 #ifdef ENABLE_DISASSEMBLER |
388 static Handle<JSFunction> GetJSFunction(v8::Handle<v8::Object> obj, | 390 static Handle<JSFunction> GetJSFunction(v8::Handle<v8::Object> obj, |
389 const char* property_name) { | 391 const char* property_name) { |
390 v8::Local<v8::Function> fun = | 392 v8::Local<v8::Function> fun = |
391 v8::Local<v8::Function>::Cast(obj->Get(v8_str(property_name))); | 393 v8::Local<v8::Function>::Cast(obj->Get(v8_str(property_name))); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 CompileRun("function f() { a = 12345678 }; f();"); | 431 CompileRun("function f() { a = 12345678 }; f();"); |
430 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 432 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
431 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); | 433 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); |
432 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 434 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
433 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); | 435 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); |
434 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 436 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
435 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); | 437 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); |
436 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 438 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
437 } | 439 } |
438 #endif | 440 #endif |
OLD | NEW |