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 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 CHECK(Type::Is##Type(args[index])); \ | 735 CHECK(Type::Is##Type(args[index])); \ |
736 Handle<Type> name = args.at<Type>(index); | 736 Handle<Type> name = args.at<Type>(index); |
737 | 737 |
738 // Take a compiled wasm module, serialize it and copy the buffer into an array | 738 // Take a compiled wasm module, serialize it and copy the buffer into an array |
739 // buffer, which is then returned. | 739 // buffer, which is then returned. |
740 RUNTIME_FUNCTION(Runtime_SerializeWasmModule) { | 740 RUNTIME_FUNCTION(Runtime_SerializeWasmModule) { |
741 HandleScope shs(isolate); | 741 HandleScope shs(isolate); |
742 DCHECK(args.length() == 1); | 742 DCHECK(args.length() == 1); |
743 CONVERT_ARG_HANDLE_CHECKED_2(WasmModuleObject, module_obj, 0); | 743 CONVERT_ARG_HANDLE_CHECKED_2(WasmModuleObject, module_obj, 0); |
744 | 744 |
745 Handle<WasmCompiledModule> orig = handle(module_obj->get_compiled_module()); | 745 Handle<WasmCompiledModule> orig(module_obj->compiled_module()); |
746 std::unique_ptr<ScriptData> data = | 746 std::unique_ptr<ScriptData> data = |
747 WasmCompiledModuleSerializer::SerializeWasmModule(isolate, orig); | 747 WasmCompiledModuleSerializer::SerializeWasmModule(isolate, orig); |
748 void* buff = isolate->array_buffer_allocator()->Allocate(data->length()); | 748 void* buff = isolate->array_buffer_allocator()->Allocate(data->length()); |
749 Handle<JSArrayBuffer> ret = isolate->factory()->NewJSArrayBuffer(); | 749 Handle<JSArrayBuffer> ret = isolate->factory()->NewJSArrayBuffer(); |
750 JSArrayBuffer::Setup(ret, isolate, false, buff, data->length()); | 750 JSArrayBuffer::Setup(ret, isolate, false, buff, data->length()); |
751 memcpy(buff, data->data(), data->length()); | 751 memcpy(buff, data->data(), data->length()); |
752 return *ret; | 752 return *ret; |
753 } | 753 } |
754 | 754 |
755 // Take an array buffer and attempt to reconstruct a compiled wasm module. | 755 // Take an array buffer and attempt to reconstruct a compiled wasm module. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 RUNTIME_FUNCTION(Runtime_ValidateWasmOrphanedInstance) { | 810 RUNTIME_FUNCTION(Runtime_ValidateWasmOrphanedInstance) { |
811 HandleScope shs(isolate); | 811 HandleScope shs(isolate); |
812 DCHECK(args.length() == 1); | 812 DCHECK(args.length() == 1); |
813 CONVERT_ARG_HANDLE_CHECKED_2(WasmInstanceObject, instance, 0); | 813 CONVERT_ARG_HANDLE_CHECKED_2(WasmInstanceObject, instance, 0); |
814 wasm::testing::ValidateOrphanedInstance(isolate, instance); | 814 wasm::testing::ValidateOrphanedInstance(isolate, instance); |
815 return isolate->heap()->ToBoolean(true); | 815 return isolate->heap()->ToBoolean(true); |
816 } | 816 } |
817 | 817 |
818 } // namespace internal | 818 } // namespace internal |
819 } // namespace v8 | 819 } // namespace v8 |
OLD | NEW |