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

Side by Side Diff: src/runtime/runtime-compiler.cc

Issue 844503002: Fix bug in Runtime_CompileOptimized resulting from stack overflow. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add test. Created 5 years, 11 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
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-446389.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/frames.h" 10 #include "src/frames.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 isolate->DebuggerHasBreakPoints() ? "T" : "F"); 62 isolate->DebuggerHasBreakPoints() ? "T" : "F");
63 } 63 }
64 function->ReplaceCode(*unoptimized); 64 function->ReplaceCode(*unoptimized);
65 return function->code(); 65 return function->code();
66 } 66 }
67 67
68 Compiler::ConcurrencyMode mode = 68 Compiler::ConcurrencyMode mode =
69 concurrent ? Compiler::CONCURRENT : Compiler::NOT_CONCURRENT; 69 concurrent ? Compiler::CONCURRENT : Compiler::NOT_CONCURRENT;
70 Handle<Code> code; 70 Handle<Code> code;
71 if (Compiler::GetOptimizedCode(function, unoptimized, mode).ToHandle(&code)) { 71 if (Compiler::GetOptimizedCode(function, unoptimized, mode).ToHandle(&code)) {
72 // Optimization succeeded, return optimized code.
72 function->ReplaceCode(*code); 73 function->ReplaceCode(*code);
73 } else { 74 } else {
74 function->ReplaceCode(function->shared()->code()); 75 // Optimization failed, get unoptimized code.
76 if (isolate->has_pending_exception()) { // Possible stack overflow.
77 return isolate->heap()->exception();
78 }
79 code = Handle<Code>(function->shared()->code(), isolate);
80 if (code->kind() != Code::FUNCTION &&
81 code->kind() != Code::OPTIMIZED_FUNCTION) {
82 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
83 isolate, code, Compiler::GetUnoptimizedCode(function));
84 }
85 function->ReplaceCode(*code);
75 } 86 }
76 87
77 DCHECK(function->code()->kind() == Code::FUNCTION || 88 DCHECK(function->code()->kind() == Code::FUNCTION ||
78 function->code()->kind() == Code::OPTIMIZED_FUNCTION || 89 function->code()->kind() == Code::OPTIMIZED_FUNCTION ||
79 function->IsInOptimizationQueue()); 90 function->IsInOptimizationQueue());
80 return function->code(); 91 return function->code();
81 } 92 }
82 93
83 94
84 RUNTIME_FUNCTION(Runtime_NotifyStubFailure) { 95 RUNTIME_FUNCTION(Runtime_NotifyStubFailure) {
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 DCHECK(args.smi_at(4) == SLOPPY || args.smi_at(4) == STRICT); 453 DCHECK(args.smi_at(4) == SLOPPY || args.smi_at(4) == STRICT);
443 StrictMode strict_mode = static_cast<StrictMode>(args.smi_at(4)); 454 StrictMode strict_mode = static_cast<StrictMode>(args.smi_at(4));
444 DCHECK(args[5]->IsSmi()); 455 DCHECK(args[5]->IsSmi());
445 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), 456 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(),
446 isolate); 457 isolate);
447 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, 458 return CompileGlobalEval(isolate, args.at<String>(1), outer_info,
448 args.at<Object>(3), strict_mode, args.smi_at(5)); 459 args.at<Object>(3), strict_mode, args.smi_at(5));
449 } 460 }
450 } 461 }
451 } // namespace v8::internal 462 } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-446389.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698