Commit ceb29f7c authored by titzer's avatar titzer Committed by Commit bot

[wasm] Rename ast-decoder.* to function-body-decoder.*

Since WASM is no longer an AST :-(

R=clemensh@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2594973003
Cr-Commit-Position: refs/heads/master@{#41889}
parent 0ba82511
...@@ -1744,9 +1744,9 @@ v8_source_set("v8_base") { ...@@ -1744,9 +1744,9 @@ v8_source_set("v8_base") {
"src/version.h", "src/version.h",
"src/vm-state-inl.h", "src/vm-state-inl.h",
"src/vm-state.h", "src/vm-state.h",
"src/wasm/ast-decoder.cc",
"src/wasm/ast-decoder.h",
"src/wasm/decoder.h", "src/wasm/decoder.h",
"src/wasm/function-body-decoder.cc",
"src/wasm/function-body-decoder.h",
"src/wasm/leb-helper.h", "src/wasm/leb-helper.h",
"src/wasm/managed.h", "src/wasm/managed.h",
"src/wasm/module-decoder.cc", "src/wasm/module-decoder.cc",
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "src/factory.h" #include "src/factory.h"
#include "src/log-inl.h" #include "src/log-inl.h"
#include "src/wasm/ast-decoder.h" #include "src/wasm/function-body-decoder.h"
#include "src/wasm/wasm-limits.h" #include "src/wasm/wasm-limits.h"
#include "src/wasm/wasm-module.h" #include "src/wasm/wasm-module.h"
#include "src/wasm/wasm-opcodes.h" #include "src/wasm/wasm-opcodes.h"
...@@ -3535,7 +3535,7 @@ SourcePositionTable* WasmCompilationUnit::BuildGraphForWasmFunction( ...@@ -3535,7 +3535,7 @@ SourcePositionTable* WasmCompilationUnit::BuildGraphForWasmFunction(
if (index >= FLAG_trace_wasm_ast_start && index < FLAG_trace_wasm_ast_end) { if (index >= FLAG_trace_wasm_ast_start && index < FLAG_trace_wasm_ast_end) {
OFStream os(stdout); OFStream os(stdout);
PrintAst(isolate_->allocator(), body, os, nullptr); PrintWasmCode(isolate_->allocator(), body, os, nullptr);
} }
if (index >= FLAG_trace_wasm_text_start && index < FLAG_trace_wasm_text_end) { if (index >= FLAG_trace_wasm_text_start && index < FLAG_trace_wasm_text_end) {
OFStream os(stdout); OFStream os(stdout);
......
...@@ -1283,9 +1283,9 @@ ...@@ -1283,9 +1283,9 @@
'version.h', 'version.h',
'vm-state-inl.h', 'vm-state-inl.h',
'vm-state.h', 'vm-state.h',
'wasm/ast-decoder.cc',
'wasm/ast-decoder.h',
'wasm/decoder.h', 'wasm/decoder.h',
'wasm/function-body-decoder.cc',
'wasm/function-body-decoder.h',
'wasm/leb-helper.h', 'wasm/leb-helper.h',
'wasm/managed.h', 'wasm/managed.h',
'wasm/module-decoder.cc', 'wasm/module-decoder.cc',
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
#include "src/handles.h" #include "src/handles.h"
#include "src/zone/zone-containers.h" #include "src/zone/zone-containers.h"
#include "src/wasm/ast-decoder.h"
#include "src/wasm/decoder.h" #include "src/wasm/decoder.h"
#include "src/wasm/function-body-decoder.h"
#include "src/wasm/wasm-module.h" #include "src/wasm/wasm-module.h"
#include "src/wasm/wasm-opcodes.h" #include "src/wasm/wasm-opcodes.h"
...@@ -382,7 +382,7 @@ class WasmFullDecoder : public WasmDecoder { ...@@ -382,7 +382,7 @@ class WasmFullDecoder : public WasmDecoder {
bool Decode() { bool Decode() {
if (FLAG_wasm_code_fuzzer_gen_test) { if (FLAG_wasm_code_fuzzer_gen_test) {
PrintAstForDebugging(start_, end_); PrintWasmCodeForDebugging(start_, end_);
} }
base::ElapsedTimer decode_timer; base::ElapsedTimer decode_timer;
if (FLAG_trace_wasm_decode_time) { if (FLAG_trace_wasm_decode_time) {
...@@ -462,7 +462,7 @@ class WasmFullDecoder : public WasmDecoder { ...@@ -462,7 +462,7 @@ class WasmFullDecoder : public WasmDecoder {
return false; return false;
} }
bool DecodeLocalDecls(AstLocalDecls& decls) { bool DecodeLocalDecls(BodyLocalDecls& decls) {
DecodeLocalDecls(); DecodeLocalDecls();
if (failed()) return false; if (failed()) return false;
decls.decls_encoded_size = pc_offset(); decls.decls_encoded_size = pc_offset();
...@@ -1889,7 +1889,7 @@ class WasmFullDecoder : public WasmDecoder { ...@@ -1889,7 +1889,7 @@ class WasmFullDecoder : public WasmDecoder {
} }
}; };
bool DecodeLocalDecls(AstLocalDecls& decls, const byte* start, bool DecodeLocalDecls(BodyLocalDecls& decls, const byte* start,
const byte* end) { const byte* end) {
AccountingAllocator allocator; AccountingAllocator allocator;
Zone tmp(&allocator, ZONE_NAME); Zone tmp(&allocator, ZONE_NAME);
...@@ -1899,7 +1899,7 @@ bool DecodeLocalDecls(AstLocalDecls& decls, const byte* start, ...@@ -1899,7 +1899,7 @@ bool DecodeLocalDecls(AstLocalDecls& decls, const byte* start,
} }
BytecodeIterator::BytecodeIterator(const byte* start, const byte* end, BytecodeIterator::BytecodeIterator(const byte* start, const byte* end,
AstLocalDecls* decls) BodyLocalDecls* decls)
: Decoder(start, end) { : Decoder(start, end) {
if (decls != nullptr) { if (decls != nullptr) {
if (DecodeLocalDecls(*decls, start, end)) { if (DecodeLocalDecls(*decls, start, end)) {
...@@ -1930,13 +1930,13 @@ unsigned OpcodeLength(const byte* pc, const byte* end) { ...@@ -1930,13 +1930,13 @@ unsigned OpcodeLength(const byte* pc, const byte* end) {
return decoder.OpcodeLength(pc); return decoder.OpcodeLength(pc);
} }
void PrintAstForDebugging(const byte* start, const byte* end) { void PrintWasmCodeForDebugging(const byte* start, const byte* end) {
AccountingAllocator allocator; AccountingAllocator allocator;
OFStream os(stdout); OFStream os(stdout);
PrintAst(&allocator, FunctionBodyForTesting(start, end), os, nullptr); PrintWasmCode(&allocator, FunctionBodyForTesting(start, end), os, nullptr);
} }
bool PrintAst(AccountingAllocator* allocator, const FunctionBody& body, bool PrintWasmCode(AccountingAllocator* allocator, const FunctionBody& body,
std::ostream& os, std::ostream& os,
std::vector<std::tuple<uint32_t, int, int>>* offset_table) { std::vector<std::tuple<uint32_t, int, int>>* offset_table) {
Zone zone(allocator, ZONE_NAME); Zone zone(allocator, ZONE_NAME);
...@@ -1950,7 +1950,7 @@ bool PrintAst(AccountingAllocator* allocator, const FunctionBody& body, ...@@ -1950,7 +1950,7 @@ bool PrintAst(AccountingAllocator* allocator, const FunctionBody& body,
} }
// Print the local declarations. // Print the local declarations.
AstLocalDecls decls(&zone); BodyLocalDecls decls(&zone);
BytecodeIterator i(body.start, body.end, &decls); BytecodeIterator i(body.start, body.end, &decls);
if (body.start != i.pc() && !FLAG_wasm_code_fuzzer_gen_test) { if (body.start != i.pc() && !FLAG_wasm_code_fuzzer_gen_test) {
os << "// locals: "; os << "// locals: ";
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef V8_WASM_AST_DECODER_H_ #ifndef V8_WASM_FUNCTION_BODY_DECODER_H_
#define V8_WASM_AST_DECODER_H_ #define V8_WASM_FUNCTION_BODY_DECODER_H_
#include <iterator> #include <iterator>
...@@ -336,12 +336,12 @@ V8_EXPORT_PRIVATE DecodeResult VerifyWasmCode(AccountingAllocator* allocator, ...@@ -336,12 +336,12 @@ V8_EXPORT_PRIVATE DecodeResult VerifyWasmCode(AccountingAllocator* allocator,
FunctionBody& body); FunctionBody& body);
DecodeResult BuildTFGraph(AccountingAllocator* allocator, TFBuilder* builder, DecodeResult BuildTFGraph(AccountingAllocator* allocator, TFBuilder* builder,
FunctionBody& body); FunctionBody& body);
bool PrintAst(AccountingAllocator* allocator, const FunctionBody& body, bool PrintWasmCode(AccountingAllocator* allocator, const FunctionBody& body,
std::ostream& os, std::ostream& os,
std::vector<std::tuple<uint32_t, int, int>>* offset_table); std::vector<std::tuple<uint32_t, int, int>>* offset_table);
// A simplified form of AST printing, e.g. from a debugger. // A simplified form of AST printing, e.g. from a debugger.
void PrintAstForDebugging(const byte* start, const byte* end); void PrintWasmCodeForDebugging(const byte* start, const byte* end);
inline DecodeResult VerifyWasmCode(AccountingAllocator* allocator, inline DecodeResult VerifyWasmCode(AccountingAllocator* allocator,
ModuleEnv* module, FunctionSig* sig, ModuleEnv* module, FunctionSig* sig,
...@@ -358,7 +358,7 @@ inline DecodeResult BuildTFGraph(AccountingAllocator* allocator, ...@@ -358,7 +358,7 @@ inline DecodeResult BuildTFGraph(AccountingAllocator* allocator,
return BuildTFGraph(allocator, builder, body); return BuildTFGraph(allocator, builder, body);
} }
struct AstLocalDecls { struct BodyLocalDecls {
// The size of the encoded declarations. // The size of the encoded declarations.
uint32_t decls_encoded_size; // size of encoded declarations uint32_t decls_encoded_size; // size of encoded declarations
...@@ -369,12 +369,12 @@ struct AstLocalDecls { ...@@ -369,12 +369,12 @@ struct AstLocalDecls {
ZoneVector<std::pair<LocalType, uint32_t>> local_types; ZoneVector<std::pair<LocalType, uint32_t>> local_types;
// Constructor initializes the vector. // Constructor initializes the vector.
explicit AstLocalDecls(Zone* zone) explicit BodyLocalDecls(Zone* zone)
: decls_encoded_size(0), total_local_count(0), local_types(zone) {} : decls_encoded_size(0), total_local_count(0), local_types(zone) {}
}; };
V8_EXPORT_PRIVATE bool DecodeLocalDecls(AstLocalDecls& decls, const byte* start, V8_EXPORT_PRIVATE bool DecodeLocalDecls(BodyLocalDecls& decls,
const byte* end); const byte* start, const byte* end);
V8_EXPORT_PRIVATE BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, V8_EXPORT_PRIVATE BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone,
size_t num_locals, size_t num_locals,
const byte* start, const byte* start,
...@@ -444,7 +444,7 @@ class V8_EXPORT_PRIVATE BytecodeIterator : public NON_EXPORTED_BASE(Decoder) { ...@@ -444,7 +444,7 @@ class V8_EXPORT_PRIVATE BytecodeIterator : public NON_EXPORTED_BASE(Decoder) {
// assume the bytecode starts with local declarations and decode them. // assume the bytecode starts with local declarations and decode them.
// Otherwise, do not decode local decls. // Otherwise, do not decode local decls.
BytecodeIterator(const byte* start, const byte* end, BytecodeIterator(const byte* start, const byte* end,
AstLocalDecls* decls = nullptr); BodyLocalDecls* decls = nullptr);
base::iterator_range<opcode_iterator> opcodes() { base::iterator_range<opcode_iterator> opcodes() {
return base::iterator_range<opcode_iterator>(opcode_iterator(pc_, end_), return base::iterator_range<opcode_iterator>(opcode_iterator(pc_, end_),
...@@ -476,4 +476,4 @@ class V8_EXPORT_PRIVATE BytecodeIterator : public NON_EXPORTED_BASE(Decoder) { ...@@ -476,4 +476,4 @@ class V8_EXPORT_PRIVATE BytecodeIterator : public NON_EXPORTED_BASE(Decoder) {
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
#endif // V8_WASM_AST_DECODER_H_ #endif // V8_WASM_FUNCTION_BODY_DECODER_H_
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#define V8_WASM_MODULE_DECODER_H_ #define V8_WASM_MODULE_DECODER_H_
#include "src/globals.h" #include "src/globals.h"
#include "src/wasm/ast-decoder.h" #include "src/wasm/function-body-decoder.h"
#include "src/wasm/wasm-module.h" #include "src/wasm/wasm-module.h"
#include "src/wasm/wasm-result.h" #include "src/wasm/wasm-result.h"
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
#include "src/wasm/wasm-interpreter.h" #include "src/wasm/wasm-interpreter.h"
#include "src/utils.h" #include "src/utils.h"
#include "src/wasm/ast-decoder.h"
#include "src/wasm/decoder.h" #include "src/wasm/decoder.h"
#include "src/wasm/function-body-decoder.h"
#include "src/wasm/wasm-external-refs.h" #include "src/wasm/wasm-external-refs.h"
#include "src/wasm/wasm-limits.h" #include "src/wasm/wasm-limits.h"
#include "src/wasm/wasm-module.h" #include "src/wasm/wasm-module.h"
...@@ -721,7 +721,7 @@ class ControlTransfers : public ZoneObject { ...@@ -721,7 +721,7 @@ class ControlTransfers : public ZoneObject {
public: public:
ControlTransferMap map_; ControlTransferMap map_;
ControlTransfers(Zone* zone, AstLocalDecls* locals, const byte* start, ControlTransfers(Zone* zone, BodyLocalDecls* locals, const byte* start,
const byte* end) const byte* end)
: map_(zone) { : map_(zone) {
// Represents a control flow label. // Represents a control flow label.
...@@ -872,7 +872,7 @@ class ControlTransfers : public ZoneObject { ...@@ -872,7 +872,7 @@ class ControlTransfers : public ZoneObject {
// Code and metadata needed to execute a function. // Code and metadata needed to execute a function.
struct InterpreterCode { struct InterpreterCode {
const WasmFunction* function; // wasm function const WasmFunction* function; // wasm function
AstLocalDecls locals; // local declarations BodyLocalDecls locals; // local declarations
const byte* orig_start; // start of original code const byte* orig_start; // start of original code
const byte* orig_end; // end of original code const byte* orig_end; // end of original code
byte* start; // start of (maybe altered) code byte* start; // start of (maybe altered) code
...@@ -938,7 +938,7 @@ class CodeMap { ...@@ -938,7 +938,7 @@ class CodeMap {
int AddFunction(const WasmFunction* function, const byte* code_start, int AddFunction(const WasmFunction* function, const byte* code_start,
const byte* code_end) { const byte* code_end) {
InterpreterCode code = { InterpreterCode code = {
function, AstLocalDecls(zone_), code_start, function, BodyLocalDecls(zone_), code_start,
code_end, const_cast<byte*>(code_start), const_cast<byte*>(code_end), code_end, const_cast<byte*>(code_start), const_cast<byte*>(code_end),
nullptr}; nullptr};
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "src/v8.h" #include "src/v8.h"
#include "src/zone/zone-containers.h" #include "src/zone/zone-containers.h"
#include "src/wasm/ast-decoder.h" #include "src/wasm/function-body-decoder.h"
#include "src/wasm/leb-helper.h" #include "src/wasm/leb-helper.h"
#include "src/wasm/wasm-macro-gen.h" #include "src/wasm/wasm-macro-gen.h"
#include "src/wasm/wasm-module-builder.h" #include "src/wasm/wasm-module-builder.h"
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "src/snapshot/snapshot.h" #include "src/snapshot/snapshot.h"
#include "src/v8.h" #include "src/v8.h"
#include "src/wasm/ast-decoder.h" #include "src/wasm/function-body-decoder.h"
#include "src/wasm/module-decoder.h" #include "src/wasm/module-decoder.h"
#include "src/wasm/wasm-js.h" #include "src/wasm/wasm-js.h"
#include "src/wasm/wasm-limits.h" #include "src/wasm/wasm-limits.h"
......
...@@ -795,7 +795,7 @@ bool WasmCompiledModule::GetPossibleBreakpoints( ...@@ -795,7 +795,7 @@ bool WasmCompiledModule::GetPossibleBreakpoints(
WasmFunction& func = functions[func_idx]; WasmFunction& func = functions[func_idx];
if (func.code_start_offset == func.code_end_offset) continue; if (func.code_start_offset == func.code_end_offset) continue;
AstLocalDecls locals(&tmp); BodyLocalDecls locals(&tmp);
BytecodeIterator iterator(module_start + func.code_start_offset, BytecodeIterator iterator(module_start + func.code_start_offset,
module_start + func.code_end_offset, &locals); module_start + func.code_end_offset, &locals);
DCHECK_LT(0u, locals.decls_encoded_size); DCHECK_LT(0u, locals.decls_encoded_size);
......
...@@ -27,7 +27,7 @@ enum LocalTypeCode { ...@@ -27,7 +27,7 @@ enum LocalTypeCode {
// Type code for multi-value block types. // Type code for multi-value block types.
static const uint8_t kMultivalBlock = 0x41; static const uint8_t kMultivalBlock = 0x41;
// We reuse the internal machine type to represent WebAssembly AST types. // We reuse the internal machine type to represent WebAssembly types.
// A typedef improves readability without adding a whole new type system. // A typedef improves readability without adding a whole new type system.
typedef MachineRepresentation LocalType; typedef MachineRepresentation LocalType;
const LocalType kAstStmt = MachineRepresentation::kNone; const LocalType kAstStmt = MachineRepresentation::kNone;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "src/debug/interface-types.h" #include "src/debug/interface-types.h"
#include "src/ostreams.h" #include "src/ostreams.h"
#include "src/vector.h" #include "src/vector.h"
#include "src/wasm/ast-decoder.h" #include "src/wasm/function-body-decoder.h"
#include "src/wasm/wasm-module.h" #include "src/wasm/wasm-module.h"
#include "src/wasm/wasm-opcodes.h" #include "src/wasm/wasm-opcodes.h"
#include "src/zone/zone.h" #include "src/zone/zone.h"
...@@ -168,7 +168,7 @@ void wasm::PrintWasmText(const WasmModule *module, ...@@ -168,7 +168,7 @@ void wasm::PrintWasmText(const WasmModule *module,
++line_nr; ++line_nr;
// Print the local declarations. // Print the local declarations.
AstLocalDecls decls(&zone); BodyLocalDecls decls(&zone);
Vector<const byte> func_bytes = wire_bytes.module_bytes.SubVector( Vector<const byte> func_bytes = wire_bytes.module_bytes.SubVector(
fun->code_start_offset, fun->code_end_offset); fun->code_start_offset, fun->code_end_offset);
BytecodeIterator i(func_bytes.begin(), func_bytes.end(), &decls); BytecodeIterator i(func_bytes.begin(), func_bytes.end(), &decls);
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "src/compiler/pipeline.h" #include "src/compiler/pipeline.h"
#include "src/compiler/wasm-compiler.h" #include "src/compiler/wasm-compiler.h"
#include "src/compiler/zone-stats.h" #include "src/compiler/zone-stats.h"
#include "src/wasm/ast-decoder.h" #include "src/wasm/function-body-decoder.h"
#include "src/wasm/wasm-external-refs.h" #include "src/wasm/wasm-external-refs.h"
#include "src/wasm/wasm-interpreter.h" #include "src/wasm/wasm-interpreter.h"
#include "src/wasm/wasm-js.h" #include "src/wasm/wasm-js.h"
......
...@@ -130,9 +130,9 @@ v8_executable("unittests") { ...@@ -130,9 +130,9 @@ v8_executable("unittests") {
"unicode-unittest.cc", "unicode-unittest.cc",
"value-serializer-unittest.cc", "value-serializer-unittest.cc",
"wasm/asm-types-unittest.cc", "wasm/asm-types-unittest.cc",
"wasm/ast-decoder-unittest.cc",
"wasm/control-transfer-unittest.cc", "wasm/control-transfer-unittest.cc",
"wasm/decoder-unittest.cc", "wasm/decoder-unittest.cc",
"wasm/function-body-decoder-unittest.cc",
"wasm/leb-helper-unittest.cc", "wasm/leb-helper-unittest.cc",
"wasm/loop-assignment-analysis-unittest.cc", "wasm/loop-assignment-analysis-unittest.cc",
"wasm/module-decoder-unittest.cc", "wasm/module-decoder-unittest.cc",
......
...@@ -130,9 +130,9 @@ ...@@ -130,9 +130,9 @@
'zone/segmentpool-unittest.cc', 'zone/segmentpool-unittest.cc',
'zone/zone-chunk-list-unittest.cc', 'zone/zone-chunk-list-unittest.cc',
'wasm/asm-types-unittest.cc', 'wasm/asm-types-unittest.cc',
'wasm/ast-decoder-unittest.cc',
'wasm/control-transfer-unittest.cc', 'wasm/control-transfer-unittest.cc',
'wasm/decoder-unittest.cc', 'wasm/decoder-unittest.cc',
'wasm/function-body-decoder-unittest.cc',
'wasm/leb-helper-unittest.cc', 'wasm/leb-helper-unittest.cc',
'wasm/loop-assignment-analysis-unittest.cc', 'wasm/loop-assignment-analysis-unittest.cc',
'wasm/module-decoder-unittest.cc', 'wasm/module-decoder-unittest.cc',
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include "src/bit-vector.h" #include "src/bit-vector.h"
#include "src/objects.h" #include "src/objects.h"
#include "src/wasm/ast-decoder.h" #include "src/wasm/function-body-decoder.h"
#include "src/wasm/wasm-macro-gen.h" #include "src/wasm/wasm-macro-gen.h"
#include "src/wasm/wasm-module.h" #include "src/wasm/wasm-module.h"
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "src/v8.h" #include "src/v8.h"
#include "src/wasm/ast-decoder.h" #include "src/wasm/function-body-decoder.h"
#include "src/wasm/wasm-module-builder.h" #include "src/wasm/wasm-module-builder.h"
#include "test/common/wasm/test-signatures.h" #include "test/common/wasm/test-signatures.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment