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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "src/assembler-inl.h" | 7 #include "src/assembler-inl.h" |
8 #include "src/base/adapters.h" | 8 #include "src/base/adapters.h" |
9 #include "src/base/atomic-utils.h" | 9 #include "src/base/atomic-utils.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2230 isolate->allow_code_gen_callback()(v8::Utils::ToLocal(context)); | 2230 isolate->allow_code_gen_callback()(v8::Utils::ToLocal(context)); |
2231 } | 2231 } |
2232 | 2232 |
2233 // TODO(clemensh): origin can be inferred from asm_js_script; remove it. | 2233 // TODO(clemensh): origin can be inferred from asm_js_script; remove it. |
2234 MaybeHandle<WasmModuleObject> wasm::CreateModuleObjectFromBytes( | 2234 MaybeHandle<WasmModuleObject> wasm::CreateModuleObjectFromBytes( |
2235 Isolate* isolate, const byte* start, const byte* end, ErrorThrower* thrower, | 2235 Isolate* isolate, const byte* start, const byte* end, ErrorThrower* thrower, |
2236 ModuleOrigin origin, Handle<Script> asm_js_script, | 2236 ModuleOrigin origin, Handle<Script> asm_js_script, |
2237 Vector<const byte> asm_js_offset_table_bytes) { | 2237 Vector<const byte> asm_js_offset_table_bytes) { |
2238 MaybeHandle<WasmModuleObject> nothing; | 2238 MaybeHandle<WasmModuleObject> nothing; |
2239 | 2239 |
2240 if (!IsWasmCodegenAllowed(isolate, isolate->native_context())) { | 2240 if (origin != kAsmJsOrigin && |
| 2241 !IsWasmCodegenAllowed(isolate, isolate->native_context())) { |
2241 thrower->CompileError("Wasm code generation disallowed in this context"); | 2242 thrower->CompileError("Wasm code generation disallowed in this context"); |
2242 return nothing; | 2243 return nothing; |
2243 } | 2244 } |
2244 | 2245 |
2245 ModuleResult result = DecodeWasmModule(isolate, start, end, false, origin); | 2246 ModuleResult result = DecodeWasmModule(isolate, start, end, false, origin); |
2246 if (result.failed()) { | 2247 if (result.failed()) { |
2247 if (result.val) delete result.val; | 2248 if (result.val) delete result.val; |
2248 thrower->CompileFailed("Wasm decoding failed", result); | 2249 thrower->CompileFailed("Wasm decoding failed", result); |
2249 return nothing; | 2250 return nothing; |
2250 } | 2251 } |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2681 | 2682 |
2682 JSObject::AddProperty(entry, name_string, export_name.ToHandleChecked(), | 2683 JSObject::AddProperty(entry, name_string, export_name.ToHandleChecked(), |
2683 NONE); | 2684 NONE); |
2684 JSObject::AddProperty(entry, kind_string, export_kind, NONE); | 2685 JSObject::AddProperty(entry, kind_string, export_kind, NONE); |
2685 | 2686 |
2686 storage->set(index, *entry); | 2687 storage->set(index, *entry); |
2687 } | 2688 } |
2688 | 2689 |
2689 return array_object; | 2690 return array_object; |
2690 } | 2691 } |
OLD | NEW |