OLD | NEW |
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 29 matching lines...) Expand all Loading... |
40 function->ReplaceCode(*code); | 40 function->ReplaceCode(*code); |
41 return *code; | 41 return *code; |
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 | 51 |
51 Handle<Code> unoptimized(function->shared()->code()); | 52 Handle<Code> unoptimized(function->shared()->code()); |
52 if (!isolate->use_crankshaft() || | 53 if (function->shared()->optimization_disabled() || |
53 function->shared()->optimization_disabled() || | |
54 isolate->DebuggerHasBreakPoints()) { | 54 isolate->DebuggerHasBreakPoints()) { |
55 // If the function is not optimizable or debugger is active continue | 55 // If the function is not optimizable or debugger is active continue |
56 // using the code from the full compiler. | 56 // using the code from the full compiler. |
57 if (FLAG_trace_opt) { | 57 if (FLAG_trace_opt) { |
58 PrintF("[failed to optimize "); | 58 PrintF("[failed to optimize "); |
59 function->PrintName(); | 59 function->PrintName(); |
60 PrintF(": is code optimizable: %s, is debugger enabled: %s]\n", | 60 PrintF(": is code optimizable: %s, is debugger enabled: %s]\n", |
61 function->shared()->optimization_disabled() ? "F" : "T", | 61 function->shared()->optimization_disabled() ? "F" : "T", |
62 isolate->DebuggerHasBreakPoints() ? "T" : "F"); | 62 isolate->DebuggerHasBreakPoints() ? "T" : "F"); |
63 } | 63 } |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 } | 169 } |
170 | 170 |
171 return isolate->heap()->undefined_value(); | 171 return isolate->heap()->undefined_value(); |
172 } | 172 } |
173 | 173 |
174 | 174 |
175 static bool IsSuitableForOnStackReplacement(Isolate* isolate, | 175 static bool IsSuitableForOnStackReplacement(Isolate* isolate, |
176 Handle<JSFunction> function, | 176 Handle<JSFunction> function, |
177 Handle<Code> current_code) { | 177 Handle<Code> current_code) { |
178 // Keep track of whether we've succeeded in optimizing. | 178 // Keep track of whether we've succeeded in optimizing. |
179 if (!isolate->use_crankshaft() || !current_code->optimizable()) return false; | 179 if (!current_code->optimizable()) return false; |
180 // If we are trying to do OSR when there are already optimized | 180 // If we are trying to do OSR when there are already optimized |
181 // activations of the function, it means (a) the function is directly or | 181 // activations of the function, it means (a) the function is directly or |
182 // indirectly recursive and (b) an optimized invocation has been | 182 // indirectly recursive and (b) an optimized invocation has been |
183 // deoptimized so that we are currently in an unoptimized activation. | 183 // deoptimized so that we are currently in an unoptimized activation. |
184 // Check for optimized activations of this function. | 184 // Check for optimized activations of this function. |
185 for (JavaScriptFrameIterator it(isolate); !it.done(); it.Advance()) { | 185 for (JavaScriptFrameIterator it(isolate); !it.done(); it.Advance()) { |
186 JavaScriptFrame* frame = it.frame(); | 186 JavaScriptFrame* frame = it.frame(); |
187 if (frame->is_optimized() && frame->function() == *function) return false; | 187 if (frame->is_optimized() && frame->function() == *function) return false; |
188 } | 188 } |
189 | 189 |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 DCHECK(args.smi_at(4) == SLOPPY || args.smi_at(4) == STRICT); | 442 DCHECK(args.smi_at(4) == SLOPPY || args.smi_at(4) == STRICT); |
443 StrictMode strict_mode = static_cast<StrictMode>(args.smi_at(4)); | 443 StrictMode strict_mode = static_cast<StrictMode>(args.smi_at(4)); |
444 DCHECK(args[5]->IsSmi()); | 444 DCHECK(args[5]->IsSmi()); |
445 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), | 445 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), |
446 isolate); | 446 isolate); |
447 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, | 447 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, |
448 args.at<Object>(3), strict_mode, args.smi_at(5)); | 448 args.at<Object>(3), strict_mode, args.smi_at(5)); |
449 } | 449 } |
450 } | 450 } |
451 } // namespace v8::internal | 451 } // namespace v8::internal |
OLD | NEW |