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

Side by Side Diff: src/runtime.cc

Issue 5753005: Make closures optimizable by Crankshaft compiler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Minor fix in hash function Created 10 years 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
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 1725 matching lines...) Expand 10 before | Expand all | Expand 10 after
1736 target->ReplaceCode(shared->code()); 1736 target->ReplaceCode(shared->code());
1737 target->shared()->set_scope_info(shared->scope_info()); 1737 target->shared()->set_scope_info(shared->scope_info());
1738 target->shared()->set_length(shared->length()); 1738 target->shared()->set_length(shared->length());
1739 target->shared()->set_formal_parameter_count( 1739 target->shared()->set_formal_parameter_count(
1740 shared->formal_parameter_count()); 1740 shared->formal_parameter_count());
1741 // Set the source code of the target function to undefined. 1741 // Set the source code of the target function to undefined.
1742 // SetCode is only used for built-in constructors like String, 1742 // SetCode is only used for built-in constructors like String,
1743 // Array, and Object, and some web code 1743 // Array, and Object, and some web code
1744 // doesn't like seeing source code for constructors. 1744 // doesn't like seeing source code for constructors.
1745 target->shared()->set_script(Heap::undefined_value()); 1745 target->shared()->set_script(Heap::undefined_value());
1746 target->shared()->code()->set_optimizable(false);
1746 // Clear the optimization hints related to the compiled code as these are no 1747 // Clear the optimization hints related to the compiled code as these are no
1747 // longer valid when the code is overwritten. 1748 // longer valid when the code is overwritten.
1748 target->shared()->ClearThisPropertyAssignmentsInfo(); 1749 target->shared()->ClearThisPropertyAssignmentsInfo();
1749 context = Handle<Context>(fun->context()); 1750 context = Handle<Context>(fun->context());
1750 1751
1751 // Make sure we get a fresh copy of the literal vector to avoid 1752 // Make sure we get a fresh copy of the literal vector to avoid
1752 // cross context contamination. 1753 // cross context contamination.
1753 int number_of_literals = fun->NumberOfLiterals(); 1754 int number_of_literals = fun->NumberOfLiterals();
1754 Handle<FixedArray> literals = 1755 Handle<FixedArray> literals =
1755 Factory::NewFixedArray(number_of_literals, TENURED); 1756 Factory::NewFixedArray(number_of_literals, TENURED);
(...skipping 4943 matching lines...) Expand 10 before | Expand all | Expand 10 after
6699 6700
6700 6701
6701 static MaybeObject* Runtime_LazyRecompile(Arguments args) { 6702 static MaybeObject* Runtime_LazyRecompile(Arguments args) {
6702 HandleScope scope; 6703 HandleScope scope;
6703 ASSERT(args.length() == 1); 6704 ASSERT(args.length() == 1);
6704 Handle<JSFunction> function = args.at<JSFunction>(0); 6705 Handle<JSFunction> function = args.at<JSFunction>(0);
6705 // If the function is not optimizable or debugger is active continue using the 6706 // If the function is not optimizable or debugger is active continue using the
6706 // code from the full compiler. 6707 // code from the full compiler.
6707 if (!function->shared()->code()->optimizable() || 6708 if (!function->shared()->code()->optimizable() ||
6708 Debug::has_break_points()) { 6709 Debug::has_break_points()) {
6710 if (FLAG_trace_opt) {
6711 PrintF("[failed to optimize ");
6712 function->PrintName();
6713 PrintF(": is code optimizable: %s, is debugger enabled: %s]\n",
6714 function->shared()->code()->optimizable() ? "T" : "F",
6715 Debug::has_break_points() ? "T" : "F");
6716 }
6709 function->ReplaceCode(function->shared()->code()); 6717 function->ReplaceCode(function->shared()->code());
6710 return function->code(); 6718 return function->code();
6711 } 6719 }
6712 if (CompileOptimized(function, AstNode::kNoNumber)) { 6720 if (CompileOptimized(function, AstNode::kNoNumber)) {
6713 return function->code(); 6721 return function->code();
6714 } 6722 }
6723 if (FLAG_trace_opt) {
6724 PrintF("[failed to optimize ");
6725 function->PrintName();
6726 PrintF(": optimized compilation failed]\n");
6727 }
6715 function->ReplaceCode(function->shared()->code()); 6728 function->ReplaceCode(function->shared()->code());
6716 return Failure::Exception(); 6729 return Failure::Exception();
6717 } 6730 }
6718 6731
6719 6732
6720 static MaybeObject* Runtime_NotifyDeoptimized(Arguments args) { 6733 static MaybeObject* Runtime_NotifyDeoptimized(Arguments args) {
6721 HandleScope scope; 6734 HandleScope scope;
6722 ASSERT(args.length() == 1); 6735 ASSERT(args.length() == 1);
6723 RUNTIME_ASSERT(args[0]->IsSmi()); 6736 RUNTIME_ASSERT(args[0]->IsSmi());
6724 Deoptimizer::BailoutType type = 6737 Deoptimizer::BailoutType type =
(...skipping 4064 matching lines...) Expand 10 before | Expand all | Expand 10 after
10789 } else { 10802 } else {
10790 // Handle last resort GC and make sure to allow future allocations 10803 // Handle last resort GC and make sure to allow future allocations
10791 // to grow the heap without causing GCs (if possible). 10804 // to grow the heap without causing GCs (if possible).
10792 Counters::gc_last_resort_from_js.Increment(); 10805 Counters::gc_last_resort_from_js.Increment();
10793 Heap::CollectAllGarbage(false); 10806 Heap::CollectAllGarbage(false);
10794 } 10807 }
10795 } 10808 }
10796 10809
10797 10810
10798 } } // namespace v8::internal 10811 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698