[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}
This commit is contained in:
parent
0ba82511da
commit
ceb29f7c62
4
BUILD.gn
4
BUILD.gn
@ -1744,9 +1744,9 @@ v8_source_set("v8_base") {
|
||||
"src/version.h",
|
||||
"src/vm-state-inl.h",
|
||||
"src/vm-state.h",
|
||||
"src/wasm/ast-decoder.cc",
|
||||
"src/wasm/ast-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/managed.h",
|
||||
"src/wasm/module-decoder.cc",
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "src/factory.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-module.h"
|
||||
#include "src/wasm/wasm-opcodes.h"
|
||||
@ -3535,7 +3535,7 @@ SourcePositionTable* WasmCompilationUnit::BuildGraphForWasmFunction(
|
||||
|
||||
if (index >= FLAG_trace_wasm_ast_start && index < FLAG_trace_wasm_ast_end) {
|
||||
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) {
|
||||
OFStream os(stdout);
|
||||
|
@ -1283,9 +1283,9 @@
|
||||
'version.h',
|
||||
'vm-state-inl.h',
|
||||
'vm-state.h',
|
||||
'wasm/ast-decoder.cc',
|
||||
'wasm/ast-decoder.h',
|
||||
'wasm/decoder.h',
|
||||
'wasm/function-body-decoder.cc',
|
||||
'wasm/function-body-decoder.h',
|
||||
'wasm/leb-helper.h',
|
||||
'wasm/managed.h',
|
||||
'wasm/module-decoder.cc',
|
||||
|
@ -9,8 +9,8 @@
|
||||
#include "src/handles.h"
|
||||
#include "src/zone/zone-containers.h"
|
||||
|
||||
#include "src/wasm/ast-decoder.h"
|
||||
#include "src/wasm/decoder.h"
|
||||
#include "src/wasm/function-body-decoder.h"
|
||||
#include "src/wasm/wasm-module.h"
|
||||
#include "src/wasm/wasm-opcodes.h"
|
||||
|
||||
@ -101,10 +101,10 @@ enum ControlKind { kControlIf, kControlBlock, kControlLoop, kControlTry };
|
||||
struct Control {
|
||||
const byte* pc;
|
||||
ControlKind kind;
|
||||
int stack_depth; // stack height at the beginning of the construct.
|
||||
SsaEnv* end_env; // end environment for the construct.
|
||||
SsaEnv* false_env; // false environment (only for if).
|
||||
TryInfo* try_info; // Information used for compiling try statements.
|
||||
int stack_depth; // stack height at the beginning of the construct.
|
||||
SsaEnv* end_env; // end environment for the construct.
|
||||
SsaEnv* false_env; // false environment (only for if).
|
||||
TryInfo* try_info; // Information used for compiling try statements.
|
||||
int32_t previous_catch; // The previous Control (on the stack) with a catch.
|
||||
|
||||
// Values merged into the end of this control construct.
|
||||
@ -382,7 +382,7 @@ class WasmFullDecoder : public WasmDecoder {
|
||||
|
||||
bool Decode() {
|
||||
if (FLAG_wasm_code_fuzzer_gen_test) {
|
||||
PrintAstForDebugging(start_, end_);
|
||||
PrintWasmCodeForDebugging(start_, end_);
|
||||
}
|
||||
base::ElapsedTimer decode_timer;
|
||||
if (FLAG_trace_wasm_decode_time) {
|
||||
@ -462,7 +462,7 @@ class WasmFullDecoder : public WasmDecoder {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DecodeLocalDecls(AstLocalDecls& decls) {
|
||||
bool DecodeLocalDecls(BodyLocalDecls& decls) {
|
||||
DecodeLocalDecls();
|
||||
if (failed()) return false;
|
||||
decls.decls_encoded_size = pc_offset();
|
||||
@ -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) {
|
||||
AccountingAllocator allocator;
|
||||
Zone tmp(&allocator, ZONE_NAME);
|
||||
@ -1899,7 +1899,7 @@ bool DecodeLocalDecls(AstLocalDecls& decls, const byte* start,
|
||||
}
|
||||
|
||||
BytecodeIterator::BytecodeIterator(const byte* start, const byte* end,
|
||||
AstLocalDecls* decls)
|
||||
BodyLocalDecls* decls)
|
||||
: Decoder(start, end) {
|
||||
if (decls != nullptr) {
|
||||
if (DecodeLocalDecls(*decls, start, end)) {
|
||||
@ -1930,15 +1930,15 @@ unsigned OpcodeLength(const byte* pc, const byte* end) {
|
||||
return decoder.OpcodeLength(pc);
|
||||
}
|
||||
|
||||
void PrintAstForDebugging(const byte* start, const byte* end) {
|
||||
void PrintWasmCodeForDebugging(const byte* start, const byte* end) {
|
||||
AccountingAllocator allocator;
|
||||
OFStream os(stdout);
|
||||
PrintAst(&allocator, FunctionBodyForTesting(start, end), os, nullptr);
|
||||
PrintWasmCode(&allocator, FunctionBodyForTesting(start, end), os, nullptr);
|
||||
}
|
||||
|
||||
bool PrintAst(AccountingAllocator* allocator, const FunctionBody& body,
|
||||
std::ostream& os,
|
||||
std::vector<std::tuple<uint32_t, int, int>>* offset_table) {
|
||||
bool PrintWasmCode(AccountingAllocator* allocator, const FunctionBody& body,
|
||||
std::ostream& os,
|
||||
std::vector<std::tuple<uint32_t, int, int>>* offset_table) {
|
||||
Zone zone(allocator, ZONE_NAME);
|
||||
WasmFullDecoder decoder(&zone, nullptr, body);
|
||||
int line_nr = 0;
|
||||
@ -1950,7 +1950,7 @@ bool PrintAst(AccountingAllocator* allocator, const FunctionBody& body,
|
||||
}
|
||||
|
||||
// Print the local declarations.
|
||||
AstLocalDecls decls(&zone);
|
||||
BodyLocalDecls decls(&zone);
|
||||
BytecodeIterator i(body.start, body.end, &decls);
|
||||
if (body.start != i.pc() && !FLAG_wasm_code_fuzzer_gen_test) {
|
||||
os << "// locals: ";
|
||||
@ -2048,7 +2048,7 @@ bool PrintAst(AccountingAllocator* allocator, const FunctionBody& body,
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
os << std::endl;
|
||||
++line_nr;
|
||||
}
|
@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef V8_WASM_AST_DECODER_H_
|
||||
#define V8_WASM_AST_DECODER_H_
|
||||
#ifndef V8_WASM_FUNCTION_BODY_DECODER_H_
|
||||
#define V8_WASM_FUNCTION_BODY_DECODER_H_
|
||||
|
||||
#include <iterator>
|
||||
|
||||
@ -336,12 +336,12 @@ V8_EXPORT_PRIVATE DecodeResult VerifyWasmCode(AccountingAllocator* allocator,
|
||||
FunctionBody& body);
|
||||
DecodeResult BuildTFGraph(AccountingAllocator* allocator, TFBuilder* builder,
|
||||
FunctionBody& body);
|
||||
bool PrintAst(AccountingAllocator* allocator, const FunctionBody& body,
|
||||
std::ostream& os,
|
||||
std::vector<std::tuple<uint32_t, int, int>>* offset_table);
|
||||
bool PrintWasmCode(AccountingAllocator* allocator, const FunctionBody& body,
|
||||
std::ostream& os,
|
||||
std::vector<std::tuple<uint32_t, int, int>>* offset_table);
|
||||
|
||||
// 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,
|
||||
ModuleEnv* module, FunctionSig* sig,
|
||||
@ -358,7 +358,7 @@ inline DecodeResult BuildTFGraph(AccountingAllocator* allocator,
|
||||
return BuildTFGraph(allocator, builder, body);
|
||||
}
|
||||
|
||||
struct AstLocalDecls {
|
||||
struct BodyLocalDecls {
|
||||
// The size of the encoded declarations.
|
||||
uint32_t decls_encoded_size; // size of encoded declarations
|
||||
|
||||
@ -369,12 +369,12 @@ struct AstLocalDecls {
|
||||
ZoneVector<std::pair<LocalType, uint32_t>> local_types;
|
||||
|
||||
// Constructor initializes the vector.
|
||||
explicit AstLocalDecls(Zone* zone)
|
||||
explicit BodyLocalDecls(Zone* zone)
|
||||
: decls_encoded_size(0), total_local_count(0), local_types(zone) {}
|
||||
};
|
||||
|
||||
V8_EXPORT_PRIVATE bool DecodeLocalDecls(AstLocalDecls& decls, const byte* start,
|
||||
const byte* end);
|
||||
V8_EXPORT_PRIVATE bool DecodeLocalDecls(BodyLocalDecls& decls,
|
||||
const byte* start, const byte* end);
|
||||
V8_EXPORT_PRIVATE BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone,
|
||||
size_t num_locals,
|
||||
const byte* start,
|
||||
@ -444,7 +444,7 @@ class V8_EXPORT_PRIVATE BytecodeIterator : public NON_EXPORTED_BASE(Decoder) {
|
||||
// assume the bytecode starts with local declarations and decode them.
|
||||
// Otherwise, do not decode local decls.
|
||||
BytecodeIterator(const byte* start, const byte* end,
|
||||
AstLocalDecls* decls = nullptr);
|
||||
BodyLocalDecls* decls = nullptr);
|
||||
|
||||
base::iterator_range<opcode_iterator> opcodes() {
|
||||
return base::iterator_range<opcode_iterator>(opcode_iterator(pc_, end_),
|
||||
@ -476,4 +476,4 @@ class V8_EXPORT_PRIVATE BytecodeIterator : public NON_EXPORTED_BASE(Decoder) {
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
#endif // V8_WASM_AST_DECODER_H_
|
||||
#endif // V8_WASM_FUNCTION_BODY_DECODER_H_
|
@ -6,7 +6,7 @@
|
||||
#define V8_WASM_MODULE_DECODER_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-result.h"
|
||||
|
||||
|
@ -5,8 +5,8 @@
|
||||
#include "src/wasm/wasm-interpreter.h"
|
||||
|
||||
#include "src/utils.h"
|
||||
#include "src/wasm/ast-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-limits.h"
|
||||
#include "src/wasm/wasm-module.h"
|
||||
@ -721,7 +721,7 @@ class ControlTransfers : public ZoneObject {
|
||||
public:
|
||||
ControlTransferMap map_;
|
||||
|
||||
ControlTransfers(Zone* zone, AstLocalDecls* locals, const byte* start,
|
||||
ControlTransfers(Zone* zone, BodyLocalDecls* locals, const byte* start,
|
||||
const byte* end)
|
||||
: map_(zone) {
|
||||
// Represents a control flow label.
|
||||
@ -872,7 +872,7 @@ class ControlTransfers : public ZoneObject {
|
||||
// Code and metadata needed to execute a function.
|
||||
struct InterpreterCode {
|
||||
const WasmFunction* function; // wasm function
|
||||
AstLocalDecls locals; // local declarations
|
||||
BodyLocalDecls locals; // local declarations
|
||||
const byte* orig_start; // start of original code
|
||||
const byte* orig_end; // end of original code
|
||||
byte* start; // start of (maybe altered) code
|
||||
@ -938,7 +938,7 @@ class CodeMap {
|
||||
int AddFunction(const WasmFunction* function, const byte* code_start,
|
||||
const byte* code_end) {
|
||||
InterpreterCode code = {
|
||||
function, AstLocalDecls(zone_), code_start,
|
||||
function, BodyLocalDecls(zone_), code_start,
|
||||
code_end, const_cast<byte*>(code_start), const_cast<byte*>(code_end),
|
||||
nullptr};
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "src/v8.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/wasm-macro-gen.h"
|
||||
#include "src/wasm/wasm-module-builder.h"
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "src/snapshot/snapshot.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/wasm-js.h"
|
||||
#include "src/wasm/wasm-limits.h"
|
||||
|
@ -795,7 +795,7 @@ bool WasmCompiledModule::GetPossibleBreakpoints(
|
||||
WasmFunction& func = functions[func_idx];
|
||||
if (func.code_start_offset == func.code_end_offset) continue;
|
||||
|
||||
AstLocalDecls locals(&tmp);
|
||||
BodyLocalDecls locals(&tmp);
|
||||
BytecodeIterator iterator(module_start + func.code_start_offset,
|
||||
module_start + func.code_end_offset, &locals);
|
||||
DCHECK_LT(0u, locals.decls_encoded_size);
|
||||
|
@ -27,7 +27,7 @@ enum LocalTypeCode {
|
||||
// Type code for multi-value block types.
|
||||
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.
|
||||
typedef MachineRepresentation LocalType;
|
||||
const LocalType kAstStmt = MachineRepresentation::kNone;
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "src/debug/interface-types.h"
|
||||
#include "src/ostreams.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-opcodes.h"
|
||||
#include "src/zone/zone.h"
|
||||
@ -168,7 +168,7 @@ void wasm::PrintWasmText(const WasmModule *module,
|
||||
++line_nr;
|
||||
|
||||
// Print the local declarations.
|
||||
AstLocalDecls decls(&zone);
|
||||
BodyLocalDecls decls(&zone);
|
||||
Vector<const byte> func_bytes = wire_bytes.module_bytes.SubVector(
|
||||
fun->code_start_offset, fun->code_end_offset);
|
||||
BytecodeIterator i(func_bytes.begin(), func_bytes.end(), &decls);
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "src/compiler/pipeline.h"
|
||||
#include "src/compiler/wasm-compiler.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-interpreter.h"
|
||||
#include "src/wasm/wasm-js.h"
|
||||
|
@ -130,9 +130,9 @@ v8_executable("unittests") {
|
||||
"unicode-unittest.cc",
|
||||
"value-serializer-unittest.cc",
|
||||
"wasm/asm-types-unittest.cc",
|
||||
"wasm/ast-decoder-unittest.cc",
|
||||
"wasm/control-transfer-unittest.cc",
|
||||
"wasm/decoder-unittest.cc",
|
||||
"wasm/function-body-decoder-unittest.cc",
|
||||
"wasm/leb-helper-unittest.cc",
|
||||
"wasm/loop-assignment-analysis-unittest.cc",
|
||||
"wasm/module-decoder-unittest.cc",
|
||||
|
@ -130,9 +130,9 @@
|
||||
'zone/segmentpool-unittest.cc',
|
||||
'zone/zone-chunk-list-unittest.cc',
|
||||
'wasm/asm-types-unittest.cc',
|
||||
'wasm/ast-decoder-unittest.cc',
|
||||
'wasm/control-transfer-unittest.cc',
|
||||
'wasm/decoder-unittest.cc',
|
||||
'wasm/function-body-decoder-unittest.cc',
|
||||
'wasm/leb-helper-unittest.cc',
|
||||
'wasm/loop-assignment-analysis-unittest.cc',
|
||||
'wasm/module-decoder-unittest.cc',
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -11,7 +11,7 @@
|
||||
#include "src/bit-vector.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-module.h"
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#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 "test/common/wasm/test-signatures.h"
|
||||
|
Loading…
Reference in New Issue
Block a user