Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: src/value-serializer.cc

Issue 2695813005: [wasm] Split the compilation and instantiation API into sync and async methods. (Closed)
Patch Set: [wasm] Split the compilation and instantiation API into sync and async methods. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/asmjs/asm-js.cc ('k') | src/wasm/wasm-js.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/asmjs/asm-js.cc ('k') | src/wasm/wasm-js.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698