Rename the Location type tags to be consistent with our current naming
scheme for enumerations (eg, EFFECT => kEffect). Remove the ability to move from one Location to another, which should never be necessary. Review URL: http://codereview.chromium.org/340034 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3175 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
be769f6a24
commit
b1defd51cb
@ -119,11 +119,11 @@ void FastCodeGenerator::Generate(FunctionLiteral* fun) {
|
|||||||
|
|
||||||
void FastCodeGenerator::Move(Location destination, Slot* source) {
|
void FastCodeGenerator::Move(Location destination, Slot* source) {
|
||||||
switch (destination.type()) {
|
switch (destination.type()) {
|
||||||
case Location::UNINITIALIZED:
|
case Location::kUninitialized:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
break;
|
break;
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
__ ldr(ip, MemOperand(fp, SlotOffset(source)));
|
__ ldr(ip, MemOperand(fp, SlotOffset(source)));
|
||||||
__ push(ip);
|
__ push(ip);
|
||||||
break;
|
break;
|
||||||
@ -133,11 +133,11 @@ void FastCodeGenerator::Move(Location destination, Slot* source) {
|
|||||||
|
|
||||||
void FastCodeGenerator::Move(Location destination, Literal* expr) {
|
void FastCodeGenerator::Move(Location destination, Literal* expr) {
|
||||||
switch (destination.type()) {
|
switch (destination.type()) {
|
||||||
case Location::UNINITIALIZED:
|
case Location::kUninitialized:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
break;
|
break;
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
__ mov(ip, Operand(expr->handle()));
|
__ mov(ip, Operand(expr->handle()));
|
||||||
__ push(ip);
|
__ push(ip);
|
||||||
break;
|
break;
|
||||||
@ -147,10 +147,10 @@ void FastCodeGenerator::Move(Location destination, Literal* expr) {
|
|||||||
|
|
||||||
void FastCodeGenerator::Move(Slot* destination, Location source) {
|
void FastCodeGenerator::Move(Slot* destination, Location source) {
|
||||||
switch (source.type()) {
|
switch (source.type()) {
|
||||||
case Location::UNINITIALIZED: // Fall through.
|
case Location::kUninitialized: // Fall through.
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
__ pop(ip);
|
__ pop(ip);
|
||||||
__ str(ip, MemOperand(fp, SlotOffset(destination)));
|
__ str(ip, MemOperand(fp, SlotOffset(destination)));
|
||||||
break;
|
break;
|
||||||
@ -160,12 +160,12 @@ void FastCodeGenerator::Move(Slot* destination, Location source) {
|
|||||||
|
|
||||||
void FastCodeGenerator::DropAndMove(Location destination, Register source) {
|
void FastCodeGenerator::DropAndMove(Location destination, Register source) {
|
||||||
switch (destination.type()) {
|
switch (destination.type()) {
|
||||||
case Location::UNINITIALIZED:
|
case Location::kUninitialized:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
__ pop();
|
__ pop();
|
||||||
break;
|
break;
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
__ str(source, MemOperand(sp));
|
__ str(source, MemOperand(sp));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -362,12 +362,12 @@ void FastCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (expr->location().type()) {
|
switch (expr->location().type()) {
|
||||||
case Location::UNINITIALIZED:
|
case Location::kUninitialized:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
if (result_saved) __ pop();
|
if (result_saved) __ pop();
|
||||||
break;
|
break;
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
if (!result_saved) __ push(r0);
|
if (!result_saved) __ push(r0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -439,12 +439,12 @@ void FastCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (expr->location().type()) {
|
switch (expr->location().type()) {
|
||||||
case Location::UNINITIALIZED:
|
case Location::kUninitialized:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
if (result_saved) __ pop();
|
if (result_saved) __ pop();
|
||||||
break;
|
break;
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
if (!result_saved) __ push(r0);
|
if (!result_saved) __ push(r0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -497,13 +497,13 @@ void FastCodeGenerator::VisitAssignment(Assignment* expr) {
|
|||||||
Visit(rhs);
|
Visit(rhs);
|
||||||
// Load right-hand side into ip.
|
// Load right-hand side into ip.
|
||||||
switch (expr->location().type()) {
|
switch (expr->location().type()) {
|
||||||
case Location::UNINITIALIZED:
|
case Location::kUninitialized:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
// Case 'var = temp'. Discard right-hand-side temporary.
|
// Case 'var = temp'. Discard right-hand-side temporary.
|
||||||
__ pop(ip);
|
__ pop(ip);
|
||||||
break;
|
break;
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
// Case 'temp1 <- (var = temp0)'. Preserve right-hand-side
|
// Case 'temp1 <- (var = temp0)'. Preserve right-hand-side
|
||||||
// temporary on the stack.
|
// temporary on the stack.
|
||||||
__ ldr(ip, MemOperand(sp));
|
__ ldr(ip, MemOperand(sp));
|
||||||
@ -549,12 +549,12 @@ void FastCodeGenerator::VisitProperty(Property* expr) {
|
|||||||
__ pop();
|
__ pop();
|
||||||
}
|
}
|
||||||
switch (expr->location().type()) {
|
switch (expr->location().type()) {
|
||||||
case Location::UNINITIALIZED:
|
case Location::kUninitialized:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
__ str(r0, MemOperand(sp));
|
__ str(r0, MemOperand(sp));
|
||||||
break;
|
break;
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
__ pop();
|
__ pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -734,12 +734,8 @@ void FastCodeGenerator::EmitLogicalOperation(BinaryOperation* expr) {
|
|||||||
// Discard the left-hand value if present on the stack.
|
// Discard the left-hand value if present on the stack.
|
||||||
if (destination.is_value()) __ pop();
|
if (destination.is_value()) __ pop();
|
||||||
// Save or discard the right-hand value as needed.
|
// Save or discard the right-hand value as needed.
|
||||||
if (right->AsLiteral() != NULL) {
|
Visit(right);
|
||||||
Move(destination, right->AsLiteral());
|
ASSERT_EQ(destination.type(), right->location().type());
|
||||||
} else {
|
|
||||||
Visit(right);
|
|
||||||
Move(destination, right->location());
|
|
||||||
}
|
|
||||||
|
|
||||||
__ bind(&done);
|
__ bind(&done);
|
||||||
}
|
}
|
||||||
|
@ -71,36 +71,15 @@ int FastCodeGenerator::SlotOffset(Slot* slot) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FastCodeGenerator::Move(Location destination, Location source) {
|
|
||||||
switch (destination.type()) {
|
|
||||||
case Location::UNINITIALIZED:
|
|
||||||
UNREACHABLE();
|
|
||||||
|
|
||||||
case Location::EFFECT:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Location::VALUE:
|
|
||||||
switch (source.type()) {
|
|
||||||
case Location::UNINITIALIZED: // Fall through.
|
|
||||||
case Location::EFFECT:
|
|
||||||
UNREACHABLE();
|
|
||||||
case Location::VALUE:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// All platform macro assemblers in {ia32,x64,arm} have a push(Register)
|
// All platform macro assemblers in {ia32,x64,arm} have a push(Register)
|
||||||
// function.
|
// function.
|
||||||
void FastCodeGenerator::Move(Location destination, Register source) {
|
void FastCodeGenerator::Move(Location destination, Register source) {
|
||||||
switch (destination.type()) {
|
switch (destination.type()) {
|
||||||
case Location::UNINITIALIZED:
|
case Location::kUninitialized:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
break;
|
break;
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
masm_->push(source);
|
masm_->push(source);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -111,10 +90,10 @@ void FastCodeGenerator::Move(Location destination, Register source) {
|
|||||||
// function.
|
// function.
|
||||||
void FastCodeGenerator::Move(Register destination, Location source) {
|
void FastCodeGenerator::Move(Register destination, Location source) {
|
||||||
switch (source.type()) {
|
switch (source.type()) {
|
||||||
case Location::UNINITIALIZED: // Fall through.
|
case Location::kUninitialized: // Fall through.
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
masm_->pop(destination);
|
masm_->pop(destination);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,8 +51,6 @@ class FastCodeGenerator: public AstVisitor {
|
|||||||
private:
|
private:
|
||||||
int SlotOffset(Slot* slot);
|
int SlotOffset(Slot* slot);
|
||||||
|
|
||||||
void Move(Location destination, Location source);
|
|
||||||
|
|
||||||
void Move(Location destination, Register source);
|
void Move(Location destination, Register source);
|
||||||
void Move(Location destination, Slot* source);
|
void Move(Location destination, Slot* source);
|
||||||
void Move(Location destination, Literal* source);
|
void Move(Location destination, Literal* source);
|
||||||
|
@ -110,11 +110,11 @@ void FastCodeGenerator::Generate(FunctionLiteral* fun) {
|
|||||||
|
|
||||||
void FastCodeGenerator::Move(Location destination, Slot* source) {
|
void FastCodeGenerator::Move(Location destination, Slot* source) {
|
||||||
switch (destination.type()) {
|
switch (destination.type()) {
|
||||||
case Location::UNINITIALIZED:
|
case Location::kUninitialized:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
break;
|
break;
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
__ push(Operand(ebp, SlotOffset(source)));
|
__ push(Operand(ebp, SlotOffset(source)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -123,11 +123,11 @@ void FastCodeGenerator::Move(Location destination, Slot* source) {
|
|||||||
|
|
||||||
void FastCodeGenerator::Move(Location destination, Literal* expr) {
|
void FastCodeGenerator::Move(Location destination, Literal* expr) {
|
||||||
switch (destination.type()) {
|
switch (destination.type()) {
|
||||||
case Location::UNINITIALIZED:
|
case Location::kUninitialized:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
break;
|
break;
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
__ push(Immediate(expr->handle()));
|
__ push(Immediate(expr->handle()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -136,10 +136,10 @@ void FastCodeGenerator::Move(Location destination, Literal* expr) {
|
|||||||
|
|
||||||
void FastCodeGenerator::Move(Slot* destination, Location source) {
|
void FastCodeGenerator::Move(Slot* destination, Location source) {
|
||||||
switch (source.type()) {
|
switch (source.type()) {
|
||||||
case Location::UNINITIALIZED: // Fall through.
|
case Location::kUninitialized: // Fall through.
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
__ pop(Operand(ebp, SlotOffset(destination)));
|
__ pop(Operand(ebp, SlotOffset(destination)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -148,12 +148,12 @@ void FastCodeGenerator::Move(Slot* destination, Location source) {
|
|||||||
|
|
||||||
void FastCodeGenerator::DropAndMove(Location destination, Register source) {
|
void FastCodeGenerator::DropAndMove(Location destination, Register source) {
|
||||||
switch (destination.type()) {
|
switch (destination.type()) {
|
||||||
case Location::UNINITIALIZED:
|
case Location::kUninitialized:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
__ add(Operand(esp), Immediate(kPointerSize));
|
__ add(Operand(esp), Immediate(kPointerSize));
|
||||||
break;
|
break;
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
__ mov(Operand(esp, 0), source);
|
__ mov(Operand(esp, 0), source);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -352,12 +352,12 @@ void FastCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (expr->location().type()) {
|
switch (expr->location().type()) {
|
||||||
case Location::UNINITIALIZED:
|
case Location::kUninitialized:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
if (result_saved) __ add(Operand(esp), Immediate(kPointerSize));
|
if (result_saved) __ add(Operand(esp), Immediate(kPointerSize));
|
||||||
break;
|
break;
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
if (!result_saved) __ push(eax);
|
if (!result_saved) __ push(eax);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -426,12 +426,12 @@ void FastCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (expr->location().type()) {
|
switch (expr->location().type()) {
|
||||||
case Location::UNINITIALIZED:
|
case Location::kUninitialized:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
if (result_saved) __ add(Operand(esp), Immediate(kPointerSize));
|
if (result_saved) __ add(Operand(esp), Immediate(kPointerSize));
|
||||||
break;
|
break;
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
if (!result_saved) __ push(eax);
|
if (!result_saved) __ push(eax);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -481,13 +481,13 @@ void FastCodeGenerator::VisitAssignment(Assignment* expr) {
|
|||||||
ASSERT(rhs->location().is_value());
|
ASSERT(rhs->location().is_value());
|
||||||
Visit(rhs);
|
Visit(rhs);
|
||||||
switch (expr->location().type()) {
|
switch (expr->location().type()) {
|
||||||
case Location::UNINITIALIZED:
|
case Location::kUninitialized:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
// Case 'var = temp'. Discard right-hand-side temporary.
|
// Case 'var = temp'. Discard right-hand-side temporary.
|
||||||
Move(var->slot(), rhs->location());
|
Move(var->slot(), rhs->location());
|
||||||
break;
|
break;
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
// Case 'temp1 <- (var = temp0)'. Preserve right-hand-side
|
// Case 'temp1 <- (var = temp0)'. Preserve right-hand-side
|
||||||
// temporary on the stack.
|
// temporary on the stack.
|
||||||
__ mov(eax, Operand(esp, 0));
|
__ mov(eax, Operand(esp, 0));
|
||||||
@ -532,12 +532,12 @@ void FastCodeGenerator::VisitProperty(Property* expr) {
|
|||||||
__ add(Operand(esp), Immediate(kPointerSize));
|
__ add(Operand(esp), Immediate(kPointerSize));
|
||||||
}
|
}
|
||||||
switch (expr->location().type()) {
|
switch (expr->location().type()) {
|
||||||
case Location::UNINITIALIZED:
|
case Location::kUninitialized:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
__ mov(Operand(esp, 0), eax);
|
__ mov(Operand(esp, 0), eax);
|
||||||
break;
|
break;
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
__ add(Operand(esp), Immediate(kPointerSize));
|
__ add(Operand(esp), Immediate(kPointerSize));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -706,14 +706,14 @@ void FastCodeGenerator::EmitLogicalOperation(BinaryOperation* expr) {
|
|||||||
Visit(left);
|
Visit(left);
|
||||||
ASSERT(left->location().is_value());
|
ASSERT(left->location().is_value());
|
||||||
switch (destination.type()) {
|
switch (destination.type()) {
|
||||||
case Location::UNINITIALIZED:
|
case Location::kUninitialized:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
// Pop the left-hand value into eax because we will not need it as the
|
// Pop the left-hand value into eax because we will not need it as the
|
||||||
// final result.
|
// final result.
|
||||||
__ pop(eax);
|
__ pop(eax);
|
||||||
break;
|
break;
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
// Copy the left-hand value into eax because we may need it as the
|
// Copy the left-hand value into eax because we may need it as the
|
||||||
// final result.
|
// final result.
|
||||||
__ mov(eax, Operand(esp, 0));
|
__ mov(eax, Operand(esp, 0));
|
||||||
@ -753,12 +753,8 @@ void FastCodeGenerator::EmitLogicalOperation(BinaryOperation* expr) {
|
|||||||
__ add(Operand(esp), Immediate(kPointerSize));
|
__ add(Operand(esp), Immediate(kPointerSize));
|
||||||
}
|
}
|
||||||
// Save or discard the right-hand value as needed.
|
// Save or discard the right-hand value as needed.
|
||||||
if (right->AsLiteral() != NULL) {
|
Visit(right);
|
||||||
Move(destination, right->AsLiteral());
|
ASSERT_EQ(destination.type(), right->location().type());
|
||||||
} else {
|
|
||||||
Visit(right);
|
|
||||||
Move(destination, right->location());
|
|
||||||
}
|
|
||||||
|
|
||||||
__ bind(&done);
|
__ bind(&done);
|
||||||
}
|
}
|
||||||
|
@ -35,14 +35,18 @@ namespace internal {
|
|||||||
|
|
||||||
class Location BASE_EMBEDDED {
|
class Location BASE_EMBEDDED {
|
||||||
public:
|
public:
|
||||||
enum Type { UNINITIALIZED, EFFECT, VALUE };
|
enum Type {
|
||||||
|
kUninitialized,
|
||||||
|
kEffect,
|
||||||
|
kValue
|
||||||
|
};
|
||||||
|
|
||||||
static Location Uninitialized() { return Location(UNINITIALIZED); }
|
static Location Uninitialized() { return Location(kUninitialized); }
|
||||||
static Location Effect() { return Location(EFFECT); }
|
static Location Effect() { return Location(kEffect); }
|
||||||
static Location Value() { return Location(VALUE); }
|
static Location Value() { return Location(kValue); }
|
||||||
|
|
||||||
bool is_effect() { return type_ == EFFECT; }
|
bool is_effect() { return type_ == kEffect; }
|
||||||
bool is_value() { return type_ == VALUE; }
|
bool is_value() { return type_ == kValue; }
|
||||||
|
|
||||||
Type type() { return type_; }
|
Type type() { return type_; }
|
||||||
|
|
||||||
|
@ -118,11 +118,11 @@ void FastCodeGenerator::Generate(FunctionLiteral* fun) {
|
|||||||
|
|
||||||
void FastCodeGenerator::Move(Location destination, Slot* source) {
|
void FastCodeGenerator::Move(Location destination, Slot* source) {
|
||||||
switch (destination.type()) {
|
switch (destination.type()) {
|
||||||
case Location::UNINITIALIZED:
|
case Location::kUninitialized:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
break;
|
break;
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
__ push(Operand(rbp, SlotOffset(source)));
|
__ push(Operand(rbp, SlotOffset(source)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -131,11 +131,11 @@ void FastCodeGenerator::Move(Location destination, Slot* source) {
|
|||||||
|
|
||||||
void FastCodeGenerator::Move(Location destination, Literal* expr) {
|
void FastCodeGenerator::Move(Location destination, Literal* expr) {
|
||||||
switch (destination.type()) {
|
switch (destination.type()) {
|
||||||
case Location::UNINITIALIZED:
|
case Location::kUninitialized:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
break;
|
break;
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
__ Push(expr->handle());
|
__ Push(expr->handle());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -144,10 +144,10 @@ void FastCodeGenerator::Move(Location destination, Literal* expr) {
|
|||||||
|
|
||||||
void FastCodeGenerator::Move(Slot* destination, Location source) {
|
void FastCodeGenerator::Move(Slot* destination, Location source) {
|
||||||
switch (source.type()) {
|
switch (source.type()) {
|
||||||
case Location::UNINITIALIZED: // Fall through.
|
case Location::kUninitialized: // Fall through.
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
__ pop(Operand(rbp, SlotOffset(destination)));
|
__ pop(Operand(rbp, SlotOffset(destination)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -156,12 +156,12 @@ void FastCodeGenerator::Move(Slot* destination, Location source) {
|
|||||||
|
|
||||||
void FastCodeGenerator::DropAndMove(Location destination, Register source) {
|
void FastCodeGenerator::DropAndMove(Location destination, Register source) {
|
||||||
switch (destination.type()) {
|
switch (destination.type()) {
|
||||||
case Location::UNINITIALIZED:
|
case Location::kUninitialized:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
__ addq(rsp, Immediate(kPointerSize));
|
__ addq(rsp, Immediate(kPointerSize));
|
||||||
break;
|
break;
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
__ movq(Operand(rsp, 0), source);
|
__ movq(Operand(rsp, 0), source);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -364,12 +364,12 @@ void FastCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (expr->location().type()) {
|
switch (expr->location().type()) {
|
||||||
case Location::UNINITIALIZED:
|
case Location::kUninitialized:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
if (result_saved) __ addq(rsp, Immediate(kPointerSize));
|
if (result_saved) __ addq(rsp, Immediate(kPointerSize));
|
||||||
break;
|
break;
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
if (!result_saved) __ push(rax);
|
if (!result_saved) __ push(rax);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -438,12 +438,12 @@ void FastCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (expr->location().type()) {
|
switch (expr->location().type()) {
|
||||||
case Location::UNINITIALIZED:
|
case Location::kUninitialized:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
if (result_saved) __ addq(rsp, Immediate(kPointerSize));
|
if (result_saved) __ addq(rsp, Immediate(kPointerSize));
|
||||||
break;
|
break;
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
if (!result_saved) __ push(rax);
|
if (!result_saved) __ push(rax);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -494,13 +494,13 @@ void FastCodeGenerator::VisitAssignment(Assignment* expr) {
|
|||||||
ASSERT(rhs->location().is_value());
|
ASSERT(rhs->location().is_value());
|
||||||
Visit(rhs);
|
Visit(rhs);
|
||||||
switch (expr->location().type()) {
|
switch (expr->location().type()) {
|
||||||
case Location::UNINITIALIZED:
|
case Location::kUninitialized:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
// Case 'var = temp'. Discard right-hand-side temporary.
|
// Case 'var = temp'. Discard right-hand-side temporary.
|
||||||
Move(var->slot(), rhs->location());
|
Move(var->slot(), rhs->location());
|
||||||
break;
|
break;
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
// Case 'temp1 <- (var = temp0)'. Preserve right-hand-side
|
// Case 'temp1 <- (var = temp0)'. Preserve right-hand-side
|
||||||
// temporary on the stack.
|
// temporary on the stack.
|
||||||
__ movq(kScratchRegister, Operand(rsp, 0));
|
__ movq(kScratchRegister, Operand(rsp, 0));
|
||||||
@ -545,12 +545,12 @@ void FastCodeGenerator::VisitProperty(Property* expr) {
|
|||||||
__ addq(rsp, Immediate(kPointerSize));
|
__ addq(rsp, Immediate(kPointerSize));
|
||||||
}
|
}
|
||||||
switch (expr->location().type()) {
|
switch (expr->location().type()) {
|
||||||
case Location::UNINITIALIZED:
|
case Location::kUninitialized:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
__ movq(Operand(rsp, 0), rax);
|
__ movq(Operand(rsp, 0), rax);
|
||||||
break;
|
break;
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
__ addq(rsp, Immediate(kPointerSize));
|
__ addq(rsp, Immediate(kPointerSize));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -722,14 +722,14 @@ void FastCodeGenerator::EmitLogicalOperation(BinaryOperation* expr) {
|
|||||||
Visit(left);
|
Visit(left);
|
||||||
ASSERT(left->location().is_value());
|
ASSERT(left->location().is_value());
|
||||||
switch (destination.type()) {
|
switch (destination.type()) {
|
||||||
case Location::UNINITIALIZED:
|
case Location::kUninitialized:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
case Location::EFFECT:
|
case Location::kEffect:
|
||||||
// Pop the left-hand value into rax because we will not need it as the
|
// Pop the left-hand value into rax because we will not need it as the
|
||||||
// final result.
|
// final result.
|
||||||
__ pop(rax);
|
__ pop(rax);
|
||||||
break;
|
break;
|
||||||
case Location::VALUE:
|
case Location::kValue:
|
||||||
// Copy the left-hand value into rax because we may need it as the
|
// Copy the left-hand value into rax because we may need it as the
|
||||||
// final result.
|
// final result.
|
||||||
__ movq(rax, Operand(rsp, 0));
|
__ movq(rax, Operand(rsp, 0));
|
||||||
@ -770,12 +770,8 @@ void FastCodeGenerator::EmitLogicalOperation(BinaryOperation* expr) {
|
|||||||
__ addq(rsp, Immediate(kPointerSize));
|
__ addq(rsp, Immediate(kPointerSize));
|
||||||
}
|
}
|
||||||
// Save or discard the right-hand value as needed.
|
// Save or discard the right-hand value as needed.
|
||||||
if (right->AsLiteral() != NULL) {
|
Visit(right);
|
||||||
Move(destination, right->AsLiteral());
|
ASSERT_EQ(destination.type(), right->location().type());
|
||||||
} else {
|
|
||||||
Visit(right);
|
|
||||||
Move(destination, right->location());
|
|
||||||
}
|
|
||||||
|
|
||||||
__ bind(&done);
|
__ bind(&done);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user