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

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

Issue 1272883003: [turbofan] Remove architecture-specific linkage files and LinkageTraits. Use macro-assembler-define… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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
Index: src/compiler/c-linkage.cc
diff --git a/src/compiler/c-linkage.cc b/src/compiler/c-linkage.cc
index 61b3ee3ea73106ca18d96347e9a619e90238c230..2b772c6bd0e9001a896f65aa247ce48354cd43d4 100644
--- a/src/compiler/c-linkage.cc
+++ b/src/compiler/c-linkage.cc
@@ -6,6 +6,7 @@
#include "src/macro-assembler.h"
#include "src/compiler/linkage.h"
+#include "src/compiler/linkage-impl.h"
#include "src/zone.h"
@@ -15,31 +16,16 @@ namespace compiler {
namespace {
// Platform-specific configuration for C calling convention.
-LinkageLocation regloc(Register reg) {
- return LinkageLocation::ForRegister(Register::ToAllocationIndex(reg));
-}
-
-
-LinkageLocation stackloc(int i) {
- DCHECK_LT(i, 0);
- return LinkageLocation::ForCallerFrameSlot(i);
-}
-
-
#if V8_TARGET_ARCH_IA32
// ===========================================================================
// == ia32 ===================================================================
// ===========================================================================
-#define RETURN_REGISTER_0 eax
-#define RETURN_REGISTER_1 edx
#define CALLEE_SAVE_REGISTERS esi.bit() | edi.bit() | ebx.bit()
#elif V8_TARGET_ARCH_X64
// ===========================================================================
// == x64 ====================================================================
// ===========================================================================
-#define RETURN_REGISTER_0 rax
-#define RETURN_REGISTER_1 rdx
#ifdef _WIN64
// == x64 windows ============================================================
@@ -64,8 +50,6 @@ LinkageLocation stackloc(int i) {
// ===========================================================================
// == x87 ====================================================================
// ===========================================================================
-#define RETURN_REGISTER_0 eax
-#define RETURN_REGISTER_1 edx
#define CALLEE_SAVE_REGISTERS esi.bit() | edi.bit() | ebx.bit()
#elif V8_TARGET_ARCH_ARM
@@ -73,8 +57,6 @@ LinkageLocation stackloc(int i) {
// == arm ====================================================================
// ===========================================================================
#define PARAM_REGISTERS r0, r1, r2, r3
-#define RETURN_REGISTER_0 r0
-#define RETURN_REGISTER_1 r1
#define CALLEE_SAVE_REGISTERS \
r4.bit() | r5.bit() | r6.bit() | r7.bit() | r8.bit() | r9.bit() | r10.bit()
#define CALLEE_SAVE_FP_REGISTERS \
@@ -88,8 +70,6 @@ LinkageLocation stackloc(int i) {
// == arm64 ====================================================================
// ===========================================================================
#define PARAM_REGISTERS x0, x1, x2, x3, x4, x5, x6, x7
-#define RETURN_REGISTER_0 x0
-#define RETURN_REGISTER_1 x1
#define CALLEE_SAVE_REGISTERS \
(1 << x19.code()) | (1 << x20.code()) | (1 << x21.code()) | \
(1 << x22.code()) | (1 << x23.code()) | (1 << x24.code()) | \
@@ -107,8 +87,6 @@ LinkageLocation stackloc(int i) {
// == mips ===================================================================
// ===========================================================================
#define PARAM_REGISTERS a0, a1, a2, a3
-#define RETURN_REGISTER_0 v0
-#define RETURN_REGISTER_1 v1
#define CALLEE_SAVE_REGISTERS \
s0.bit() | s1.bit() | s2.bit() | s3.bit() | s4.bit() | s5.bit() | s6.bit() | \
s7.bit()
@@ -120,8 +98,6 @@ LinkageLocation stackloc(int i) {
// == mips64 =================================================================
// ===========================================================================
#define PARAM_REGISTERS a0, a1, a2, a3, a4, a5, a6, a7
-#define RETURN_REGISTER_0 v0
-#define RETURN_REGISTER_1 v1
#define CALLEE_SAVE_REGISTERS \
s0.bit() | s1.bit() | s2.bit() | s3.bit() | s4.bit() | s5.bit() | s6.bit() | \
s7.bit()
@@ -133,8 +109,6 @@ LinkageLocation stackloc(int i) {
// == ppc & ppc64 ============================================================
// ===========================================================================
#define PARAM_REGISTERS r3, r4, r5, r6, r7, r8, r9, r10
-#define RETURN_REGISTER_0 r3
-#define RETURN_REGISTER_1 r4
#define CALLEE_SAVE_REGISTERS \
r14.bit() | r15.bit() | r16.bit() | r17.bit() | r18.bit() | r19.bit() | \
r20.bit() | r21.bit() | r22.bit() | r23.bit() | r24.bit() | r25.bit() | \
@@ -148,7 +122,7 @@ LinkageLocation stackloc(int i) {
// ===========================================================================
// == unknown ================================================================
// ===========================================================================
-// Don't define anything. The below code will dynamically fail.
+#define UNSUPPORTED_C_LINKAGE 1
#endif
} // namespace
@@ -173,22 +147,22 @@ CallDescriptor* Linkage::GetSimplifiedCDescriptor(
}
#endif
-#ifdef RETURN_REGISTER_0
+#ifdef UNSUPPORTED_C_LINKAGE
+ // This method should not be called on unknown architectures.
+ V8_Fatal(__FILE__, __LINE__,
+ "requested C call descriptor on unsupported architecture");
+ return nullptr;
+#endif
+
// Add return location(s).
CHECK(locations.return_count_ <= 2);
if (locations.return_count_ > 0) {
- locations.AddReturn(regloc(RETURN_REGISTER_0));
+ locations.AddReturn(regloc(kReturnRegister0));
}
if (locations.return_count_ > 1) {
- locations.AddReturn(regloc(RETURN_REGISTER_1));
+ locations.AddReturn(regloc(kReturnRegister1));
}
-#else
- // This method should not be called on unknown architectures.
- V8_Fatal(__FILE__, __LINE__,
- "requested C call descriptor on unsupported architecture");
- return nullptr;
-#endif
const int parameter_count = static_cast<int>(msig->parameter_count());

Powered by Google App Engine
This is Rietveld 408576698