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-wasm-builder.h" | 10 #include "src/asmjs/asm-wasm-builder.h" |
10 #include "src/asmjs/typing-asm.h" | |
11 #include "src/assert-scope.h" | 11 #include "src/assert-scope.h" |
12 #include "src/ast/ast.h" | 12 #include "src/ast/ast.h" |
13 #include "src/ast/scopes.h" | 13 #include "src/ast/scopes.h" |
14 #include "src/execution.h" | 14 #include "src/execution.h" |
15 #include "src/factory.h" | 15 #include "src/factory.h" |
16 #include "src/handles.h" | 16 #include "src/handles.h" |
17 #include "src/isolate.h" | 17 #include "src/isolate.h" |
18 #include "src/objects.h" | 18 #include "src/objects.h" |
19 #include "src/parsing/parser.h" | 19 #include "src/parsing/parser.h" |
20 | 20 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 } | 52 } |
53 | 53 |
54 if (result.val) delete result.val; | 54 if (result.val) delete result.val; |
55 return compiled_module; | 55 return compiled_module; |
56 } | 56 } |
57 | 57 |
58 } // namespace | 58 } // namespace |
59 | 59 |
60 MaybeHandle<FixedArray> AsmJs::ConvertAsmToWasm(ParseInfo* info) { | 60 MaybeHandle<FixedArray> AsmJs::ConvertAsmToWasm(ParseInfo* info) { |
61 ErrorThrower thrower(info->isolate(), "Asm.js -> WebAssembly conversion"); | 61 ErrorThrower thrower(info->isolate(), "Asm.js -> WebAssembly conversion"); |
62 AsmTyper typer(info->isolate(), info->zone(), *(info->script()), | 62 wasm::AsmTyper typer(info->isolate(), info->zone(), *(info->script()), |
63 info->literal()); | 63 info->literal()); |
64 typer.set_fixed_signature(true); | |
65 if (i::FLAG_enable_simd_asmjs) { | |
66 typer.set_allow_simd(true); | |
67 } | |
68 if (!typer.Validate()) { | 64 if (!typer.Validate()) { |
69 DCHECK(!info->isolate()->has_pending_exception()); | 65 DCHECK(!info->isolate()->has_pending_exception()); |
70 PrintF("Validation of asm.js module failed: %s", typer.error_message()); | 66 PrintF("Validation of asm.js module failed: %s", typer.error_message()); |
71 return MaybeHandle<FixedArray>(); | 67 return MaybeHandle<FixedArray>(); |
72 } | 68 } |
73 v8::internal::wasm::AsmWasmBuilder builder(info->isolate(), info->zone(), | 69 v8::internal::wasm::AsmWasmBuilder builder(info->isolate(), info->zone(), |
74 info->literal(), &typer); | 70 info->literal(), &typer); |
75 i::Handle<i::FixedArray> foreign_globals; | 71 i::Handle<i::FixedArray> foreign_globals; |
76 auto module = builder.Run(&foreign_globals); | 72 auto module = builder.Run(&foreign_globals); |
77 | 73 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 if (retval.is_null()) { | 132 if (retval.is_null()) { |
137 thrower.Error( | 133 thrower.Error( |
138 "WASM.instantiateModuleFromAsm(): foreign init function failed"); | 134 "WASM.instantiateModuleFromAsm(): foreign init function failed"); |
139 return MaybeHandle<Object>(); | 135 return MaybeHandle<Object>(); |
140 } | 136 } |
141 return maybe_module_object; | 137 return maybe_module_object; |
142 } | 138 } |
143 | 139 |
144 } // namespace internal | 140 } // namespace internal |
145 } // namespace v8 | 141 } // namespace v8 |
OLD | NEW |