OLD | NEW |
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 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1752 target->ReplaceCode(shared->code()); | 1752 target->ReplaceCode(shared->code()); |
1753 target->shared()->set_scope_info(shared->scope_info()); | 1753 target->shared()->set_scope_info(shared->scope_info()); |
1754 target->shared()->set_length(shared->length()); | 1754 target->shared()->set_length(shared->length()); |
1755 target->shared()->set_formal_parameter_count( | 1755 target->shared()->set_formal_parameter_count( |
1756 shared->formal_parameter_count()); | 1756 shared->formal_parameter_count()); |
1757 // Set the source code of the target function to undefined. | 1757 // Set the source code of the target function to undefined. |
1758 // SetCode is only used for built-in constructors like String, | 1758 // SetCode is only used for built-in constructors like String, |
1759 // Array, and Object, and some web code | 1759 // Array, and Object, and some web code |
1760 // doesn't like seeing source code for constructors. | 1760 // doesn't like seeing source code for constructors. |
1761 target->shared()->set_script(Heap::undefined_value()); | 1761 target->shared()->set_script(Heap::undefined_value()); |
| 1762 target->shared()->code()->set_optimizable(false); |
1762 // Clear the optimization hints related to the compiled code as these are no | 1763 // Clear the optimization hints related to the compiled code as these are no |
1763 // longer valid when the code is overwritten. | 1764 // longer valid when the code is overwritten. |
1764 target->shared()->ClearThisPropertyAssignmentsInfo(); | 1765 target->shared()->ClearThisPropertyAssignmentsInfo(); |
1765 context = Handle<Context>(fun->context()); | 1766 context = Handle<Context>(fun->context()); |
1766 | 1767 |
1767 // Make sure we get a fresh copy of the literal vector to avoid | 1768 // Make sure we get a fresh copy of the literal vector to avoid |
1768 // cross context contamination. | 1769 // cross context contamination. |
1769 int number_of_literals = fun->NumberOfLiterals(); | 1770 int number_of_literals = fun->NumberOfLiterals(); |
1770 Handle<FixedArray> literals = | 1771 Handle<FixedArray> literals = |
1771 Factory::NewFixedArray(number_of_literals, TENURED); | 1772 Factory::NewFixedArray(number_of_literals, TENURED); |
(...skipping 4943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6715 | 6716 |
6716 | 6717 |
6717 static MaybeObject* Runtime_LazyRecompile(Arguments args) { | 6718 static MaybeObject* Runtime_LazyRecompile(Arguments args) { |
6718 HandleScope scope; | 6719 HandleScope scope; |
6719 ASSERT(args.length() == 1); | 6720 ASSERT(args.length() == 1); |
6720 Handle<JSFunction> function = args.at<JSFunction>(0); | 6721 Handle<JSFunction> function = args.at<JSFunction>(0); |
6721 // If the function is not optimizable or debugger is active continue using the | 6722 // If the function is not optimizable or debugger is active continue using the |
6722 // code from the full compiler. | 6723 // code from the full compiler. |
6723 if (!function->shared()->code()->optimizable() || | 6724 if (!function->shared()->code()->optimizable() || |
6724 Debug::has_break_points()) { | 6725 Debug::has_break_points()) { |
| 6726 if (FLAG_trace_opt) { |
| 6727 PrintF("[failed to optimize "); |
| 6728 function->PrintName(); |
| 6729 PrintF(": is code optimizable: %s, is debugger enabled: %s]\n", |
| 6730 function->shared()->code()->optimizable() ? "T" : "F", |
| 6731 Debug::has_break_points() ? "T" : "F"); |
| 6732 } |
6725 function->ReplaceCode(function->shared()->code()); | 6733 function->ReplaceCode(function->shared()->code()); |
6726 return function->code(); | 6734 return function->code(); |
6727 } | 6735 } |
6728 if (CompileOptimized(function, AstNode::kNoNumber)) { | 6736 if (CompileOptimized(function, AstNode::kNoNumber)) { |
6729 return function->code(); | 6737 return function->code(); |
6730 } | 6738 } |
| 6739 if (FLAG_trace_opt) { |
| 6740 PrintF("[failed to optimize "); |
| 6741 function->PrintName(); |
| 6742 PrintF(": optimized compilation failed]\n"); |
| 6743 } |
6731 function->ReplaceCode(function->shared()->code()); | 6744 function->ReplaceCode(function->shared()->code()); |
6732 return Failure::Exception(); | 6745 return Failure::Exception(); |
6733 } | 6746 } |
6734 | 6747 |
6735 | 6748 |
6736 static MaybeObject* Runtime_NotifyDeoptimized(Arguments args) { | 6749 static MaybeObject* Runtime_NotifyDeoptimized(Arguments args) { |
6737 HandleScope scope; | 6750 HandleScope scope; |
6738 ASSERT(args.length() == 1); | 6751 ASSERT(args.length() == 1); |
6739 RUNTIME_ASSERT(args[0]->IsSmi()); | 6752 RUNTIME_ASSERT(args[0]->IsSmi()); |
6740 Deoptimizer::BailoutType type = | 6753 Deoptimizer::BailoutType type = |
(...skipping 4044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10785 } else { | 10798 } else { |
10786 // Handle last resort GC and make sure to allow future allocations | 10799 // Handle last resort GC and make sure to allow future allocations |
10787 // to grow the heap without causing GCs (if possible). | 10800 // to grow the heap without causing GCs (if possible). |
10788 Counters::gc_last_resort_from_js.Increment(); | 10801 Counters::gc_last_resort_from_js.Increment(); |
10789 Heap::CollectAllGarbage(false); | 10802 Heap::CollectAllGarbage(false); |
10790 } | 10803 } |
10791 } | 10804 } |
10792 | 10805 |
10793 | 10806 |
10794 } } // namespace v8::internal | 10807 } } // namespace v8::internal |
OLD | NEW |