Cleanup frame description constant.
This unifies the existing frame constants that are the same accross all architectures. It also adds a new kOriginalConstructorOffset constant for construct frames and uses is in full-codegen. R=bmeurer@chromium.org Review URL: https://codereview.chromium.org/1220223005 Cr-Commit-Position: refs/heads/master@{#29509}
This commit is contained in:
parent
c935d2b9ee
commit
a104e7c9b4
@ -128,35 +128,6 @@ class JavaScriptFrameConstants : public AllStatic {
|
||||
};
|
||||
|
||||
|
||||
class ArgumentsAdaptorFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kLengthOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
|
||||
static const int kFrameSize =
|
||||
StandardFrameConstants::kFixedFrameSize + kPointerSize;
|
||||
};
|
||||
|
||||
|
||||
class ConstructFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kImplicitReceiverOffset = -5 * kPointerSize;
|
||||
static const int kLengthOffset = -4 * kPointerSize;
|
||||
static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
|
||||
static const int kFrameSize =
|
||||
StandardFrameConstants::kFixedFrameSize + 3 * kPointerSize;
|
||||
};
|
||||
|
||||
|
||||
class InternalFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
};
|
||||
|
||||
|
||||
inline Object* JavaScriptFrame::function_slot_object() const {
|
||||
const int offset = JavaScriptFrameConstants::kFunctionOffset;
|
||||
return Memory::Object_at(fp() + offset);
|
||||
|
@ -263,8 +263,8 @@ void FullCodeGenerator::Generate() {
|
||||
Label non_construct_frame, done;
|
||||
|
||||
__ b(ne, &non_construct_frame);
|
||||
__ ldr(r0, MemOperand(r2, StandardFrameConstants::kExpressionsOffset -
|
||||
2 * kPointerSize));
|
||||
__ ldr(r0,
|
||||
MemOperand(r2, ConstructFrameConstants::kOriginalConstructorOffset));
|
||||
__ b(&done);
|
||||
|
||||
__ bind(&non_construct_frame);
|
||||
|
@ -63,35 +63,6 @@ class JavaScriptFrameConstants : public AllStatic {
|
||||
};
|
||||
|
||||
|
||||
class ArgumentsAdaptorFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kLengthOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
|
||||
static const int kFrameSize =
|
||||
StandardFrameConstants::kFixedFrameSize + kPointerSize;
|
||||
};
|
||||
|
||||
|
||||
class ConstructFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
static const int kLengthOffset = -4 * kPointerSize;
|
||||
static const int kImplicitReceiverOffset = -5 * kPointerSize;
|
||||
|
||||
static const int kFrameSize =
|
||||
StandardFrameConstants::kFixedFrameSize + 3 * kPointerSize;
|
||||
};
|
||||
|
||||
|
||||
class InternalFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
};
|
||||
|
||||
|
||||
inline Object* JavaScriptFrame::function_slot_object() const {
|
||||
const int offset = JavaScriptFrameConstants::kFunctionOffset;
|
||||
return Memory::Object_at(fp() + offset);
|
||||
|
@ -269,8 +269,8 @@ void FullCodeGenerator::Generate() {
|
||||
Label non_construct_frame, done;
|
||||
|
||||
__ B(ne, &non_construct_frame);
|
||||
__ Ldr(x0, MemOperand(x2, StandardFrameConstants::kExpressionsOffset -
|
||||
2 * kPointerSize));
|
||||
__ Ldr(x0,
|
||||
MemOperand(x2, ConstructFrameConstants::kOriginalConstructorOffset));
|
||||
__ B(&done);
|
||||
|
||||
__ Bind(&non_construct_frame);
|
||||
|
@ -737,6 +737,8 @@ Object* JavaScriptFrame::GetOriginalConstructor() const {
|
||||
fp = Memory::Address_at(fp + StandardFrameConstants::kCallerFPOffset);
|
||||
}
|
||||
DCHECK(IsConstructFrame(fp));
|
||||
STATIC_ASSERT(ConstructFrameConstants::kOriginalConstructorOffset ==
|
||||
StandardFrameConstants::kExpressionsOffset - 2 * kPointerSize);
|
||||
return GetExpression(fp, 2);
|
||||
}
|
||||
|
||||
@ -744,6 +746,8 @@ Object* JavaScriptFrame::GetOriginalConstructor() const {
|
||||
int JavaScriptFrame::GetArgumentsLength() const {
|
||||
// If there is an arguments adaptor frame get the arguments length from it.
|
||||
if (has_adapted_arguments()) {
|
||||
STATIC_ASSERT(ArgumentsAdaptorFrameConstants::kLengthOffset ==
|
||||
StandardFrameConstants::kExpressionsOffset);
|
||||
return Smi::cast(GetExpression(caller_fp(), 0))->value();
|
||||
} else {
|
||||
return GetNumberOfIncomingArguments();
|
||||
|
34
src/frames.h
34
src/frames.h
@ -134,6 +134,40 @@ class StandardFrameConstants : public AllStatic {
|
||||
};
|
||||
|
||||
|
||||
class ArgumentsAdaptorFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kLengthOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
|
||||
static const int kFrameSize =
|
||||
StandardFrameConstants::kFixedFrameSize + kPointerSize;
|
||||
};
|
||||
|
||||
|
||||
class InternalFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
};
|
||||
|
||||
|
||||
class ConstructFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kImplicitReceiverOffset =
|
||||
StandardFrameConstants::kExpressionsOffset - 2 * kPointerSize;
|
||||
static const int kOriginalConstructorOffset =
|
||||
StandardFrameConstants::kExpressionsOffset - 2 * kPointerSize;
|
||||
static const int kLengthOffset =
|
||||
StandardFrameConstants::kExpressionsOffset - 1 * kPointerSize;
|
||||
static const int kCodeOffset =
|
||||
StandardFrameConstants::kExpressionsOffset - 0 * kPointerSize;
|
||||
|
||||
static const int kFrameSize =
|
||||
StandardFrameConstants::kFixedFrameSize + 3 * kPointerSize;
|
||||
};
|
||||
|
||||
|
||||
// Abstract base class for all stack frames.
|
||||
class StackFrame BASE_EMBEDDED {
|
||||
public:
|
||||
|
@ -79,35 +79,6 @@ class JavaScriptFrameConstants : public AllStatic {
|
||||
};
|
||||
|
||||
|
||||
class ArgumentsAdaptorFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kLengthOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
|
||||
static const int kFrameSize =
|
||||
StandardFrameConstants::kFixedFrameSize + kPointerSize;
|
||||
};
|
||||
|
||||
|
||||
class ConstructFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kImplicitReceiverOffset = -5 * kPointerSize;
|
||||
static const int kLengthOffset = -4 * kPointerSize;
|
||||
static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
|
||||
static const int kFrameSize =
|
||||
StandardFrameConstants::kFixedFrameSize + 3 * kPointerSize;
|
||||
};
|
||||
|
||||
|
||||
class InternalFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
};
|
||||
|
||||
|
||||
inline Object* JavaScriptFrame::function_slot_object() const {
|
||||
const int offset = JavaScriptFrameConstants::kFunctionOffset;
|
||||
return Memory::Object_at(fp() + offset);
|
||||
|
@ -264,8 +264,8 @@ void FullCodeGenerator::Generate() {
|
||||
__ j(not_equal, &non_construct_frame);
|
||||
|
||||
// Construct frame
|
||||
__ mov(eax, Operand(eax, StandardFrameConstants::kExpressionsOffset -
|
||||
2 * kPointerSize));
|
||||
__ mov(eax,
|
||||
Operand(eax, ConstructFrameConstants::kOriginalConstructorOffset));
|
||||
__ jmp(&done);
|
||||
|
||||
// Non-construct frame
|
||||
|
@ -169,35 +169,6 @@ class JavaScriptFrameConstants : public AllStatic {
|
||||
};
|
||||
|
||||
|
||||
class ArgumentsAdaptorFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kLengthOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
|
||||
static const int kFrameSize =
|
||||
StandardFrameConstants::kFixedFrameSize + kPointerSize;
|
||||
};
|
||||
|
||||
|
||||
class ConstructFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kImplicitReceiverOffset = -5 * kPointerSize;
|
||||
static const int kLengthOffset = -4 * kPointerSize;
|
||||
static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
|
||||
static const int kFrameSize =
|
||||
StandardFrameConstants::kFixedFrameSize + 3 * kPointerSize;
|
||||
};
|
||||
|
||||
|
||||
class InternalFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
};
|
||||
|
||||
|
||||
inline Object* JavaScriptFrame::function_slot_object() const {
|
||||
const int offset = JavaScriptFrameConstants::kFunctionOffset;
|
||||
return Memory::Object_at(fp() + offset);
|
||||
|
@ -281,8 +281,8 @@ void FullCodeGenerator::Generate() {
|
||||
__ Branch(&non_construct_frame, ne, a1,
|
||||
Operand(Smi::FromInt(StackFrame::CONSTRUCT)));
|
||||
|
||||
__ lw(v0, MemOperand(a2, StandardFrameConstants::kExpressionsOffset -
|
||||
2 * kPointerSize));
|
||||
__ lw(v0,
|
||||
MemOperand(a2, ConstructFrameConstants::kOriginalConstructorOffset));
|
||||
__ Branch(&done);
|
||||
|
||||
__ bind(&non_construct_frame);
|
||||
|
@ -169,35 +169,6 @@ class JavaScriptFrameConstants : public AllStatic {
|
||||
};
|
||||
|
||||
|
||||
class ArgumentsAdaptorFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kLengthOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
|
||||
static const int kFrameSize =
|
||||
StandardFrameConstants::kFixedFrameSize + kPointerSize;
|
||||
};
|
||||
|
||||
|
||||
class ConstructFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kImplicitReceiverOffset = -5 * kPointerSize;
|
||||
static const int kLengthOffset = -4 * kPointerSize;
|
||||
static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
|
||||
static const int kFrameSize =
|
||||
StandardFrameConstants::kFixedFrameSize + 3 * kPointerSize;
|
||||
};
|
||||
|
||||
|
||||
class InternalFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
};
|
||||
|
||||
|
||||
inline Object* JavaScriptFrame::function_slot_object() const {
|
||||
const int offset = JavaScriptFrameConstants::kFunctionOffset;
|
||||
return Memory::Object_at(fp() + offset);
|
||||
|
@ -277,8 +277,8 @@ void FullCodeGenerator::Generate() {
|
||||
__ Branch(&non_construct_frame, ne, a1,
|
||||
Operand(Smi::FromInt(StackFrame::CONSTRUCT)));
|
||||
|
||||
__ ld(v0, MemOperand(a2, StandardFrameConstants::kExpressionsOffset -
|
||||
2 * kPointerSize));
|
||||
__ ld(v0,
|
||||
MemOperand(a2, ConstructFrameConstants::kOriginalConstructorOffset));
|
||||
__ Branch(&done);
|
||||
|
||||
__ bind(&non_construct_frame);
|
||||
|
@ -148,35 +148,6 @@ class JavaScriptFrameConstants : public AllStatic {
|
||||
};
|
||||
|
||||
|
||||
class ArgumentsAdaptorFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kLengthOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
|
||||
static const int kFrameSize =
|
||||
StandardFrameConstants::kFixedFrameSize + kPointerSize;
|
||||
};
|
||||
|
||||
|
||||
class ConstructFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kImplicitReceiverOffset = -5 * kPointerSize;
|
||||
static const int kLengthOffset = -4 * kPointerSize;
|
||||
static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
|
||||
static const int kFrameSize =
|
||||
StandardFrameConstants::kFixedFrameSize + 3 * kPointerSize;
|
||||
};
|
||||
|
||||
|
||||
class InternalFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
};
|
||||
|
||||
|
||||
inline Object* JavaScriptFrame::function_slot_object() const {
|
||||
const int offset = JavaScriptFrameConstants::kFunctionOffset;
|
||||
return Memory::Object_at(fp() + offset);
|
||||
|
@ -276,8 +276,8 @@ void FullCodeGenerator::Generate() {
|
||||
Label non_construct_frame, done;
|
||||
|
||||
__ bne(&non_construct_frame);
|
||||
__ LoadP(r3, MemOperand(r5, StandardFrameConstants::kExpressionsOffset -
|
||||
2 * kPointerSize));
|
||||
__ LoadP(r3, MemOperand(
|
||||
r5, ConstructFrameConstants::kOriginalConstructorOffset));
|
||||
__ b(&done);
|
||||
|
||||
__ bind(&non_construct_frame);
|
||||
|
@ -71,35 +71,6 @@ class JavaScriptFrameConstants : public AllStatic {
|
||||
};
|
||||
|
||||
|
||||
class ArgumentsAdaptorFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kLengthOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
|
||||
static const int kFrameSize =
|
||||
StandardFrameConstants::kFixedFrameSize + kPointerSize;
|
||||
};
|
||||
|
||||
|
||||
class ConstructFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kImplicitReceiverOffset = -5 * kPointerSize;
|
||||
static const int kLengthOffset = -4 * kPointerSize;
|
||||
static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
|
||||
static const int kFrameSize =
|
||||
StandardFrameConstants::kFixedFrameSize + 3 * kPointerSize;
|
||||
};
|
||||
|
||||
|
||||
class InternalFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
};
|
||||
|
||||
|
||||
inline Object* JavaScriptFrame::function_slot_object() const {
|
||||
const int offset = JavaScriptFrameConstants::kFunctionOffset;
|
||||
return Memory::Object_at(fp() + offset);
|
||||
|
@ -261,8 +261,8 @@ void FullCodeGenerator::Generate() {
|
||||
__ j(not_equal, &non_construct_frame);
|
||||
|
||||
// Construct frame
|
||||
__ movp(rax, Operand(rax, StandardFrameConstants::kExpressionsOffset -
|
||||
2 * kPointerSize));
|
||||
__ movp(rax,
|
||||
Operand(rax, ConstructFrameConstants::kOriginalConstructorOffset));
|
||||
__ jmp(&done);
|
||||
|
||||
// Non-construct frame
|
||||
|
@ -79,35 +79,6 @@ class JavaScriptFrameConstants : public AllStatic {
|
||||
};
|
||||
|
||||
|
||||
class ArgumentsAdaptorFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kLengthOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
|
||||
static const int kFrameSize =
|
||||
StandardFrameConstants::kFixedFrameSize + kPointerSize;
|
||||
};
|
||||
|
||||
|
||||
class ConstructFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kImplicitReceiverOffset = -5 * kPointerSize;
|
||||
static const int kLengthOffset = -4 * kPointerSize;
|
||||
static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
|
||||
static const int kFrameSize =
|
||||
StandardFrameConstants::kFixedFrameSize + 3 * kPointerSize;
|
||||
};
|
||||
|
||||
|
||||
class InternalFrameConstants : public AllStatic {
|
||||
public:
|
||||
// FP-relative.
|
||||
static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
|
||||
};
|
||||
|
||||
|
||||
inline Object* JavaScriptFrame::function_slot_object() const {
|
||||
const int offset = JavaScriptFrameConstants::kFunctionOffset;
|
||||
return Memory::Object_at(fp() + offset);
|
||||
|
@ -261,8 +261,8 @@ void FullCodeGenerator::Generate() {
|
||||
__ j(not_equal, &non_construct_frame);
|
||||
|
||||
// Construct frame
|
||||
__ mov(eax, Operand(eax, StandardFrameConstants::kExpressionsOffset -
|
||||
2 * kPointerSize));
|
||||
__ mov(eax,
|
||||
Operand(eax, ConstructFrameConstants::kOriginalConstructorOffset));
|
||||
__ jmp(&done);
|
||||
|
||||
// Non-construct frame
|
||||
|
Loading…
Reference in New Issue
Block a user