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.h" | 5 #include "src/api.h" |
6 #include "src/api-natives.h" | 6 #include "src/api-natives.h" |
7 #include "src/assert-scope.h" | 7 #include "src/assert-scope.h" |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/factory.h" | 10 #include "src/factory.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 typer.set_allow_simd(true); | 119 typer.set_allow_simd(true); |
120 } | 120 } |
121 if (!typer.Validate()) { | 121 if (!typer.Validate()) { |
122 thrower->Error("Asm.js validation failed: %s", typer.error_message()); | 122 thrower->Error("Asm.js validation failed: %s", typer.error_message()); |
123 return nullptr; | 123 return nullptr; |
124 } | 124 } |
125 | 125 |
126 auto module = v8::internal::wasm::AsmWasmBuilder( | 126 auto module = v8::internal::wasm::AsmWasmBuilder( |
127 info->isolate(), info->zone(), info->literal(), foreign) | 127 info->isolate(), info->zone(), info->literal(), foreign) |
128 .Run(); | 128 .Run(); |
| 129 |
| 130 if (i::FLAG_dump_asmjs_wasm) { |
| 131 FILE* wasm_file = fopen(i::FLAG_asmjs_wasm_dumpfile, "wb"); |
| 132 if (wasm_file) { |
| 133 fwrite(module->Begin(), module->End() - module->Begin(), 1, wasm_file); |
| 134 fclose(wasm_file); |
| 135 } |
| 136 } |
| 137 |
129 return module; | 138 return module; |
130 } | 139 } |
131 | 140 |
132 | 141 |
133 void InstantiateModuleCommon(const v8::FunctionCallbackInfo<v8::Value>& args, | 142 void InstantiateModuleCommon(const v8::FunctionCallbackInfo<v8::Value>& args, |
134 const byte* start, const byte* end, | 143 const byte* start, const byte* end, |
135 ErrorThrower* thrower, bool must_decode) { | 144 ErrorThrower* thrower, bool must_decode) { |
136 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate()); | 145 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate()); |
137 | 146 |
138 i::Handle<i::JSArrayBuffer> memory = i::Handle<i::JSArrayBuffer>::null(); | 147 i::Handle<i::JSArrayBuffer> memory = i::Handle<i::JSArrayBuffer>::null(); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 if (!context->get(Context::WASM_FUNCTION_MAP_INDEX)->IsMap()) { | 282 if (!context->get(Context::WASM_FUNCTION_MAP_INDEX)->IsMap()) { |
274 Handle<Map> wasm_function_map = isolate->factory()->NewMap( | 283 Handle<Map> wasm_function_map = isolate->factory()->NewMap( |
275 JS_FUNCTION_TYPE, JSFunction::kSize + kPointerSize); | 284 JS_FUNCTION_TYPE, JSFunction::kSize + kPointerSize); |
276 wasm_function_map->set_is_callable(); | 285 wasm_function_map->set_is_callable(); |
277 context->set_wasm_function_map(*wasm_function_map); | 286 context->set_wasm_function_map(*wasm_function_map); |
278 } | 287 } |
279 } | 288 } |
280 | 289 |
281 } // namespace internal | 290 } // namespace internal |
282 } // namespace v8 | 291 } // namespace v8 |
OLD | NEW |