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

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

Issue 857853004: Remove early bailout from Runtime_CompileOptimized. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | no next file » | 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } 42 }
43 43
44 44
45 RUNTIME_FUNCTION(Runtime_CompileOptimized) { 45 RUNTIME_FUNCTION(Runtime_CompileOptimized) {
46 HandleScope scope(isolate); 46 HandleScope scope(isolate);
47 DCHECK(args.length() == 2); 47 DCHECK(args.length() == 2);
48 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 48 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
49 CONVERT_BOOLEAN_ARG_CHECKED(concurrent, 1); 49 CONVERT_BOOLEAN_ARG_CHECKED(concurrent, 1);
50 DCHECK(isolate->use_crankshaft()); 50 DCHECK(isolate->use_crankshaft());
51 51
52 Handle<Code> unoptimized(function->shared()->code());
53 if (function->shared()->optimization_disabled()) {
54 // If the function is not optimizable continue using the code from the full
55 // compiler.
56 if (FLAG_trace_opt) {
57 OFStream os(stdout);
58 os << "[failed to optimize " << Brief(*function)
59 << ", code is not optimizable]" << std::endl;
60 }
61 function->ReplaceCode(*unoptimized);
62 return function->code();
63 }
64
65 Compiler::ConcurrencyMode mode = 52 Compiler::ConcurrencyMode mode =
66 concurrent ? Compiler::CONCURRENT : Compiler::NOT_CONCURRENT; 53 concurrent ? Compiler::CONCURRENT : Compiler::NOT_CONCURRENT;
67 Handle<Code> code; 54 Handle<Code> code;
55 Handle<Code> unoptimized(function->shared()->code());
68 if (Compiler::GetOptimizedCode(function, unoptimized, mode).ToHandle(&code)) { 56 if (Compiler::GetOptimizedCode(function, unoptimized, mode).ToHandle(&code)) {
69 // Optimization succeeded, return optimized code. 57 // Optimization succeeded, return optimized code.
70 function->ReplaceCode(*code); 58 function->ReplaceCode(*code);
71 } else { 59 } else {
72 // Optimization failed, get unoptimized code. 60 // Optimization failed, get unoptimized code.
73 if (isolate->has_pending_exception()) { // Possible stack overflow. 61 if (isolate->has_pending_exception()) { // Possible stack overflow.
74 return isolate->heap()->exception(); 62 return isolate->heap()->exception();
75 } 63 }
76 code = Handle<Code>(function->shared()->code(), isolate); 64 code = Handle<Code>(function->shared()->code(), isolate);
77 if (code->kind() != Code::FUNCTION && 65 if (code->kind() != Code::FUNCTION &&
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 DCHECK(args.smi_at(4) == SLOPPY || args.smi_at(4) == STRICT); 445 DCHECK(args.smi_at(4) == SLOPPY || args.smi_at(4) == STRICT);
458 StrictMode strict_mode = static_cast<StrictMode>(args.smi_at(4)); 446 StrictMode strict_mode = static_cast<StrictMode>(args.smi_at(4));
459 DCHECK(args[5]->IsSmi()); 447 DCHECK(args[5]->IsSmi());
460 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), 448 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(),
461 isolate); 449 isolate);
462 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, 450 return CompileGlobalEval(isolate, args.at<String>(1), outer_info,
463 args.at<Object>(3), strict_mode, args.smi_at(5)); 451 args.at<Object>(3), strict_mode, args.smi_at(5));
464 } 452 }
465 } 453 }
466 } // namespace v8::internal 454 } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698