| 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, &thrower, module, foreign, | 210 i::wasm::WasmModule::Instantiate(isolate, module, foreign, memory); |
| 211 memory); | |
| 212 if (maybe_module_object.is_null()) { | 211 if (maybe_module_object.is_null()) { |
| 213 return MaybeHandle<Object>(); | 212 return MaybeHandle<Object>(); |
| 214 } | 213 } |
| 215 | 214 |
| 216 i::Handle<i::Name> init_name(isolate->factory()->InternalizeUtf8String( | 215 i::Handle<i::Name> init_name(isolate->factory()->InternalizeUtf8String( |
| 217 wasm::AsmWasmBuilder::foreign_init_name)); | 216 wasm::AsmWasmBuilder::foreign_init_name)); |
| 218 | 217 |
| 219 i::Handle<i::Object> module_object = maybe_module_object.ToHandleChecked(); | 218 i::Handle<i::Object> module_object = maybe_module_object.ToHandleChecked(); |
| 220 i::MaybeHandle<i::Object> maybe_init = | 219 i::MaybeHandle<i::Object> maybe_init = |
| 221 i::Object::GetProperty(module_object, init_name); | 220 i::Object::GetProperty(module_object, init_name); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 252 i::Object::GetProperty(module_object, single_function_name); | 251 i::Object::GetProperty(module_object, single_function_name); |
| 253 if (!single_function.is_null() && | 252 if (!single_function.is_null() && |
| 254 !single_function.ToHandleChecked()->IsUndefined(isolate)) { | 253 !single_function.ToHandleChecked()->IsUndefined(isolate)) { |
| 255 return single_function; | 254 return single_function; |
| 256 } | 255 } |
| 257 return module_object; | 256 return module_object; |
| 258 } | 257 } |
| 259 | 258 |
| 260 } // namespace internal | 259 } // namespace internal |
| 261 } // namespace v8 | 260 } // namespace v8 |
| OLD | NEW |