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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 // Required to get M_E etc. in MSVC. | 7 // Required to get M_E etc. in MSVC. |
8 #if defined(_WIN32) | 8 #if defined(_WIN32) |
9 #define _USE_MATH_DEFINES | 9 #define _USE_MATH_DEFINES |
10 #endif | 10 #endif |
(...skipping 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1752 private: | 1752 private: |
1753 DISALLOW_COPY_AND_ASSIGN(AsmWasmBuilderImpl); | 1753 DISALLOW_COPY_AND_ASSIGN(AsmWasmBuilderImpl); |
1754 }; | 1754 }; |
1755 | 1755 |
1756 AsmWasmBuilder::AsmWasmBuilder(Isolate* isolate, Zone* zone, | 1756 AsmWasmBuilder::AsmWasmBuilder(Isolate* isolate, Zone* zone, |
1757 FunctionLiteral* literal, AsmTyper* typer) | 1757 FunctionLiteral* literal, AsmTyper* typer) |
1758 : isolate_(isolate), zone_(zone), literal_(literal), typer_(typer) {} | 1758 : isolate_(isolate), zone_(zone), literal_(literal), typer_(typer) {} |
1759 | 1759 |
1760 // TODO(aseemgarg): probably should take zone (to write wasm to) as input so | 1760 // TODO(aseemgarg): probably should take zone (to write wasm to) as input so |
1761 // that zone in constructor may be thrown away once wasm module is written. | 1761 // that zone in constructor may be thrown away once wasm module is written. |
1762 WasmModuleIndex* AsmWasmBuilder::Run(i::Handle<i::FixedArray>* foreign_args) { | 1762 ZoneBuffer* AsmWasmBuilder::Run(i::Handle<i::FixedArray>* foreign_args) { |
1763 AsmWasmBuilderImpl impl(isolate_, zone_, literal_, typer_); | 1763 AsmWasmBuilderImpl impl(isolate_, zone_, literal_, typer_); |
1764 impl.Compile(); | 1764 impl.Compile(); |
1765 *foreign_args = impl.GetForeignArgs(); | 1765 *foreign_args = impl.GetForeignArgs(); |
| 1766 ZoneBuffer* buffer = new (zone_) ZoneBuffer(zone_); |
1766 WasmModuleWriter* writer = impl.builder_->Build(zone_); | 1767 WasmModuleWriter* writer = impl.builder_->Build(zone_); |
1767 return writer->WriteTo(zone_); | 1768 writer->WriteTo(*buffer); |
| 1769 return buffer; |
1768 } | 1770 } |
1769 } // namespace wasm | 1771 } // namespace wasm |
1770 } // namespace internal | 1772 } // namespace internal |
1771 } // namespace v8 | 1773 } // namespace v8 |
OLD | NEW |