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