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