Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Unified Diff: src/compiler/wasm-linkage.cc

Issue 2959963002: [wasm] Move the CallDescriptor creation methods out of ModuleEnv into the compiler. (Closed)
Patch Set: Include wasm-compiler.h from wasm-linkage.cc Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | src/wasm/module-compiler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/wasm-linkage.cc
diff --git a/src/compiler/wasm-linkage.cc b/src/compiler/wasm-linkage.cc
index 5834dc59514629dc7bb92625cef70f8310d898e3..f9c7126b2f7e580ce4243ccbe5cd62ecc7b0ddd5 100644
--- a/src/compiler/wasm-linkage.cc
+++ b/src/compiler/wasm-linkage.cc
@@ -8,34 +8,30 @@
#include "src/objects-inl.h"
#include "src/register-configuration.h"
-#include "src/wasm/wasm-module.h"
-
#include "src/compiler/linkage.h"
+#include "src/compiler/wasm-compiler.h"
#include "src/zone/zone.h"
namespace v8 {
namespace internal {
-// TODO(titzer): this should not be in the wasm namespace.
-namespace wasm {
+namespace compiler {
-using compiler::LocationSignature;
-using compiler::CallDescriptor;
-using compiler::LinkageLocation;
+using wasm::ValueType;
namespace {
MachineType MachineTypeFor(ValueType type) {
switch (type) {
- case kWasmI32:
+ case wasm::kWasmI32:
return MachineType::Int32();
- case kWasmI64:
+ case wasm::kWasmI64:
return MachineType::Int64();
- case kWasmF64:
+ case wasm::kWasmF64:
return MachineType::Float64();
- case kWasmF32:
+ case wasm::kWasmF32:
return MachineType::Float32();
- case kWasmS128:
+ case wasm::kWasmS128:
return MachineType::Simd128();
default:
UNREACHABLE();
@@ -182,7 +178,7 @@ struct Allocator {
// Allocate floats using a double register, but modify the code to
// reflect how ARM FP registers alias.
// TODO(bbudge) Modify wasm linkage to allow use of all float regs.
- if (type == kWasmF32) {
+ if (type == wasm::kWasmF32) {
int float_reg_code = reg.code() * 2;
DCHECK(float_reg_code < RegisterConfiguration::kMaxFPRegisters);
return regloc(DoubleRegister::from_code(float_reg_code),
@@ -207,10 +203,11 @@ struct Allocator {
}
}
bool IsFloatingPoint(ValueType type) {
- return type == kWasmF32 || type == kWasmF64;
+ return type == wasm::kWasmF32 || type == wasm::kWasmF64;
}
int Words(ValueType type) {
- if (kPointerSize < 8 && (type == kWasmI64 || type == kWasmF64)) {
+ if (kPointerSize < 8 &&
+ (type == wasm::kWasmI64 || type == wasm::kWasmF64)) {
return 2;
}
return 1;
@@ -275,8 +272,7 @@ static base::LazyInstance<Allocator, ReturnRegistersCreateTrait>::type
return_registers = LAZY_INSTANCE_INITIALIZER;
// General code uses the above configuration data.
-CallDescriptor* ModuleEnv::GetWasmCallDescriptor(Zone* zone,
- FunctionSig* fsig) {
+CallDescriptor* GetWasmCallDescriptor(Zone* zone, wasm::FunctionSig* fsig) {
LocationSignature::Builder locations(zone, fsig->return_count(),
fsig->parameter_count());
@@ -379,20 +375,20 @@ CallDescriptor* ReplaceTypeInCallDescriptorWith(
descriptor->debug_name());
}
-CallDescriptor* ModuleEnv::GetI32WasmCallDescriptor(
- Zone* zone, CallDescriptor* descriptor) {
+CallDescriptor* GetI32WasmCallDescriptor(Zone* zone,
+ CallDescriptor* descriptor) {
return ReplaceTypeInCallDescriptorWith(zone, descriptor, 2,
MachineType::Int64(),
MachineRepresentation::kWord32);
}
-CallDescriptor* ModuleEnv::GetI32WasmCallDescriptorForSimd(
- Zone* zone, CallDescriptor* descriptor) {
+CallDescriptor* GetI32WasmCallDescriptorForSimd(Zone* zone,
+ CallDescriptor* descriptor) {
return ReplaceTypeInCallDescriptorWith(zone, descriptor, 4,
MachineType::Simd128(),
MachineRepresentation::kWord32);
}
-} // namespace wasm
+} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | src/wasm/module-compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698