Consistently use named getters for Lithium operands on ARM.

Removed a dead Lithium instruction on the way.

Review URL: https://codereview.chromium.org/10907234

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12527 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
svenpanne@chromium.org 2012-09-17 10:54:26 +00:00
parent 3018b875b1
commit 6f5d872410
4 changed files with 470 additions and 298 deletions

View File

@ -194,22 +194,22 @@ void LGoto::PrintDataTo(StringStream* stream) {
void LBranch::PrintDataTo(StringStream* stream) { void LBranch::PrintDataTo(StringStream* stream) {
stream->Add("B%d | B%d on ", true_block_id(), false_block_id()); stream->Add("B%d | B%d on ", true_block_id(), false_block_id());
InputAt(0)->PrintTo(stream); value()->PrintTo(stream);
} }
void LCmpIDAndBranch::PrintDataTo(StringStream* stream) { void LCmpIDAndBranch::PrintDataTo(StringStream* stream) {
stream->Add("if "); stream->Add("if ");
InputAt(0)->PrintTo(stream); left()->PrintTo(stream);
stream->Add(" %s ", Token::String(op())); stream->Add(" %s ", Token::String(op()));
InputAt(1)->PrintTo(stream); right()->PrintTo(stream);
stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); stream->Add(" then B%d else B%d", true_block_id(), false_block_id());
} }
void LIsNilAndBranch::PrintDataTo(StringStream* stream) { void LIsNilAndBranch::PrintDataTo(StringStream* stream) {
stream->Add("if "); stream->Add("if ");
InputAt(0)->PrintTo(stream); value()->PrintTo(stream);
stream->Add(kind() == kStrictEquality ? " === " : " == "); stream->Add(kind() == kStrictEquality ? " === " : " == ");
stream->Add(nil() == kNullValue ? "null" : "undefined"); stream->Add(nil() == kNullValue ? "null" : "undefined");
stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); stream->Add(" then B%d else B%d", true_block_id(), false_block_id());
@ -218,57 +218,57 @@ void LIsNilAndBranch::PrintDataTo(StringStream* stream) {
void LIsObjectAndBranch::PrintDataTo(StringStream* stream) { void LIsObjectAndBranch::PrintDataTo(StringStream* stream) {
stream->Add("if is_object("); stream->Add("if is_object(");
InputAt(0)->PrintTo(stream); value()->PrintTo(stream);
stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
} }
void LIsStringAndBranch::PrintDataTo(StringStream* stream) { void LIsStringAndBranch::PrintDataTo(StringStream* stream) {
stream->Add("if is_string("); stream->Add("if is_string(");
InputAt(0)->PrintTo(stream); value()->PrintTo(stream);
stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
} }
void LIsSmiAndBranch::PrintDataTo(StringStream* stream) { void LIsSmiAndBranch::PrintDataTo(StringStream* stream) {
stream->Add("if is_smi("); stream->Add("if is_smi(");
InputAt(0)->PrintTo(stream); value()->PrintTo(stream);
stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
} }
void LIsUndetectableAndBranch::PrintDataTo(StringStream* stream) { void LIsUndetectableAndBranch::PrintDataTo(StringStream* stream) {
stream->Add("if is_undetectable("); stream->Add("if is_undetectable(");
InputAt(0)->PrintTo(stream); value()->PrintTo(stream);
stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
} }
void LStringCompareAndBranch::PrintDataTo(StringStream* stream) { void LStringCompareAndBranch::PrintDataTo(StringStream* stream) {
stream->Add("if string_compare("); stream->Add("if string_compare(");
InputAt(0)->PrintTo(stream); left()->PrintTo(stream);
InputAt(1)->PrintTo(stream); right()->PrintTo(stream);
stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
} }
void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) { void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) {
stream->Add("if has_instance_type("); stream->Add("if has_instance_type(");
InputAt(0)->PrintTo(stream); value()->PrintTo(stream);
stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
} }
void LHasCachedArrayIndexAndBranch::PrintDataTo(StringStream* stream) { void LHasCachedArrayIndexAndBranch::PrintDataTo(StringStream* stream) {
stream->Add("if has_cached_array_index("); stream->Add("if has_cached_array_index(");
InputAt(0)->PrintTo(stream); value()->PrintTo(stream);
stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
} }
void LClassOfTestAndBranch::PrintDataTo(StringStream* stream) { void LClassOfTestAndBranch::PrintDataTo(StringStream* stream) {
stream->Add("if class_of_test("); stream->Add("if class_of_test(");
InputAt(0)->PrintTo(stream); value()->PrintTo(stream);
stream->Add(", \"%o\") then B%d else B%d", stream->Add(", \"%o\") then B%d else B%d",
*hydrogen()->class_name(), *hydrogen()->class_name(),
true_block_id(), true_block_id(),
@ -278,7 +278,7 @@ void LClassOfTestAndBranch::PrintDataTo(StringStream* stream) {
void LTypeofIsAndBranch::PrintDataTo(StringStream* stream) { void LTypeofIsAndBranch::PrintDataTo(StringStream* stream) {
stream->Add("if typeof "); stream->Add("if typeof ");
InputAt(0)->PrintTo(stream); value()->PrintTo(stream);
stream->Add(" == \"%s\" then B%d else B%d", stream->Add(" == \"%s\" then B%d else B%d",
*hydrogen()->type_literal()->ToCString(), *hydrogen()->type_literal()->ToCString(),
true_block_id(), false_block_id()); true_block_id(), false_block_id());
@ -292,26 +292,26 @@ void LCallConstantFunction::PrintDataTo(StringStream* stream) {
void LUnaryMathOperation::PrintDataTo(StringStream* stream) { void LUnaryMathOperation::PrintDataTo(StringStream* stream) {
stream->Add("/%s ", hydrogen()->OpName()); stream->Add("/%s ", hydrogen()->OpName());
InputAt(0)->PrintTo(stream); value()->PrintTo(stream);
} }
void LLoadContextSlot::PrintDataTo(StringStream* stream) { void LLoadContextSlot::PrintDataTo(StringStream* stream) {
InputAt(0)->PrintTo(stream); context()->PrintTo(stream);
stream->Add("[%d]", slot_index()); stream->Add("[%d]", slot_index());
} }
void LStoreContextSlot::PrintDataTo(StringStream* stream) { void LStoreContextSlot::PrintDataTo(StringStream* stream) {
InputAt(0)->PrintTo(stream); context()->PrintTo(stream);
stream->Add("[%d] <- ", slot_index()); stream->Add("[%d] <- ", slot_index());
InputAt(1)->PrintTo(stream); value()->PrintTo(stream);
} }
void LInvokeFunction::PrintDataTo(StringStream* stream) { void LInvokeFunction::PrintDataTo(StringStream* stream) {
stream->Add("= "); stream->Add("= ");
InputAt(0)->PrintTo(stream); function()->PrintTo(stream);
stream->Add(" #%d / ", arity()); stream->Add(" #%d / ", arity());
} }
@ -340,17 +340,15 @@ void LCallKnownGlobal::PrintDataTo(StringStream* stream) {
void LCallNew::PrintDataTo(StringStream* stream) { void LCallNew::PrintDataTo(StringStream* stream) {
stream->Add("= "); stream->Add("= ");
InputAt(0)->PrintTo(stream); constructor()->PrintTo(stream);
stream->Add(" #%d / ", arity()); stream->Add(" #%d / ", arity());
} }
void LAccessArgumentsAt::PrintDataTo(StringStream* stream) { void LAccessArgumentsAt::PrintDataTo(StringStream* stream) {
arguments()->PrintTo(stream); arguments()->PrintTo(stream);
stream->Add(" length "); stream->Add(" length ");
length()->PrintTo(stream); length()->PrintTo(stream);
stream->Add(" index "); stream->Add(" index ");
index()->PrintTo(stream); index()->PrintTo(stream);
} }

File diff suppressed because it is too large Load Diff

View File

@ -951,7 +951,7 @@ void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) {
void LCodeGen::DoModI(LModI* instr) { void LCodeGen::DoModI(LModI* instr) {
if (instr->hydrogen()->HasPowerOf2Divisor()) { if (instr->hydrogen()->HasPowerOf2Divisor()) {
Register dividend = ToRegister(instr->InputAt(0)); Register dividend = ToRegister(instr->left());
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
int32_t divisor = int32_t divisor =
@ -976,14 +976,14 @@ void LCodeGen::DoModI(LModI* instr) {
} }
// These registers hold untagged 32 bit values. // These registers hold untagged 32 bit values.
Register left = ToRegister(instr->InputAt(0)); Register left = ToRegister(instr->left());
Register right = ToRegister(instr->InputAt(1)); Register right = ToRegister(instr->right());
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
Register scratch = scratch0(); Register scratch = scratch0();
Register scratch2 = ToRegister(instr->TempAt(0)); Register scratch2 = ToRegister(instr->temp());
DwVfpRegister dividend = ToDoubleRegister(instr->TempAt(1)); DwVfpRegister dividend = ToDoubleRegister(instr->temp2());
DwVfpRegister divisor = ToDoubleRegister(instr->TempAt(2)); DwVfpRegister divisor = ToDoubleRegister(instr->temp3());
DwVfpRegister quotient = double_scratch0(); DwVfpRegister quotient = double_scratch0();
ASSERT(!dividend.is(divisor)); ASSERT(!dividend.is(divisor));
@ -1186,15 +1186,18 @@ void LCodeGen::DoDivI(LDivI* instr) {
DeferredDivI(LCodeGen* codegen, LDivI* instr) DeferredDivI(LCodeGen* codegen, LDivI* instr)
: LDeferredCode(codegen), instr_(instr) { } : LDeferredCode(codegen), instr_(instr) { }
virtual void Generate() { virtual void Generate() {
codegen()->DoDeferredBinaryOpStub(instr_, Token::DIV); codegen()->DoDeferredBinaryOpStub(instr_->pointer_map(),
instr_->left(),
instr_->right(),
Token::DIV);
} }
virtual LInstruction* instr() { return instr_; } virtual LInstruction* instr() { return instr_; }
private: private:
LDivI* instr_; LDivI* instr_;
}; };
const Register left = ToRegister(instr->InputAt(0)); const Register left = ToRegister(instr->left());
const Register right = ToRegister(instr->InputAt(1)); const Register right = ToRegister(instr->right());
const Register scratch = scratch0(); const Register scratch = scratch0();
const Register result = ToRegister(instr->result()); const Register result = ToRegister(instr->result());
@ -1263,15 +1266,15 @@ void LCodeGen::DoDivI(LDivI* instr) {
void LCodeGen::DoMathFloorOfDiv(LMathFloorOfDiv* instr) { void LCodeGen::DoMathFloorOfDiv(LMathFloorOfDiv* instr) {
const Register result = ToRegister(instr->result()); const Register result = ToRegister(instr->result());
const Register left = ToRegister(instr->InputAt(0)); const Register left = ToRegister(instr->left());
const Register remainder = ToRegister(instr->TempAt(0)); const Register remainder = ToRegister(instr->temp());
const Register scratch = scratch0(); const Register scratch = scratch0();
// We only optimize this for division by constants, because the standard // We only optimize this for division by constants, because the standard
// integer division routine is usually slower than transitionning to VFP. // integer division routine is usually slower than transitionning to VFP.
// This could be optimized on processors with SDIV available. // This could be optimized on processors with SDIV available.
ASSERT(instr->InputAt(1)->IsConstantOperand()); ASSERT(instr->right()->IsConstantOperand());
int32_t divisor = ToInteger32(LConstantOperand::cast(instr->InputAt(1))); int32_t divisor = ToInteger32(LConstantOperand::cast(instr->right()));
if (divisor < 0) { if (divisor < 0) {
__ cmp(left, Operand(0)); __ cmp(left, Operand(0));
DeoptimizeIf(eq, instr->environment()); DeoptimizeIf(eq, instr->environment());
@ -1289,11 +1292,12 @@ void LCodeGen::DoMathFloorOfDiv(LMathFloorOfDiv* instr) {
} }
template<int T> void LCodeGen::DoDeferredBinaryOpStub(LPointerMap* pointer_map,
void LCodeGen::DoDeferredBinaryOpStub(LTemplateInstruction<1, 2, T>* instr, LOperand* left_argument,
LOperand* right_argument,
Token::Value op) { Token::Value op) {
Register left = ToRegister(instr->InputAt(0)); Register left = ToRegister(left_argument);
Register right = ToRegister(instr->InputAt(1)); Register right = ToRegister(right_argument);
PushSafepointRegistersScope scope(this, Safepoint::kWithRegistersAndDoubles); PushSafepointRegistersScope scope(this, Safepoint::kWithRegistersAndDoubles);
// Move left to r1 and right to r0 for the stub call. // Move left to r1 and right to r0 for the stub call.
@ -1312,7 +1316,7 @@ void LCodeGen::DoDeferredBinaryOpStub(LTemplateInstruction<1, 2, T>* instr,
} }
BinaryOpStub stub(op, OVERWRITE_LEFT); BinaryOpStub stub(op, OVERWRITE_LEFT);
__ CallStub(&stub); __ CallStub(&stub);
RecordSafepointWithRegistersAndDoubles(instr->pointer_map(), RecordSafepointWithRegistersAndDoubles(pointer_map,
0, 0,
Safepoint::kNoLazyDeopt); Safepoint::kNoLazyDeopt);
// Overwrite the stored value of r0 with the result of the stub. // Overwrite the stored value of r0 with the result of the stub.
@ -1324,8 +1328,8 @@ void LCodeGen::DoMulI(LMulI* instr) {
Register scratch = scratch0(); Register scratch = scratch0();
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
// Note that result may alias left. // Note that result may alias left.
Register left = ToRegister(instr->InputAt(0)); Register left = ToRegister(instr->left());
LOperand* right_op = instr->InputAt(1); LOperand* right_op = instr->right();
bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow); bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
bool bailout_on_minus_zero = bool bailout_on_minus_zero =
@ -1392,7 +1396,7 @@ void LCodeGen::DoMulI(LMulI* instr) {
} else { } else {
Register right = EmitLoadRegister(right_op, scratch); Register right = EmitLoadRegister(right_op, scratch);
if (bailout_on_minus_zero) { if (bailout_on_minus_zero) {
__ orr(ToRegister(instr->TempAt(0)), left, right); __ orr(ToRegister(instr->temp()), left, right);
} }
if (can_overflow) { if (can_overflow) {
@ -1409,7 +1413,7 @@ void LCodeGen::DoMulI(LMulI* instr) {
Label done; Label done;
__ cmp(result, Operand(0)); __ cmp(result, Operand(0));
__ b(ne, &done); __ b(ne, &done);
__ cmp(ToRegister(instr->TempAt(0)), Operand(0)); __ cmp(ToRegister(instr->temp()), Operand(0));
DeoptimizeIf(mi, instr->environment()); DeoptimizeIf(mi, instr->environment());
__ bind(&done); __ bind(&done);
} }
@ -1418,8 +1422,8 @@ void LCodeGen::DoMulI(LMulI* instr) {
void LCodeGen::DoBitI(LBitI* instr) { void LCodeGen::DoBitI(LBitI* instr) {
LOperand* left_op = instr->InputAt(0); LOperand* left_op = instr->left();
LOperand* right_op = instr->InputAt(1); LOperand* right_op = instr->right();
ASSERT(left_op->IsRegister()); ASSERT(left_op->IsRegister());
Register left = ToRegister(left_op); Register left = ToRegister(left_op);
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
@ -1452,8 +1456,8 @@ void LCodeGen::DoBitI(LBitI* instr) {
void LCodeGen::DoShiftI(LShiftI* instr) { void LCodeGen::DoShiftI(LShiftI* instr) {
// Both 'left' and 'right' are "used at start" (see LCodeGen::DoShift), so // Both 'left' and 'right' are "used at start" (see LCodeGen::DoShift), so
// result may alias either of them. // result may alias either of them.
LOperand* right_op = instr->InputAt(1); LOperand* right_op = instr->right();
Register left = ToRegister(instr->InputAt(0)); Register left = ToRegister(instr->left());
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
Register scratch = scratch0(); Register scratch = scratch0();
if (right_op->IsRegister()) { if (right_op->IsRegister()) {
@ -1517,8 +1521,8 @@ void LCodeGen::DoShiftI(LShiftI* instr) {
void LCodeGen::DoSubI(LSubI* instr) { void LCodeGen::DoSubI(LSubI* instr) {
LOperand* left = instr->InputAt(0); LOperand* left = instr->left();
LOperand* right = instr->InputAt(1); LOperand* right = instr->right();
LOperand* result = instr->result(); LOperand* result = instr->result();
bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow); bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
SBit set_cond = can_overflow ? SetCC : LeaveCC; SBit set_cond = can_overflow ? SetCC : LeaveCC;
@ -1564,28 +1568,28 @@ void LCodeGen::DoConstantT(LConstantT* instr) {
void LCodeGen::DoJSArrayLength(LJSArrayLength* instr) { void LCodeGen::DoJSArrayLength(LJSArrayLength* instr) {
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
Register array = ToRegister(instr->InputAt(0)); Register array = ToRegister(instr->value());
__ ldr(result, FieldMemOperand(array, JSArray::kLengthOffset)); __ ldr(result, FieldMemOperand(array, JSArray::kLengthOffset));
} }
void LCodeGen::DoFixedArrayBaseLength(LFixedArrayBaseLength* instr) { void LCodeGen::DoFixedArrayBaseLength(LFixedArrayBaseLength* instr) {
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
Register array = ToRegister(instr->InputAt(0)); Register array = ToRegister(instr->value());
__ ldr(result, FieldMemOperand(array, FixedArrayBase::kLengthOffset)); __ ldr(result, FieldMemOperand(array, FixedArrayBase::kLengthOffset));
} }
void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) {
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
Register map = ToRegister(instr->InputAt(0)); Register map = ToRegister(instr->value());
__ EnumLength(result, map); __ EnumLength(result, map);
} }
void LCodeGen::DoElementsKind(LElementsKind* instr) { void LCodeGen::DoElementsKind(LElementsKind* instr) {
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
Register input = ToRegister(instr->InputAt(0)); Register input = ToRegister(instr->value());
// Load map into |result|. // Load map into |result|.
__ ldr(result, FieldMemOperand(input, HeapObject::kMapOffset)); __ ldr(result, FieldMemOperand(input, HeapObject::kMapOffset));
@ -1598,9 +1602,9 @@ void LCodeGen::DoElementsKind(LElementsKind* instr) {
void LCodeGen::DoValueOf(LValueOf* instr) { void LCodeGen::DoValueOf(LValueOf* instr) {
Register input = ToRegister(instr->InputAt(0)); Register input = ToRegister(instr->value());
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
Register map = ToRegister(instr->TempAt(0)); Register map = ToRegister(instr->temp());
Label done; Label done;
// If the object is a smi return the object. // If the object is a smi return the object.
@ -1619,9 +1623,9 @@ void LCodeGen::DoValueOf(LValueOf* instr) {
void LCodeGen::DoDateField(LDateField* instr) { void LCodeGen::DoDateField(LDateField* instr) {
Register object = ToRegister(instr->InputAt(0)); Register object = ToRegister(instr->date());
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
Register scratch = ToRegister(instr->TempAt(0)); Register scratch = ToRegister(instr->temp());
Smi* index = instr->index(); Smi* index = instr->index();
Label runtime, done; Label runtime, done;
ASSERT(object.is(result)); ASSERT(object.is(result));
@ -1658,14 +1662,14 @@ void LCodeGen::DoDateField(LDateField* instr) {
void LCodeGen::DoBitNotI(LBitNotI* instr) { void LCodeGen::DoBitNotI(LBitNotI* instr) {
Register input = ToRegister(instr->InputAt(0)); Register input = ToRegister(instr->value());
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
__ mvn(result, Operand(input)); __ mvn(result, Operand(input));
} }
void LCodeGen::DoThrow(LThrow* instr) { void LCodeGen::DoThrow(LThrow* instr) {
Register input_reg = EmitLoadRegister(instr->InputAt(0), ip); Register input_reg = EmitLoadRegister(instr->value(), ip);
__ push(input_reg); __ push(input_reg);
CallRuntime(Runtime::kThrow, 1, instr); CallRuntime(Runtime::kThrow, 1, instr);
@ -1676,8 +1680,8 @@ void LCodeGen::DoThrow(LThrow* instr) {
void LCodeGen::DoAddI(LAddI* instr) { void LCodeGen::DoAddI(LAddI* instr) {
LOperand* left = instr->InputAt(0); LOperand* left = instr->left();
LOperand* right = instr->InputAt(1); LOperand* right = instr->right();
LOperand* result = instr->result(); LOperand* result = instr->result();
bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow); bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
SBit set_cond = can_overflow ? SetCC : LeaveCC; SBit set_cond = can_overflow ? SetCC : LeaveCC;
@ -1697,8 +1701,8 @@ void LCodeGen::DoAddI(LAddI* instr) {
void LCodeGen::DoMathMinMax(LMathMinMax* instr) { void LCodeGen::DoMathMinMax(LMathMinMax* instr) {
LOperand* left = instr->InputAt(0); LOperand* left = instr->left();
LOperand* right = instr->InputAt(1); LOperand* right = instr->right();
HMathMinMax::Operation operation = instr->hydrogen()->operation(); HMathMinMax::Operation operation = instr->hydrogen()->operation();
Condition condition = (operation == HMathMinMax::kMathMin) ? le : ge; Condition condition = (operation == HMathMinMax::kMathMin) ? le : ge;
if (instr->hydrogen()->representation().IsInteger32()) { if (instr->hydrogen()->representation().IsInteger32()) {
@ -1759,8 +1763,8 @@ void LCodeGen::DoMathMinMax(LMathMinMax* instr) {
void LCodeGen::DoArithmeticD(LArithmeticD* instr) { void LCodeGen::DoArithmeticD(LArithmeticD* instr) {
DoubleRegister left = ToDoubleRegister(instr->InputAt(0)); DoubleRegister left = ToDoubleRegister(instr->left());
DoubleRegister right = ToDoubleRegister(instr->InputAt(1)); DoubleRegister right = ToDoubleRegister(instr->right());
DoubleRegister result = ToDoubleRegister(instr->result()); DoubleRegister result = ToDoubleRegister(instr->result());
switch (instr->op()) { switch (instr->op()) {
case Token::ADD: case Token::ADD:
@ -1799,8 +1803,8 @@ void LCodeGen::DoArithmeticD(LArithmeticD* instr) {
void LCodeGen::DoArithmeticT(LArithmeticT* instr) { void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
ASSERT(ToRegister(instr->InputAt(0)).is(r1)); ASSERT(ToRegister(instr->left()).is(r1));
ASSERT(ToRegister(instr->InputAt(1)).is(r0)); ASSERT(ToRegister(instr->right()).is(r0));
ASSERT(ToRegister(instr->result()).is(r0)); ASSERT(ToRegister(instr->result()).is(r0));
BinaryOpStub stub(instr->op(), NO_OVERWRITE); BinaryOpStub stub(instr->op(), NO_OVERWRITE);
@ -1845,11 +1849,11 @@ void LCodeGen::DoBranch(LBranch* instr) {
Representation r = instr->hydrogen()->value()->representation(); Representation r = instr->hydrogen()->value()->representation();
if (r.IsInteger32()) { if (r.IsInteger32()) {
Register reg = ToRegister(instr->InputAt(0)); Register reg = ToRegister(instr->value());
__ cmp(reg, Operand(0)); __ cmp(reg, Operand(0));
EmitBranch(true_block, false_block, ne); EmitBranch(true_block, false_block, ne);
} else if (r.IsDouble()) { } else if (r.IsDouble()) {
DoubleRegister reg = ToDoubleRegister(instr->InputAt(0)); DoubleRegister reg = ToDoubleRegister(instr->value());
Register scratch = scratch0(); Register scratch = scratch0();
// Test the double value. Zero and NaN are false. // Test the double value. Zero and NaN are false.
@ -1858,7 +1862,7 @@ void LCodeGen::DoBranch(LBranch* instr) {
EmitBranch(true_block, false_block, eq); EmitBranch(true_block, false_block, eq);
} else { } else {
ASSERT(r.IsTagged()); ASSERT(r.IsTagged());
Register reg = ToRegister(instr->InputAt(0)); Register reg = ToRegister(instr->value());
HType type = instr->hydrogen()->value()->type(); HType type = instr->hydrogen()->value()->type();
if (type.IsBoolean()) { if (type.IsBoolean()) {
__ CompareRoot(reg, Heap::kTrueValueRootIndex); __ CompareRoot(reg, Heap::kTrueValueRootIndex);
@ -1997,8 +2001,8 @@ Condition LCodeGen::TokenToCondition(Token::Value op, bool is_unsigned) {
void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) { void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) {
LOperand* left = instr->InputAt(0); LOperand* left = instr->left();
LOperand* right = instr->InputAt(1); LOperand* right = instr->right();
int false_block = chunk_->LookupDestination(instr->false_block_id()); int false_block = chunk_->LookupDestination(instr->false_block_id());
int true_block = chunk_->LookupDestination(instr->true_block_id()); int true_block = chunk_->LookupDestination(instr->true_block_id());
Condition cond = TokenToCondition(instr->op(), false); Condition cond = TokenToCondition(instr->op(), false);
@ -2038,8 +2042,8 @@ void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) {
void LCodeGen::DoCmpObjectEqAndBranch(LCmpObjectEqAndBranch* instr) { void LCodeGen::DoCmpObjectEqAndBranch(LCmpObjectEqAndBranch* instr) {
Register left = ToRegister(instr->InputAt(0)); Register left = ToRegister(instr->left());
Register right = ToRegister(instr->InputAt(1)); Register right = ToRegister(instr->right());
int false_block = chunk_->LookupDestination(instr->false_block_id()); int false_block = chunk_->LookupDestination(instr->false_block_id());
int true_block = chunk_->LookupDestination(instr->true_block_id()); int true_block = chunk_->LookupDestination(instr->true_block_id());
@ -2049,7 +2053,7 @@ void LCodeGen::DoCmpObjectEqAndBranch(LCmpObjectEqAndBranch* instr) {
void LCodeGen::DoCmpConstantEqAndBranch(LCmpConstantEqAndBranch* instr) { void LCodeGen::DoCmpConstantEqAndBranch(LCmpConstantEqAndBranch* instr) {
Register left = ToRegister(instr->InputAt(0)); Register left = ToRegister(instr->left());
int true_block = chunk_->LookupDestination(instr->true_block_id()); int true_block = chunk_->LookupDestination(instr->true_block_id());
int false_block = chunk_->LookupDestination(instr->false_block_id()); int false_block = chunk_->LookupDestination(instr->false_block_id());
@ -2060,7 +2064,7 @@ void LCodeGen::DoCmpConstantEqAndBranch(LCmpConstantEqAndBranch* instr) {
void LCodeGen::DoIsNilAndBranch(LIsNilAndBranch* instr) { void LCodeGen::DoIsNilAndBranch(LIsNilAndBranch* instr) {
Register scratch = scratch0(); Register scratch = scratch0();
Register reg = ToRegister(instr->InputAt(0)); Register reg = ToRegister(instr->value());
int false_block = chunk_->LookupDestination(instr->false_block_id()); int false_block = chunk_->LookupDestination(instr->false_block_id());
// If the expression is known to be untagged or a smi, then it's definitely // If the expression is known to be untagged or a smi, then it's definitely
@ -2128,8 +2132,8 @@ Condition LCodeGen::EmitIsObject(Register input,
void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) { void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) {
Register reg = ToRegister(instr->InputAt(0)); Register reg = ToRegister(instr->value());
Register temp1 = ToRegister(instr->TempAt(0)); Register temp1 = ToRegister(instr->temp());
int true_block = chunk_->LookupDestination(instr->true_block_id()); int true_block = chunk_->LookupDestination(instr->true_block_id());
int false_block = chunk_->LookupDestination(instr->false_block_id()); int false_block = chunk_->LookupDestination(instr->false_block_id());
@ -2154,8 +2158,8 @@ Condition LCodeGen::EmitIsString(Register input,
void LCodeGen::DoIsStringAndBranch(LIsStringAndBranch* instr) { void LCodeGen::DoIsStringAndBranch(LIsStringAndBranch* instr) {
Register reg = ToRegister(instr->InputAt(0)); Register reg = ToRegister(instr->value());
Register temp1 = ToRegister(instr->TempAt(0)); Register temp1 = ToRegister(instr->temp());
int true_block = chunk_->LookupDestination(instr->true_block_id()); int true_block = chunk_->LookupDestination(instr->true_block_id());
int false_block = chunk_->LookupDestination(instr->false_block_id()); int false_block = chunk_->LookupDestination(instr->false_block_id());
@ -2172,15 +2176,15 @@ void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) {
int true_block = chunk_->LookupDestination(instr->true_block_id()); int true_block = chunk_->LookupDestination(instr->true_block_id());
int false_block = chunk_->LookupDestination(instr->false_block_id()); int false_block = chunk_->LookupDestination(instr->false_block_id());
Register input_reg = EmitLoadRegister(instr->InputAt(0), ip); Register input_reg = EmitLoadRegister(instr->value(), ip);
__ tst(input_reg, Operand(kSmiTagMask)); __ tst(input_reg, Operand(kSmiTagMask));
EmitBranch(true_block, false_block, eq); EmitBranch(true_block, false_block, eq);
} }
void LCodeGen::DoIsUndetectableAndBranch(LIsUndetectableAndBranch* instr) { void LCodeGen::DoIsUndetectableAndBranch(LIsUndetectableAndBranch* instr) {
Register input = ToRegister(instr->InputAt(0)); Register input = ToRegister(instr->value());
Register temp = ToRegister(instr->TempAt(0)); Register temp = ToRegister(instr->temp());
int true_block = chunk_->LookupDestination(instr->true_block_id()); int true_block = chunk_->LookupDestination(instr->true_block_id());
int false_block = chunk_->LookupDestination(instr->false_block_id()); int false_block = chunk_->LookupDestination(instr->false_block_id());
@ -2250,7 +2254,7 @@ static Condition BranchCondition(HHasInstanceTypeAndBranch* instr) {
void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) { void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) {
Register scratch = scratch0(); Register scratch = scratch0();
Register input = ToRegister(instr->InputAt(0)); Register input = ToRegister(instr->value());
int true_block = chunk_->LookupDestination(instr->true_block_id()); int true_block = chunk_->LookupDestination(instr->true_block_id());
int false_block = chunk_->LookupDestination(instr->false_block_id()); int false_block = chunk_->LookupDestination(instr->false_block_id());
@ -2265,7 +2269,7 @@ void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) {
void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) { void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) {
Register input = ToRegister(instr->InputAt(0)); Register input = ToRegister(instr->value());
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
__ AbortIfNotString(input); __ AbortIfNotString(input);
@ -2277,7 +2281,7 @@ void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) {
void LCodeGen::DoHasCachedArrayIndexAndBranch( void LCodeGen::DoHasCachedArrayIndexAndBranch(
LHasCachedArrayIndexAndBranch* instr) { LHasCachedArrayIndexAndBranch* instr) {
Register input = ToRegister(instr->InputAt(0)); Register input = ToRegister(instr->value());
Register scratch = scratch0(); Register scratch = scratch0();
int true_block = chunk_->LookupDestination(instr->true_block_id()); int true_block = chunk_->LookupDestination(instr->true_block_id());
@ -2358,9 +2362,9 @@ void LCodeGen::EmitClassOfTest(Label* is_true,
void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) { void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) {
Register input = ToRegister(instr->InputAt(0)); Register input = ToRegister(instr->value());
Register temp = scratch0(); Register temp = scratch0();
Register temp2 = ToRegister(instr->TempAt(0)); Register temp2 = ToRegister(instr->temp());
Handle<String> class_name = instr->hydrogen()->class_name(); Handle<String> class_name = instr->hydrogen()->class_name();
int true_block = chunk_->LookupDestination(instr->true_block_id()); int true_block = chunk_->LookupDestination(instr->true_block_id());
@ -2376,8 +2380,8 @@ void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) {
void LCodeGen::DoCmpMapAndBranch(LCmpMapAndBranch* instr) { void LCodeGen::DoCmpMapAndBranch(LCmpMapAndBranch* instr) {
Register reg = ToRegister(instr->InputAt(0)); Register reg = ToRegister(instr->value());
Register temp = ToRegister(instr->TempAt(0)); Register temp = ToRegister(instr->temp());
int true_block = instr->true_block_id(); int true_block = instr->true_block_id();
int false_block = instr->false_block_id(); int false_block = instr->false_block_id();
@ -2388,8 +2392,8 @@ void LCodeGen::DoCmpMapAndBranch(LCmpMapAndBranch* instr) {
void LCodeGen::DoInstanceOf(LInstanceOf* instr) { void LCodeGen::DoInstanceOf(LInstanceOf* instr) {
ASSERT(ToRegister(instr->InputAt(0)).is(r0)); // Object is in r0. ASSERT(ToRegister(instr->left()).is(r0)); // Object is in r0.
ASSERT(ToRegister(instr->InputAt(1)).is(r1)); // Function is in r1. ASSERT(ToRegister(instr->right()).is(r1)); // Function is in r1.
InstanceofStub stub(InstanceofStub::kArgsInRegisters); InstanceofStub stub(InstanceofStub::kArgsInRegisters);
CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
@ -2420,8 +2424,8 @@ void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr); deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr);
Label done, false_result; Label done, false_result;
Register object = ToRegister(instr->InputAt(0)); Register object = ToRegister(instr->value());
Register temp = ToRegister(instr->TempAt(0)); Register temp = ToRegister(instr->temp());
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
ASSERT(object.is(r0)); ASSERT(object.is(r0));
@ -2501,7 +2505,7 @@ void LCodeGen::DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
// Get the temp register reserved by the instruction. This needs to be r4 as // Get the temp register reserved by the instruction. This needs to be r4 as
// its slot of the pushing of safepoint registers is used to communicate the // its slot of the pushing of safepoint registers is used to communicate the
// offset to the location of the map check. // offset to the location of the map check.
Register temp = ToRegister(instr->TempAt(0)); Register temp = ToRegister(instr->temp());
ASSERT(temp.is(r4)); ASSERT(temp.is(r4));
__ LoadHeapObject(InstanceofStub::right(), instr->function()); __ LoadHeapObject(InstanceofStub::right(), instr->function());
static const int kAdditionalDelta = 5; static const int kAdditionalDelta = 5;
@ -2598,7 +2602,7 @@ void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
// it as no longer deleted. // it as no longer deleted.
if (instr->hydrogen()->RequiresHoleCheck()) { if (instr->hydrogen()->RequiresHoleCheck()) {
// We use a temp to check the payload (CompareRoot might clobber ip). // We use a temp to check the payload (CompareRoot might clobber ip).
Register payload = ToRegister(instr->TempAt(0)); Register payload = ToRegister(instr->temp());
__ ldr(payload, FieldMemOperand(cell, JSGlobalPropertyCell::kValueOffset)); __ ldr(payload, FieldMemOperand(cell, JSGlobalPropertyCell::kValueOffset));
__ CompareRoot(payload, Heap::kTheHoleValueRootIndex); __ CompareRoot(payload, Heap::kTheHoleValueRootIndex);
DeoptimizeIf(eq, instr->environment()); DeoptimizeIf(eq, instr->environment());
@ -2677,7 +2681,7 @@ void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) {
void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
Register object = ToRegister(instr->InputAt(0)); Register object = ToRegister(instr->object());
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
if (instr->hydrogen()->is_in_object()) { if (instr->hydrogen()->is_in_object()) {
__ ldr(result, FieldMemOperand(object, instr->hydrogen()->offset())); __ ldr(result, FieldMemOperand(object, instr->hydrogen()->offset()));
@ -2831,7 +2835,7 @@ void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) {
void LCodeGen::DoLoadElements(LLoadElements* instr) { void LCodeGen::DoLoadElements(LLoadElements* instr) {
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
Register input = ToRegister(instr->InputAt(0)); Register input = ToRegister(instr->object());
Register scratch = scratch0(); Register scratch = scratch0();
__ ldr(result, FieldMemOperand(input, JSObject::kElementsOffset)); __ ldr(result, FieldMemOperand(input, JSObject::kElementsOffset));
@ -2866,7 +2870,7 @@ void LCodeGen::DoLoadElements(LLoadElements* instr) {
void LCodeGen::DoLoadExternalArrayPointer( void LCodeGen::DoLoadExternalArrayPointer(
LLoadExternalArrayPointer* instr) { LLoadExternalArrayPointer* instr) {
Register to_reg = ToRegister(instr->result()); Register to_reg = ToRegister(instr->result());
Register from_reg = ToRegister(instr->InputAt(0)); Register from_reg = ToRegister(instr->object());
__ ldr(to_reg, FieldMemOperand(from_reg, __ ldr(to_reg, FieldMemOperand(from_reg,
ExternalArray::kExternalPointerOffset)); ExternalArray::kExternalPointerOffset));
} }
@ -3123,7 +3127,7 @@ void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) {
void LCodeGen::DoArgumentsLength(LArgumentsLength* instr) { void LCodeGen::DoArgumentsLength(LArgumentsLength* instr) {
Register elem = ToRegister(instr->InputAt(0)); Register elem = ToRegister(instr->elements());
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
Label done; Label done;
@ -3242,7 +3246,7 @@ void LCodeGen::DoApplyArguments(LApplyArguments* instr) {
void LCodeGen::DoPushArgument(LPushArgument* instr) { void LCodeGen::DoPushArgument(LPushArgument* instr) {
LOperand* argument = instr->InputAt(0); LOperand* argument = instr->value();
if (argument->IsDoubleRegister() || argument->IsDoubleStackSlot()) { if (argument->IsDoubleRegister() || argument->IsDoubleStackSlot()) {
Abort("DoPushArgument not implemented for double type."); Abort("DoPushArgument not implemented for double type.");
} else { } else {
@ -3294,7 +3298,7 @@ void LCodeGen::DoGlobalObject(LGlobalObject* instr) {
void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) { void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) {
Register global = ToRegister(instr->global()); Register global = ToRegister(instr->global_object());
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
__ ldr(result, FieldMemOperand(global, GlobalObject::kGlobalReceiverOffset)); __ ldr(result, FieldMemOperand(global, GlobalObject::kGlobalReceiverOffset));
} }
@ -3354,7 +3358,7 @@ void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) {
void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) { void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) {
Register input = ToRegister(instr->InputAt(0)); Register input = ToRegister(instr->value());
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
Register scratch = scratch0(); Register scratch = scratch0();
@ -3420,7 +3424,7 @@ void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) {
void LCodeGen::EmitIntegerMathAbs(LUnaryMathOperation* instr) { void LCodeGen::EmitIntegerMathAbs(LUnaryMathOperation* instr) {
Register input = ToRegister(instr->InputAt(0)); Register input = ToRegister(instr->value());
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
__ cmp(input, Operand(0)); __ cmp(input, Operand(0));
__ Move(result, input, pl); __ Move(result, input, pl);
@ -3450,7 +3454,7 @@ void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) {
Representation r = instr->hydrogen()->value()->representation(); Representation r = instr->hydrogen()->value()->representation();
if (r.IsDouble()) { if (r.IsDouble()) {
DwVfpRegister input = ToDoubleRegister(instr->InputAt(0)); DwVfpRegister input = ToDoubleRegister(instr->value());
DwVfpRegister result = ToDoubleRegister(instr->result()); DwVfpRegister result = ToDoubleRegister(instr->result());
__ vabs(result, input); __ vabs(result, input);
} else if (r.IsInteger32()) { } else if (r.IsInteger32()) {
@ -3459,7 +3463,7 @@ void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) {
// Representation is tagged. // Representation is tagged.
DeferredMathAbsTaggedHeapNumber* deferred = DeferredMathAbsTaggedHeapNumber* deferred =
new(zone()) DeferredMathAbsTaggedHeapNumber(this, instr); new(zone()) DeferredMathAbsTaggedHeapNumber(this, instr);
Register input = ToRegister(instr->InputAt(0)); Register input = ToRegister(instr->value());
// Smi check. // Smi check.
__ JumpIfNotSmi(input, deferred->entry()); __ JumpIfNotSmi(input, deferred->entry());
// If smi, handle it directly. // If smi, handle it directly.
@ -3470,11 +3474,11 @@ void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) {
void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) { void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) {
DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); DoubleRegister input = ToDoubleRegister(instr->value());
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
SwVfpRegister single_scratch = double_scratch0().low(); SwVfpRegister single_scratch = double_scratch0().low();
Register scratch1 = scratch0(); Register scratch1 = scratch0();
Register scratch2 = ToRegister(instr->TempAt(0)); Register scratch2 = ToRegister(instr->temp());
__ EmitVFPTruncate(kRoundToMinusInf, __ EmitVFPTruncate(kRoundToMinusInf,
single_scratch, single_scratch,
@ -3500,7 +3504,7 @@ void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) {
void LCodeGen::DoMathRound(LUnaryMathOperation* instr) { void LCodeGen::DoMathRound(LUnaryMathOperation* instr) {
DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); DoubleRegister input = ToDoubleRegister(instr->value());
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
Register scratch = scratch0(); Register scratch = scratch0();
Label done, check_sign_on_zero; Label done, check_sign_on_zero;
@ -3565,16 +3569,16 @@ void LCodeGen::DoMathRound(LUnaryMathOperation* instr) {
void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) { void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) {
DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); DoubleRegister input = ToDoubleRegister(instr->value());
DoubleRegister result = ToDoubleRegister(instr->result()); DoubleRegister result = ToDoubleRegister(instr->result());
__ vsqrt(result, input); __ vsqrt(result, input);
} }
void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) { void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) {
DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); DoubleRegister input = ToDoubleRegister(instr->value());
DoubleRegister result = ToDoubleRegister(instr->result()); DoubleRegister result = ToDoubleRegister(instr->result());
DoubleRegister temp = ToDoubleRegister(instr->TempAt(0)); DoubleRegister temp = ToDoubleRegister(instr->temp());
// Note that according to ECMA-262 15.8.2.13: // Note that according to ECMA-262 15.8.2.13:
// Math.pow(-Infinity, 0.5) == Infinity // Math.pow(-Infinity, 0.5) == Infinity
@ -3596,11 +3600,11 @@ void LCodeGen::DoPower(LPower* instr) {
Representation exponent_type = instr->hydrogen()->right()->representation(); Representation exponent_type = instr->hydrogen()->right()->representation();
// Having marked this as a call, we can use any registers. // Having marked this as a call, we can use any registers.
// Just make sure that the input/output registers are the expected ones. // Just make sure that the input/output registers are the expected ones.
ASSERT(!instr->InputAt(1)->IsDoubleRegister() || ASSERT(!instr->right()->IsDoubleRegister() ||
ToDoubleRegister(instr->InputAt(1)).is(d2)); ToDoubleRegister(instr->right()).is(d2));
ASSERT(!instr->InputAt(1)->IsRegister() || ASSERT(!instr->right()->IsRegister() ||
ToRegister(instr->InputAt(1)).is(r2)); ToRegister(instr->right()).is(r2));
ASSERT(ToDoubleRegister(instr->InputAt(0)).is(d1)); ASSERT(ToDoubleRegister(instr->left()).is(d1));
ASSERT(ToDoubleRegister(instr->result()).is(d3)); ASSERT(ToDoubleRegister(instr->result()).is(d3));
if (exponent_type.IsTagged()) { if (exponent_type.IsTagged()) {
@ -3640,7 +3644,7 @@ void LCodeGen::DoRandom(LRandom* instr) {
// Having marked this instruction as a call we can use any // Having marked this instruction as a call we can use any
// registers. // registers.
ASSERT(ToDoubleRegister(instr->result()).is(d7)); ASSERT(ToDoubleRegister(instr->result()).is(d7));
ASSERT(ToRegister(instr->InputAt(0)).is(r0)); ASSERT(ToRegister(instr->global_object()).is(r0));
static const int kSeedSize = sizeof(uint32_t); static const int kSeedSize = sizeof(uint32_t);
STATIC_ASSERT(kPointerSize == kSeedSize); STATIC_ASSERT(kPointerSize == kSeedSize);
@ -3851,7 +3855,7 @@ void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
void LCodeGen::DoCallNew(LCallNew* instr) { void LCodeGen::DoCallNew(LCallNew* instr) {
ASSERT(ToRegister(instr->InputAt(0)).is(r1)); ASSERT(ToRegister(instr->constructor()).is(r1));
ASSERT(ToRegister(instr->result()).is(r0)); ASSERT(ToRegister(instr->result()).is(r0));
CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); CallConstructStub stub(NO_CALL_FUNCTION_FLAGS);
@ -3877,7 +3881,7 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
__ mov(scratch, Operand(instr->transition())); __ mov(scratch, Operand(instr->transition()));
__ str(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); __ str(scratch, FieldMemOperand(object, HeapObject::kMapOffset));
if (instr->hydrogen()->NeedsWriteBarrierForMap()) { if (instr->hydrogen()->NeedsWriteBarrierForMap()) {
Register temp = ToRegister(instr->TempAt(0)); Register temp = ToRegister(instr->temp());
// Update the write barrier for the map field. // Update the write barrier for the map field.
__ RecordWriteField(object, __ RecordWriteField(object,
HeapObject::kMapOffset, HeapObject::kMapOffset,
@ -4155,7 +4159,7 @@ void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) {
Register object_reg = ToRegister(instr->object()); Register object_reg = ToRegister(instr->object());
Register new_map_reg = ToRegister(instr->new_map_reg()); Register new_map_reg = ToRegister(instr->new_map_temp());
Register scratch = scratch0(); Register scratch = scratch0();
Handle<Map> from_map = instr->original_map(); Handle<Map> from_map = instr->original_map();
@ -4176,7 +4180,7 @@ void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) {
scratch, kLRHasBeenSaved, kDontSaveFPRegs); scratch, kLRHasBeenSaved, kDontSaveFPRegs);
} else if (IsFastSmiElementsKind(from_kind) && } else if (IsFastSmiElementsKind(from_kind) &&
IsFastDoubleElementsKind(to_kind)) { IsFastDoubleElementsKind(to_kind)) {
Register fixed_object_reg = ToRegister(instr->temp_reg()); Register fixed_object_reg = ToRegister(instr->temp());
ASSERT(fixed_object_reg.is(r2)); ASSERT(fixed_object_reg.is(r2));
ASSERT(new_map_reg.is(r3)); ASSERT(new_map_reg.is(r3));
__ mov(fixed_object_reg, object_reg); __ mov(fixed_object_reg, object_reg);
@ -4184,7 +4188,7 @@ void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) {
RelocInfo::CODE_TARGET, instr); RelocInfo::CODE_TARGET, instr);
} else if (IsFastDoubleElementsKind(from_kind) && } else if (IsFastDoubleElementsKind(from_kind) &&
IsFastObjectElementsKind(to_kind)) { IsFastObjectElementsKind(to_kind)) {
Register fixed_object_reg = ToRegister(instr->temp_reg()); Register fixed_object_reg = ToRegister(instr->temp());
ASSERT(fixed_object_reg.is(r2)); ASSERT(fixed_object_reg.is(r2));
ASSERT(new_map_reg.is(r3)); ASSERT(new_map_reg.is(r3));
__ mov(fixed_object_reg, object_reg); __ mov(fixed_object_reg, object_reg);
@ -4309,14 +4313,14 @@ void LCodeGen::DoDeferredStringCharFromCode(LStringCharFromCode* instr) {
void LCodeGen::DoStringLength(LStringLength* instr) { void LCodeGen::DoStringLength(LStringLength* instr) {
Register string = ToRegister(instr->InputAt(0)); Register string = ToRegister(instr->string());
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
__ ldr(result, FieldMemOperand(string, String::kLengthOffset)); __ ldr(result, FieldMemOperand(string, String::kLengthOffset));
} }
void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) { void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) {
LOperand* input = instr->InputAt(0); LOperand* input = instr->value();
ASSERT(input->IsRegister() || input->IsStackSlot()); ASSERT(input->IsRegister() || input->IsStackSlot());
LOperand* output = instr->result(); LOperand* output = instr->result();
ASSERT(output->IsDoubleRegister()); ASSERT(output->IsDoubleRegister());
@ -4333,7 +4337,7 @@ void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) {
void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) {
LOperand* input = instr->InputAt(0); LOperand* input = instr->value();
LOperand* output = instr->result(); LOperand* output = instr->result();
SwVfpRegister flt_scratch = double_scratch0().low(); SwVfpRegister flt_scratch = double_scratch0().low();
@ -4349,7 +4353,7 @@ void LCodeGen::DoNumberTagI(LNumberTagI* instr) {
: LDeferredCode(codegen), instr_(instr) { } : LDeferredCode(codegen), instr_(instr) { }
virtual void Generate() { virtual void Generate() {
codegen()->DoDeferredNumberTagI(instr_, codegen()->DoDeferredNumberTagI(instr_,
instr_->InputAt(0), instr_->value(),
SIGNED_INT32); SIGNED_INT32);
} }
virtual LInstruction* instr() { return instr_; } virtual LInstruction* instr() { return instr_; }
@ -4357,7 +4361,7 @@ void LCodeGen::DoNumberTagI(LNumberTagI* instr) {
LNumberTagI* instr_; LNumberTagI* instr_;
}; };
Register src = ToRegister(instr->InputAt(0)); Register src = ToRegister(instr->value());
Register dst = ToRegister(instr->result()); Register dst = ToRegister(instr->result());
DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr); DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr);
@ -4374,7 +4378,7 @@ void LCodeGen::DoNumberTagU(LNumberTagU* instr) {
: LDeferredCode(codegen), instr_(instr) { } : LDeferredCode(codegen), instr_(instr) { }
virtual void Generate() { virtual void Generate() {
codegen()->DoDeferredNumberTagI(instr_, codegen()->DoDeferredNumberTagI(instr_,
instr_->InputAt(0), instr_->value(),
UNSIGNED_INT32); UNSIGNED_INT32);
} }
virtual LInstruction* instr() { return instr_; } virtual LInstruction* instr() { return instr_; }
@ -4382,7 +4386,7 @@ void LCodeGen::DoNumberTagU(LNumberTagU* instr) {
LNumberTagU* instr_; LNumberTagU* instr_;
}; };
LOperand* input = instr->InputAt(0); LOperand* input = instr->value();
ASSERT(input->IsRegister() && input->Equals(instr->result())); ASSERT(input->IsRegister() && input->Equals(instr->result()));
Register reg = ToRegister(input); Register reg = ToRegister(input);
@ -4460,11 +4464,11 @@ void LCodeGen::DoNumberTagD(LNumberTagD* instr) {
LNumberTagD* instr_; LNumberTagD* instr_;
}; };
DoubleRegister input_reg = ToDoubleRegister(instr->InputAt(0)); DoubleRegister input_reg = ToDoubleRegister(instr->value());
Register scratch = scratch0(); Register scratch = scratch0();
Register reg = ToRegister(instr->result()); Register reg = ToRegister(instr->result());
Register temp1 = ToRegister(instr->TempAt(0)); Register temp1 = ToRegister(instr->temp());
Register temp2 = ToRegister(instr->TempAt(1)); Register temp2 = ToRegister(instr->temp2());
DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr); DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr);
if (FLAG_inline_new) { if (FLAG_inline_new) {
@ -4494,12 +4498,12 @@ void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) {
void LCodeGen::DoSmiTag(LSmiTag* instr) { void LCodeGen::DoSmiTag(LSmiTag* instr) {
ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow)); ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow));
__ SmiTag(ToRegister(instr->result()), ToRegister(instr->InputAt(0))); __ SmiTag(ToRegister(instr->result()), ToRegister(instr->value()));
} }
void LCodeGen::DoSmiUntag(LSmiUntag* instr) { void LCodeGen::DoSmiUntag(LSmiUntag* instr) {
Register input = ToRegister(instr->InputAt(0)); Register input = ToRegister(instr->value());
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
if (instr->needs_check()) { if (instr->needs_check()) {
STATIC_ASSERT(kHeapObjectTag == 1); STATIC_ASSERT(kHeapObjectTag == 1);
@ -4571,9 +4575,9 @@ void LCodeGen::EmitNumberUntagD(Register input_reg,
void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) { void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) {
Register input_reg = ToRegister(instr->InputAt(0)); Register input_reg = ToRegister(instr->value());
Register scratch1 = scratch0(); Register scratch1 = scratch0();
Register scratch2 = ToRegister(instr->TempAt(0)); Register scratch2 = ToRegister(instr->temp());
DwVfpRegister double_scratch = double_scratch0(); DwVfpRegister double_scratch = double_scratch0();
SwVfpRegister single_scratch = double_scratch.low(); SwVfpRegister single_scratch = double_scratch.low();
@ -4594,8 +4598,8 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) {
__ cmp(scratch1, Operand(ip)); __ cmp(scratch1, Operand(ip));
if (instr->truncating()) { if (instr->truncating()) {
Register scratch3 = ToRegister(instr->TempAt(1)); Register scratch3 = ToRegister(instr->temp2());
DwVfpRegister double_scratch2 = ToDoubleRegister(instr->TempAt(2)); DwVfpRegister double_scratch2 = ToDoubleRegister(instr->temp3());
ASSERT(!scratch3.is(input_reg) && ASSERT(!scratch3.is(input_reg) &&
!scratch3.is(scratch1) && !scratch3.is(scratch1) &&
!scratch3.is(scratch2)); !scratch3.is(scratch2));
@ -4662,7 +4666,7 @@ void LCodeGen::DoTaggedToI(LTaggedToI* instr) {
LTaggedToI* instr_; LTaggedToI* instr_;
}; };
LOperand* input = instr->InputAt(0); LOperand* input = instr->value();
ASSERT(input->IsRegister()); ASSERT(input->IsRegister());
ASSERT(input->Equals(instr->result())); ASSERT(input->Equals(instr->result()));
@ -4681,7 +4685,7 @@ void LCodeGen::DoTaggedToI(LTaggedToI* instr) {
void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) { void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) {
LOperand* input = instr->InputAt(0); LOperand* input = instr->value();
ASSERT(input->IsRegister()); ASSERT(input->IsRegister());
LOperand* result = instr->result(); LOperand* result = instr->result();
ASSERT(result->IsDoubleRegister()); ASSERT(result->IsDoubleRegister());
@ -4699,14 +4703,14 @@ void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) {
void LCodeGen::DoDoubleToI(LDoubleToI* instr) { void LCodeGen::DoDoubleToI(LDoubleToI* instr) {
Register result_reg = ToRegister(instr->result()); Register result_reg = ToRegister(instr->result());
Register scratch1 = scratch0(); Register scratch1 = scratch0();
Register scratch2 = ToRegister(instr->TempAt(0)); Register scratch2 = ToRegister(instr->temp());
DwVfpRegister double_input = ToDoubleRegister(instr->InputAt(0)); DwVfpRegister double_input = ToDoubleRegister(instr->value());
SwVfpRegister single_scratch = double_scratch0().low(); SwVfpRegister single_scratch = double_scratch0().low();
Label done; Label done;
if (instr->truncating()) { if (instr->truncating()) {
Register scratch3 = ToRegister(instr->TempAt(1)); Register scratch3 = ToRegister(instr->temp2());
__ EmitECMATruncate(result_reg, __ EmitECMATruncate(result_reg,
double_input, double_input,
single_scratch, single_scratch,
@ -4732,21 +4736,21 @@ void LCodeGen::DoDoubleToI(LDoubleToI* instr) {
void LCodeGen::DoCheckSmi(LCheckSmi* instr) { void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
LOperand* input = instr->InputAt(0); LOperand* input = instr->value();
__ tst(ToRegister(input), Operand(kSmiTagMask)); __ tst(ToRegister(input), Operand(kSmiTagMask));
DeoptimizeIf(ne, instr->environment()); DeoptimizeIf(ne, instr->environment());
} }
void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) { void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) {
LOperand* input = instr->InputAt(0); LOperand* input = instr->value();
__ tst(ToRegister(input), Operand(kSmiTagMask)); __ tst(ToRegister(input), Operand(kSmiTagMask));
DeoptimizeIf(eq, instr->environment()); DeoptimizeIf(eq, instr->environment());
} }
void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) { void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) {
Register input = ToRegister(instr->InputAt(0)); Register input = ToRegister(instr->value());
Register scratch = scratch0(); Register scratch = scratch0();
__ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset)); __ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset));
@ -4819,7 +4823,7 @@ void LCodeGen::DoCheckMapCommon(Register reg,
void LCodeGen::DoCheckMaps(LCheckMaps* instr) { void LCodeGen::DoCheckMaps(LCheckMaps* instr) {
Register scratch = scratch0(); Register scratch = scratch0();
LOperand* input = instr->InputAt(0); LOperand* input = instr->value();
ASSERT(input->IsRegister()); ASSERT(input->IsRegister());
Register reg = ToRegister(input); Register reg = ToRegister(input);
@ -4839,7 +4843,7 @@ void LCodeGen::DoCheckMaps(LCheckMaps* instr) {
void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) {
DoubleRegister value_reg = ToDoubleRegister(instr->unclamped()); DoubleRegister value_reg = ToDoubleRegister(instr->unclamped());
Register result_reg = ToRegister(instr->result()); Register result_reg = ToRegister(instr->result());
DoubleRegister temp_reg = ToDoubleRegister(instr->TempAt(0)); DoubleRegister temp_reg = ToDoubleRegister(instr->temp());
__ ClampDoubleToUint8(result_reg, value_reg, temp_reg); __ ClampDoubleToUint8(result_reg, value_reg, temp_reg);
} }
@ -4855,7 +4859,7 @@ void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) {
Register scratch = scratch0(); Register scratch = scratch0();
Register input_reg = ToRegister(instr->unclamped()); Register input_reg = ToRegister(instr->unclamped());
Register result_reg = ToRegister(instr->result()); Register result_reg = ToRegister(instr->result());
DoubleRegister temp_reg = ToDoubleRegister(instr->TempAt(0)); DoubleRegister temp_reg = ToDoubleRegister(instr->temp());
Label is_smi, done, heap_number; Label is_smi, done, heap_number;
// Both smi and heap number cases are handled. // Both smi and heap number cases are handled.
@ -4889,8 +4893,8 @@ void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) {
void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) {
Register temp1 = ToRegister(instr->TempAt(0)); Register temp1 = ToRegister(instr->temp());
Register temp2 = ToRegister(instr->TempAt(1)); Register temp2 = ToRegister(instr->temp2());
Handle<JSObject> holder = instr->holder(); Handle<JSObject> holder = instr->holder();
Handle<JSObject> current_prototype = instr->prototype(); Handle<JSObject> current_prototype = instr->prototype();
@ -4932,8 +4936,8 @@ void LCodeGen::DoAllocateObject(LAllocateObject* instr) {
new(zone()) DeferredAllocateObject(this, instr); new(zone()) DeferredAllocateObject(this, instr);
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
Register scratch = ToRegister(instr->TempAt(0)); Register scratch = ToRegister(instr->temp());
Register scratch2 = ToRegister(instr->TempAt(1)); Register scratch2 = ToRegister(instr->temp2());
Handle<JSFunction> constructor = instr->hydrogen()->constructor(); Handle<JSFunction> constructor = instr->hydrogen()->constructor();
Handle<Map> initial_map(constructor->initial_map()); Handle<Map> initial_map(constructor->initial_map());
int instance_size = initial_map->instance_size(); int instance_size = initial_map->instance_size();
@ -5225,7 +5229,7 @@ void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) {
void LCodeGen::DoToFastProperties(LToFastProperties* instr) { void LCodeGen::DoToFastProperties(LToFastProperties* instr) {
ASSERT(ToRegister(instr->InputAt(0)).is(r0)); ASSERT(ToRegister(instr->value()).is(r0));
__ push(r0); __ push(r0);
CallRuntime(Runtime::kToFastProperties, 1, instr); CallRuntime(Runtime::kToFastProperties, 1, instr);
} }
@ -5306,14 +5310,14 @@ void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) {
void LCodeGen::DoTypeof(LTypeof* instr) { void LCodeGen::DoTypeof(LTypeof* instr) {
Register input = ToRegister(instr->InputAt(0)); Register input = ToRegister(instr->value());
__ push(input); __ push(input);
CallRuntime(Runtime::kTypeof, 1, instr); CallRuntime(Runtime::kTypeof, 1, instr);
} }
void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) { void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) {
Register input = ToRegister(instr->InputAt(0)); Register input = ToRegister(instr->value());
int true_block = chunk_->LookupDestination(instr->true_block_id()); int true_block = chunk_->LookupDestination(instr->true_block_id());
int false_block = chunk_->LookupDestination(instr->false_block_id()); int false_block = chunk_->LookupDestination(instr->false_block_id());
Label* true_label = chunk_->GetAssemblyLabel(true_block); Label* true_label = chunk_->GetAssemblyLabel(true_block);
@ -5403,7 +5407,7 @@ Condition LCodeGen::EmitTypeofIs(Label* true_label,
void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) { void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) {
Register temp1 = ToRegister(instr->TempAt(0)); Register temp1 = ToRegister(instr->temp());
int true_block = chunk_->LookupDestination(instr->true_block_id()); int true_block = chunk_->LookupDestination(instr->true_block_id());
int false_block = chunk_->LookupDestination(instr->false_block_id()); int false_block = chunk_->LookupDestination(instr->false_block_id());

View File

@ -110,8 +110,9 @@ class LCodeGen BASE_EMBEDDED {
void FinishCode(Handle<Code> code); void FinishCode(Handle<Code> code);
// Deferred code support. // Deferred code support.
template<int T> void DoDeferredBinaryOpStub(LPointerMap* pointer_map,
void DoDeferredBinaryOpStub(LTemplateInstruction<1, 2, T>* instr, LOperand* left_argument,
LOperand* right_argument,
Token::Value op); Token::Value op);
void DoDeferredNumberTagD(LNumberTagD* instr); void DoDeferredNumberTagD(LNumberTagD* instr);