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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 152 |
153 if (args.Length() < 1) { | 153 if (args.Length() < 1) { |
154 thrower.TypeError("Argument 0 must be a buffer source"); | 154 thrower.TypeError("Argument 0 must be a buffer source"); |
155 return; | 155 return; |
156 } | 156 } |
157 | 157 |
158 v8::ReturnValue<v8::Value> return_value = args.GetReturnValue(); | 158 v8::ReturnValue<v8::Value> return_value = args.GetReturnValue(); |
159 if (ValidateModule(isolate, args[0], &thrower)) { | 159 if (ValidateModule(isolate, args[0], &thrower)) { |
160 return_value.Set(v8::True(isolate)); | 160 return_value.Set(v8::True(isolate)); |
161 } else { | 161 } else { |
| 162 if (thrower.wasm_error()) thrower.Reify(); // Clear error. |
162 return_value.Set(v8::False(isolate)); | 163 return_value.Set(v8::False(isolate)); |
163 } | 164 } |
164 } | 165 } |
165 | 166 |
166 void WebAssemblyModule(const v8::FunctionCallbackInfo<v8::Value>& args) { | 167 void WebAssemblyModule(const v8::FunctionCallbackInfo<v8::Value>& args) { |
167 v8::Isolate* isolate = args.GetIsolate(); | 168 v8::Isolate* isolate = args.GetIsolate(); |
168 HandleScope scope(isolate); | 169 HandleScope scope(isolate); |
169 ErrorThrower thrower(reinterpret_cast<i::Isolate*>(isolate), | 170 ErrorThrower thrower(reinterpret_cast<i::Isolate*>(isolate), |
170 "WebAssembly.Module()"); | 171 "WebAssembly.Module()"); |
171 | 172 |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
903 i::Handle<i::Symbol> symbol(isolate->context()->wasm_memory_sym(), isolate); | 904 i::Handle<i::Symbol> symbol(isolate->context()->wasm_memory_sym(), isolate); |
904 return HasBrand(value, symbol); | 905 return HasBrand(value, symbol); |
905 } | 906 } |
906 | 907 |
907 bool WasmJs::IsWasmTableObject(Isolate* isolate, Handle<Object> value) { | 908 bool WasmJs::IsWasmTableObject(Isolate* isolate, Handle<Object> value) { |
908 i::Handle<i::Symbol> symbol(isolate->context()->wasm_table_sym(), isolate); | 909 i::Handle<i::Symbol> symbol(isolate->context()->wasm_table_sym(), isolate); |
909 return HasBrand(value, symbol); | 910 return HasBrand(value, symbol); |
910 } | 911 } |
911 } // namespace internal | 912 } // namespace internal |
912 } // namespace v8 | 913 } // namespace v8 |
OLD | NEW |