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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 CONVERT_ARG_HANDLE_CHECKED(String, type, 1); | 133 CONVERT_ARG_HANDLE_CHECKED(String, type, 1); |
134 if (type->IsOneByteEqualTo(STATIC_CHAR_VECTOR("concurrent")) && | 134 if (type->IsOneByteEqualTo(STATIC_CHAR_VECTOR("concurrent")) && |
135 isolate->concurrent_recompilation_enabled()) { | 135 isolate->concurrent_recompilation_enabled()) { |
136 function->AttemptConcurrentOptimization(); | 136 function->AttemptConcurrentOptimization(); |
137 } | 137 } |
138 } | 138 } |
139 | 139 |
140 return isolate->heap()->undefined_value(); | 140 return isolate->heap()->undefined_value(); |
141 } | 141 } |
142 | 142 |
| 143 RUNTIME_FUNCTION(Runtime_InterpretFunctionOnNextCall) { |
| 144 HandleScope scope(isolate); |
| 145 DCHECK(args.length() == 1); |
| 146 CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0); |
| 147 if (!function_object->IsJSFunction()) { |
| 148 return isolate->heap()->undefined_value(); |
| 149 } |
| 150 Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); |
| 151 |
| 152 // Do not tier down if we are already on optimized code. Replacing optimized |
| 153 // code without actual deoptimization can lead to funny bugs. |
| 154 if (function->code()->kind() != Code::OPTIMIZED_FUNCTION && |
| 155 function->shared()->HasBytecodeArray()) { |
| 156 function->ReplaceCode(*isolate->builtins()->InterpreterEntryTrampoline()); |
| 157 } |
| 158 return isolate->heap()->undefined_value(); |
| 159 } |
| 160 |
| 161 RUNTIME_FUNCTION(Runtime_BaselineFunctionOnNextCall) { |
| 162 HandleScope scope(isolate); |
| 163 DCHECK(args.length() == 1); |
| 164 CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0); |
| 165 if (!function_object->IsJSFunction()) { |
| 166 return isolate->heap()->undefined_value(); |
| 167 } |
| 168 Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); |
| 169 |
| 170 // Do not tier down if we are already on optimized code. Replacing optimized |
| 171 // code without actual deoptimization can lead to funny bugs. |
| 172 if (function->code()->kind() != Code::OPTIMIZED_FUNCTION && |
| 173 function->code()->kind() != Code::FUNCTION) { |
| 174 if (function->shared()->HasBaselineCode()) { |
| 175 function->ReplaceCode(function->shared()->code()); |
| 176 } else { |
| 177 function->MarkForBaseline(); |
| 178 } |
| 179 } |
| 180 |
| 181 return isolate->heap()->undefined_value(); |
| 182 } |
143 | 183 |
144 RUNTIME_FUNCTION(Runtime_OptimizeOsr) { | 184 RUNTIME_FUNCTION(Runtime_OptimizeOsr) { |
145 HandleScope scope(isolate); | 185 HandleScope scope(isolate); |
146 DCHECK(args.length() == 0 || args.length() == 1); | 186 DCHECK(args.length() == 0 || args.length() == 1); |
147 | 187 |
148 Handle<JSFunction> function; | 188 Handle<JSFunction> function; |
149 | 189 |
150 // The optional parameter determines the frame being targeted. | 190 // The optional parameter determines the frame being targeted. |
151 int stack_depth = args.length() == 1 ? args.smi_at(0) : 0; | 191 int stack_depth = args.length() == 1 ? args.smi_at(0) : 0; |
152 | 192 |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 WasmCompiledModuleSerializer::DeserializeWasmModule(isolate, &sc); | 733 WasmCompiledModuleSerializer::DeserializeWasmModule(isolate, &sc); |
694 Handle<FixedArray> compiled_module; | 734 Handle<FixedArray> compiled_module; |
695 if (!maybe_compiled_module.ToHandle(&compiled_module)) { | 735 if (!maybe_compiled_module.ToHandle(&compiled_module)) { |
696 return isolate->heap()->undefined_value(); | 736 return isolate->heap()->undefined_value(); |
697 } | 737 } |
698 return *wasm::CreateCompiledModuleObject(isolate, compiled_module); | 738 return *wasm::CreateCompiledModuleObject(isolate, compiled_module); |
699 } | 739 } |
700 | 740 |
701 } // namespace internal | 741 } // namespace internal |
702 } // namespace v8 | 742 } // namespace v8 |
OLD | NEW |