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/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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 "Argument 0 must be a WebAssembly.Module")) { | 301 "Argument 0 must be a WebAssembly.Module")) { |
302 return; | 302 return; |
303 } | 303 } |
304 | 304 |
305 Local<Object> module_obj = Local<Object>::Cast(args[0]); | 305 Local<Object> module_obj = Local<Object>::Cast(args[0]); |
306 i::Handle<i::WasmModuleObject> i_module_obj = | 306 i::Handle<i::WasmModuleObject> i_module_obj = |
307 i::Handle<i::WasmModuleObject>::cast(v8::Utils::OpenHandle(*module_obj)); | 307 i::Handle<i::WasmModuleObject>::cast(v8::Utils::OpenHandle(*module_obj)); |
308 | 308 |
309 MaybeLocal<Value> instance = | 309 MaybeLocal<Value> instance = |
310 InstantiateModuleImpl(i_isolate, i_module_obj, args, &thrower); | 310 InstantiateModuleImpl(i_isolate, i_module_obj, args, &thrower); |
311 if (instance.IsEmpty()) return; | 311 if (instance.IsEmpty()) { |
| 312 DCHECK(thrower.error()); |
| 313 return; |
| 314 } |
312 | 315 |
313 v8::ReturnValue<v8::Value> return_value = args.GetReturnValue(); | 316 v8::ReturnValue<v8::Value> return_value = args.GetReturnValue(); |
314 return_value.Set(instance.ToLocalChecked()); | 317 return_value.Set(instance.ToLocalChecked()); |
315 } | 318 } |
316 | 319 |
317 void WebAssemblyInstantiate(const v8::FunctionCallbackInfo<v8::Value>& args) { | 320 void WebAssemblyInstantiate(const v8::FunctionCallbackInfo<v8::Value>& args) { |
318 v8::Isolate* isolate = args.GetIsolate(); | 321 v8::Isolate* isolate = args.GetIsolate(); |
319 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 322 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
320 | 323 |
321 HandleScope scope(isolate); | 324 HandleScope scope(isolate); |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 i::Handle<i::Symbol> symbol(isolate->context()->wasm_memory_sym(), isolate); | 890 i::Handle<i::Symbol> symbol(isolate->context()->wasm_memory_sym(), isolate); |
888 return HasBrand(value, symbol); | 891 return HasBrand(value, symbol); |
889 } | 892 } |
890 | 893 |
891 bool WasmJs::IsWasmTableObject(Isolate* isolate, Handle<Object> value) { | 894 bool WasmJs::IsWasmTableObject(Isolate* isolate, Handle<Object> value) { |
892 i::Handle<i::Symbol> symbol(isolate->context()->wasm_table_sym(), isolate); | 895 i::Handle<i::Symbol> symbol(isolate->context()->wasm_table_sym(), isolate); |
893 return HasBrand(value, symbol); | 896 return HasBrand(value, symbol); |
894 } | 897 } |
895 } // namespace internal | 898 } // namespace internal |
896 } // namespace v8 | 899 } // namespace v8 |
OLD | NEW |