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

Side by Side Diff: src/asmjs/asm-js.cc

Issue 2320723005: [wasm] Compilation/Instantiation pipeline works off module object (Closed)
Patch Set: rebase Created 4 years, 3 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 | src/wasm/wasm-js.h » ('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 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/asmjs/asm-js.h" 5 #include "src/asmjs/asm-js.h"
6 6
7 #include "src/api-natives.h" 7 #include "src/api-natives.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/asmjs/asm-typer.h" 9 #include "src/asmjs/asm-typer.h"
10 #include "src/asmjs/asm-wasm-builder.h" 10 #include "src/asmjs/asm-wasm-builder.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 } 194 }
195 } 195 }
196 return true; 196 return true;
197 } 197 }
198 198
199 MaybeHandle<Object> AsmJs::InstantiateAsmWasm(i::Isolate* isolate, 199 MaybeHandle<Object> AsmJs::InstantiateAsmWasm(i::Isolate* isolate,
200 Handle<FixedArray> wasm_data, 200 Handle<FixedArray> wasm_data,
201 Handle<JSArrayBuffer> memory, 201 Handle<JSArrayBuffer> memory,
202 Handle<JSReceiver> foreign) { 202 Handle<JSReceiver> foreign) {
203 i::Handle<i::JSObject> module(i::JSObject::cast(wasm_data->get(0))); 203 i::Handle<i::JSObject> module(i::JSObject::cast(wasm_data->get(0)));
204 i::Handle<i::FixedArray> compiled(
205 i::FixedArray::cast(module->GetInternalField(0)));
206 i::Handle<i::FixedArray> foreign_globals( 204 i::Handle<i::FixedArray> foreign_globals(
207 i::FixedArray::cast(wasm_data->get(1))); 205 i::FixedArray::cast(wasm_data->get(1)));
208 206
209 ErrorThrower thrower(isolate, "Asm.js -> WebAssembly instantiation"); 207 ErrorThrower thrower(isolate, "Asm.js -> WebAssembly instantiation");
210 208
211 i::MaybeHandle<i::JSObject> maybe_module_object = 209 i::MaybeHandle<i::JSObject> maybe_module_object =
212 i::wasm::WasmModule::Instantiate(isolate, compiled, foreign, memory); 210 i::wasm::WasmModule::Instantiate(isolate, module, foreign, memory);
213 if (maybe_module_object.is_null()) { 211 if (maybe_module_object.is_null()) {
214 return MaybeHandle<Object>(); 212 return MaybeHandle<Object>();
215 } 213 }
216 214
217 i::Handle<i::Name> name(isolate->factory()->InternalizeOneByteString( 215 i::Handle<i::Name> name(isolate->factory()->InternalizeOneByteString(
218 STATIC_CHAR_VECTOR("__foreign_init__"))); 216 STATIC_CHAR_VECTOR("__foreign_init__")));
219 217
220 i::Handle<i::Object> module_object = maybe_module_object.ToHandleChecked(); 218 i::Handle<i::Object> module_object = maybe_module_object.ToHandleChecked();
221 i::MaybeHandle<i::Object> maybe_init = 219 i::MaybeHandle<i::Object> maybe_init =
222 i::Object::GetProperty(module_object, name); 220 i::Object::GetProperty(module_object, name);
(...skipping 22 matching lines...) Expand all
245 isolate, init, undefined, foreign_globals->length(), foreign_args_array); 243 isolate, init, undefined, foreign_globals->length(), foreign_args_array);
246 delete[] foreign_args_array; 244 delete[] foreign_args_array;
247 245
248 DCHECK(!retval.is_null()); 246 DCHECK(!retval.is_null());
249 247
250 return maybe_module_object; 248 return maybe_module_object;
251 } 249 }
252 250
253 } // namespace internal 251 } // namespace internal
254 } // namespace v8 252 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/wasm/wasm-js.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698