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

Side by Side Diff: src/wasm/wasm-js.cc

Issue 2424623002: [wasm] Use a Managed<WasmModule> to hold metadata about modules. (Closed)
Patch Set: Created 4 years, 2 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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/api-natives.h" 5 #include "src/api-natives.h"
6 #include "src/api.h" 6 #include "src/api.h"
7 #include "src/asmjs/asm-js.h" 7 #include "src/asmjs/asm-js.h"
8 #include "src/asmjs/asm-typer.h" 8 #include "src/asmjs/asm-typer.h"
9 #include "src/asmjs/asm-wasm-builder.h" 9 #include "src/asmjs/asm-wasm-builder.h"
10 #include "src/assert-scope.h" 10 #include "src/assert-scope.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate()); 85 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate());
86 ErrorThrower thrower(isolate, "Wasm.verifyModule()"); 86 ErrorThrower thrower(isolate, "Wasm.verifyModule()");
87 87
88 if (args.Length() < 1) { 88 if (args.Length() < 1) {
89 thrower.TypeError("Argument 0 must be a buffer source"); 89 thrower.TypeError("Argument 0 must be a buffer source");
90 return; 90 return;
91 } 91 }
92 RawBuffer buffer = GetRawBufferSource(args[0], &thrower); 92 RawBuffer buffer = GetRawBufferSource(args[0], &thrower);
93 if (thrower.error()) return; 93 if (thrower.error()) return;
94 94
95 i::Zone zone(isolate->allocator()); 95 internal::wasm::ModuleResult result = internal::wasm::DecodeWasmModule(
96 internal::wasm::ModuleResult result = 96 isolate, buffer.start, buffer.end, true, internal::wasm::kWasmOrigin);
97 internal::wasm::DecodeWasmModule(isolate, &zone, buffer.start, buffer.end,
98 true, internal::wasm::kWasmOrigin);
99 97
100 if (result.failed()) { 98 if (result.failed()) {
101 thrower.Failed("", result); 99 thrower.Failed("", result);
102 } 100 }
103 101
104 if (result.val) delete result.val; 102 if (result.val) delete result.val;
105 } 103 }
106 104
107 void VerifyFunction(const v8::FunctionCallbackInfo<v8::Value>& args) { 105 void VerifyFunction(const v8::FunctionCallbackInfo<v8::Value>& args) {
108 HandleScope scope(args.GetIsolate()); 106 HandleScope scope(args.GetIsolate());
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 Handle<JSArrayBuffer> WasmJs::GetWasmMemoryArrayBuffer(Isolate* isolate, 752 Handle<JSArrayBuffer> WasmJs::GetWasmMemoryArrayBuffer(Isolate* isolate,
755 Handle<Object> value) { 753 Handle<Object> value) {
756 DCHECK(IsWasmMemoryObject(isolate, value)); 754 DCHECK(IsWasmMemoryObject(isolate, value));
757 Handle<Object> buf( 755 Handle<Object> buf(
758 JSObject::cast(*value)->GetInternalField(kWasmMemoryBufferFieldIndex), 756 JSObject::cast(*value)->GetInternalField(kWasmMemoryBufferFieldIndex),
759 isolate); 757 isolate);
760 return Handle<JSArrayBuffer>::cast(buf); 758 return Handle<JSArrayBuffer>::cast(buf);
761 } 759 }
762 } // namespace internal 760 } // namespace internal
763 } // namespace v8 761 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698