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

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

Issue 2424623002: [wasm] Use a Managed<WasmModule> to hold metadata about modules. (Closed)
Patch Set: Review comments 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate()); 88 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate());
89 ErrorThrower thrower(isolate, "Wasm.verifyModule()"); 89 ErrorThrower thrower(isolate, "Wasm.verifyModule()");
90 90
91 if (args.Length() < 1) { 91 if (args.Length() < 1) {
92 thrower.TypeError("Argument 0 must be a buffer source"); 92 thrower.TypeError("Argument 0 must be a buffer source");
93 return; 93 return;
94 } 94 }
95 RawBuffer buffer = GetRawBufferSource(args[0], &thrower); 95 RawBuffer buffer = GetRawBufferSource(args[0], &thrower);
96 if (thrower.error()) return; 96 if (thrower.error()) return;
97 97
98 i::Zone zone(isolate->allocator(), ZONE_NAME); 98 internal::wasm::ModuleResult result = internal::wasm::DecodeWasmModule(
99 internal::wasm::ModuleResult result = 99 isolate, buffer.start, buffer.end, true, internal::wasm::kWasmOrigin);
100 internal::wasm::DecodeWasmModule(isolate, &zone, buffer.start, buffer.end,
101 true, internal::wasm::kWasmOrigin);
102 100
103 if (result.failed()) { 101 if (result.failed()) {
104 thrower.CompileFailed("", result); 102 thrower.CompileFailed("", result);
105 } 103 }
106 104
107 if (result.val) delete result.val; 105 if (result.val) delete result.val;
108 } 106 }
109 107
110 void VerifyFunction(const v8::FunctionCallbackInfo<v8::Value>& args) { 108 void VerifyFunction(const v8::FunctionCallbackInfo<v8::Value>& args) {
111 HandleScope scope(args.GetIsolate()); 109 HandleScope scope(args.GetIsolate());
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 Handle<JSArrayBuffer> WasmJs::GetWasmMemoryArrayBuffer(Isolate* isolate, 909 Handle<JSArrayBuffer> WasmJs::GetWasmMemoryArrayBuffer(Isolate* isolate,
912 Handle<Object> value) { 910 Handle<Object> value) {
913 DCHECK(IsWasmMemoryObject(isolate, value)); 911 DCHECK(IsWasmMemoryObject(isolate, value));
914 Handle<Object> buf( 912 Handle<Object> buf(
915 JSObject::cast(*value)->GetInternalField(kWasmMemoryBufferFieldIndex), 913 JSObject::cast(*value)->GetInternalField(kWasmMemoryBufferFieldIndex),
916 isolate); 914 isolate);
917 return Handle<JSArrayBuffer>::cast(buf); 915 return Handle<JSArrayBuffer>::cast(buf);
918 } 916 }
919 } // namespace internal 917 } // namespace internal
920 } // namespace v8 918 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698