Commit 0acf185a authored by Stephan Herhut's avatar Stephan Herhut Committed by Commit Bot

[wasm] Move wasm::WasmName to a better header

Minor cleanup moving some types to more meaningful headers.

Bug: v8:8015
Change-Id: I99e428529f0b2d967a3c67385c80001bb0df19fa
Reviewed-on: https://chromium-review.googlesource.com/1195506Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Stephan Herhut <herhut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55511}
parent 9edbacd9
......@@ -80,10 +80,6 @@ enum class Bytecode : uint8_t;
enum class OperandScale : uint8_t;
} // namespace interpreter
namespace wasm {
class WasmCode;
}
#undef LOG
#define LOG(isolate, Call) \
do { \
......
......@@ -375,27 +375,6 @@ class Decoder {
}
};
// Reference to a string in the wire bytes.
class WireBytesRef {
public:
WireBytesRef() : WireBytesRef(0, 0) {}
WireBytesRef(uint32_t offset, uint32_t length)
: offset_(offset), length_(length) {
DCHECK_IMPLIES(offset_ == 0, length_ == 0);
DCHECK_LE(offset_, offset_ + length_); // no uint32_t overflow.
}
uint32_t offset() const { return offset_; }
uint32_t length() const { return length_; }
uint32_t end_offset() const { return offset_ + length_; }
bool is_empty() const { return length_ == 0; }
bool is_set() const { return offset_ != 0; }
private:
uint32_t offset_;
uint32_t length_;
};
#undef TRACE
} // namespace wasm
} // namespace internal
......
......@@ -9,7 +9,7 @@
#include "src/globals.h"
#include "src/handles.h"
#include "src/wasm/decoder.h"
#include "src/vector.h"
#include "src/wasm/signature-map.h"
#include "src/wasm/wasm-constants.h"
#include "src/wasm/wasm-opcodes.h"
......@@ -22,8 +22,31 @@ class WasmModuleObject;
namespace wasm {
using WasmName = Vector<const char>;
class ErrorThrower;
// Reference to a string in the wire bytes.
class WireBytesRef {
public:
WireBytesRef() : WireBytesRef(0, 0) {}
WireBytesRef(uint32_t offset, uint32_t length)
: offset_(offset), length_(length) {
DCHECK_IMPLIES(offset_ == 0, length_ == 0);
DCHECK_LE(offset_, offset_ + length_); // no uint32_t overflow.
}
uint32_t offset() const { return offset_; }
uint32_t length() const { return length_; }
uint32_t end_offset() const { return offset_ + length_; }
bool is_empty() const { return length_ == 0; }
bool is_set() const { return offset_ != 0; }
private:
uint32_t offset_;
uint32_t length_;
};
// Static representation of a wasm function.
struct WasmFunction {
FunctionSig* sig; // signature of the function.
......
......@@ -6,7 +6,6 @@
#define V8_WASM_WASM_OPCODES_H_
#include "src/globals.h"
#include "src/vector.h"
#include "src/wasm/value-type.h"
#include "src/wasm/wasm-constants.h"
......@@ -22,8 +21,6 @@ using FunctionSig = Signature<ValueType>;
std::ostream& operator<<(std::ostream& os, const FunctionSig& function);
bool IsJSCompatibleSignature(const FunctionSig* sig);
using WasmName = Vector<const char>;
// Control expressions and blocks.
#define FOREACH_CONTROL_OPCODE(V) \
V(Unreachable, 0x00, _) \
......
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