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 1976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1987 DISALLOW_COPY_AND_ASSIGN(AsmWasmBuilderImpl); | 1987 DISALLOW_COPY_AND_ASSIGN(AsmWasmBuilderImpl); |
1988 }; | 1988 }; |
1989 | 1989 |
1990 AsmWasmBuilder::AsmWasmBuilder(CompilationInfo* info) | 1990 AsmWasmBuilder::AsmWasmBuilder(CompilationInfo* info) |
1991 : info_(info), | 1991 : info_(info), |
1992 typer_(info->isolate(), info->zone(), info->script(), info->literal()) {} | 1992 typer_(info->isolate(), info->zone(), info->script(), info->literal()) {} |
1993 | 1993 |
1994 // TODO(aseemgarg): probably should take zone (to write wasm to) as input so | 1994 // TODO(aseemgarg): probably should take zone (to write wasm to) as input so |
1995 // that zone in constructor may be thrown away once wasm module is written. | 1995 // that zone in constructor may be thrown away once wasm module is written. |
1996 AsmWasmBuilder::Result AsmWasmBuilder::Run(Handle<FixedArray>* foreign_args) { | 1996 AsmWasmBuilder::Result AsmWasmBuilder::Run(Handle<FixedArray>* foreign_args) { |
| 1997 HistogramTimerScope asm_wasm_time_scope( |
| 1998 info_->isolate()->counters()->asm_wasm_translation_time()); |
| 1999 |
1997 Zone* zone = info_->zone(); | 2000 Zone* zone = info_->zone(); |
1998 AsmWasmBuilderImpl impl(info_->isolate(), zone, info_, | 2001 AsmWasmBuilderImpl impl(info_->isolate(), zone, info_, |
1999 info_->parse_info()->ast_value_factory(), | 2002 info_->parse_info()->ast_value_factory(), |
2000 info_->script(), info_->literal(), &typer_); | 2003 info_->script(), info_->literal(), &typer_); |
2001 bool success = impl.Build(); | 2004 bool success = impl.Build(); |
2002 *foreign_args = impl.GetForeignArgs(); | 2005 *foreign_args = impl.GetForeignArgs(); |
2003 ZoneBuffer* module_buffer = new (zone) ZoneBuffer(zone); | 2006 ZoneBuffer* module_buffer = new (zone) ZoneBuffer(zone); |
2004 impl.builder_->WriteTo(*module_buffer); | 2007 impl.builder_->WriteTo(*module_buffer); |
2005 ZoneBuffer* asm_offsets_buffer = new (zone) ZoneBuffer(zone); | 2008 ZoneBuffer* asm_offsets_buffer = new (zone) ZoneBuffer(zone); |
2006 impl.builder_->WriteAsmJsOffsetTable(*asm_offsets_buffer); | 2009 impl.builder_->WriteAsmJsOffsetTable(*asm_offsets_buffer); |
2007 return {module_buffer, asm_offsets_buffer, success}; | 2010 return {module_buffer, asm_offsets_buffer, success}; |
2008 } | 2011 } |
2009 | 2012 |
2010 const char* AsmWasmBuilder::foreign_init_name = "__foreign_init__"; | 2013 const char* AsmWasmBuilder::foreign_init_name = "__foreign_init__"; |
2011 const char* AsmWasmBuilder::single_function_name = "__single_function__"; | 2014 const char* AsmWasmBuilder::single_function_name = "__single_function__"; |
2012 | 2015 |
2013 } // namespace wasm | 2016 } // namespace wasm |
2014 } // namespace internal | 2017 } // namespace internal |
2015 } // namespace v8 | 2018 } // namespace v8 |
OLD | NEW |