| 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/compiler-dispatcher/optimizing-compile-dispatcher.h" | 10 #include "src/compiler-dispatcher/optimizing-compile-dispatcher.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 RUNTIME_FUNCTION(Runtime_BaselineFunctionOnNextCall) { | 171 RUNTIME_FUNCTION(Runtime_BaselineFunctionOnNextCall) { |
| 172 HandleScope scope(isolate); | 172 HandleScope scope(isolate); |
| 173 DCHECK(args.length() == 1); | 173 DCHECK(args.length() == 1); |
| 174 CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0); | 174 CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0); |
| 175 if (!function_object->IsJSFunction()) { | 175 if (!function_object->IsJSFunction()) { |
| 176 return isolate->heap()->undefined_value(); | 176 return isolate->heap()->undefined_value(); |
| 177 } | 177 } |
| 178 Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); | 178 Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); |
| 179 | 179 |
| 180 // If function isn't compiled, compile it now. |
| 181 if (!function->shared()->is_compiled() && |
| 182 !Compiler::Compile(function, Compiler::CLEAR_EXCEPTION)) { |
| 183 return isolate->heap()->undefined_value(); |
| 184 } |
| 185 |
| 180 // Do not tier down if we are already on optimized code. Replacing optimized | 186 // Do not tier down if we are already on optimized code. Replacing optimized |
| 181 // code without actual deoptimization can lead to funny bugs. | 187 // code without actual deoptimization can lead to funny bugs. |
| 182 if (function->code()->kind() != Code::OPTIMIZED_FUNCTION && | 188 if (function->code()->kind() != Code::OPTIMIZED_FUNCTION && |
| 183 function->code()->kind() != Code::FUNCTION) { | 189 function->code()->kind() != Code::FUNCTION) { |
| 184 if (function->shared()->HasBaselineCode()) { | 190 if (function->shared()->HasBaselineCode()) { |
| 185 function->ReplaceCode(function->shared()->code()); | 191 function->ReplaceCode(function->shared()->code()); |
| 186 } else { | 192 } else { |
| 187 function->MarkForBaseline(); | 193 function->MarkForBaseline(); |
| 188 } | 194 } |
| 189 } | 195 } |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 RUNTIME_FUNCTION(Runtime_ValidateWasmOrphanedInstance) { | 816 RUNTIME_FUNCTION(Runtime_ValidateWasmOrphanedInstance) { |
| 811 HandleScope shs(isolate); | 817 HandleScope shs(isolate); |
| 812 DCHECK(args.length() == 1); | 818 DCHECK(args.length() == 1); |
| 813 CONVERT_ARG_HANDLE_CHECKED_2(WasmInstanceObject, instance, 0); | 819 CONVERT_ARG_HANDLE_CHECKED_2(WasmInstanceObject, instance, 0); |
| 814 wasm::testing::ValidateOrphanedInstance(isolate, instance); | 820 wasm::testing::ValidateOrphanedInstance(isolate, instance); |
| 815 return isolate->heap()->ToBoolean(true); | 821 return isolate->heap()->ToBoolean(true); |
| 816 } | 822 } |
| 817 | 823 |
| 818 } // namespace internal | 824 } // namespace internal |
| 819 } // namespace v8 | 825 } // namespace v8 |
| OLD | NEW |