OLD | NEW |
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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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> foreign_globals( | 204 i::Handle<i::FixedArray> foreign_globals( |
205 i::FixedArray::cast(wasm_data->get(1))); | 205 i::FixedArray::cast(wasm_data->get(1))); |
206 | 206 |
207 ErrorThrower thrower(isolate, "Asm.js -> WebAssembly instantiation"); | 207 ErrorThrower thrower(isolate, "Asm.js -> WebAssembly instantiation"); |
208 | 208 |
209 i::MaybeHandle<i::JSObject> maybe_module_object = | 209 i::MaybeHandle<i::JSObject> maybe_module_object = |
210 i::wasm::WasmModule::Instantiate(isolate, module, foreign, memory); | 210 i::wasm::WasmModule::Instantiate(isolate, &thrower, module, foreign, |
| 211 memory); |
211 if (maybe_module_object.is_null()) { | 212 if (maybe_module_object.is_null()) { |
212 return MaybeHandle<Object>(); | 213 return MaybeHandle<Object>(); |
213 } | 214 } |
214 | 215 |
215 i::Handle<i::Name> init_name(isolate->factory()->InternalizeUtf8String( | 216 i::Handle<i::Name> init_name(isolate->factory()->InternalizeUtf8String( |
216 wasm::AsmWasmBuilder::foreign_init_name)); | 217 wasm::AsmWasmBuilder::foreign_init_name)); |
217 | 218 |
218 i::Handle<i::Object> module_object = maybe_module_object.ToHandleChecked(); | 219 i::Handle<i::Object> module_object = maybe_module_object.ToHandleChecked(); |
219 i::MaybeHandle<i::Object> maybe_init = | 220 i::MaybeHandle<i::Object> maybe_init = |
220 i::Object::GetProperty(module_object, init_name); | 221 i::Object::GetProperty(module_object, init_name); |
(...skipping 30 matching lines...) Expand all Loading... |
251 i::Object::GetProperty(module_object, single_function_name); | 252 i::Object::GetProperty(module_object, single_function_name); |
252 if (!single_function.is_null() && | 253 if (!single_function.is_null() && |
253 !single_function.ToHandleChecked()->IsUndefined(isolate)) { | 254 !single_function.ToHandleChecked()->IsUndefined(isolate)) { |
254 return single_function; | 255 return single_function; |
255 } | 256 } |
256 return module_object; | 257 return module_object; |
257 } | 258 } |
258 | 259 |
259 } // namespace internal | 260 } // namespace internal |
260 } // namespace v8 | 261 } // namespace v8 |
OLD | NEW |