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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 } | 393 } |
394 } | 394 } |
395 | 395 |
396 | 396 |
397 // Test that optimized code for different closures is actually shared | 397 // Test that optimized code for different closures is actually shared |
398 // immediately by the FastNewClosureStub when run different contexts. | 398 // immediately by the FastNewClosureStub when run different contexts. |
399 TEST(OptimizedCodeSharing2) { | 399 TEST(OptimizedCodeSharing2) { |
400 if (FLAG_stress_compaction) return; | 400 if (FLAG_stress_compaction) return; |
401 FLAG_allow_natives_syntax = true; | 401 FLAG_allow_natives_syntax = true; |
402 FLAG_cache_optimized_code = true; | 402 FLAG_cache_optimized_code = true; |
403 FLAG_native_context_specialization = false; | |
404 FLAG_turbo_cache_shared_code = true; | 403 FLAG_turbo_cache_shared_code = true; |
405 const char* flag = "--turbo-filter=*"; | 404 const char* flag = "--turbo-filter=*"; |
406 FlagList::SetFlagsFromString(flag, StrLength(flag)); | 405 FlagList::SetFlagsFromString(flag, StrLength(flag)); |
407 CcTest::InitializeVM(); | 406 CcTest::InitializeVM(); |
408 v8::HandleScope scope(CcTest::isolate()); | 407 v8::HandleScope scope(CcTest::isolate()); |
409 v8::Local<v8::Script> script = v8_compile( | 408 v8::Local<v8::Script> script = v8_compile( |
410 "function MakeClosure() {" | 409 "function MakeClosure() {" |
411 " return function() { return x; };" | 410 " return function() { return x; };" |
412 "}"); | 411 "}"); |
413 Handle<Code> reference_code; | 412 Handle<Code> reference_code; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 } | 448 } |
450 } | 449 } |
451 | 450 |
452 | 451 |
453 // Test that optimized code for different closures is actually shared | 452 // Test that optimized code for different closures is actually shared |
454 // immediately by the FastNewClosureStub without context-dependent entries. | 453 // immediately by the FastNewClosureStub without context-dependent entries. |
455 TEST(OptimizedCodeSharing3) { | 454 TEST(OptimizedCodeSharing3) { |
456 if (FLAG_stress_compaction) return; | 455 if (FLAG_stress_compaction) return; |
457 FLAG_allow_natives_syntax = true; | 456 FLAG_allow_natives_syntax = true; |
458 FLAG_cache_optimized_code = true; | 457 FLAG_cache_optimized_code = true; |
459 FLAG_native_context_specialization = false; | |
460 FLAG_turbo_cache_shared_code = true; | 458 FLAG_turbo_cache_shared_code = true; |
461 const char* flag = "--turbo-filter=*"; | 459 const char* flag = "--turbo-filter=*"; |
462 FlagList::SetFlagsFromString(flag, StrLength(flag)); | 460 FlagList::SetFlagsFromString(flag, StrLength(flag)); |
463 CcTest::InitializeVM(); | 461 CcTest::InitializeVM(); |
464 v8::HandleScope scope(CcTest::isolate()); | 462 v8::HandleScope scope(CcTest::isolate()); |
465 v8::Local<v8::Script> script = v8_compile( | 463 v8::Local<v8::Script> script = v8_compile( |
466 "function MakeClosure() {" | 464 "function MakeClosure() {" |
467 " return function() { return x; };" | 465 " return function() { return x; };" |
468 "}"); | 466 "}"); |
469 Handle<Code> reference_code; | 467 Handle<Code> reference_code; |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 CompileRun("function f() { a = 12345678 }; f();"); | 691 CompileRun("function f() { a = 12345678 }; f();"); |
694 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 692 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
695 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); | 693 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); |
696 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 694 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
697 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); | 695 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); |
698 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 696 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
699 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); | 697 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); |
700 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 698 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
701 } | 699 } |
702 #endif | 700 #endif |
OLD | NEW |