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 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1742 target->ReplaceCode(shared->code()); | 1742 target->ReplaceCode(shared->code()); |
1743 target->shared()->set_scope_info(shared->scope_info()); | 1743 target->shared()->set_scope_info(shared->scope_info()); |
1744 target->shared()->set_length(shared->length()); | 1744 target->shared()->set_length(shared->length()); |
1745 target->shared()->set_formal_parameter_count( | 1745 target->shared()->set_formal_parameter_count( |
1746 shared->formal_parameter_count()); | 1746 shared->formal_parameter_count()); |
1747 // Set the source code of the target function to undefined. | 1747 // Set the source code of the target function to undefined. |
1748 // SetCode is only used for built-in constructors like String, | 1748 // SetCode is only used for built-in constructors like String, |
1749 // Array, and Object, and some web code | 1749 // Array, and Object, and some web code |
1750 // doesn't like seeing source code for constructors. | 1750 // doesn't like seeing source code for constructors. |
1751 target->shared()->set_script(Heap::undefined_value()); | 1751 target->shared()->set_script(Heap::undefined_value()); |
| 1752 target->shared()->code()->set_optimizable(false); |
1752 // Clear the optimization hints related to the compiled code as these are no | 1753 // Clear the optimization hints related to the compiled code as these are no |
1753 // longer valid when the code is overwritten. | 1754 // longer valid when the code is overwritten. |
1754 target->shared()->ClearThisPropertyAssignmentsInfo(); | 1755 target->shared()->ClearThisPropertyAssignmentsInfo(); |
1755 context = Handle<Context>(fun->context()); | 1756 context = Handle<Context>(fun->context()); |
1756 | 1757 |
1757 // Make sure we get a fresh copy of the literal vector to avoid | 1758 // Make sure we get a fresh copy of the literal vector to avoid |
1758 // cross context contamination. | 1759 // cross context contamination. |
1759 int number_of_literals = fun->NumberOfLiterals(); | 1760 int number_of_literals = fun->NumberOfLiterals(); |
1760 Handle<FixedArray> literals = | 1761 Handle<FixedArray> literals = |
1761 Factory::NewFixedArray(number_of_literals, TENURED); | 1762 Factory::NewFixedArray(number_of_literals, TENURED); |
(...skipping 4945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6707 | 6708 |
6708 | 6709 |
6709 static MaybeObject* Runtime_LazyRecompile(Arguments args) { | 6710 static MaybeObject* Runtime_LazyRecompile(Arguments args) { |
6710 HandleScope scope; | 6711 HandleScope scope; |
6711 ASSERT(args.length() == 1); | 6712 ASSERT(args.length() == 1); |
6712 Handle<JSFunction> function = args.at<JSFunction>(0); | 6713 Handle<JSFunction> function = args.at<JSFunction>(0); |
6713 // If the function is not optimizable or debugger is active continue using the | 6714 // If the function is not optimizable or debugger is active continue using the |
6714 // code from the full compiler. | 6715 // code from the full compiler. |
6715 if (!function->shared()->code()->optimizable() || | 6716 if (!function->shared()->code()->optimizable() || |
6716 Debug::has_break_points()) { | 6717 Debug::has_break_points()) { |
| 6718 if (FLAG_trace_opt) { |
| 6719 PrintF("[failed to optimize "); |
| 6720 function->PrintName(); |
| 6721 PrintF(": is code optimizable: %s, is debugger enabled: %s]\n", |
| 6722 function->shared()->code()->optimizable() ? "T" : "F", |
| 6723 Debug::has_break_points() ? "T" : "F"); |
| 6724 } |
6717 function->ReplaceCode(function->shared()->code()); | 6725 function->ReplaceCode(function->shared()->code()); |
6718 return function->code(); | 6726 return function->code(); |
6719 } | 6727 } |
6720 if (CompileOptimized(function, AstNode::kNoNumber)) { | 6728 if (CompileOptimized(function, AstNode::kNoNumber)) { |
6721 return function->code(); | 6729 return function->code(); |
6722 } | 6730 } |
| 6731 if (FLAG_trace_opt) { |
| 6732 PrintF("[failed to optimize "); |
| 6733 function->PrintName(); |
| 6734 PrintF(": optimized compilation failed]\n"); |
| 6735 } |
6723 function->ReplaceCode(function->shared()->code()); | 6736 function->ReplaceCode(function->shared()->code()); |
6724 return Failure::Exception(); | 6737 return Failure::Exception(); |
6725 } | 6738 } |
6726 | 6739 |
6727 | 6740 |
6728 static MaybeObject* Runtime_NotifyDeoptimized(Arguments args) { | 6741 static MaybeObject* Runtime_NotifyDeoptimized(Arguments args) { |
6729 HandleScope scope; | 6742 HandleScope scope; |
6730 ASSERT(args.length() == 1); | 6743 ASSERT(args.length() == 1); |
6731 RUNTIME_ASSERT(args[0]->IsSmi()); | 6744 RUNTIME_ASSERT(args[0]->IsSmi()); |
6732 Deoptimizer::BailoutType type = | 6745 Deoptimizer::BailoutType type = |
(...skipping 4096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10829 } else { | 10842 } else { |
10830 // Handle last resort GC and make sure to allow future allocations | 10843 // Handle last resort GC and make sure to allow future allocations |
10831 // to grow the heap without causing GCs (if possible). | 10844 // to grow the heap without causing GCs (if possible). |
10832 Counters::gc_last_resort_from_js.Increment(); | 10845 Counters::gc_last_resort_from_js.Increment(); |
10833 Heap::CollectAllGarbage(false); | 10846 Heap::CollectAllGarbage(false); |
10834 } | 10847 } |
10835 } | 10848 } |
10836 | 10849 |
10837 | 10850 |
10838 } } // namespace v8::internal | 10851 } } // namespace v8::internal |
OLD | NEW |