| 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 if (!v8::Promise::Resolver::New(context).ToLocal(&resolver)) return; | 241 if (!v8::Promise::Resolver::New(context).ToLocal(&resolver)) return; |
| 242 v8::ReturnValue<v8::Value> return_value = args.GetReturnValue(); | 242 v8::ReturnValue<v8::Value> return_value = args.GetReturnValue(); |
| 243 return_value.Set(resolver->GetPromise()); | 243 return_value.Set(resolver->GetPromise()); |
| 244 | 244 |
| 245 if (args.Length() < 1) { | 245 if (args.Length() < 1) { |
| 246 thrower.TypeError("Argument 0 must be a buffer source"); | 246 thrower.TypeError("Argument 0 must be a buffer source"); |
| 247 resolver->Reject(context, Utils::ToLocal(thrower.Reify())); | 247 resolver->Reject(context, Utils::ToLocal(thrower.Reify())); |
| 248 return; | 248 return; |
| 249 } | 249 } |
| 250 auto bytes = GetFirstArgumentAsBytes(args, &thrower); | 250 auto bytes = GetFirstArgumentAsBytes(args, &thrower); |
| 251 USE(bytes); |
| 251 if (!IsCompilationAllowed(i_isolate, &thrower, args[0], true)) { | 252 if (!IsCompilationAllowed(i_isolate, &thrower, args[0], true)) { |
| 252 resolver->Reject(context, Utils::ToLocal(thrower.Reify())); | 253 resolver->Reject(context, Utils::ToLocal(thrower.Reify())); |
| 253 return; | 254 return; |
| 254 } | 255 } |
| 255 i::MaybeHandle<i::JSObject> module_obj = | 256 i::MaybeHandle<i::JSObject> module_obj = |
| 256 CreateModuleObject(isolate, args[0], &thrower); | 257 CreateModuleObject(isolate, args[0], &thrower); |
| 257 | 258 |
| 258 if (thrower.error()) { | 259 if (thrower.error()) { |
| 259 resolver->Reject(context, Utils::ToLocal(thrower.Reify())); | 260 resolver->Reject(context, Utils::ToLocal(thrower.Reify())); |
| 260 } else { | 261 } else { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 287 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 288 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 288 HandleScope scope(isolate); | 289 HandleScope scope(isolate); |
| 289 ErrorThrower thrower(reinterpret_cast<i::Isolate*>(isolate), | 290 ErrorThrower thrower(reinterpret_cast<i::Isolate*>(isolate), |
| 290 "WebAssembly.Module()"); | 291 "WebAssembly.Module()"); |
| 291 | 292 |
| 292 if (args.Length() < 1) { | 293 if (args.Length() < 1) { |
| 293 thrower.TypeError("Argument 0 must be a buffer source"); | 294 thrower.TypeError("Argument 0 must be a buffer source"); |
| 294 return; | 295 return; |
| 295 } | 296 } |
| 296 auto bytes = GetFirstArgumentAsBytes(args, &thrower); | 297 auto bytes = GetFirstArgumentAsBytes(args, &thrower); |
| 298 USE(bytes); |
| 297 if (!IsCompilationAllowed(i_isolate, &thrower, args[0], false)) return; | 299 if (!IsCompilationAllowed(i_isolate, &thrower, args[0], false)) return; |
| 298 | 300 |
| 299 i::MaybeHandle<i::JSObject> module_obj = | 301 i::MaybeHandle<i::JSObject> module_obj = |
| 300 CreateModuleObject(isolate, args[0], &thrower); | 302 CreateModuleObject(isolate, args[0], &thrower); |
| 301 if (module_obj.is_null()) return; | 303 if (module_obj.is_null()) return; |
| 302 | 304 |
| 303 v8::ReturnValue<v8::Value> return_value = args.GetReturnValue(); | 305 v8::ReturnValue<v8::Value> return_value = args.GetReturnValue(); |
| 304 return_value.Set(Utils::ToLocal(module_obj.ToHandleChecked())); | 306 return_value.Set(Utils::ToLocal(module_obj.ToHandleChecked())); |
| 305 } | 307 } |
| 306 | 308 |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 i::Handle<i::Symbol> symbol(isolate->context()->wasm_memory_sym(), isolate); | 1092 i::Handle<i::Symbol> symbol(isolate->context()->wasm_memory_sym(), isolate); |
| 1091 return HasBrand(value, symbol); | 1093 return HasBrand(value, symbol); |
| 1092 } | 1094 } |
| 1093 | 1095 |
| 1094 bool WasmJs::IsWasmTableObject(Isolate* isolate, Handle<Object> value) { | 1096 bool WasmJs::IsWasmTableObject(Isolate* isolate, Handle<Object> value) { |
| 1095 i::Handle<i::Symbol> symbol(isolate->context()->wasm_table_sym(), isolate); | 1097 i::Handle<i::Symbol> symbol(isolate->context()->wasm_table_sym(), isolate); |
| 1096 return HasBrand(value, symbol); | 1098 return HasBrand(value, symbol); |
| 1097 } | 1099 } |
| 1098 } // namespace internal | 1100 } // namespace internal |
| 1099 } // namespace v8 | 1101 } // namespace v8 |
| OLD | NEW |