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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); | 120 Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); |
121 | 121 |
122 // The following condition was lifted from the DCHECK inside | 122 // The following condition was lifted from the DCHECK inside |
123 // JSFunction::MarkForOptimization(). | 123 // JSFunction::MarkForOptimization(). |
124 if (!(function->shared()->allows_lazy_compilation() || | 124 if (!(function->shared()->allows_lazy_compilation() || |
125 (function->code()->kind() == Code::FUNCTION && | 125 (function->code()->kind() == Code::FUNCTION && |
126 !function->shared()->optimization_disabled()))) { | 126 !function->shared()->optimization_disabled()))) { |
127 return isolate->heap()->undefined_value(); | 127 return isolate->heap()->undefined_value(); |
128 } | 128 } |
129 | 129 |
| 130 // If function isn't compiled, compile it now. |
| 131 if (!function->shared()->is_compiled() && |
| 132 !Compiler::Compile(function, Compiler::CLEAR_EXCEPTION)) { |
| 133 return isolate->heap()->undefined_value(); |
| 134 } |
| 135 |
130 // If the function is already optimized, just return. | 136 // If the function is already optimized, just return. |
131 if (function->IsOptimized()) return isolate->heap()->undefined_value(); | 137 if (function->IsOptimized()) return isolate->heap()->undefined_value(); |
132 | 138 |
133 function->MarkForOptimization(); | 139 function->MarkForOptimization(); |
134 | 140 |
135 Code* unoptimized = function->shared()->code(); | 141 Code* unoptimized = function->shared()->code(); |
136 if (args.length() == 2 && unoptimized->kind() == Code::FUNCTION) { | 142 if (args.length() == 2 && unoptimized->kind() == Code::FUNCTION) { |
137 CONVERT_ARG_HANDLE_CHECKED(String, type, 1); | 143 CONVERT_ARG_HANDLE_CHECKED(String, type, 1); |
138 if (type->IsOneByteEqualTo(STATIC_CHAR_VECTOR("concurrent")) && | 144 if (type->IsOneByteEqualTo(STATIC_CHAR_VECTOR("concurrent")) && |
139 isolate->concurrent_recompilation_enabled()) { | 145 isolate->concurrent_recompilation_enabled()) { |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 RUNTIME_FUNCTION(Runtime_ValidateWasmOrphanedInstance) { | 821 RUNTIME_FUNCTION(Runtime_ValidateWasmOrphanedInstance) { |
816 HandleScope shs(isolate); | 822 HandleScope shs(isolate); |
817 DCHECK(args.length() == 1); | 823 DCHECK(args.length() == 1); |
818 CONVERT_ARG_HANDLE_CHECKED_2(WasmInstanceObject, instance, 0); | 824 CONVERT_ARG_HANDLE_CHECKED_2(WasmInstanceObject, instance, 0); |
819 wasm::testing::ValidateOrphanedInstance(isolate, instance); | 825 wasm::testing::ValidateOrphanedInstance(isolate, instance); |
820 return isolate->heap()->ToBoolean(true); | 826 return isolate->heap()->ToBoolean(true); |
821 } | 827 } |
822 | 828 |
823 } // namespace internal | 829 } // namespace internal |
824 } // namespace v8 | 830 } // namespace v8 |
OLD | NEW |