| 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 // Skip test if --cache-optimized-code is not activated by default because | 363 // Skip test if --cache-optimized-code is not activated by default because |
| 364 // FastNewClosureStub that is baked into the snapshot is incorrect. | 364 // FastNewClosureStub that is baked into the snapshot is incorrect. |
| 365 if (!FLAG_cache_optimized_code) return; | 365 if (!FLAG_cache_optimized_code) return; |
| 366 FLAG_stress_compaction = false; | 366 FLAG_stress_compaction = false; |
| 367 FLAG_allow_natives_syntax = true; | 367 FLAG_allow_natives_syntax = true; |
| 368 CcTest::InitializeVM(); | 368 CcTest::InitializeVM(); |
| 369 v8::HandleScope scope(CcTest::isolate()); | 369 v8::HandleScope scope(CcTest::isolate()); |
| 370 for (int i = 0; i < 10; i++) { | 370 for (int i = 0; i < 10; i++) { |
| 371 LocalContext env; | 371 LocalContext env; |
| 372 env->Global()->Set(v8::String::NewFromUtf8(CcTest::isolate(), "x"), | 372 env->Global()->Set(v8::String::NewFromUtf8(CcTest::isolate(), "x"), |
| 373 v8::Integer::New(i)); | 373 v8::Integer::New(CcTest::isolate(), i)); |
| 374 CompileRun("function MakeClosure() {" | 374 CompileRun("function MakeClosure() {" |
| 375 " return function() { return x; };" | 375 " return function() { return x; };" |
| 376 "}" | 376 "}" |
| 377 "var closure0 = MakeClosure();" | 377 "var closure0 = MakeClosure();" |
| 378 "%DebugPrint(closure0());" | 378 "%DebugPrint(closure0());" |
| 379 "%OptimizeFunctionOnNextCall(closure0);" | 379 "%OptimizeFunctionOnNextCall(closure0);" |
| 380 "%DebugPrint(closure0());" | 380 "%DebugPrint(closure0());" |
| 381 "var closure1 = MakeClosure();" | 381 "var closure1 = MakeClosure();" |
| 382 "var closure2 = MakeClosure();"); | 382 "var closure2 = MakeClosure();"); |
| 383 Handle<JSFunction> fun1 = v8::Utils::OpenHandle( | 383 Handle<JSFunction> fun1 = v8::Utils::OpenHandle( |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 CompileRun("function f() { a = 12345678 }; f();"); | 438 CompileRun("function f() { a = 12345678 }; f();"); |
| 439 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 439 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
| 440 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); | 440 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); |
| 441 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 441 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
| 442 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); | 442 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); |
| 443 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 443 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
| 444 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); | 444 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); |
| 445 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 445 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
| 446 } | 446 } |
| 447 #endif | 447 #endif |
| OLD | NEW |