Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/compiler.cc

Issue 6685044: Set optimizable to false on code object if shared function info says so.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Set optimizable to false on code object if shared function info says so Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 HistogramTimerScope timer(isolate->counters()->compile_lazy()); 622 HistogramTimerScope timer(isolate->counters()->compile_lazy());
623 623
624 // Compile the code. 624 // Compile the code.
625 if (!MakeCode(info)) { 625 if (!MakeCode(info)) {
626 if (!isolate->has_pending_exception()) { 626 if (!isolate->has_pending_exception()) {
627 isolate->StackOverflow(); 627 isolate->StackOverflow();
628 } 628 }
629 } else { 629 } else {
630 ASSERT(!info->code().is_null()); 630 ASSERT(!info->code().is_null());
631 Handle<Code> code = info->code(); 631 Handle<Code> code = info->code();
632 // Set optimizable to false if this is disallowed by the shared
633 // function info, e.g., we might have flushed the code and must
634 // reset this bit when lazy compiling the code again.
635 if (shared->optimization_disabled()) code->set_optimizable(false);
636
632 Handle<JSFunction> function = info->closure(); 637 Handle<JSFunction> function = info->closure();
633 RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, info, shared); 638 RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, info, shared);
634 639
635 if (info->IsOptimizing()) { 640 if (info->IsOptimizing()) {
636 function->ReplaceCode(*code); 641 function->ReplaceCode(*code);
637 } else { 642 } else {
638 // Update the shared function info with the compiled code and the 643 // Update the shared function info with the compiled code and the
639 // scope info. Please note, that the order of the shared function 644 // scope info. Please note, that the order of the shared function
640 // info initialization is important since set_scope_info might 645 // info initialization is important since set_scope_info might
641 // trigger a GC, causing the ASSERT below to be invalid if the code 646 // trigger a GC, causing the ASSERT below to be invalid if the code
(...skipping 16 matching lines...) Expand all
658 // these are not set when the function is set up as a lazily 663 // these are not set when the function is set up as a lazily
659 // compiled function. 664 // compiled function.
660 shared->SetThisPropertyAssignmentsInfo( 665 shared->SetThisPropertyAssignmentsInfo(
661 lit->has_only_simple_this_property_assignments(), 666 lit->has_only_simple_this_property_assignments(),
662 *lit->this_property_assignments()); 667 *lit->this_property_assignments());
663 668
664 // Check the function has compiled code. 669 // Check the function has compiled code.
665 ASSERT(shared->is_compiled()); 670 ASSERT(shared->is_compiled());
666 shared->set_code_age(0); 671 shared->set_code_age(0);
667 672
668 if (V8::UseCrankshaft() && info->AllowOptimize()) { 673 if (info->AllowOptimize() && !shared->optimization_disabled()) {
669 // If we're asked to always optimize, we compile the optimized 674 // If we're asked to always optimize, we compile the optimized
670 // version of the function right away - unless the debugger is 675 // version of the function right away - unless the debugger is
671 // active as it makes no sense to compile optimized code then. 676 // active as it makes no sense to compile optimized code then.
672 if (FLAG_always_opt && 677 if (FLAG_always_opt &&
673 !Isolate::Current()->debug()->has_break_points()) { 678 !Isolate::Current()->debug()->has_break_points()) {
674 CompilationInfo optimized(function); 679 CompilationInfo optimized(function);
675 optimized.SetOptimizing(AstNode::kNoNumber); 680 optimized.SetOptimizing(AstNode::kNoNumber);
676 return CompileLazy(&optimized); 681 return CompileLazy(&optimized);
677 } else if (isolate->compilation_cache()->ShouldOptimizeEagerly( 682 } else if (isolate->compilation_cache()->ShouldOptimizeEagerly(
678 function)) { 683 function)) {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 shared->DebugName())); 825 shared->DebugName()));
821 } 826 }
822 } 827 }
823 828
824 GDBJIT(AddCode(name, 829 GDBJIT(AddCode(name,
825 Handle<Script>(info->script()), 830 Handle<Script>(info->script()),
826 Handle<Code>(info->code()))); 831 Handle<Code>(info->code())));
827 } 832 }
828 833
829 } } // namespace v8::internal 834 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698