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

Side by Side Diff: src/runtime.cc

Issue 6524039: Make exception be ignored when trying to optimize. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge/build-ia32
Patch Set: Changing set_code to ReplaceCode. Created 9 years, 10 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 | « src/handles.cc ('k') | test/mjsunit/regress/regress-1145.js » ('j') | 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 6982 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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) &&
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
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->ReplaceCode(function->shared()->code());
7218 }
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
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
OLDNEW
« no previous file with comments | « src/handles.cc ('k') | test/mjsunit/regress/regress-1145.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698