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 6982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6993 if (FLAG_trace_opt) { | 6993 if (FLAG_trace_opt) { |
6994 PrintF("[failed to optimize "); | 6994 PrintF("[failed to optimize "); |
6995 function->PrintName(); | 6995 function->PrintName(); |
6996 PrintF(": is code optimizable: %s, is debugger enabled: %s]\n", | 6996 PrintF(": is code optimizable: %s, is debugger enabled: %s]\n", |
6997 function->shared()->code()->optimizable() ? "T" : "F", | 6997 function->shared()->code()->optimizable() ? "T" : "F", |
6998 Debug::has_break_points() ? "T" : "F"); | 6998 Debug::has_break_points() ? "T" : "F"); |
6999 } | 6999 } |
7000 function->ReplaceCode(function->shared()->code()); | 7000 function->ReplaceCode(function->shared()->code()); |
7001 return function->code(); | 7001 return function->code(); |
7002 } | 7002 } |
7003 if (CompileOptimized(function, AstNode::kNoNumber)) { | 7003 if (CompileOptimized(function, AstNode::kNoNumber, KEEP_EXCEPTION)) { |
7004 return function->code(); | 7004 return function->code(); |
7005 } | 7005 } |
7006 if (FLAG_trace_opt) { | 7006 if (FLAG_trace_opt) { |
7007 PrintF("[failed to optimize "); | 7007 PrintF("[failed to optimize "); |
7008 function->PrintName(); | 7008 function->PrintName(); |
7009 PrintF(": optimized compilation failed]\n"); | 7009 PrintF(": optimized compilation failed]\n"); |
7010 } | 7010 } |
7011 function->ReplaceCode(function->shared()->code()); | 7011 function->ReplaceCode(function->shared()->code()); |
7012 return Failure::Exception(); | 7012 return Failure::Exception(); |
7013 } | 7013 } |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7162 ASSERT(ast_id != AstNode::kNoNumber); | 7162 ASSERT(ast_id != AstNode::kNoNumber); |
7163 if (FLAG_trace_osr) { | 7163 if (FLAG_trace_osr) { |
7164 PrintF("[replacing on-stack at AST id %d in ", ast_id); | 7164 PrintF("[replacing on-stack at AST id %d in ", ast_id); |
7165 function->PrintName(); | 7165 function->PrintName(); |
7166 PrintF("]\n"); | 7166 PrintF("]\n"); |
7167 } | 7167 } |
7168 | 7168 |
7169 // Try to compile the optimized code. A true return value from | 7169 // Try to compile the optimized code. A true return value from |
7170 // CompileOptimized means that compilation succeeded, not necessarily | 7170 // CompileOptimized means that compilation succeeded, not necessarily |
7171 // that optimization succeeded. | 7171 // that optimization succeeded. |
7172 if (CompileOptimized(function, ast_id) && function->IsOptimized()) { | 7172 if (CompileOptimized(function, ast_id, CLEAR_EXCEPTION) && |
Lasse Reichstein
2011/02/16 19:06:08
The exception is thrown inside TryInline. Would it
Kevin Millikin (Chromium)
2011/02/17 11:02:34
That would be good to do, but it's blocked on a re
| |
7173 function->IsOptimized()) { | |
7173 DeoptimizationInputData* data = DeoptimizationInputData::cast( | 7174 DeoptimizationInputData* data = DeoptimizationInputData::cast( |
7174 function->code()->deoptimization_data()); | 7175 function->code()->deoptimization_data()); |
7175 if (data->OsrPcOffset()->value() >= 0) { | 7176 if (data->OsrPcOffset()->value() >= 0) { |
7176 if (FLAG_trace_osr) { | 7177 if (FLAG_trace_osr) { |
7177 PrintF("[on-stack replacement offset %d in optimized code]\n", | 7178 PrintF("[on-stack replacement offset %d in optimized code]\n", |
7178 data->OsrPcOffset()->value()); | 7179 data->OsrPcOffset()->value()); |
7179 } | 7180 } |
7180 ASSERT(data->OsrAstId()->value() == ast_id); | 7181 ASSERT(data->OsrAstId()->value() == ast_id); |
7181 } else { | 7182 } else { |
7182 // We may never generate the desired OSR entry if we emit an | 7183 // We may never generate the desired OSR entry if we emit an |
(...skipping 22 matching lines...) Expand all Loading... | |
7205 // Allow OSR only at nesting level zero again. | 7206 // Allow OSR only at nesting level zero again. |
7206 unoptimized->set_allow_osr_at_loop_nesting_level(0); | 7207 unoptimized->set_allow_osr_at_loop_nesting_level(0); |
7207 | 7208 |
7208 // If the optimization attempt succeeded, return the AST id tagged as a | 7209 // If the optimization attempt succeeded, return the AST id tagged as a |
7209 // smi. This tells the builtin that we need to translate the unoptimized | 7210 // smi. This tells the builtin that we need to translate the unoptimized |
7210 // frame to an optimized one. | 7211 // frame to an optimized one. |
7211 if (succeeded) { | 7212 if (succeeded) { |
7212 ASSERT(function->code()->kind() == Code::OPTIMIZED_FUNCTION); | 7213 ASSERT(function->code()->kind() == Code::OPTIMIZED_FUNCTION); |
7213 return Smi::FromInt(ast_id); | 7214 return Smi::FromInt(ast_id); |
7214 } else { | 7215 } else { |
7216 if (function->IsMarkedForLazyRecompilation()) { | |
7217 function->set_code(function->shared()->code()); | |
7218 } | |
Lasse Reichstein
2011/02/16 19:06:08
I'm a little wary at this.
If I don't unmark the f
Kevin Millikin (Chromium)
2011/02/17 11:02:34
On the other hand, we don't really care about opti
Lasse Reichstein
2011/02/17 11:44:59
It *would* be better to catch those syntax errors
| |
7215 return Smi::FromInt(-1); | 7219 return Smi::FromInt(-1); |
7216 } | 7220 } |
7217 } | 7221 } |
7218 | 7222 |
7219 | 7223 |
7220 static MaybeObject* Runtime_GetFunctionDelegate(Arguments args) { | 7224 static MaybeObject* Runtime_GetFunctionDelegate(Arguments args) { |
7221 HandleScope scope; | 7225 HandleScope scope; |
7222 ASSERT(args.length() == 1); | 7226 ASSERT(args.length() == 1); |
7223 RUNTIME_ASSERT(!args[0]->IsJSFunction()); | 7227 RUNTIME_ASSERT(!args[0]->IsJSFunction()); |
7224 return *Execution::GetFunctionDelegate(args.at<Object>(0)); | 7228 return *Execution::GetFunctionDelegate(args.at<Object>(0)); |
(...skipping 3976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11201 } else { | 11205 } else { |
11202 // Handle last resort GC and make sure to allow future allocations | 11206 // Handle last resort GC and make sure to allow future allocations |
11203 // to grow the heap without causing GCs (if possible). | 11207 // to grow the heap without causing GCs (if possible). |
11204 Counters::gc_last_resort_from_js.Increment(); | 11208 Counters::gc_last_resort_from_js.Increment(); |
11205 Heap::CollectAllGarbage(false); | 11209 Heap::CollectAllGarbage(false); |
11206 } | 11210 } |
11207 } | 11211 } |
11208 | 11212 |
11209 | 11213 |
11210 } } // namespace v8::internal | 11214 } } // namespace v8::internal |
OLD | NEW |