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

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
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 1599 matching lines...) Expand 10 before | Expand all | Expand 10 after
1610 isolate_, &script_data, wire_bytes) 1610 isolate_, &script_data, wire_bytes)
1611 .ToHandle(&compiled_part)) { 1611 .ToHandle(&compiled_part)) {
1612 return WasmModuleObject::New( 1612 return WasmModuleObject::New(
1613 isolate_, Handle<WasmCompiledModule>::cast(compiled_part)); 1613 isolate_, Handle<WasmCompiledModule>::cast(compiled_part));
1614 } 1614 }
1615 1615
1616 // If that fails, recompile. 1616 // If that fails, recompile.
1617 MaybeHandle<JSObject> result; 1617 MaybeHandle<JSObject> result;
1618 { 1618 {
1619 wasm::ErrorThrower thrower(isolate_, "ValueDeserializer::ReadWasmModule"); 1619 wasm::ErrorThrower thrower(isolate_, "ValueDeserializer::ReadWasmModule");
1620 result = wasm::CreateModuleObjectFromBytes( 1620 result = wasm::SyncCompile(isolate_, &thrower,
1621 isolate_, wire_bytes.begin(), wire_bytes.end(), &thrower, 1621 wasm::ModuleWireBytes(wire_bytes));
1622 wasm::ModuleOrigin::kWasmOrigin, Handle<Script>::null(),
1623 Vector<const byte>::empty());
1624 } 1622 }
1625 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate_, JSObject); 1623 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate_, JSObject);
1626 return result; 1624 return result;
1627 } 1625 }
1628 1626
1629 MaybeHandle<JSObject> ValueDeserializer::ReadHostObject() { 1627 MaybeHandle<JSObject> ValueDeserializer::ReadHostObject() {
1630 if (!delegate_) return MaybeHandle<JSObject>(); 1628 if (!delegate_) return MaybeHandle<JSObject>();
1631 STACK_CHECK(isolate_, MaybeHandle<JSObject>()); 1629 STACK_CHECK(isolate_, MaybeHandle<JSObject>());
1632 uint32_t id = next_id_++; 1630 uint32_t id = next_id_++;
1633 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate_); 1631 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate_);
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1929 if (stack.size() != 1) { 1927 if (stack.size() != 1) {
1930 isolate_->Throw(*isolate_->factory()->NewError( 1928 isolate_->Throw(*isolate_->factory()->NewError(
1931 MessageTemplate::kDataCloneDeserializationError)); 1929 MessageTemplate::kDataCloneDeserializationError));
1932 return MaybeHandle<Object>(); 1930 return MaybeHandle<Object>();
1933 } 1931 }
1934 return scope.CloseAndEscape(stack[0]); 1932 return scope.CloseAndEscape(stack[0]);
1935 } 1933 }
1936 1934
1937 } // namespace internal 1935 } // namespace internal
1938 } // namespace v8 1936 } // namespace v8
OLDNEW
« no previous file with comments | « src/asmjs/asm-js.cc ('k') | src/wasm/wasm-js.cc » ('j') | src/wasm/wasm-js.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698