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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 } | 655 } |
656 | 656 |
657 | 657 |
658 RUNTIME_FUNCTION(Runtime_InNewSpace) { | 658 RUNTIME_FUNCTION(Runtime_InNewSpace) { |
659 SealHandleScope shs(isolate); | 659 SealHandleScope shs(isolate); |
660 DCHECK(args.length() == 1); | 660 DCHECK(args.length() == 1); |
661 CONVERT_ARG_CHECKED(Object, obj, 0); | 661 CONVERT_ARG_CHECKED(Object, obj, 0); |
662 return isolate->heap()->ToBoolean(isolate->heap()->InNewSpace(obj)); | 662 return isolate->heap()->ToBoolean(isolate->heap()->InNewSpace(obj)); |
663 } | 663 } |
664 | 664 |
| 665 RUNTIME_FUNCTION(Runtime_IsAsmWasmCode) { |
| 666 SealHandleScope shs(isolate); |
| 667 DCHECK(args.length() == 1); |
| 668 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
| 669 |
| 670 if (!function->shared()->HasAsmWasmData()) { |
| 671 // Doesn't have wasm data. |
| 672 return isolate->heap()->ToBoolean(false); |
| 673 } |
| 674 if (function->shared()->code() != |
| 675 isolate->builtins()->builtin(Builtins::kInstantiateAsmJs)) { |
| 676 // Hasn't been compiled yet. |
| 677 return isolate->heap()->ToBoolean(false); |
| 678 } |
| 679 return isolate->heap()->ToBoolean(true); |
| 680 } |
665 | 681 |
666 #define ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(Name) \ | 682 #define ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(Name) \ |
667 RUNTIME_FUNCTION(Runtime_Has##Name) { \ | 683 RUNTIME_FUNCTION(Runtime_Has##Name) { \ |
668 CONVERT_ARG_CHECKED(JSObject, obj, 0); \ | 684 CONVERT_ARG_CHECKED(JSObject, obj, 0); \ |
669 return isolate->heap()->ToBoolean(obj->Has##Name()); \ | 685 return isolate->heap()->ToBoolean(obj->Has##Name()); \ |
670 } | 686 } |
671 | 687 |
672 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastSmiElements) | 688 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastSmiElements) |
673 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastObjectElements) | 689 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastObjectElements) |
674 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastSmiOrObjectElements) | 690 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastSmiOrObjectElements) |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 WasmCompiledModuleSerializer::DeserializeWasmModule(isolate, &sc); | 749 WasmCompiledModuleSerializer::DeserializeWasmModule(isolate, &sc); |
734 Handle<FixedArray> compiled_module; | 750 Handle<FixedArray> compiled_module; |
735 if (!maybe_compiled_module.ToHandle(&compiled_module)) { | 751 if (!maybe_compiled_module.ToHandle(&compiled_module)) { |
736 return isolate->heap()->undefined_value(); | 752 return isolate->heap()->undefined_value(); |
737 } | 753 } |
738 return *wasm::CreateCompiledModuleObject(isolate, compiled_module); | 754 return *wasm::CreateCompiledModuleObject(isolate, compiled_module); |
739 } | 755 } |
740 | 756 |
741 } // namespace internal | 757 } // namespace internal |
742 } // namespace v8 | 758 } // namespace v8 |
OLD | NEW |