Move RegList and related out of frame.h and arch-specific files.
Register configuration data is not the same as frame configuration data. This CL moves the last remnants of register configuration into the assembler files, to be with the other register configuration macros. Next step: extract this register configuration data into platform-specific files that can be included independent of the assembler. R=mstarzinger@chromium.org Bug: Change-Id: I10933b5090be94e90e2a1442197528dfe30bb566 Reviewed-on: https://chromium-review.googlesource.com/595590 Commit-Queue: Ben Titzer <titzer@chromium.org> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Cr-Commit-Position: refs/heads/master@{#47044}
This commit is contained in:
parent
481c170505
commit
b488e73a02
1
BUILD.gn
1
BUILD.gn
@ -1853,6 +1853,7 @@ v8_source_set("v8_base") {
|
||||
"src/regexp/regexp-utils.h",
|
||||
"src/register-configuration.cc",
|
||||
"src/register-configuration.h",
|
||||
"src/reglist.h",
|
||||
"src/runtime-profiler.cc",
|
||||
"src/runtime-profiler.h",
|
||||
"src/runtime/runtime-array.cc",
|
||||
|
@ -86,6 +86,60 @@ namespace internal {
|
||||
V(d8) V(d9) V(d10) V(d11) V(d12) V(d15) \
|
||||
// clang-format on
|
||||
|
||||
// The ARM ABI does not specify the usage of register r9, which may be reserved
|
||||
// as the static base or thread register on some platforms, in which case we
|
||||
// leave it alone. Adjust the value of kR9Available accordingly:
|
||||
const int kR9Available = 1; // 1 if available to us, 0 if reserved
|
||||
|
||||
// Register list in load/store instructions
|
||||
// Note that the bit values must match those used in actual instruction encoding
|
||||
const int kNumRegs = 16;
|
||||
|
||||
// Caller-saved/arguments registers
|
||||
const RegList kJSCallerSaved =
|
||||
1 << 0 | // r0 a1
|
||||
1 << 1 | // r1 a2
|
||||
1 << 2 | // r2 a3
|
||||
1 << 3; // r3 a4
|
||||
|
||||
const int kNumJSCallerSaved = 4;
|
||||
|
||||
// Callee-saved registers preserved when switching from C to JavaScript
|
||||
const RegList kCalleeSaved =
|
||||
1 << 4 | // r4 v1
|
||||
1 << 5 | // r5 v2
|
||||
1 << 6 | // r6 v3
|
||||
1 << 7 | // r7 v4 (cp in JavaScript code)
|
||||
1 << 8 | // r8 v5 (pp in JavaScript code)
|
||||
kR9Available << 9 | // r9 v6
|
||||
1 << 10 | // r10 v7
|
||||
1 << 11; // r11 v8 (fp in JavaScript code)
|
||||
|
||||
// When calling into C++ (only for C++ calls that can't cause a GC).
|
||||
// The call code will take care of lr, fp, etc.
|
||||
const RegList kCallerSaved =
|
||||
1 << 0 | // r0
|
||||
1 << 1 | // r1
|
||||
1 << 2 | // r2
|
||||
1 << 3 | // r3
|
||||
1 << 9; // r9
|
||||
|
||||
const int kNumCalleeSaved = 7 + kR9Available;
|
||||
|
||||
// Double registers d8 to d15 are callee-saved.
|
||||
const int kNumDoubleCalleeSaved = 8;
|
||||
|
||||
// Number of registers for which space is reserved in safepoints. Must be a
|
||||
// multiple of 8.
|
||||
// TODO(regis): Only 8 registers may actually be sufficient. Revisit.
|
||||
const int kNumSafepointRegisters = 16;
|
||||
|
||||
// Define the list of registers actually saved at safepoints.
|
||||
// Note that the number of saved registers may be smaller than the reserved
|
||||
// space, i.e. kNumSafepointSavedRegisters <= kNumSafepointRegisters.
|
||||
const RegList kSafepointSavedRegisters = kJSCallerSaved | kCalleeSaved;
|
||||
const int kNumSafepointSavedRegisters = kNumJSCallerSaved + kNumCalleeSaved;
|
||||
|
||||
// CPU Registers.
|
||||
//
|
||||
// 1) We would prefer to use an enum, but enum values are assignment-
|
||||
@ -491,7 +545,6 @@ enum Coprocessor {
|
||||
p15 = 15
|
||||
};
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Machine instruction Operands
|
||||
|
||||
|
@ -8,73 +8,6 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
|
||||
// The ARM ABI does not specify the usage of register r9, which may be reserved
|
||||
// as the static base or thread register on some platforms, in which case we
|
||||
// leave it alone. Adjust the value of kR9Available accordingly:
|
||||
const int kR9Available = 1; // 1 if available to us, 0 if reserved
|
||||
|
||||
|
||||
// Register list in load/store instructions
|
||||
// Note that the bit values must match those used in actual instruction encoding
|
||||
const int kNumRegs = 16;
|
||||
|
||||
|
||||
// Caller-saved/arguments registers
|
||||
const RegList kJSCallerSaved =
|
||||
1 << 0 | // r0 a1
|
||||
1 << 1 | // r1 a2
|
||||
1 << 2 | // r2 a3
|
||||
1 << 3; // r3 a4
|
||||
|
||||
const int kNumJSCallerSaved = 4;
|
||||
|
||||
// Return the code of the n-th caller-saved register available to JavaScript
|
||||
// e.g. JSCallerSavedReg(0) returns r0.code() == 0
|
||||
int JSCallerSavedCode(int n);
|
||||
|
||||
|
||||
// Callee-saved registers preserved when switching from C to JavaScript
|
||||
const RegList kCalleeSaved =
|
||||
1 << 4 | // r4 v1
|
||||
1 << 5 | // r5 v2
|
||||
1 << 6 | // r6 v3
|
||||
1 << 7 | // r7 v4 (cp in JavaScript code)
|
||||
1 << 8 | // r8 v5 (pp in JavaScript code)
|
||||
kR9Available << 9 | // r9 v6
|
||||
1 << 10 | // r10 v7
|
||||
1 << 11; // r11 v8 (fp in JavaScript code)
|
||||
|
||||
// When calling into C++ (only for C++ calls that can't cause a GC).
|
||||
// The call code will take care of lr, fp, etc.
|
||||
const RegList kCallerSaved =
|
||||
1 << 0 | // r0
|
||||
1 << 1 | // r1
|
||||
1 << 2 | // r2
|
||||
1 << 3 | // r3
|
||||
1 << 9; // r9
|
||||
|
||||
|
||||
const int kNumCalleeSaved = 7 + kR9Available;
|
||||
|
||||
// Double registers d8 to d15 are callee-saved.
|
||||
const int kNumDoubleCalleeSaved = 8;
|
||||
|
||||
|
||||
// Number of registers for which space is reserved in safepoints. Must be a
|
||||
// multiple of 8.
|
||||
// TODO(regis): Only 8 registers may actually be sufficient. Revisit.
|
||||
const int kNumSafepointRegisters = 16;
|
||||
|
||||
// Define the list of registers actually saved at safepoints.
|
||||
// Note that the number of saved registers may be smaller than the reserved
|
||||
// space, i.e. kNumSafepointSavedRegisters <= kNumSafepointRegisters.
|
||||
const RegList kSafepointSavedRegisters = kJSCallerSaved | kCalleeSaved;
|
||||
const int kNumSafepointSavedRegisters = kNumJSCallerSaved + kNumCalleeSaved;
|
||||
|
||||
// ----------------------------------------------------
|
||||
|
||||
|
||||
class EntryFrameConstants : public AllStatic {
|
||||
public:
|
||||
static const int kCallerFPOffset =
|
||||
@ -110,7 +43,6 @@ class JavaScriptFrameConstants : public AllStatic {
|
||||
static const int kReceiverOffset = -1 * kPointerSize;
|
||||
};
|
||||
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Registers.
|
||||
// clang-format off
|
||||
@ -70,6 +69,23 @@ namespace internal {
|
||||
constexpr int kRegListSizeInBits = sizeof(RegList) * kBitsPerByte;
|
||||
static const int kNoCodeAgeSequenceLength = 5 * kInstructionSize;
|
||||
|
||||
const int kNumRegs = kNumberOfRegisters;
|
||||
// Registers x0-x17 are caller-saved.
|
||||
const int kNumJSCallerSaved = 18;
|
||||
const RegList kJSCallerSaved = 0x3ffff;
|
||||
|
||||
// Number of registers for which space is reserved in safepoints. Must be a
|
||||
// multiple of eight.
|
||||
// TODO(all): Refine this number.
|
||||
const int kNumSafepointRegisters = 32;
|
||||
|
||||
// Define the list of registers actually saved at safepoints.
|
||||
// Note that the number of saved registers may be smaller than the reserved
|
||||
// space, i.e. kNumSafepointSavedRegisters <= kNumSafepointRegisters.
|
||||
#define kSafepointSavedRegisters CPURegList::GetSafepointSavedRegisters().list()
|
||||
#define kNumSafepointSavedRegisters \
|
||||
CPURegList::GetSafepointSavedRegisters().Count();
|
||||
|
||||
// Some CPURegister methods can return Register and VRegister types, so we
|
||||
// need to declare them in advance.
|
||||
struct Register;
|
||||
|
@ -11,23 +11,6 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
const int kNumRegs = kNumberOfRegisters;
|
||||
// Registers x0-x17 are caller-saved.
|
||||
const int kNumJSCallerSaved = 18;
|
||||
const RegList kJSCallerSaved = 0x3ffff;
|
||||
|
||||
// Number of registers for which space is reserved in safepoints. Must be a
|
||||
// multiple of eight.
|
||||
// TODO(all): Refine this number.
|
||||
const int kNumSafepointRegisters = 32;
|
||||
|
||||
// Define the list of registers actually saved at safepoints.
|
||||
// Note that the number of saved registers may be smaller than the reserved
|
||||
// space, i.e. kNumSafepointSavedRegisters <= kNumSafepointRegisters.
|
||||
#define kSafepointSavedRegisters CPURegList::GetSafepointSavedRegisters().list()
|
||||
#define kNumSafepointSavedRegisters \
|
||||
CPURegList::GetSafepointSavedRegisters().Count();
|
||||
|
||||
class EntryFrameConstants : public AllStatic {
|
||||
public:
|
||||
static const int kCallerFPOffset =
|
||||
@ -57,7 +40,6 @@ class JavaScriptFrameConstants : public AllStatic {
|
||||
static const int kFunctionOffset = StandardFrameConstants::kFunctionOffset;
|
||||
};
|
||||
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
|
@ -1936,5 +1936,22 @@ void Assembler::RequestHeapObject(HeapObjectRequest request) {
|
||||
heap_object_requests_.push_front(request);
|
||||
}
|
||||
|
||||
namespace {
|
||||
int caller_saved_codes[kNumJSCallerSaved];
|
||||
}
|
||||
|
||||
void SetUpJSCallerSavedCodeData() {
|
||||
int i = 0;
|
||||
for (int r = 0; r < kNumRegs; r++)
|
||||
if ((kJSCallerSaved & (1 << r)) != 0) caller_saved_codes[i++] = r;
|
||||
|
||||
DCHECK(i == kNumJSCallerSaved);
|
||||
}
|
||||
|
||||
int JSCallerSavedCode(int n) {
|
||||
DCHECK(0 <= n && n < kNumJSCallerSaved);
|
||||
return caller_saved_codes[n];
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "src/label.h"
|
||||
#include "src/log.h"
|
||||
#include "src/register-configuration.h"
|
||||
#include "src/reglist.h"
|
||||
#include "src/runtime/runtime.h"
|
||||
|
||||
namespace v8 {
|
||||
@ -59,6 +60,11 @@ class Isolate;
|
||||
class SourcePosition;
|
||||
class StatsCounter;
|
||||
|
||||
void SetUpJSCallerSavedCodeData();
|
||||
|
||||
// Return the code of the n-th saved register available to JavaScript.
|
||||
int JSCallerSavedCode(int n);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Platform independent assembler base class.
|
||||
|
||||
|
@ -9,9 +9,9 @@
|
||||
#include "src/base/flags.h"
|
||||
#include "src/compiler/frame.h"
|
||||
#include "src/compiler/operator.h"
|
||||
#include "src/frames.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/machine-type.h"
|
||||
#include "src/reglist.h"
|
||||
#include "src/runtime/runtime.h"
|
||||
#include "src/zone/zone.h"
|
||||
|
||||
|
@ -2184,31 +2184,6 @@ InnerPointerToCodeCache::InnerPointerToCodeCacheEntry*
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
int NumRegs(RegList reglist) { return base::bits::CountPopulation(reglist); }
|
||||
|
||||
|
||||
struct JSCallerSavedCodeData {
|
||||
int reg_code[kNumJSCallerSaved];
|
||||
};
|
||||
|
||||
JSCallerSavedCodeData caller_saved_code_data;
|
||||
|
||||
void SetUpJSCallerSavedCodeData() {
|
||||
int i = 0;
|
||||
for (int r = 0; r < kNumRegs; r++)
|
||||
if ((kJSCallerSaved & (1 << r)) != 0)
|
||||
caller_saved_code_data.reg_code[i++] = r;
|
||||
|
||||
DCHECK(i == kNumJSCallerSaved);
|
||||
}
|
||||
|
||||
|
||||
int JSCallerSavedCode(int n) {
|
||||
DCHECK(0 <= n && n < kNumJSCallerSaved);
|
||||
return caller_saved_code_data.reg_code[n];
|
||||
}
|
||||
|
||||
|
||||
#define DEFINE_WRAPPER(type, field) \
|
||||
class field##_Wrapper : public ZoneObject { \
|
||||
public: /* NOLINT */ \
|
||||
|
15
src/frames.h
15
src/frames.h
@ -19,21 +19,6 @@ class Debug;
|
||||
class ObjectVisitor;
|
||||
class StringStream;
|
||||
|
||||
#if V8_TARGET_ARCH_ARM64
|
||||
typedef uint64_t RegList;
|
||||
#else
|
||||
typedef uint32_t RegList;
|
||||
#endif
|
||||
|
||||
// Get the number of registers in a given register list.
|
||||
int NumRegs(RegList list);
|
||||
|
||||
void SetUpJSCallerSavedCodeData();
|
||||
|
||||
// Return the code of the n-th saved register available to JavaScript.
|
||||
int JSCallerSavedCode(int n);
|
||||
|
||||
|
||||
// Forward declarations.
|
||||
class ExternalCallbackScope;
|
||||
class Isolate;
|
||||
|
@ -87,6 +87,22 @@ namespace internal {
|
||||
V(xmm6) \
|
||||
V(xmm7)
|
||||
|
||||
// Note that the bit values must match those used in actual instruction encoding
|
||||
const int kNumRegs = 8;
|
||||
|
||||
// Caller-saved registers
|
||||
const RegList kJSCallerSaved =
|
||||
1 << 0 | // eax
|
||||
1 << 1 | // ecx
|
||||
1 << 2 | // edx
|
||||
1 << 3 | // ebx - used as a caller-saved register in JavaScript code
|
||||
1 << 7; // edi - callee function
|
||||
|
||||
const int kNumJSCallerSaved = 5;
|
||||
|
||||
// Number of registers for which space is reserved in safepoints.
|
||||
const int kNumSafepointRegisters = 8;
|
||||
|
||||
// CPU Registers.
|
||||
//
|
||||
// 1) We would prefer to use an enum, but enum values are assignment-
|
||||
|
@ -8,29 +8,6 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
|
||||
// Register lists
|
||||
// Note that the bit values must match those used in actual instruction encoding
|
||||
const int kNumRegs = 8;
|
||||
|
||||
|
||||
// Caller-saved registers
|
||||
const RegList kJSCallerSaved =
|
||||
1 << 0 | // eax
|
||||
1 << 1 | // ecx
|
||||
1 << 2 | // edx
|
||||
1 << 3 | // ebx - used as a caller-saved register in JavaScript code
|
||||
1 << 7; // edi - callee function
|
||||
|
||||
const int kNumJSCallerSaved = 5;
|
||||
|
||||
|
||||
// Number of registers for which space is reserved in safepoints.
|
||||
const int kNumSafepointRegisters = 8;
|
||||
|
||||
// ----------------------------------------------------
|
||||
|
||||
|
||||
class EntryFrameConstants : public AllStatic {
|
||||
public:
|
||||
static const int kCallerFPOffset = -6 * kPointerSize;
|
||||
@ -71,7 +48,6 @@ class JavaScriptFrameConstants : public AllStatic {
|
||||
static const int kReceiverOffset = -1 * kPointerSize;
|
||||
};
|
||||
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
|
@ -75,6 +75,106 @@ namespace internal {
|
||||
V(f16) V(f18) V(f20) V(f22) V(f24)
|
||||
// clang-format on
|
||||
|
||||
// Register lists.
|
||||
// Note that the bit values must match those used in actual instruction
|
||||
// encoding.
|
||||
const int kNumRegs = 32;
|
||||
|
||||
const RegList kJSCallerSaved = 1 << 2 | // v0
|
||||
1 << 3 | // v1
|
||||
1 << 4 | // a0
|
||||
1 << 5 | // a1
|
||||
1 << 6 | // a2
|
||||
1 << 7 | // a3
|
||||
1 << 8 | // t0
|
||||
1 << 9 | // t1
|
||||
1 << 10 | // t2
|
||||
1 << 11 | // t3
|
||||
1 << 12 | // t4
|
||||
1 << 13 | // t5
|
||||
1 << 14 | // t6
|
||||
1 << 15; // t7
|
||||
|
||||
const int kNumJSCallerSaved = 14;
|
||||
|
||||
// Callee-saved registers preserved when switching from C to JavaScript.
|
||||
const RegList kCalleeSaved = 1 << 16 | // s0
|
||||
1 << 17 | // s1
|
||||
1 << 18 | // s2
|
||||
1 << 19 | // s3
|
||||
1 << 20 | // s4
|
||||
1 << 21 | // s5
|
||||
1 << 22 | // s6 (roots in Javascript code)
|
||||
1 << 23 | // s7 (cp in Javascript code)
|
||||
1 << 30; // fp/s8
|
||||
|
||||
const int kNumCalleeSaved = 9;
|
||||
|
||||
const RegList kCalleeSavedFPU = 1 << 20 | // f20
|
||||
1 << 22 | // f22
|
||||
1 << 24 | // f24
|
||||
1 << 26 | // f26
|
||||
1 << 28 | // f28
|
||||
1 << 30; // f30
|
||||
|
||||
const int kNumCalleeSavedFPU = 6;
|
||||
|
||||
const RegList kCallerSavedFPU = 1 << 0 | // f0
|
||||
1 << 2 | // f2
|
||||
1 << 4 | // f4
|
||||
1 << 6 | // f6
|
||||
1 << 8 | // f8
|
||||
1 << 10 | // f10
|
||||
1 << 12 | // f12
|
||||
1 << 14 | // f14
|
||||
1 << 16 | // f16
|
||||
1 << 18; // f18
|
||||
|
||||
// Number of registers for which space is reserved in safepoints. Must be a
|
||||
// multiple of 8.
|
||||
const int kNumSafepointRegisters = 24;
|
||||
|
||||
// Define the list of registers actually saved at safepoints.
|
||||
// Note that the number of saved registers may be smaller than the reserved
|
||||
// space, i.e. kNumSafepointSavedRegisters <= kNumSafepointRegisters.
|
||||
const RegList kSafepointSavedRegisters = kJSCallerSaved | kCalleeSaved;
|
||||
const int kNumSafepointSavedRegisters = kNumJSCallerSaved + kNumCalleeSaved;
|
||||
|
||||
const int kUndefIndex = -1;
|
||||
// Map with indexes on stack that corresponds to codes of saved registers.
|
||||
const int kSafepointRegisterStackIndexMap[kNumRegs] = {kUndefIndex, // zero_reg
|
||||
kUndefIndex, // at
|
||||
0, // v0
|
||||
1, // v1
|
||||
2, // a0
|
||||
3, // a1
|
||||
4, // a2
|
||||
5, // a3
|
||||
6, // t0
|
||||
7, // t1
|
||||
8, // t2
|
||||
9, // t3
|
||||
10, // t4
|
||||
11, // t5
|
||||
12, // t6
|
||||
13, // t7
|
||||
14, // s0
|
||||
15, // s1
|
||||
16, // s2
|
||||
17, // s3
|
||||
18, // s4
|
||||
19, // s5
|
||||
20, // s6
|
||||
21, // s7
|
||||
kUndefIndex, // t8
|
||||
kUndefIndex, // t9
|
||||
kUndefIndex, // k0
|
||||
kUndefIndex, // k1
|
||||
kUndefIndex, // gp
|
||||
kUndefIndex, // sp
|
||||
22, // fp
|
||||
kUndefIndex};
|
||||
|
||||
// CPU Registers.
|
||||
//
|
||||
// 1) We would prefer to use an enum, but enum values are assignment-
|
||||
|
@ -2,131 +2,12 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
|
||||
|
||||
#ifndef V8_MIPS_FRAMES_MIPS_H_
|
||||
#define V8_MIPS_FRAMES_MIPS_H_
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
// Register lists.
|
||||
// Note that the bit values must match those used in actual instruction
|
||||
// encoding.
|
||||
const int kNumRegs = 32;
|
||||
|
||||
const RegList kJSCallerSaved =
|
||||
1 << 2 | // v0
|
||||
1 << 3 | // v1
|
||||
1 << 4 | // a0
|
||||
1 << 5 | // a1
|
||||
1 << 6 | // a2
|
||||
1 << 7 | // a3
|
||||
1 << 8 | // t0
|
||||
1 << 9 | // t1
|
||||
1 << 10 | // t2
|
||||
1 << 11 | // t3
|
||||
1 << 12 | // t4
|
||||
1 << 13 | // t5
|
||||
1 << 14 | // t6
|
||||
1 << 15; // t7
|
||||
|
||||
const int kNumJSCallerSaved = 14;
|
||||
|
||||
|
||||
// Return the code of the n-th caller-saved register available to JavaScript
|
||||
// e.g. JSCallerSavedReg(0) returns a0.code() == 4.
|
||||
int JSCallerSavedCode(int n);
|
||||
|
||||
|
||||
// Callee-saved registers preserved when switching from C to JavaScript.
|
||||
const RegList kCalleeSaved =
|
||||
1 << 16 | // s0
|
||||
1 << 17 | // s1
|
||||
1 << 18 | // s2
|
||||
1 << 19 | // s3
|
||||
1 << 20 | // s4
|
||||
1 << 21 | // s5
|
||||
1 << 22 | // s6 (roots in Javascript code)
|
||||
1 << 23 | // s7 (cp in Javascript code)
|
||||
1 << 30; // fp/s8
|
||||
|
||||
const int kNumCalleeSaved = 9;
|
||||
|
||||
const RegList kCalleeSavedFPU =
|
||||
1 << 20 | // f20
|
||||
1 << 22 | // f22
|
||||
1 << 24 | // f24
|
||||
1 << 26 | // f26
|
||||
1 << 28 | // f28
|
||||
1 << 30; // f30
|
||||
|
||||
const int kNumCalleeSavedFPU = 6;
|
||||
|
||||
const RegList kCallerSavedFPU =
|
||||
1 << 0 | // f0
|
||||
1 << 2 | // f2
|
||||
1 << 4 | // f4
|
||||
1 << 6 | // f6
|
||||
1 << 8 | // f8
|
||||
1 << 10 | // f10
|
||||
1 << 12 | // f12
|
||||
1 << 14 | // f14
|
||||
1 << 16 | // f16
|
||||
1 << 18; // f18
|
||||
|
||||
|
||||
// Number of registers for which space is reserved in safepoints. Must be a
|
||||
// multiple of 8.
|
||||
const int kNumSafepointRegisters = 24;
|
||||
|
||||
// Define the list of registers actually saved at safepoints.
|
||||
// Note that the number of saved registers may be smaller than the reserved
|
||||
// space, i.e. kNumSafepointSavedRegisters <= kNumSafepointRegisters.
|
||||
const RegList kSafepointSavedRegisters = kJSCallerSaved | kCalleeSaved;
|
||||
const int kNumSafepointSavedRegisters =
|
||||
kNumJSCallerSaved + kNumCalleeSaved;
|
||||
|
||||
const int kUndefIndex = -1;
|
||||
// Map with indexes on stack that corresponds to codes of saved registers.
|
||||
const int kSafepointRegisterStackIndexMap[kNumRegs] = {
|
||||
kUndefIndex, // zero_reg
|
||||
kUndefIndex, // at
|
||||
0, // v0
|
||||
1, // v1
|
||||
2, // a0
|
||||
3, // a1
|
||||
4, // a2
|
||||
5, // a3
|
||||
6, // t0
|
||||
7, // t1
|
||||
8, // t2
|
||||
9, // t3
|
||||
10, // t4
|
||||
11, // t5
|
||||
12, // t6
|
||||
13, // t7
|
||||
14, // s0
|
||||
15, // s1
|
||||
16, // s2
|
||||
17, // s3
|
||||
18, // s4
|
||||
19, // s5
|
||||
20, // s6
|
||||
21, // s7
|
||||
kUndefIndex, // t8
|
||||
kUndefIndex, // t9
|
||||
kUndefIndex, // k0
|
||||
kUndefIndex, // k1
|
||||
kUndefIndex, // gp
|
||||
kUndefIndex, // sp
|
||||
22, // fp
|
||||
kUndefIndex
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------
|
||||
|
||||
class EntryFrameConstants : public AllStatic {
|
||||
public:
|
||||
static const int kCallerFPOffset =
|
||||
|
@ -75,6 +75,105 @@ namespace internal {
|
||||
V(f16) V(f18) V(f20) V(f22) V(f24) V(f26)
|
||||
// clang-format on
|
||||
|
||||
// Note that the bit values must match those used in actual instruction
|
||||
// encoding.
|
||||
const int kNumRegs = 32;
|
||||
|
||||
const RegList kJSCallerSaved = 1 << 2 | // v0
|
||||
1 << 3 | // v1
|
||||
1 << 4 | // a0
|
||||
1 << 5 | // a1
|
||||
1 << 6 | // a2
|
||||
1 << 7 | // a3
|
||||
1 << 8 | // a4
|
||||
1 << 9 | // a5
|
||||
1 << 10 | // a6
|
||||
1 << 11 | // a7
|
||||
1 << 12 | // t0
|
||||
1 << 13 | // t1
|
||||
1 << 14 | // t2
|
||||
1 << 15; // t3
|
||||
|
||||
const int kNumJSCallerSaved = 14;
|
||||
|
||||
// Callee-saved registers preserved when switching from C to JavaScript.
|
||||
const RegList kCalleeSaved = 1 << 16 | // s0
|
||||
1 << 17 | // s1
|
||||
1 << 18 | // s2
|
||||
1 << 19 | // s3
|
||||
1 << 20 | // s4
|
||||
1 << 21 | // s5
|
||||
1 << 22 | // s6 (roots in Javascript code)
|
||||
1 << 23 | // s7 (cp in Javascript code)
|
||||
1 << 30; // fp/s8
|
||||
|
||||
const int kNumCalleeSaved = 9;
|
||||
|
||||
const RegList kCalleeSavedFPU = 1 << 20 | // f20
|
||||
1 << 22 | // f22
|
||||
1 << 24 | // f24
|
||||
1 << 26 | // f26
|
||||
1 << 28 | // f28
|
||||
1 << 30; // f30
|
||||
|
||||
const int kNumCalleeSavedFPU = 6;
|
||||
|
||||
const RegList kCallerSavedFPU = 1 << 0 | // f0
|
||||
1 << 2 | // f2
|
||||
1 << 4 | // f4
|
||||
1 << 6 | // f6
|
||||
1 << 8 | // f8
|
||||
1 << 10 | // f10
|
||||
1 << 12 | // f12
|
||||
1 << 14 | // f14
|
||||
1 << 16 | // f16
|
||||
1 << 18; // f18
|
||||
|
||||
// Number of registers for which space is reserved in safepoints. Must be a
|
||||
// multiple of 8.
|
||||
const int kNumSafepointRegisters = 24;
|
||||
|
||||
// Define the list of registers actually saved at safepoints.
|
||||
// Note that the number of saved registers may be smaller than the reserved
|
||||
// space, i.e. kNumSafepointSavedRegisters <= kNumSafepointRegisters.
|
||||
const RegList kSafepointSavedRegisters = kJSCallerSaved | kCalleeSaved;
|
||||
const int kNumSafepointSavedRegisters = kNumJSCallerSaved + kNumCalleeSaved;
|
||||
|
||||
const int kUndefIndex = -1;
|
||||
// Map with indexes on stack that corresponds to codes of saved registers.
|
||||
const int kSafepointRegisterStackIndexMap[kNumRegs] = {kUndefIndex, // zero_reg
|
||||
kUndefIndex, // at
|
||||
0, // v0
|
||||
1, // v1
|
||||
2, // a0
|
||||
3, // a1
|
||||
4, // a2
|
||||
5, // a3
|
||||
6, // a4
|
||||
7, // a5
|
||||
8, // a6
|
||||
9, // a7
|
||||
10, // t0
|
||||
11, // t1
|
||||
12, // t2
|
||||
13, // t3
|
||||
14, // s0
|
||||
15, // s1
|
||||
16, // s2
|
||||
17, // s3
|
||||
18, // s4
|
||||
19, // s5
|
||||
20, // s6
|
||||
21, // s7
|
||||
kUndefIndex, // t8
|
||||
kUndefIndex, // t9
|
||||
kUndefIndex, // k0
|
||||
kUndefIndex, // k1
|
||||
kUndefIndex, // gp
|
||||
kUndefIndex, // sp
|
||||
22, // fp
|
||||
kUndefIndex};
|
||||
|
||||
// CPU Registers.
|
||||
//
|
||||
// 1) We would prefer to use an enum, but enum values are assignment-
|
||||
|
@ -2,131 +2,12 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
|
||||
|
||||
#ifndef V8_MIPS_FRAMES_MIPS_H_
|
||||
#define V8_MIPS_FRAMES_MIPS_H_
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
// Register lists.
|
||||
// Note that the bit values must match those used in actual instruction
|
||||
// encoding.
|
||||
const int kNumRegs = 32;
|
||||
|
||||
const RegList kJSCallerSaved =
|
||||
1 << 2 | // v0
|
||||
1 << 3 | // v1
|
||||
1 << 4 | // a0
|
||||
1 << 5 | // a1
|
||||
1 << 6 | // a2
|
||||
1 << 7 | // a3
|
||||
1 << 8 | // a4
|
||||
1 << 9 | // a5
|
||||
1 << 10 | // a6
|
||||
1 << 11 | // a7
|
||||
1 << 12 | // t0
|
||||
1 << 13 | // t1
|
||||
1 << 14 | // t2
|
||||
1 << 15; // t3
|
||||
|
||||
const int kNumJSCallerSaved = 14;
|
||||
|
||||
|
||||
// Return the code of the n-th caller-saved register available to JavaScript
|
||||
// e.g. JSCallerSavedReg(0) returns a0.code() == 4.
|
||||
int JSCallerSavedCode(int n);
|
||||
|
||||
|
||||
// Callee-saved registers preserved when switching from C to JavaScript.
|
||||
const RegList kCalleeSaved =
|
||||
1 << 16 | // s0
|
||||
1 << 17 | // s1
|
||||
1 << 18 | // s2
|
||||
1 << 19 | // s3
|
||||
1 << 20 | // s4
|
||||
1 << 21 | // s5
|
||||
1 << 22 | // s6 (roots in Javascript code)
|
||||
1 << 23 | // s7 (cp in Javascript code)
|
||||
1 << 30; // fp/s8
|
||||
|
||||
const int kNumCalleeSaved = 9;
|
||||
|
||||
const RegList kCalleeSavedFPU =
|
||||
1 << 20 | // f20
|
||||
1 << 22 | // f22
|
||||
1 << 24 | // f24
|
||||
1 << 26 | // f26
|
||||
1 << 28 | // f28
|
||||
1 << 30; // f30
|
||||
|
||||
const int kNumCalleeSavedFPU = 6;
|
||||
|
||||
const RegList kCallerSavedFPU =
|
||||
1 << 0 | // f0
|
||||
1 << 2 | // f2
|
||||
1 << 4 | // f4
|
||||
1 << 6 | // f6
|
||||
1 << 8 | // f8
|
||||
1 << 10 | // f10
|
||||
1 << 12 | // f12
|
||||
1 << 14 | // f14
|
||||
1 << 16 | // f16
|
||||
1 << 18; // f18
|
||||
|
||||
|
||||
// Number of registers for which space is reserved in safepoints. Must be a
|
||||
// multiple of 8.
|
||||
const int kNumSafepointRegisters = 24;
|
||||
|
||||
// Define the list of registers actually saved at safepoints.
|
||||
// Note that the number of saved registers may be smaller than the reserved
|
||||
// space, i.e. kNumSafepointSavedRegisters <= kNumSafepointRegisters.
|
||||
const RegList kSafepointSavedRegisters = kJSCallerSaved | kCalleeSaved;
|
||||
const int kNumSafepointSavedRegisters =
|
||||
kNumJSCallerSaved + kNumCalleeSaved;
|
||||
|
||||
const int kUndefIndex = -1;
|
||||
// Map with indexes on stack that corresponds to codes of saved registers.
|
||||
const int kSafepointRegisterStackIndexMap[kNumRegs] = {
|
||||
kUndefIndex, // zero_reg
|
||||
kUndefIndex, // at
|
||||
0, // v0
|
||||
1, // v1
|
||||
2, // a0
|
||||
3, // a1
|
||||
4, // a2
|
||||
5, // a3
|
||||
6, // a4
|
||||
7, // a5
|
||||
8, // a6
|
||||
9, // a7
|
||||
10, // t0
|
||||
11, // t1
|
||||
12, // t2
|
||||
13, // t3
|
||||
14, // s0
|
||||
15, // s1
|
||||
16, // s2
|
||||
17, // s3
|
||||
18, // s4
|
||||
19, // s5
|
||||
20, // s6
|
||||
21, // s7
|
||||
kUndefIndex, // t8
|
||||
kUndefIndex, // t9
|
||||
kUndefIndex, // k0
|
||||
kUndefIndex, // k1
|
||||
kUndefIndex, // gp
|
||||
kUndefIndex, // sp
|
||||
22, // fp
|
||||
kUndefIndex
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------
|
||||
|
||||
class EntryFrameConstants : public AllStatic {
|
||||
public:
|
||||
static const int kCallerFPOffset =
|
||||
@ -153,7 +34,6 @@ class ExitFrameConstants : public TypedFrameConstants {
|
||||
static const int kConstantPoolOffset = 0; // Not used.
|
||||
};
|
||||
|
||||
|
||||
class JavaScriptFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
@ -166,7 +46,6 @@ class JavaScriptFrameConstants : public AllStatic {
|
||||
static const int kReceiverOffset = -1 * kPointerSize;
|
||||
};
|
||||
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
|
@ -120,6 +120,136 @@ namespace internal {
|
||||
V(d24) V(d25) V(d26) V(d27) V(d28) V(d29) V(d30) V(d31)
|
||||
// clang-format on
|
||||
|
||||
// Register list in load/store instructions
|
||||
// Note that the bit values must match those used in actual instruction encoding
|
||||
const int kNumRegs = 32;
|
||||
|
||||
// Caller-saved/arguments registers
|
||||
const RegList kJSCallerSaved = 1 << 3 | // r3 a1
|
||||
1 << 4 | // r4 a2
|
||||
1 << 5 | // r5 a3
|
||||
1 << 6 | // r6 a4
|
||||
1 << 7 | // r7 a5
|
||||
1 << 8 | // r8 a6
|
||||
1 << 9 | // r9 a7
|
||||
1 << 10 | // r10 a8
|
||||
1 << 11;
|
||||
|
||||
const int kNumJSCallerSaved = 9;
|
||||
|
||||
// Return the code of the n-th caller-saved register available to JavaScript
|
||||
// e.g. JSCallerSavedReg(0) returns r0.code() == 0
|
||||
int JSCallerSavedCode(int n);
|
||||
|
||||
// Callee-saved registers preserved when switching from C to JavaScript
|
||||
const RegList kCalleeSaved = 1 << 14 | // r14
|
||||
1 << 15 | // r15
|
||||
1 << 16 | // r16
|
||||
1 << 17 | // r17
|
||||
1 << 18 | // r18
|
||||
1 << 19 | // r19
|
||||
1 << 20 | // r20
|
||||
1 << 21 | // r21
|
||||
1 << 22 | // r22
|
||||
1 << 23 | // r23
|
||||
1 << 24 | // r24
|
||||
1 << 25 | // r25
|
||||
1 << 26 | // r26
|
||||
1 << 27 | // r27
|
||||
1 << 28 | // r28
|
||||
1 << 29 | // r29
|
||||
1 << 30 | // r20
|
||||
1 << 31; // r31
|
||||
|
||||
const int kNumCalleeSaved = 18;
|
||||
|
||||
const RegList kCallerSavedDoubles = 1 << 0 | // d0
|
||||
1 << 1 | // d1
|
||||
1 << 2 | // d2
|
||||
1 << 3 | // d3
|
||||
1 << 4 | // d4
|
||||
1 << 5 | // d5
|
||||
1 << 6 | // d6
|
||||
1 << 7 | // d7
|
||||
1 << 8 | // d8
|
||||
1 << 9 | // d9
|
||||
1 << 10 | // d10
|
||||
1 << 11 | // d11
|
||||
1 << 12 | // d12
|
||||
1 << 13; // d13
|
||||
|
||||
const int kNumCallerSavedDoubles = 14;
|
||||
|
||||
const RegList kCalleeSavedDoubles = 1 << 14 | // d14
|
||||
1 << 15 | // d15
|
||||
1 << 16 | // d16
|
||||
1 << 17 | // d17
|
||||
1 << 18 | // d18
|
||||
1 << 19 | // d19
|
||||
1 << 20 | // d20
|
||||
1 << 21 | // d21
|
||||
1 << 22 | // d22
|
||||
1 << 23 | // d23
|
||||
1 << 24 | // d24
|
||||
1 << 25 | // d25
|
||||
1 << 26 | // d26
|
||||
1 << 27 | // d27
|
||||
1 << 28 | // d28
|
||||
1 << 29 | // d29
|
||||
1 << 30 | // d30
|
||||
1 << 31; // d31
|
||||
|
||||
const int kNumCalleeSavedDoubles = 18;
|
||||
|
||||
// Number of registers for which space is reserved in safepoints. Must be a
|
||||
// multiple of 8.
|
||||
const int kNumSafepointRegisters = 32;
|
||||
|
||||
// The following constants describe the stack frame linkage area as
|
||||
// defined by the ABI. Note that kNumRequiredStackFrameSlots must
|
||||
// satisfy alignment requirements (rounding up if required).
|
||||
#if V8_TARGET_ARCH_PPC64 && V8_TARGET_LITTLE_ENDIAN
|
||||
// [0] back chain
|
||||
// [1] condition register save area
|
||||
// [2] link register save area
|
||||
// [3] TOC save area
|
||||
// [4] Parameter1 save area
|
||||
// ...
|
||||
// [11] Parameter8 save area
|
||||
// [12] Parameter9 slot (if necessary)
|
||||
// ...
|
||||
const int kNumRequiredStackFrameSlots = 12;
|
||||
const int kStackFrameLRSlot = 2;
|
||||
const int kStackFrameExtraParamSlot = 12;
|
||||
#elif V8_OS_AIX || V8_TARGET_ARCH_PPC64
|
||||
// [0] back chain
|
||||
// [1] condition register save area
|
||||
// [2] link register save area
|
||||
// [3] reserved for compiler
|
||||
// [4] reserved by binder
|
||||
// [5] TOC save area
|
||||
// [6] Parameter1 save area
|
||||
// ...
|
||||
// [13] Parameter8 save area
|
||||
// [14] Parameter9 slot (if necessary)
|
||||
// ...
|
||||
#if V8_TARGET_ARCH_PPC64
|
||||
const int kNumRequiredStackFrameSlots = 14;
|
||||
#else
|
||||
const int kNumRequiredStackFrameSlots = 16;
|
||||
#endif
|
||||
const int kStackFrameLRSlot = 2;
|
||||
const int kStackFrameExtraParamSlot = 14;
|
||||
#else
|
||||
// [0] back chain
|
||||
// [1] link register save area
|
||||
// [2] Parameter9 slot (if necessary)
|
||||
// ...
|
||||
const int kNumRequiredStackFrameSlots = 4;
|
||||
const int kStackFrameLRSlot = 1;
|
||||
const int kStackFrameExtraParamSlot = 2;
|
||||
#endif
|
||||
|
||||
// CPU Registers.
|
||||
//
|
||||
// 1) We would prefer to use an enum, but enum values are assignment-
|
||||
|
@ -8,144 +8,6 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
|
||||
// Register list in load/store instructions
|
||||
// Note that the bit values must match those used in actual instruction encoding
|
||||
const int kNumRegs = 32;
|
||||
|
||||
|
||||
// Caller-saved/arguments registers
|
||||
const RegList kJSCallerSaved = 1 << 3 | // r3 a1
|
||||
1 << 4 | // r4 a2
|
||||
1 << 5 | // r5 a3
|
||||
1 << 6 | // r6 a4
|
||||
1 << 7 | // r7 a5
|
||||
1 << 8 | // r8 a6
|
||||
1 << 9 | // r9 a7
|
||||
1 << 10 | // r10 a8
|
||||
1 << 11;
|
||||
|
||||
const int kNumJSCallerSaved = 9;
|
||||
|
||||
// Return the code of the n-th caller-saved register available to JavaScript
|
||||
// e.g. JSCallerSavedReg(0) returns r0.code() == 0
|
||||
int JSCallerSavedCode(int n);
|
||||
|
||||
|
||||
// Callee-saved registers preserved when switching from C to JavaScript
|
||||
const RegList kCalleeSaved = 1 << 14 | // r14
|
||||
1 << 15 | // r15
|
||||
1 << 16 | // r16
|
||||
1 << 17 | // r17
|
||||
1 << 18 | // r18
|
||||
1 << 19 | // r19
|
||||
1 << 20 | // r20
|
||||
1 << 21 | // r21
|
||||
1 << 22 | // r22
|
||||
1 << 23 | // r23
|
||||
1 << 24 | // r24
|
||||
1 << 25 | // r25
|
||||
1 << 26 | // r26
|
||||
1 << 27 | // r27
|
||||
1 << 28 | // r28
|
||||
1 << 29 | // r29
|
||||
1 << 30 | // r20
|
||||
1 << 31; // r31
|
||||
|
||||
|
||||
const int kNumCalleeSaved = 18;
|
||||
|
||||
const RegList kCallerSavedDoubles = 1 << 0 | // d0
|
||||
1 << 1 | // d1
|
||||
1 << 2 | // d2
|
||||
1 << 3 | // d3
|
||||
1 << 4 | // d4
|
||||
1 << 5 | // d5
|
||||
1 << 6 | // d6
|
||||
1 << 7 | // d7
|
||||
1 << 8 | // d8
|
||||
1 << 9 | // d9
|
||||
1 << 10 | // d10
|
||||
1 << 11 | // d11
|
||||
1 << 12 | // d12
|
||||
1 << 13; // d13
|
||||
|
||||
const int kNumCallerSavedDoubles = 14;
|
||||
|
||||
const RegList kCalleeSavedDoubles = 1 << 14 | // d14
|
||||
1 << 15 | // d15
|
||||
1 << 16 | // d16
|
||||
1 << 17 | // d17
|
||||
1 << 18 | // d18
|
||||
1 << 19 | // d19
|
||||
1 << 20 | // d20
|
||||
1 << 21 | // d21
|
||||
1 << 22 | // d22
|
||||
1 << 23 | // d23
|
||||
1 << 24 | // d24
|
||||
1 << 25 | // d25
|
||||
1 << 26 | // d26
|
||||
1 << 27 | // d27
|
||||
1 << 28 | // d28
|
||||
1 << 29 | // d29
|
||||
1 << 30 | // d30
|
||||
1 << 31; // d31
|
||||
|
||||
const int kNumCalleeSavedDoubles = 18;
|
||||
|
||||
|
||||
// Number of registers for which space is reserved in safepoints. Must be a
|
||||
// multiple of 8.
|
||||
const int kNumSafepointRegisters = 32;
|
||||
|
||||
// The following constants describe the stack frame linkage area as
|
||||
// defined by the ABI. Note that kNumRequiredStackFrameSlots must
|
||||
// satisfy alignment requirements (rounding up if required).
|
||||
#if V8_TARGET_ARCH_PPC64 && V8_TARGET_LITTLE_ENDIAN
|
||||
// [0] back chain
|
||||
// [1] condition register save area
|
||||
// [2] link register save area
|
||||
// [3] TOC save area
|
||||
// [4] Parameter1 save area
|
||||
// ...
|
||||
// [11] Parameter8 save area
|
||||
// [12] Parameter9 slot (if necessary)
|
||||
// ...
|
||||
const int kNumRequiredStackFrameSlots = 12;
|
||||
const int kStackFrameLRSlot = 2;
|
||||
const int kStackFrameExtraParamSlot = 12;
|
||||
#elif V8_OS_AIX || V8_TARGET_ARCH_PPC64
|
||||
// [0] back chain
|
||||
// [1] condition register save area
|
||||
// [2] link register save area
|
||||
// [3] reserved for compiler
|
||||
// [4] reserved by binder
|
||||
// [5] TOC save area
|
||||
// [6] Parameter1 save area
|
||||
// ...
|
||||
// [13] Parameter8 save area
|
||||
// [14] Parameter9 slot (if necessary)
|
||||
// ...
|
||||
#if V8_TARGET_ARCH_PPC64
|
||||
const int kNumRequiredStackFrameSlots = 14;
|
||||
#else
|
||||
const int kNumRequiredStackFrameSlots = 16;
|
||||
#endif
|
||||
const int kStackFrameLRSlot = 2;
|
||||
const int kStackFrameExtraParamSlot = 14;
|
||||
#else
|
||||
// [0] back chain
|
||||
// [1] link register save area
|
||||
// [2] Parameter9 slot (if necessary)
|
||||
// ...
|
||||
const int kNumRequiredStackFrameSlots = 4;
|
||||
const int kStackFrameLRSlot = 1;
|
||||
const int kStackFrameExtraParamSlot = 2;
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------
|
||||
|
||||
|
||||
class EntryFrameConstants : public AllStatic {
|
||||
public:
|
||||
static const int kCallerFPOffset =
|
||||
@ -168,7 +30,6 @@ class ExitFrameConstants : public TypedFrameConstants {
|
||||
static const int kCallerSPDisplacement = 2 * kPointerSize;
|
||||
};
|
||||
|
||||
|
||||
class JavaScriptFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
@ -181,7 +42,6 @@ class JavaScriptFrameConstants : public AllStatic {
|
||||
static const int kReceiverOffset = -1 * kPointerSize;
|
||||
};
|
||||
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
|
@ -266,7 +266,5 @@ bool RegisterConfiguration::AreAliases(MachineRepresentation rep, int index,
|
||||
return index >> shift == other_index;
|
||||
}
|
||||
|
||||
#undef REGISTER_COUNT
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
24
src/reglist.h
Normal file
24
src/reglist.h
Normal file
@ -0,0 +1,24 @@
|
||||
// Copyright 2017 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef V8_REGLIST_H_
|
||||
#define V8_REGLIST_H_
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
// Register configurations.
|
||||
#if V8_TARGET_ARCH_ARM64
|
||||
typedef uint64_t RegList;
|
||||
#else
|
||||
typedef uint32_t RegList;
|
||||
#endif
|
||||
|
||||
// Get the number of registers in a given register list.
|
||||
inline int NumRegs(RegList list) { return base::bits::CountPopulation(list); }
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
#endif // V8_REGLIST_H_
|
@ -98,6 +98,141 @@ namespace internal {
|
||||
V(d8) V(d9) V(d10) V(d11) V(d12) V(d15) V(d0)
|
||||
// clang-format on
|
||||
|
||||
// Register list in load/store instructions
|
||||
// Note that the bit values must match those used in actual instruction encoding
|
||||
const int kNumRegs = 16;
|
||||
|
||||
// Caller-saved/arguments registers
|
||||
const RegList kJSCallerSaved = 1 << 1 | 1 << 2 | // r2 a1
|
||||
1 << 3 | // r3 a2
|
||||
1 << 4 | // r4 a3
|
||||
1 << 5; // r5 a4
|
||||
|
||||
const int kNumJSCallerSaved = 5;
|
||||
|
||||
// Callee-saved registers preserved when switching from C to JavaScript
|
||||
const RegList kCalleeSaved =
|
||||
1 << 6 | // r6 (argument passing in CEntryStub)
|
||||
// (HandleScope logic in MacroAssembler)
|
||||
1 << 7 | // r7 (argument passing in CEntryStub)
|
||||
// (HandleScope logic in MacroAssembler)
|
||||
1 << 8 | // r8 (argument passing in CEntryStub)
|
||||
// (HandleScope logic in MacroAssembler)
|
||||
1 << 9 | // r9 (HandleScope logic in MacroAssembler)
|
||||
1 << 10 | // r10 (Roots register in Javascript)
|
||||
1 << 11 | // r11 (fp in Javascript)
|
||||
1 << 12 | // r12 (ip in Javascript)
|
||||
1 << 13; // r13 (cp in Javascript)
|
||||
// 1 << 15; // r15 (sp in Javascript)
|
||||
|
||||
const int kNumCalleeSaved = 8;
|
||||
|
||||
#ifdef V8_TARGET_ARCH_S390X
|
||||
|
||||
const RegList kCallerSavedDoubles = 1 << 0 | // d0
|
||||
1 << 1 | // d1
|
||||
1 << 2 | // d2
|
||||
1 << 3 | // d3
|
||||
1 << 4 | // d4
|
||||
1 << 5 | // d5
|
||||
1 << 6 | // d6
|
||||
1 << 7; // d7
|
||||
|
||||
const int kNumCallerSavedDoubles = 8;
|
||||
|
||||
const RegList kCalleeSavedDoubles = 1 << 8 | // d8
|
||||
1 << 9 | // d9
|
||||
1 << 10 | // d10
|
||||
1 << 11 | // d11
|
||||
1 << 12 | // d12
|
||||
1 << 13 | // d12
|
||||
1 << 14 | // d12
|
||||
1 << 15; // d13
|
||||
|
||||
const int kNumCalleeSavedDoubles = 8;
|
||||
|
||||
#else
|
||||
|
||||
const RegList kCallerSavedDoubles = 1 << 14 | // d14
|
||||
1 << 15 | // d15
|
||||
1 << 0 | // d0
|
||||
1 << 1 | // d1
|
||||
1 << 2 | // d2
|
||||
1 << 3 | // d3
|
||||
1 << 5 | // d5
|
||||
1 << 7 | // d7
|
||||
1 << 8 | // d8
|
||||
1 << 9 | // d9
|
||||
1 << 10 | // d10
|
||||
1 << 11 | // d10
|
||||
1 << 12 | // d10
|
||||
1 << 13; // d11
|
||||
|
||||
const int kNumCallerSavedDoubles = 14;
|
||||
|
||||
const RegList kCalleeSavedDoubles = 1 << 4 | // d4
|
||||
1 << 6; // d6
|
||||
|
||||
const int kNumCalleeSavedDoubles = 2;
|
||||
|
||||
#endif
|
||||
|
||||
// Number of registers for which space is reserved in safepoints. Must be a
|
||||
// multiple of 8.
|
||||
// TODO(regis): Only 8 registers may actually be sufficient. Revisit.
|
||||
const int kNumSafepointRegisters = 16;
|
||||
|
||||
// Define the list of registers actually saved at safepoints.
|
||||
// Note that the number of saved registers may be smaller than the reserved
|
||||
// space, i.e. kNumSafepointSavedRegisters <= kNumSafepointRegisters.
|
||||
// const RegList kSafepointSavedRegisters = kJSCallerSaved | kCalleeSaved;
|
||||
// const int kNumSafepointSavedRegisters = kNumJSCallerSaved + kNumCalleeSaved;
|
||||
|
||||
// The following constants describe the stack frame linkage area as
|
||||
// defined by the ABI.
|
||||
|
||||
#if V8_TARGET_ARCH_S390X
|
||||
// [0] Back Chain
|
||||
// [1] Reserved for compiler use
|
||||
// [2] GPR 2
|
||||
// [3] GPR 3
|
||||
// ...
|
||||
// [15] GPR 15
|
||||
// [16] FPR 0
|
||||
// [17] FPR 2
|
||||
// [18] FPR 4
|
||||
// [19] FPR 6
|
||||
const int kNumRequiredStackFrameSlots = 20;
|
||||
const int kStackFrameRASlot = 14;
|
||||
const int kStackFrameSPSlot = 15;
|
||||
const int kStackFrameExtraParamSlot = 20;
|
||||
#else
|
||||
// [0] Back Chain
|
||||
// [1] Reserved for compiler use
|
||||
// [2] GPR 2
|
||||
// [3] GPR 3
|
||||
// ...
|
||||
// [15] GPR 15
|
||||
// [16..17] FPR 0
|
||||
// [18..19] FPR 2
|
||||
// [20..21] FPR 4
|
||||
// [22..23] FPR 6
|
||||
const int kNumRequiredStackFrameSlots = 24;
|
||||
const int kStackFrameRASlot = 14;
|
||||
const int kStackFrameSPSlot = 15;
|
||||
const int kStackFrameExtraParamSlot = 24;
|
||||
#endif
|
||||
|
||||
// zLinux ABI requires caller frames to include sufficient space for
|
||||
// callee preserved register save area.
|
||||
#if V8_TARGET_ARCH_S390X
|
||||
const int kCalleeRegisterSaveAreaSize = 160;
|
||||
#elif V8_TARGET_ARCH_S390
|
||||
const int kCalleeRegisterSaveAreaSize = 96;
|
||||
#else
|
||||
const int kCalleeRegisterSaveAreaSize = 0;
|
||||
#endif
|
||||
|
||||
// CPU Registers.
|
||||
//
|
||||
// 1) We would prefer to use an enum, but enum values are assignment-
|
||||
|
@ -8,147 +8,6 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
// Register list in load/store instructions
|
||||
// Note that the bit values must match those used in actual instruction encoding
|
||||
const int kNumRegs = 16;
|
||||
|
||||
// Caller-saved/arguments registers
|
||||
const RegList kJSCallerSaved = 1 << 1 | 1 << 2 | // r2 a1
|
||||
1 << 3 | // r3 a2
|
||||
1 << 4 | // r4 a3
|
||||
1 << 5; // r5 a4
|
||||
|
||||
const int kNumJSCallerSaved = 5;
|
||||
|
||||
// Return the code of the n-th caller-saved register available to JavaScript
|
||||
// e.g. JSCallerSavedReg(0) returns r0.code() == 0
|
||||
int JSCallerSavedCode(int n);
|
||||
|
||||
// Callee-saved registers preserved when switching from C to JavaScript
|
||||
const RegList kCalleeSaved =
|
||||
1 << 6 | // r6 (argument passing in CEntryStub)
|
||||
// (HandleScope logic in MacroAssembler)
|
||||
1 << 7 | // r7 (argument passing in CEntryStub)
|
||||
// (HandleScope logic in MacroAssembler)
|
||||
1 << 8 | // r8 (argument passing in CEntryStub)
|
||||
// (HandleScope logic in MacroAssembler)
|
||||
1 << 9 | // r9 (HandleScope logic in MacroAssembler)
|
||||
1 << 10 | // r10 (Roots register in Javascript)
|
||||
1 << 11 | // r11 (fp in Javascript)
|
||||
1 << 12 | // r12 (ip in Javascript)
|
||||
1 << 13; // r13 (cp in Javascript)
|
||||
// 1 << 15; // r15 (sp in Javascript)
|
||||
|
||||
const int kNumCalleeSaved = 8;
|
||||
|
||||
#ifdef V8_TARGET_ARCH_S390X
|
||||
|
||||
const RegList kCallerSavedDoubles = 1 << 0 | // d0
|
||||
1 << 1 | // d1
|
||||
1 << 2 | // d2
|
||||
1 << 3 | // d3
|
||||
1 << 4 | // d4
|
||||
1 << 5 | // d5
|
||||
1 << 6 | // d6
|
||||
1 << 7; // d7
|
||||
|
||||
const int kNumCallerSavedDoubles = 8;
|
||||
|
||||
const RegList kCalleeSavedDoubles = 1 << 8 | // d8
|
||||
1 << 9 | // d9
|
||||
1 << 10 | // d10
|
||||
1 << 11 | // d11
|
||||
1 << 12 | // d12
|
||||
1 << 13 | // d12
|
||||
1 << 14 | // d12
|
||||
1 << 15; // d13
|
||||
|
||||
const int kNumCalleeSavedDoubles = 8;
|
||||
|
||||
#else
|
||||
|
||||
const RegList kCallerSavedDoubles = 1 << 14 | // d14
|
||||
1 << 15 | // d15
|
||||
1 << 0 | // d0
|
||||
1 << 1 | // d1
|
||||
1 << 2 | // d2
|
||||
1 << 3 | // d3
|
||||
1 << 5 | // d5
|
||||
1 << 7 | // d7
|
||||
1 << 8 | // d8
|
||||
1 << 9 | // d9
|
||||
1 << 10 | // d10
|
||||
1 << 11 | // d10
|
||||
1 << 12 | // d10
|
||||
1 << 13; // d11
|
||||
|
||||
const int kNumCallerSavedDoubles = 14;
|
||||
|
||||
const RegList kCalleeSavedDoubles = 1 << 4 | // d4
|
||||
1 << 6; // d6
|
||||
|
||||
const int kNumCalleeSavedDoubles = 2;
|
||||
|
||||
#endif
|
||||
|
||||
// Number of registers for which space is reserved in safepoints. Must be a
|
||||
// multiple of 8.
|
||||
// TODO(regis): Only 8 registers may actually be sufficient. Revisit.
|
||||
const int kNumSafepointRegisters = 16;
|
||||
|
||||
// Define the list of registers actually saved at safepoints.
|
||||
// Note that the number of saved registers may be smaller than the reserved
|
||||
// space, i.e. kNumSafepointSavedRegisters <= kNumSafepointRegisters.
|
||||
// const RegList kSafepointSavedRegisters = kJSCallerSaved | kCalleeSaved;
|
||||
// const int kNumSafepointSavedRegisters = kNumJSCallerSaved + kNumCalleeSaved;
|
||||
|
||||
// The following constants describe the stack frame linkage area as
|
||||
// defined by the ABI.
|
||||
|
||||
#if V8_TARGET_ARCH_S390X
|
||||
// [0] Back Chain
|
||||
// [1] Reserved for compiler use
|
||||
// [2] GPR 2
|
||||
// [3] GPR 3
|
||||
// ...
|
||||
// [15] GPR 15
|
||||
// [16] FPR 0
|
||||
// [17] FPR 2
|
||||
// [18] FPR 4
|
||||
// [19] FPR 6
|
||||
const int kNumRequiredStackFrameSlots = 20;
|
||||
const int kStackFrameRASlot = 14;
|
||||
const int kStackFrameSPSlot = 15;
|
||||
const int kStackFrameExtraParamSlot = 20;
|
||||
#else
|
||||
// [0] Back Chain
|
||||
// [1] Reserved for compiler use
|
||||
// [2] GPR 2
|
||||
// [3] GPR 3
|
||||
// ...
|
||||
// [15] GPR 15
|
||||
// [16..17] FPR 0
|
||||
// [18..19] FPR 2
|
||||
// [20..21] FPR 4
|
||||
// [22..23] FPR 6
|
||||
const int kNumRequiredStackFrameSlots = 24;
|
||||
const int kStackFrameRASlot = 14;
|
||||
const int kStackFrameSPSlot = 15;
|
||||
const int kStackFrameExtraParamSlot = 24;
|
||||
#endif
|
||||
|
||||
// zLinux ABI requires caller frames to include sufficient space for
|
||||
// callee preserved register save area.
|
||||
#if V8_TARGET_ARCH_S390X
|
||||
const int kCalleeRegisterSaveAreaSize = 160;
|
||||
#elif V8_TARGET_ARCH_S390
|
||||
const int kCalleeRegisterSaveAreaSize = 96;
|
||||
#else
|
||||
const int kCalleeRegisterSaveAreaSize = 0;
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------
|
||||
|
||||
class EntryFrameConstants : public AllStatic {
|
||||
public:
|
||||
static const int kCallerFPOffset =
|
||||
|
@ -1295,6 +1295,7 @@
|
||||
'regexp/regexp-utils.h',
|
||||
'register-configuration.cc',
|
||||
'register-configuration.h',
|
||||
'reglist.h',
|
||||
'runtime-profiler.cc',
|
||||
'runtime-profiler.h',
|
||||
'runtime/runtime-array.cc',
|
||||
|
@ -83,6 +83,19 @@ namespace internal {
|
||||
// The length of pushq(rbp), movp(rbp, rsp), Push(rsi) and Push(rdi).
|
||||
constexpr int kNoCodeAgeSequenceLength = kPointerSize == kInt64Size ? 6 : 17;
|
||||
|
||||
const int kNumRegs = 16;
|
||||
const RegList kJSCallerSaved =
|
||||
1 << 0 | // rax
|
||||
1 << 1 | // rcx
|
||||
1 << 2 | // rdx
|
||||
1 << 3 | // rbx - used as a caller-saved register in JavaScript code
|
||||
1 << 7; // rdi - callee function
|
||||
|
||||
const int kNumJSCallerSaved = 5;
|
||||
|
||||
// Number of registers for which space is reserved in safepoints.
|
||||
const int kNumSafepointRegisters = 16;
|
||||
|
||||
// CPU Registers.
|
||||
//
|
||||
// 1) We would prefer to use an enum, but enum values are assignment-
|
||||
|
@ -8,21 +8,6 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
const int kNumRegs = 16;
|
||||
const RegList kJSCallerSaved =
|
||||
1 << 0 | // rax
|
||||
1 << 1 | // rcx
|
||||
1 << 2 | // rdx
|
||||
1 << 3 | // rbx - used as a caller-saved register in JavaScript code
|
||||
1 << 7; // rdi - callee function
|
||||
|
||||
const int kNumJSCallerSaved = 5;
|
||||
|
||||
// Number of registers for which space is reserved in safepoints.
|
||||
const int kNumSafepointRegisters = 16;
|
||||
|
||||
// ----------------------------------------------------
|
||||
|
||||
class EntryFrameConstants : public AllStatic {
|
||||
public:
|
||||
#ifdef _WIN64
|
||||
@ -68,7 +53,6 @@ class JavaScriptFrameConstants : public AllStatic {
|
||||
static const int kReceiverOffset = -1 * kPointerSize;
|
||||
};
|
||||
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user