Commit 8b2a3221 authored by Jakob Kummerow's avatar Jakob Kummerow Committed by Commit Bot

[cleanup][wasm] Move local functions to anonymous namespaces

in wasm-compiler.cc.

Bug: v8:10506
Change-Id: I056344d64a58a53db46540f958dc4256243e0547
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2196342
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67747}
parent 723cf685
...@@ -1161,8 +1161,9 @@ Node* WasmGraphBuilder::MaskShiftCount64(Node* node) { ...@@ -1161,8 +1161,9 @@ Node* WasmGraphBuilder::MaskShiftCount64(Node* node) {
return node; return node;
} }
static bool ReverseBytesSupported(MachineOperatorBuilder* m, namespace {
size_t size_in_bytes) {
bool ReverseBytesSupported(MachineOperatorBuilder* m, size_t size_in_bytes) {
switch (size_in_bytes) { switch (size_in_bytes) {
case 4: case 4:
case 16: case 16:
...@@ -1175,6 +1176,8 @@ static bool ReverseBytesSupported(MachineOperatorBuilder* m, ...@@ -1175,6 +1176,8 @@ static bool ReverseBytesSupported(MachineOperatorBuilder* m,
return false; return false;
} }
} // namespace
Node* WasmGraphBuilder::BuildChangeEndiannessStore( Node* WasmGraphBuilder::BuildChangeEndiannessStore(
Node* node, MachineRepresentation mem_rep, wasm::ValueType wasmtype) { Node* node, MachineRepresentation mem_rep, wasm::ValueType wasmtype) {
Node* result; Node* result;
...@@ -2993,19 +2996,6 @@ Node* WasmGraphBuilder::Invert(Node* node) { ...@@ -2993,19 +2996,6 @@ Node* WasmGraphBuilder::Invert(Node* node) {
return Unop(wasm::kExprI32Eqz, node); return Unop(wasm::kExprI32Eqz, node);
} }
bool CanCover(Node* value, IrOpcode::Value opcode) {
if (value->opcode() != opcode) return false;
bool first = true;
for (Edge const edge : value->use_edges()) {
if (NodeProperties::IsControlEdge(edge)) continue;
if (NodeProperties::IsEffectEdge(edge)) continue;
DCHECK(NodeProperties::IsValueEdge(edge));
if (!first) return false;
first = false;
}
return true;
}
Node* WasmGraphBuilder::BuildTruncateIntPtrToInt32(Node* value) { Node* WasmGraphBuilder::BuildTruncateIntPtrToInt32(Node* value) {
if (mcgraph()->machine()->Is64()) { if (mcgraph()->machine()->Is64()) {
value = value =
...@@ -5048,6 +5038,8 @@ Node* WasmGraphBuilder::TableFill(uint32_t table_index, Node* start, ...@@ -5048,6 +5038,8 @@ Node* WasmGraphBuilder::TableFill(uint32_t table_index, Node* start,
return BuildCallToRuntime(Runtime::kWasmTableFill, args, arraysize(args)); return BuildCallToRuntime(Runtime::kWasmTableFill, args, arraysize(args));
} }
namespace {
MachineType FieldType(const wasm::StructType* type, uint32_t field_index) { MachineType FieldType(const wasm::StructType* type, uint32_t field_index) {
return MachineType::TypeForRepresentation( return MachineType::TypeForRepresentation(
type->field(field_index).machine_representation()); type->field(field_index).machine_representation());
...@@ -5075,6 +5067,22 @@ Node* StoreStructFieldUnchecked(MachineGraph* graph, WasmGraphAssembler* gasm, ...@@ -5075,6 +5067,22 @@ Node* StoreStructFieldUnchecked(MachineGraph* graph, WasmGraphAssembler* gasm,
return gasm->Store(rep, struct_object, offset, value); return gasm->Store(rep, struct_object, offset, value);
} }
Node* ArrayElementOffset(GraphAssembler* gasm, Node* index,
wasm::ValueType element_type) {
return gasm->Int32Add(
gasm->Int32Constant(WasmArray::kHeaderSize - kHeapObjectTag),
gasm->Int32Mul(index,
gasm->Int32Constant(element_type.element_size_bytes())));
}
Node* ArrayLength(GraphAssembler* gasm, Node* array) {
return gasm->Load(
MachineType::Uint32(), array,
gasm->Int32Constant(WasmArray::kLengthOffset - kHeapObjectTag));
}
} // namespace
Node* WasmGraphBuilder::StructNew(uint32_t struct_index, Node* WasmGraphBuilder::StructNew(uint32_t struct_index,
const wasm::StructType* type, const wasm::StructType* type,
Vector<Node*> fields) { Vector<Node*> fields) {
...@@ -5177,20 +5185,6 @@ Node* WasmGraphBuilder::StructSet(Node* struct_object, ...@@ -5177,20 +5185,6 @@ Node* WasmGraphBuilder::StructSet(Node* struct_object,
struct_type, field_index, field_value); struct_type, field_index, field_value);
} }
Node* ArrayElementOffset(GraphAssembler* gasm, Node* index,
wasm::ValueType element_type) {
return gasm->Int32Add(
gasm->Int32Constant(WasmArray::kHeaderSize - kHeapObjectTag),
gasm->Int32Mul(index,
gasm->Int32Constant(element_type.element_size_bytes())));
}
Node* ArrayLength(GraphAssembler* gasm, Node* array) {
return gasm->Load(
MachineType::Uint32(), array,
gasm->Int32Constant(WasmArray::kLengthOffset - kHeapObjectTag));
}
void WasmGraphBuilder::BoundsCheck(Node* array, Node* index, void WasmGraphBuilder::BoundsCheck(Node* array, Node* index,
wasm::WasmCodePosition position) { wasm::WasmCodePosition position) {
Node* length = ArrayLength(gasm_.get(), array); Node* length = ArrayLength(gasm_.get(), array);
...@@ -6431,6 +6425,8 @@ std::pair<WasmImportCallKind, Handle<JSReceiver>> ResolveWasmImportCall( ...@@ -6431,6 +6425,8 @@ std::pair<WasmImportCallKind, Handle<JSReceiver>> ResolveWasmImportCall(
return std::make_pair(WasmImportCallKind::kUseCallBuiltin, callable); return std::make_pair(WasmImportCallKind::kUseCallBuiltin, callable);
} }
namespace {
wasm::WasmOpcode GetMathIntrinsicOpcode(WasmImportCallKind kind, wasm::WasmOpcode GetMathIntrinsicOpcode(WasmImportCallKind kind,
const char** name_ptr) { const char** name_ptr) {
#define CASE(name) \ #define CASE(name) \
...@@ -6531,6 +6527,8 @@ wasm::WasmCompilationResult CompileWasmMathIntrinsic( ...@@ -6531,6 +6527,8 @@ wasm::WasmCompilationResult CompileWasmMathIntrinsic(
return result; return result;
} }
} // namespace
wasm::WasmCompilationResult CompileWasmImportCallWrapper( wasm::WasmCompilationResult CompileWasmImportCallWrapper(
wasm::WasmEngine* wasm_engine, wasm::CompilationEnv* env, wasm::WasmEngine* wasm_engine, wasm::CompilationEnv* env,
WasmImportCallKind kind, const wasm::FunctionSig* sig, WasmImportCallKind kind, const wasm::FunctionSig* sig,
......
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