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

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

Issue 2659483004: ValueSerializer: Promote scheduled exceptions from wasm::ErrorThrower. (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | no next file » | 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 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 ScriptData script_data(compiled_bytes.start(), compiled_bytes.length()); 1562 ScriptData script_data(compiled_bytes.start(), compiled_bytes.length());
1563 Handle<FixedArray> compiled_part; 1563 Handle<FixedArray> compiled_part;
1564 if (WasmCompiledModuleSerializer::DeserializeWasmModule( 1564 if (WasmCompiledModuleSerializer::DeserializeWasmModule(
1565 isolate_, &script_data, wire_bytes) 1565 isolate_, &script_data, wire_bytes)
1566 .ToHandle(&compiled_part)) { 1566 .ToHandle(&compiled_part)) {
1567 return WasmModuleObject::New( 1567 return WasmModuleObject::New(
1568 isolate_, Handle<WasmCompiledModule>::cast(compiled_part)); 1568 isolate_, Handle<WasmCompiledModule>::cast(compiled_part));
1569 } 1569 }
1570 1570
1571 // If that fails, recompile. 1571 // If that fails, recompile.
1572 wasm::ErrorThrower thrower(isolate_, "ValueDeserializer::ReadWasmModule"); 1572 MaybeHandle<JSObject> result;
1573 return wasm::CreateModuleObjectFromBytes( 1573 {
1574 isolate_, wire_bytes.begin(), wire_bytes.end(), &thrower, 1574 wasm::ErrorThrower thrower(isolate_, "ValueDeserializer::ReadWasmModule");
1575 wasm::ModuleOrigin::kWasmOrigin, Handle<Script>::null(), 1575 result = wasm::CreateModuleObjectFromBytes(
1576 Vector<const byte>::empty()); 1576 isolate_, wire_bytes.begin(), wire_bytes.end(), &thrower,
1577 wasm::ModuleOrigin::kWasmOrigin, Handle<Script>::null(),
1578 Vector<const byte>::empty());
1579 }
1580 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate_, JSObject);
1581 return result;
1577 } 1582 }
1578 1583
1579 MaybeHandle<JSObject> ValueDeserializer::ReadHostObject() { 1584 MaybeHandle<JSObject> ValueDeserializer::ReadHostObject() {
1580 if (!delegate_) return MaybeHandle<JSObject>(); 1585 if (!delegate_) return MaybeHandle<JSObject>();
1581 STACK_CHECK(isolate_, MaybeHandle<JSObject>()); 1586 STACK_CHECK(isolate_, MaybeHandle<JSObject>());
1582 uint32_t id = next_id_++; 1587 uint32_t id = next_id_++;
1583 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate_); 1588 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate_);
1584 v8::Local<v8::Object> object; 1589 v8::Local<v8::Object> object;
1585 if (!delegate_->ReadHostObject(v8_isolate).ToLocal(&object)) { 1590 if (!delegate_->ReadHostObject(v8_isolate).ToLocal(&object)) {
1586 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate_, JSObject); 1591 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate_, JSObject);
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 if (stack.size() != 1) { 1884 if (stack.size() != 1) {
1880 isolate_->Throw(*isolate_->factory()->NewError( 1885 isolate_->Throw(*isolate_->factory()->NewError(
1881 MessageTemplate::kDataCloneDeserializationError)); 1886 MessageTemplate::kDataCloneDeserializationError));
1882 return MaybeHandle<Object>(); 1887 return MaybeHandle<Object>();
1883 } 1888 }
1884 return scope.CloseAndEscape(stack[0]); 1889 return scope.CloseAndEscape(stack[0]);
1885 } 1890 }
1886 1891
1887 } // namespace internal 1892 } // namespace internal
1888 } // namespace v8 1893 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698