OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/value-serializer.h" | 5 #include "src/value-serializer.h" |
6 | 6 |
7 #include <type_traits> | 7 #include <type_traits> |
8 | 8 |
9 #include "src/base/logging.h" | 9 #include "src/base/logging.h" |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 1606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1617 isolate_, &script_data, wire_bytes) | 1617 isolate_, &script_data, wire_bytes) |
1618 .ToHandle(&compiled_part)) { | 1618 .ToHandle(&compiled_part)) { |
1619 return WasmModuleObject::New( | 1619 return WasmModuleObject::New( |
1620 isolate_, Handle<WasmCompiledModule>::cast(compiled_part)); | 1620 isolate_, Handle<WasmCompiledModule>::cast(compiled_part)); |
1621 } | 1621 } |
1622 | 1622 |
1623 // If that fails, recompile. | 1623 // If that fails, recompile. |
1624 MaybeHandle<JSObject> result; | 1624 MaybeHandle<JSObject> result; |
1625 { | 1625 { |
1626 wasm::ErrorThrower thrower(isolate_, "ValueDeserializer::ReadWasmModule"); | 1626 wasm::ErrorThrower thrower(isolate_, "ValueDeserializer::ReadWasmModule"); |
1627 result = wasm::CreateModuleObjectFromBytes( | 1627 result = wasm::SyncCompile(isolate_, &thrower, |
1628 isolate_, wire_bytes.begin(), wire_bytes.end(), &thrower, | 1628 wasm::ModuleWireBytes(wire_bytes)); |
1629 wasm::ModuleOrigin::kWasmOrigin, Handle<Script>::null(), | |
1630 Vector<const byte>::empty()); | |
1631 } | 1629 } |
1632 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate_, JSObject); | 1630 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate_, JSObject); |
1633 return result; | 1631 return result; |
1634 } | 1632 } |
1635 | 1633 |
1636 MaybeHandle<JSObject> ValueDeserializer::ReadHostObject() { | 1634 MaybeHandle<JSObject> ValueDeserializer::ReadHostObject() { |
1637 if (!delegate_) return MaybeHandle<JSObject>(); | 1635 if (!delegate_) return MaybeHandle<JSObject>(); |
1638 STACK_CHECK(isolate_, MaybeHandle<JSObject>()); | 1636 STACK_CHECK(isolate_, MaybeHandle<JSObject>()); |
1639 uint32_t id = next_id_++; | 1637 uint32_t id = next_id_++; |
1640 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate_); | 1638 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate_); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1945 if (stack.size() != 1) { | 1943 if (stack.size() != 1) { |
1946 isolate_->Throw(*isolate_->factory()->NewError( | 1944 isolate_->Throw(*isolate_->factory()->NewError( |
1947 MessageTemplate::kDataCloneDeserializationError)); | 1945 MessageTemplate::kDataCloneDeserializationError)); |
1948 return MaybeHandle<Object>(); | 1946 return MaybeHandle<Object>(); |
1949 } | 1947 } |
1950 return scope.CloseAndEscape(stack[0]); | 1948 return scope.CloseAndEscape(stack[0]); |
1951 } | 1949 } |
1952 | 1950 |
1953 } // namespace internal | 1951 } // namespace internal |
1954 } // namespace v8 | 1952 } // namespace v8 |
OLD | NEW |