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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 if (!typer.Validate()) { | 145 if (!typer.Validate()) { |
146 thrower->Error("Asm.js validation failed: %s", typer.error_message()); | 146 thrower->Error("Asm.js validation failed: %s", typer.error_message()); |
147 return nullptr; | 147 return nullptr; |
148 } | 148 } |
149 | 149 |
150 auto module = | 150 auto module = |
151 v8::internal::wasm::AsmWasmBuilder(info->isolate(), info->zone(), | 151 v8::internal::wasm::AsmWasmBuilder(info->isolate(), info->zone(), |
152 info->literal(), foreign, &typer) | 152 info->literal(), foreign, &typer) |
153 .Run(); | 153 .Run(); |
154 | 154 |
155 if (i::FLAG_dump_asmjs_wasm) { | |
156 FILE* wasm_file = fopen(i::FLAG_asmjs_wasm_dumpfile, "wb"); | |
157 if (wasm_file) { | |
158 fwrite(module->Begin(), module->End() - module->Begin(), 1, wasm_file); | |
159 fclose(wasm_file); | |
160 } | |
161 } | |
162 | |
163 return module; | 155 return module; |
164 } | 156 } |
165 | 157 |
166 void InstantiateModuleCommon(const v8::FunctionCallbackInfo<v8::Value>& args, | 158 void InstantiateModuleCommon(const v8::FunctionCallbackInfo<v8::Value>& args, |
167 const byte* start, const byte* end, | 159 const byte* start, const byte* end, |
168 ErrorThrower* thrower, | 160 ErrorThrower* thrower, |
169 internal::wasm::ModuleOrigin origin) { | 161 internal::wasm::ModuleOrigin origin) { |
170 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate()); | 162 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate()); |
171 | 163 |
172 i::Handle<i::JSArrayBuffer> memory = i::Handle<i::JSArrayBuffer>::null(); | 164 i::Handle<i::JSArrayBuffer> memory = i::Handle<i::JSArrayBuffer>::null(); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 int unused_property_fields = in_object_properties - pre_allocated; | 317 int unused_property_fields = in_object_properties - pre_allocated; |
326 Handle<Map> map = Map::CopyInitialMap( | 318 Handle<Map> map = Map::CopyInitialMap( |
327 prev_map, instance_size, in_object_properties, unused_property_fields); | 319 prev_map, instance_size, in_object_properties, unused_property_fields); |
328 | 320 |
329 context->set_wasm_function_map(*map); | 321 context->set_wasm_function_map(*map); |
330 } | 322 } |
331 } | 323 } |
332 | 324 |
333 } // namespace internal | 325 } // namespace internal |
334 } // namespace v8 | 326 } // namespace v8 |
OLD | NEW |