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 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 return isolate->heap()->false_value(); | 692 return isolate->heap()->false_value(); |
693 } | 693 } |
694 if (function->shared()->code() != | 694 if (function->shared()->code() != |
695 isolate->builtins()->builtin(Builtins::kInstantiateAsmJs)) { | 695 isolate->builtins()->builtin(Builtins::kInstantiateAsmJs)) { |
696 // Hasn't been compiled yet. | 696 // Hasn't been compiled yet. |
697 return isolate->heap()->false_value(); | 697 return isolate->heap()->false_value(); |
698 } | 698 } |
699 return isolate->heap()->true_value(); | 699 return isolate->heap()->true_value(); |
700 } | 700 } |
701 | 701 |
| 702 RUNTIME_FUNCTION(Runtime_IsWasmCode) { |
| 703 SealHandleScope shs(isolate); |
| 704 DCHECK_EQ(1, args.length()); |
| 705 CONVERT_ARG_CHECKED(JSFunction, function, 0); |
| 706 bool is_js_to_wasm = function->code()->kind() == Code::JS_TO_WASM_FUNCTION; |
| 707 return isolate->heap()->ToBoolean(is_js_to_wasm); |
| 708 } |
702 | 709 |
703 #define ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(Name) \ | 710 #define ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(Name) \ |
704 RUNTIME_FUNCTION(Runtime_Has##Name) { \ | 711 RUNTIME_FUNCTION(Runtime_Has##Name) { \ |
705 CONVERT_ARG_CHECKED(JSObject, obj, 0); \ | 712 CONVERT_ARG_CHECKED(JSObject, obj, 0); \ |
706 return isolate->heap()->ToBoolean(obj->Has##Name()); \ | 713 return isolate->heap()->ToBoolean(obj->Has##Name()); \ |
707 } | 714 } |
708 | 715 |
709 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastSmiElements) | 716 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastSmiElements) |
710 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastObjectElements) | 717 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastObjectElements) |
711 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastSmiOrObjectElements) | 718 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastSmiOrObjectElements) |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 RUNTIME_FUNCTION(Runtime_ValidateWasmOrphanedInstance) { | 823 RUNTIME_FUNCTION(Runtime_ValidateWasmOrphanedInstance) { |
817 HandleScope shs(isolate); | 824 HandleScope shs(isolate); |
818 DCHECK(args.length() == 1); | 825 DCHECK(args.length() == 1); |
819 CONVERT_ARG_HANDLE_CHECKED_2(WasmInstanceObject, instance, 0); | 826 CONVERT_ARG_HANDLE_CHECKED_2(WasmInstanceObject, instance, 0); |
820 wasm::testing::ValidateOrphanedInstance(isolate, instance); | 827 wasm::testing::ValidateOrphanedInstance(isolate, instance); |
821 return isolate->heap()->ToBoolean(true); | 828 return isolate->heap()->ToBoolean(true); |
822 } | 829 } |
823 | 830 |
824 } // namespace internal | 831 } // namespace internal |
825 } // namespace v8 | 832 } // namespace v8 |
OLD | NEW |