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

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

Issue 2642683002: [wasm][asm.js] Store foreign init function for asm.js as internal field. (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 | src/wasm/wasm-module.cc » ('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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 foreign, NONE); 271 foreign, NONE);
272 } 272 }
273 273
274 i::MaybeHandle<i::JSObject> maybe_module_object = 274 i::MaybeHandle<i::JSObject> maybe_module_object =
275 i::wasm::WasmModule::Instantiate(isolate, &thrower, module, ffi_object, 275 i::wasm::WasmModule::Instantiate(isolate, &thrower, module, ffi_object,
276 memory); 276 memory);
277 if (maybe_module_object.is_null()) { 277 if (maybe_module_object.is_null()) {
278 return MaybeHandle<Object>(); 278 return MaybeHandle<Object>();
279 } 279 }
280 280
281 i::Handle<i::Name> init_name(isolate->factory()->InternalizeUtf8String( 281 i::Handle<i::JSObject> module_object = maybe_module_object.ToHandleChecked();
282 wasm::AsmWasmBuilder::foreign_init_name)); 282 i::Handle<i::Object> init(
283 module->GetInternalField(WasmModuleObject::kAsmForeignInit), isolate);
284 DCHECK(!init.is_null());
283 285
284 i::Handle<i::Object> module_object = maybe_module_object.ToHandleChecked();
285 i::MaybeHandle<i::Object> maybe_init =
286 i::Object::GetProperty(module_object, init_name);
287 DCHECK(!maybe_init.is_null());
288
289 i::Handle<i::Object> init = maybe_init.ToHandleChecked();
290 i::Handle<i::Object> undefined(isolate->heap()->undefined_value(), isolate); 286 i::Handle<i::Object> undefined(isolate->heap()->undefined_value(), isolate);
291 i::Handle<i::Object>* foreign_args_array = 287 i::Handle<i::Object>* foreign_args_array =
292 new i::Handle<i::Object>[foreign_globals->length()]; 288 new i::Handle<i::Object>[foreign_globals->length()];
293 for (int j = 0; j < foreign_globals->length(); j++) { 289 for (int j = 0; j < foreign_globals->length(); j++) {
294 if (!foreign.is_null()) { 290 if (!foreign.is_null()) {
295 i::MaybeHandle<i::Name> name = i::Object::ToName( 291 i::MaybeHandle<i::Name> name = i::Object::ToName(
296 isolate, i::Handle<i::Object>(foreign_globals->get(j), isolate)); 292 isolate, i::Handle<i::Object>(foreign_globals->get(j), isolate));
297 if (!name.is_null()) { 293 if (!name.is_null()) {
298 i::MaybeHandle<i::Object> val = 294 i::MaybeHandle<i::Object> val =
299 i::Object::GetProperty(foreign, name.ToHandleChecked()); 295 i::Object::GetProperty(foreign, name.ToHandleChecked());
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 message->set_error_level(v8::Isolate::kMessageInfo); 339 message->set_error_level(v8::Isolate::kMessageInfo);
344 if (!FLAG_suppress_asm_messages && FLAG_trace_asm_time) { 340 if (!FLAG_suppress_asm_messages && FLAG_trace_asm_time) {
345 MessageHandler::ReportMessage(isolate, &location, message); 341 MessageHandler::ReportMessage(isolate, &location, message);
346 } 342 }
347 343
348 return module_object; 344 return module_object;
349 } 345 }
350 346
351 } // namespace internal 347 } // namespace internal
352 } // namespace v8 348 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/wasm/wasm-module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698