Consistently use named getters for Lithium operands on x64

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12508 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
svenpanne@chromium.org 2012-09-14 11:46:01 +00:00
parent 8d04c8c89f
commit 924c38c063
3 changed files with 411 additions and 237 deletions

View File

@ -818,7 +818,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());
int32_t divisor = int32_t divisor =
HConstant::cast(instr->hydrogen()->right())->Integer32Value(); HConstant::cast(instr->hydrogen()->right())->Integer32Value();
@ -842,8 +842,8 @@ void LCodeGen::DoModI(LModI* instr) {
__ bind(&done); __ bind(&done);
} else { } else {
Label done, remainder_eq_dividend, slow, do_subtraction, both_positive; Label done, remainder_eq_dividend, slow, do_subtraction, both_positive;
Register left_reg = ToRegister(instr->InputAt(0)); Register left_reg = ToRegister(instr->left());
Register right_reg = ToRegister(instr->InputAt(1)); Register right_reg = ToRegister(instr->right());
Register result_reg = ToRegister(instr->result()); Register result_reg = ToRegister(instr->result());
ASSERT(left_reg.is(rax)); ASSERT(left_reg.is(rax));
@ -873,7 +873,7 @@ void LCodeGen::DoModI(LModI* instr) {
__ j(less, &remainder_eq_dividend, Label::kNear); __ j(less, &remainder_eq_dividend, Label::kNear);
// Check if the divisor is a PowerOfTwo integer. // Check if the divisor is a PowerOfTwo integer.
Register scratch = ToRegister(instr->TempAt(0)); Register scratch = ToRegister(instr->temp());
__ movl(scratch, right_reg); __ movl(scratch, right_reg);
__ subl(scratch, Immediate(1)); __ subl(scratch, Immediate(1));
__ testl(scratch, right_reg); __ testl(scratch, right_reg);
@ -930,10 +930,10 @@ void LCodeGen::DoModI(LModI* instr) {
void LCodeGen::DoMathFloorOfDiv(LMathFloorOfDiv* instr) { void LCodeGen::DoMathFloorOfDiv(LMathFloorOfDiv* instr) {
ASSERT(instr->InputAt(1)->IsConstantOperand()); ASSERT(instr->right()->IsConstantOperand());
const Register dividend = ToRegister(instr->InputAt(0)); const Register dividend = ToRegister(instr->left());
int32_t divisor = ToInteger32(LConstantOperand::cast(instr->InputAt(1))); int32_t divisor = ToInteger32(LConstantOperand::cast(instr->right()));
const Register result = ToRegister(instr->result()); const Register result = ToRegister(instr->result());
switch (divisor) { switch (divisor) {
@ -978,7 +978,7 @@ void LCodeGen::DoMathFloorOfDiv(LMathFloorOfDiv* instr) {
__ sarl(result, Immediate(power)); __ sarl(result, Immediate(power));
} }
} else { } else {
Register reg1 = ToRegister(instr->TempAt(0)); Register reg1 = ToRegister(instr->temp());
Register reg2 = ToRegister(instr->result()); Register reg2 = ToRegister(instr->result());
// Find b which: 2^b < divisor_abs < 2^(b+1). // Find b which: 2^b < divisor_abs < 2^(b+1).
@ -1013,11 +1013,11 @@ void LCodeGen::DoMathFloorOfDiv(LMathFloorOfDiv* instr) {
void LCodeGen::DoDivI(LDivI* instr) { void LCodeGen::DoDivI(LDivI* instr) {
LOperand* right = instr->InputAt(1); LOperand* right = instr->right();
ASSERT(ToRegister(instr->result()).is(rax)); ASSERT(ToRegister(instr->result()).is(rax));
ASSERT(ToRegister(instr->InputAt(0)).is(rax)); ASSERT(ToRegister(instr->left()).is(rax));
ASSERT(!ToRegister(instr->InputAt(1)).is(rax)); ASSERT(!ToRegister(instr->right()).is(rax));
ASSERT(!ToRegister(instr->InputAt(1)).is(rdx)); ASSERT(!ToRegister(instr->right()).is(rdx));
Register left_reg = rax; Register left_reg = rax;
@ -1059,8 +1059,8 @@ void LCodeGen::DoDivI(LDivI* instr) {
void LCodeGen::DoMulI(LMulI* instr) { void LCodeGen::DoMulI(LMulI* instr) {
Register left = ToRegister(instr->InputAt(0)); Register left = ToRegister(instr->left());
LOperand* right = instr->InputAt(1); LOperand* right = instr->right();
if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
__ movl(kScratchRegister, left); __ movl(kScratchRegister, left);
@ -1142,8 +1142,8 @@ void LCodeGen::DoMulI(LMulI* instr) {
void LCodeGen::DoBitI(LBitI* instr) { void LCodeGen::DoBitI(LBitI* instr) {
LOperand* left = instr->InputAt(0); LOperand* left = instr->left();
LOperand* right = instr->InputAt(1); LOperand* right = instr->right();
ASSERT(left->Equals(instr->result())); ASSERT(left->Equals(instr->result()));
ASSERT(left->IsRegister()); ASSERT(left->IsRegister());
@ -1199,8 +1199,8 @@ void LCodeGen::DoBitI(LBitI* instr) {
void LCodeGen::DoShiftI(LShiftI* instr) { void LCodeGen::DoShiftI(LShiftI* instr) {
LOperand* left = instr->InputAt(0); LOperand* left = instr->left();
LOperand* right = instr->InputAt(1); LOperand* right = instr->right();
ASSERT(left->Equals(instr->result())); ASSERT(left->Equals(instr->result()));
ASSERT(left->IsRegister()); ASSERT(left->IsRegister());
if (right->IsRegister()) { if (right->IsRegister()) {
@ -1255,8 +1255,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();
ASSERT(left->Equals(instr->result())); ASSERT(left->Equals(instr->result()));
if (right->IsConstantOperand()) { if (right->IsConstantOperand()) {
@ -1290,7 +1290,7 @@ void LCodeGen::DoConstantD(LConstantD* instr) {
if (int_val == 0) { if (int_val == 0) {
__ xorps(res, res); __ xorps(res, res);
} else { } else {
Register tmp = ToRegister(instr->TempAt(0)); Register tmp = ToRegister(instr->temp());
__ Set(tmp, int_val); __ Set(tmp, int_val);
__ movq(res, tmp); __ movq(res, tmp);
} }
@ -1310,28 +1310,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());
__ movq(result, FieldOperand(array, JSArray::kLengthOffset)); __ movq(result, FieldOperand(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());
__ movq(result, FieldOperand(array, FixedArrayBase::kLengthOffset)); __ movq(result, FieldOperand(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|.
__ movq(result, FieldOperand(input, HeapObject::kMapOffset)); __ movq(result, FieldOperand(input, HeapObject::kMapOffset));
@ -1344,7 +1344,7 @@ 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());
ASSERT(input.is(result)); ASSERT(input.is(result));
Label done; Label done;
@ -1361,7 +1361,7 @@ 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());
Smi* index = instr->index(); Smi* index = instr->index();
Label runtime, done, not_date_object; Label runtime, done, not_date_object;
@ -1403,14 +1403,14 @@ void LCodeGen::DoDateField(LDateField* instr) {
void LCodeGen::DoBitNotI(LBitNotI* instr) { void LCodeGen::DoBitNotI(LBitNotI* instr) {
LOperand* input = instr->InputAt(0); LOperand* input = instr->value();
ASSERT(input->Equals(instr->result())); ASSERT(input->Equals(instr->result()));
__ not_(ToRegister(input)); __ not_(ToRegister(input));
} }
void LCodeGen::DoThrow(LThrow* instr) { void LCodeGen::DoThrow(LThrow* instr) {
__ push(ToRegister(instr->InputAt(0))); __ push(ToRegister(instr->value()));
CallRuntime(Runtime::kThrow, 1, instr); CallRuntime(Runtime::kThrow, 1, instr);
if (FLAG_debug_code) { if (FLAG_debug_code) {
@ -1421,8 +1421,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();
ASSERT(left->Equals(instr->result())); ASSERT(left->Equals(instr->result()));
if (right->IsConstantOperand()) { if (right->IsConstantOperand()) {
@ -1441,8 +1441,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();
ASSERT(left->Equals(instr->result())); ASSERT(left->Equals(instr->result()));
HMathMinMax::Operation operation = instr->hydrogen()->operation(); HMathMinMax::Operation operation = instr->hydrogen()->operation();
if (instr->hydrogen()->representation().IsInteger32()) { if (instr->hydrogen()->representation().IsInteger32()) {
@ -1507,8 +1507,8 @@ void LCodeGen::DoMathMinMax(LMathMinMax* instr) {
void LCodeGen::DoArithmeticD(LArithmeticD* instr) { void LCodeGen::DoArithmeticD(LArithmeticD* instr) {
XMMRegister left = ToDoubleRegister(instr->InputAt(0)); XMMRegister left = ToDoubleRegister(instr->left());
XMMRegister right = ToDoubleRegister(instr->InputAt(1)); XMMRegister right = ToDoubleRegister(instr->right());
XMMRegister result = ToDoubleRegister(instr->result()); XMMRegister result = ToDoubleRegister(instr->result());
// All operations except MOD are computed in-place. // All operations except MOD are computed in-place.
ASSERT(instr->op() == Token::MOD || left.is(result)); ASSERT(instr->op() == Token::MOD || left.is(result));
@ -1542,8 +1542,8 @@ void LCodeGen::DoArithmeticD(LArithmeticD* instr) {
void LCodeGen::DoArithmeticT(LArithmeticT* instr) { void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
ASSERT(ToRegister(instr->InputAt(0)).is(rdx)); ASSERT(ToRegister(instr->left()).is(rdx));
ASSERT(ToRegister(instr->InputAt(1)).is(rax)); ASSERT(ToRegister(instr->right()).is(rax));
ASSERT(ToRegister(instr->result()).is(rax)); ASSERT(ToRegister(instr->result()).is(rax));
BinaryOpStub stub(instr->op(), NO_OVERWRITE); BinaryOpStub stub(instr->op(), NO_OVERWRITE);
@ -1587,17 +1587,17 @@ 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());
__ testl(reg, reg); __ testl(reg, reg);
EmitBranch(true_block, false_block, not_zero); EmitBranch(true_block, false_block, not_zero);
} else if (r.IsDouble()) { } else if (r.IsDouble()) {
XMMRegister reg = ToDoubleRegister(instr->InputAt(0)); XMMRegister reg = ToDoubleRegister(instr->value());
__ xorps(xmm0, xmm0); __ xorps(xmm0, xmm0);
__ ucomisd(reg, xmm0); __ ucomisd(reg, xmm0);
EmitBranch(true_block, false_block, not_equal); EmitBranch(true_block, false_block, not_equal);
} 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);
@ -1734,8 +1734,8 @@ inline 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 cc = TokenToCondition(instr->op(), instr->is_double()); Condition cc = TokenToCondition(instr->op(), instr->is_double());
@ -1782,8 +1782,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());
@ -1793,7 +1793,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());
@ -1803,7 +1803,7 @@ void LCodeGen::DoCmpConstantEqAndBranch(LCmpConstantEqAndBranch* instr) {
void LCodeGen::DoIsNilAndBranch(LIsNilAndBranch* instr) { void LCodeGen::DoIsNilAndBranch(LIsNilAndBranch* instr) {
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
@ -1833,7 +1833,7 @@ void LCodeGen::DoIsNilAndBranch(LIsNilAndBranch* instr) {
__ JumpIfSmi(reg, false_label); __ JumpIfSmi(reg, false_label);
// Check for undetectable objects by looking in the bit field in // Check for undetectable objects by looking in the bit field in
// the map. The object has already been smi checked. // the map. The object has already been smi checked.
Register scratch = ToRegister(instr->TempAt(0)); Register scratch = ToRegister(instr->temp());
__ movq(scratch, FieldOperand(reg, HeapObject::kMapOffset)); __ movq(scratch, FieldOperand(reg, HeapObject::kMapOffset));
__ testb(FieldOperand(scratch, Map::kBitFieldOffset), __ testb(FieldOperand(scratch, Map::kBitFieldOffset),
Immediate(1 << Map::kIsUndetectable)); Immediate(1 << Map::kIsUndetectable));
@ -1868,7 +1868,7 @@ 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());
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());
@ -1892,8 +1892,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 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());
@ -1910,11 +1910,11 @@ void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) {
int false_block = chunk_->LookupDestination(instr->false_block_id()); int false_block = chunk_->LookupDestination(instr->false_block_id());
Condition is_smi; Condition is_smi;
if (instr->InputAt(0)->IsRegister()) { if (instr->value()->IsRegister()) {
Register input = ToRegister(instr->InputAt(0)); Register input = ToRegister(instr->value());
is_smi = masm()->CheckSmi(input); is_smi = masm()->CheckSmi(input);
} else { } else {
Operand input = ToOperand(instr->InputAt(0)); Operand input = ToOperand(instr->value());
is_smi = masm()->CheckSmi(input); is_smi = masm()->CheckSmi(input);
} }
EmitBranch(true_block, false_block, is_smi); EmitBranch(true_block, false_block, is_smi);
@ -1922,8 +1922,8 @@ void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) {
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());
@ -1972,7 +1972,7 @@ static Condition BranchCondition(HHasInstanceTypeAndBranch* instr) {
void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) { void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* 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());
@ -1987,7 +1987,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);
@ -2000,7 +2000,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());
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());
@ -2080,9 +2080,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 = ToRegister(instr->TempAt(0)); Register temp = ToRegister(instr->temp());
Register temp2 = ToRegister(instr->TempAt(1)); Register temp2 = ToRegister(instr->temp2());
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());
@ -2098,7 +2098,7 @@ 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());
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();
@ -2109,8 +2109,8 @@ void LCodeGen::DoCmpMapAndBranch(LCmpMapAndBranch* instr) {
void LCodeGen::DoInstanceOf(LInstanceOf* instr) { void LCodeGen::DoInstanceOf(LInstanceOf* instr) {
InstanceofStub stub(InstanceofStub::kNoFlags); InstanceofStub stub(InstanceofStub::kNoFlags);
__ push(ToRegister(instr->InputAt(0))); __ push(ToRegister(instr->left()));
__ push(ToRegister(instr->InputAt(1))); __ push(ToRegister(instr->right()));
CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
Label true_value, done; Label true_value, done;
__ testq(rax, rax); __ testq(rax, rax);
@ -2144,7 +2144,7 @@ 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());
// A Smi is not an instance of anything. // A Smi is not an instance of anything.
__ JumpIfSmi(object, &false_result); __ JumpIfSmi(object, &false_result);
@ -2154,7 +2154,7 @@ void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
// instanceof stub. // instanceof stub.
Label cache_miss; Label cache_miss;
// Use a temp register to avoid memory operands with variable lengths. // Use a temp register to avoid memory operands with variable lengths.
Register map = ToRegister(instr->TempAt(0)); Register map = ToRegister(instr->temp());
__ movq(map, FieldOperand(object, HeapObject::kMapOffset)); __ movq(map, FieldOperand(object, HeapObject::kMapOffset));
__ bind(deferred->map_check()); // Label for calculating code patching. __ bind(deferred->map_check()); // Label for calculating code patching.
Handle<JSGlobalPropertyCell> cache_cell = Handle<JSGlobalPropertyCell> cache_cell =
@ -2197,7 +2197,7 @@ void LCodeGen::DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
InstanceofStub::kNoFlags | InstanceofStub::kCallSiteInlineCheck); InstanceofStub::kNoFlags | InstanceofStub::kCallSiteInlineCheck);
InstanceofStub stub(flags); InstanceofStub stub(flags);
__ push(ToRegister(instr->InputAt(0))); __ push(ToRegister(instr->value()));
__ PushHeapObject(instr->function()); __ PushHeapObject(instr->function());
static const int kAdditionalDelta = 10; static const int kAdditionalDelta = 10;
@ -2297,7 +2297,7 @@ void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
// it as no longer deleted. We deoptimize in that case. // it as no longer deleted. We deoptimize in that case.
if (instr->hydrogen()->RequiresHoleCheck()) { if (instr->hydrogen()->RequiresHoleCheck()) {
// We have a temp because CompareRoot might clobber kScratchRegister. // We have a temp because CompareRoot might clobber kScratchRegister.
Register cell = ToRegister(instr->TempAt(0)); Register cell = ToRegister(instr->temp());
ASSERT(!value.is(cell)); ASSERT(!value.is(cell));
__ movq(cell, cell_handle, RelocInfo::GLOBAL_PROPERTY_CELL); __ movq(cell, cell_handle, RelocInfo::GLOBAL_PROPERTY_CELL);
__ CompareRoot(Operand(cell, 0), Heap::kTheHoleValueRootIndex); __ CompareRoot(Operand(cell, 0), Heap::kTheHoleValueRootIndex);
@ -2365,7 +2365,7 @@ void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) {
SmiCheck check_needed = SmiCheck check_needed =
type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
int offset = Context::SlotOffset(instr->slot_index()); int offset = Context::SlotOffset(instr->slot_index());
Register scratch = ToRegister(instr->TempAt(0)); Register scratch = ToRegister(instr->temp());
__ RecordWriteContextSlot(context, __ RecordWriteContextSlot(context,
offset, offset,
value, value,
@ -2380,7 +2380,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()) {
__ movq(result, FieldOperand(object, instr->hydrogen()->offset())); __ movq(result, FieldOperand(object, instr->hydrogen()->offset()));
@ -2552,7 +2552,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());
__ movq(result, FieldOperand(input, JSObject::kElementsOffset)); __ movq(result, FieldOperand(input, JSObject::kElementsOffset));
if (FLAG_debug_code) { if (FLAG_debug_code) {
Label done, ok, fail; Label done, ok, fail;
@ -2588,7 +2588,7 @@ void LCodeGen::DoLoadElements(LLoadElements* instr) {
void LCodeGen::DoLoadExternalArrayPointer( void LCodeGen::DoLoadExternalArrayPointer(
LLoadExternalArrayPointer* instr) { LLoadExternalArrayPointer* instr) {
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
Register input = ToRegister(instr->InputAt(0)); Register input = ToRegister(instr->object());
__ movq(result, FieldOperand(input, __ movq(result, FieldOperand(input,
ExternalPixelArray::kExternalPointerOffset)); ExternalPixelArray::kExternalPointerOffset));
} }
@ -2836,10 +2836,10 @@ void LCodeGen::DoArgumentsLength(LArgumentsLength* instr) {
Label done; Label done;
// If no arguments adaptor frame the number of arguments is fixed. // If no arguments adaptor frame the number of arguments is fixed.
if (instr->InputAt(0)->IsRegister()) { if (instr->elements()->IsRegister()) {
__ cmpq(rbp, ToRegister(instr->InputAt(0))); __ cmpq(rbp, ToRegister(instr->elements()));
} else { } else {
__ cmpq(rbp, ToOperand(instr->InputAt(0))); __ cmpq(rbp, ToOperand(instr->elements()));
} }
__ movl(result, Immediate(scope()->num_parameters())); __ movl(result, Immediate(scope()->num_parameters()));
__ j(equal, &done, Label::kNear); __ j(equal, &done, Label::kNear);
@ -2947,7 +2947,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();
EmitPushTaggedOperand(argument); EmitPushTaggedOperand(argument);
} }
@ -3057,7 +3057,7 @@ void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) {
void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) { void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) {
Register input_reg = ToRegister(instr->InputAt(0)); Register input_reg = ToRegister(instr->value());
__ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset), __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset),
Heap::kHeapNumberMapRootIndex); Heap::kHeapNumberMapRootIndex);
DeoptimizeIf(not_equal, instr->environment()); DeoptimizeIf(not_equal, instr->environment());
@ -3109,7 +3109,7 @@ void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) {
void LCodeGen::EmitIntegerMathAbs(LUnaryMathOperation* instr) { void LCodeGen::EmitIntegerMathAbs(LUnaryMathOperation* instr) {
Register input_reg = ToRegister(instr->InputAt(0)); Register input_reg = ToRegister(instr->value());
__ testl(input_reg, input_reg); __ testl(input_reg, input_reg);
Label is_positive; Label is_positive;
__ j(not_sign, &is_positive); __ j(not_sign, &is_positive);
@ -3134,12 +3134,12 @@ void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) {
LUnaryMathOperation* instr_; LUnaryMathOperation* instr_;
}; };
ASSERT(instr->InputAt(0)->Equals(instr->result())); ASSERT(instr->value()->Equals(instr->result()));
Representation r = instr->hydrogen()->value()->representation(); Representation r = instr->hydrogen()->value()->representation();
if (r.IsDouble()) { if (r.IsDouble()) {
XMMRegister scratch = xmm0; XMMRegister scratch = xmm0;
XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0)); XMMRegister input_reg = ToDoubleRegister(instr->value());
__ xorps(scratch, scratch); __ xorps(scratch, scratch);
__ subsd(scratch, input_reg); __ subsd(scratch, input_reg);
__ andpd(input_reg, scratch); __ andpd(input_reg, scratch);
@ -3148,7 +3148,7 @@ void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) {
} else { // Tagged case. } else { // Tagged case.
DeferredMathAbsTaggedHeapNumber* deferred = DeferredMathAbsTaggedHeapNumber* deferred =
new(zone()) DeferredMathAbsTaggedHeapNumber(this, instr); new(zone()) DeferredMathAbsTaggedHeapNumber(this, instr);
Register input_reg = ToRegister(instr->InputAt(0)); Register input_reg = ToRegister(instr->value());
// Smi check. // Smi check.
__ JumpIfNotSmi(input_reg, deferred->entry()); __ JumpIfNotSmi(input_reg, deferred->entry());
__ SmiToInteger32(input_reg, input_reg); __ SmiToInteger32(input_reg, input_reg);
@ -3162,7 +3162,7 @@ void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) {
void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) { void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) {
XMMRegister xmm_scratch = xmm0; XMMRegister xmm_scratch = xmm0;
Register output_reg = ToRegister(instr->result()); Register output_reg = ToRegister(instr->result());
XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0)); XMMRegister input_reg = ToDoubleRegister(instr->value());
if (CpuFeatures::IsSupported(SSE4_1)) { if (CpuFeatures::IsSupported(SSE4_1)) {
CpuFeatures::Scope scope(SSE4_1); CpuFeatures::Scope scope(SSE4_1);
@ -3221,7 +3221,7 @@ void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) {
void LCodeGen::DoMathRound(LUnaryMathOperation* instr) { void LCodeGen::DoMathRound(LUnaryMathOperation* instr) {
const XMMRegister xmm_scratch = xmm0; const XMMRegister xmm_scratch = xmm0;
Register output_reg = ToRegister(instr->result()); Register output_reg = ToRegister(instr->result());
XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0)); XMMRegister input_reg = ToDoubleRegister(instr->value());
Label done; Label done;
// xmm_scratch = 0.5 // xmm_scratch = 0.5
@ -3266,7 +3266,7 @@ void LCodeGen::DoMathRound(LUnaryMathOperation* instr) {
void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) { void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) {
XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0)); XMMRegister input_reg = ToDoubleRegister(instr->value());
ASSERT(ToDoubleRegister(instr->result()).is(input_reg)); ASSERT(ToDoubleRegister(instr->result()).is(input_reg));
__ sqrtsd(input_reg, input_reg); __ sqrtsd(input_reg, input_reg);
} }
@ -3274,7 +3274,7 @@ void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) {
void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) { void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) {
XMMRegister xmm_scratch = xmm0; XMMRegister xmm_scratch = xmm0;
XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0)); XMMRegister input_reg = ToDoubleRegister(instr->value());
ASSERT(ToDoubleRegister(instr->result()).is(input_reg)); ASSERT(ToDoubleRegister(instr->result()).is(input_reg));
// Note that according to ECMA-262 15.8.2.13: // Note that according to ECMA-262 15.8.2.13:
@ -3315,11 +3315,11 @@ void LCodeGen::DoPower(LPower* instr) {
#else #else
Register exponent = rdi; Register exponent = rdi;
#endif #endif
ASSERT(!instr->InputAt(1)->IsRegister() || ASSERT(!instr->right()->IsRegister() ||
ToRegister(instr->InputAt(1)).is(exponent)); ToRegister(instr->right()).is(exponent));
ASSERT(!instr->InputAt(1)->IsDoubleRegister() || ASSERT(!instr->right()->IsDoubleRegister() ||
ToDoubleRegister(instr->InputAt(1)).is(xmm1)); ToDoubleRegister(instr->right()).is(xmm1));
ASSERT(ToDoubleRegister(instr->InputAt(0)).is(xmm2)); ASSERT(ToDoubleRegister(instr->left()).is(xmm2));
ASSERT(ToDoubleRegister(instr->result()).is(xmm3)); ASSERT(ToDoubleRegister(instr->result()).is(xmm3));
if (exponent_type.IsTagged()) { if (exponent_type.IsTagged()) {
@ -3361,10 +3361,10 @@ void LCodeGen::DoRandom(LRandom* instr) {
// Choose the right register for the first argument depending on // Choose the right register for the first argument depending on
// calling convention. // calling convention.
#ifdef _WIN64 #ifdef _WIN64
ASSERT(ToRegister(instr->InputAt(0)).is(rcx)); ASSERT(ToRegister(instr->global_object()).is(rcx));
Register global_object = rcx; Register global_object = rcx;
#else #else
ASSERT(ToRegister(instr->InputAt(0)).is(rdi)); ASSERT(ToRegister(instr->global_object()).is(rdi));
Register global_object = rdi; Register global_object = rdi;
#endif #endif
@ -3579,7 +3579,7 @@ void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
void LCodeGen::DoCallNew(LCallNew* instr) { void LCodeGen::DoCallNew(LCallNew* instr) {
ASSERT(ToRegister(instr->InputAt(0)).is(rdi)); ASSERT(ToRegister(instr->constructor()).is(rdi));
ASSERT(ToRegister(instr->result()).is(rax)); ASSERT(ToRegister(instr->result()).is(rax));
CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); CallConstructStub stub(NO_CALL_FUNCTION_FLAGS);
@ -3603,7 +3603,7 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
__ Move(FieldOperand(object, HeapObject::kMapOffset), __ Move(FieldOperand(object, HeapObject::kMapOffset),
instr->transition()); instr->transition());
} else { } else {
Register temp = ToRegister(instr->TempAt(0)); Register temp = ToRegister(instr->temp());
__ Move(kScratchRegister, instr->transition()); __ Move(kScratchRegister, instr->transition());
__ movq(FieldOperand(object, HeapObject::kMapOffset), kScratchRegister); __ movq(FieldOperand(object, HeapObject::kMapOffset), kScratchRegister);
// Update the write barrier for the map field. // Update the write barrier for the map field.
@ -3624,7 +3624,7 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
if (instr->is_in_object()) { if (instr->is_in_object()) {
__ movq(FieldOperand(object, offset), value); __ movq(FieldOperand(object, offset), value);
if (instr->hydrogen()->NeedsWriteBarrier()) { if (instr->hydrogen()->NeedsWriteBarrier()) {
Register temp = ToRegister(instr->TempAt(0)); Register temp = ToRegister(instr->temp());
// Update the write barrier for the object for in-object properties. // Update the write barrier for the object for in-object properties.
__ RecordWriteField(object, __ RecordWriteField(object,
offset, offset,
@ -3635,7 +3635,7 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
check_needed); check_needed);
} }
} else { } else {
Register temp = ToRegister(instr->TempAt(0)); Register temp = ToRegister(instr->temp());
__ movq(temp, FieldOperand(object, JSObject::kPropertiesOffset)); __ movq(temp, FieldOperand(object, JSObject::kPropertiesOffset));
__ movq(FieldOperand(temp, offset), value); __ movq(FieldOperand(temp, offset), value);
if (instr->hydrogen()->NeedsWriteBarrier()) { if (instr->hydrogen()->NeedsWriteBarrier()) {
@ -3888,7 +3888,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());
Handle<Map> from_map = instr->original_map(); Handle<Map> from_map = instr->original_map();
Handle<Map> to_map = instr->transitioned_map(); Handle<Map> to_map = instr->transitioned_map();
@ -3902,12 +3902,12 @@ void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) {
if (IsSimpleMapChangeTransition(from_kind, to_kind)) { if (IsSimpleMapChangeTransition(from_kind, to_kind)) {
__ movq(FieldOperand(object_reg, HeapObject::kMapOffset), new_map_reg); __ movq(FieldOperand(object_reg, HeapObject::kMapOffset), new_map_reg);
// Write barrier. // Write barrier.
ASSERT_NE(instr->temp_reg(), NULL); ASSERT_NE(instr->temp(), NULL);
__ RecordWriteField(object_reg, HeapObject::kMapOffset, new_map_reg, __ RecordWriteField(object_reg, HeapObject::kMapOffset, new_map_reg,
ToRegister(instr->temp_reg()), kDontSaveFPRegs); ToRegister(instr->temp()), 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(rdx)); ASSERT(fixed_object_reg.is(rdx));
ASSERT(new_map_reg.is(rbx)); ASSERT(new_map_reg.is(rbx));
__ movq(fixed_object_reg, object_reg); __ movq(fixed_object_reg, object_reg);
@ -3915,7 +3915,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(rdx)); ASSERT(fixed_object_reg.is(rdx));
ASSERT(new_map_reg.is(rbx)); ASSERT(new_map_reg.is(rbx));
__ movq(fixed_object_reg, object_reg); __ movq(fixed_object_reg, object_reg);
@ -4046,7 +4046,7 @@ void LCodeGen::DoStringLength(LStringLength* instr) {
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());
@ -4059,9 +4059,9 @@ 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();
LOperand* temp = instr->TempAt(0); LOperand* temp = instr->temp();
__ LoadUint32(ToDoubleRegister(output), __ LoadUint32(ToDoubleRegister(output),
ToRegister(input), ToRegister(input),
@ -4070,7 +4070,7 @@ void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) {
void LCodeGen::DoNumberTagI(LNumberTagI* instr) { void LCodeGen::DoNumberTagI(LNumberTagI* 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);
@ -4091,7 +4091,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);
@ -4105,7 +4105,7 @@ void LCodeGen::DoNumberTagU(LNumberTagU* instr) {
void LCodeGen::DoDeferredNumberTagU(LNumberTagU* instr) { void LCodeGen::DoDeferredNumberTagU(LNumberTagU* instr) {
Label slow; Label slow;
Register reg = ToRegister(instr->InputAt(0)); Register reg = ToRegister(instr->value());
Register tmp = reg.is(rax) ? rcx : rax; Register tmp = reg.is(rax) ? rcx : rax;
// Preserve the value of all registers. // Preserve the value of all registers.
@ -4152,9 +4152,9 @@ void LCodeGen::DoNumberTagD(LNumberTagD* instr) {
LNumberTagD* instr_; LNumberTagD* instr_;
}; };
XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0)); XMMRegister input_reg = ToDoubleRegister(instr->value());
Register reg = ToRegister(instr->result()); Register reg = ToRegister(instr->result());
Register tmp = ToRegister(instr->TempAt(0)); Register tmp = ToRegister(instr->temp());
DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr); DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr);
if (FLAG_inline_new) { if (FLAG_inline_new) {
@ -4185,16 +4185,16 @@ void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) {
void LCodeGen::DoSmiTag(LSmiTag* instr) { void LCodeGen::DoSmiTag(LSmiTag* instr) {
ASSERT(instr->InputAt(0)->Equals(instr->result())); ASSERT(instr->value()->Equals(instr->result()));
Register input = ToRegister(instr->InputAt(0)); Register input = ToRegister(instr->value());
ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow)); ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow));
__ Integer32ToSmi(input, input); __ Integer32ToSmi(input, input);
} }
void LCodeGen::DoSmiUntag(LSmiUntag* instr) { void LCodeGen::DoSmiUntag(LSmiUntag* instr) {
ASSERT(instr->InputAt(0)->Equals(instr->result())); ASSERT(instr->value()->Equals(instr->result()));
Register input = ToRegister(instr->InputAt(0)); Register input = ToRegister(instr->value());
if (instr->needs_check()) { if (instr->needs_check()) {
Condition is_smi = __ CheckSmi(input); Condition is_smi = __ CheckSmi(input);
DeoptimizeIf(NegateCondition(is_smi), instr->environment()); DeoptimizeIf(NegateCondition(is_smi), instr->environment());
@ -4259,7 +4259,7 @@ void LCodeGen::EmitNumberUntagD(Register input_reg,
void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) { void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) {
Label done, heap_number; Label done, heap_number;
Register input_reg = ToRegister(instr->InputAt(0)); Register input_reg = ToRegister(instr->value());
// Heap number map check. // Heap number map check.
__ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset), __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset),
@ -4285,7 +4285,7 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) {
// Deoptimize if we don't have a heap number. // Deoptimize if we don't have a heap number.
DeoptimizeIf(not_equal, instr->environment()); DeoptimizeIf(not_equal, instr->environment());
XMMRegister xmm_temp = ToDoubleRegister(instr->TempAt(0)); XMMRegister xmm_temp = ToDoubleRegister(instr->temp());
__ movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset)); __ movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset));
__ cvttsd2si(input_reg, xmm0); __ cvttsd2si(input_reg, xmm0);
__ cvtlsi2sd(xmm_temp, input_reg); __ cvtlsi2sd(xmm_temp, input_reg);
@ -4315,7 +4315,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()));
@ -4328,7 +4328,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());
@ -4344,7 +4344,7 @@ void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) {
void LCodeGen::DoDoubleToI(LDoubleToI* instr) { void LCodeGen::DoDoubleToI(LDoubleToI* instr) {
LOperand* input = instr->InputAt(0); LOperand* input = instr->value();
ASSERT(input->IsDoubleRegister()); ASSERT(input->IsDoubleRegister());
LOperand* result = instr->result(); LOperand* result = instr->result();
ASSERT(result->IsRegister()); ASSERT(result->IsRegister());
@ -4384,21 +4384,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();
Condition cc = masm()->CheckSmi(ToRegister(input)); Condition cc = masm()->CheckSmi(ToRegister(input));
DeoptimizeIf(NegateCondition(cc), instr->environment()); DeoptimizeIf(NegateCondition(cc), instr->environment());
} }
void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) { void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) {
LOperand* input = instr->InputAt(0); LOperand* input = instr->value();
Condition cc = masm()->CheckSmi(ToRegister(input)); Condition cc = masm()->CheckSmi(ToRegister(input));
DeoptimizeIf(cc, instr->environment()); DeoptimizeIf(cc, instr->environment());
} }
void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) { void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) {
Register input = ToRegister(instr->InputAt(0)); Register input = ToRegister(instr->value());
__ movq(kScratchRegister, FieldOperand(input, HeapObject::kMapOffset)); __ movq(kScratchRegister, FieldOperand(input, HeapObject::kMapOffset));
@ -4470,7 +4470,7 @@ void LCodeGen::DoCheckMapCommon(Register reg,
void LCodeGen::DoCheckMaps(LCheckMaps* instr) { void LCodeGen::DoCheckMaps(LCheckMaps* instr) {
LOperand* input = instr->InputAt(0); LOperand* input = instr->value();
ASSERT(input->IsRegister()); ASSERT(input->IsRegister());
Register reg = ToRegister(input); Register reg = ToRegister(input);
@ -4490,7 +4490,7 @@ void LCodeGen::DoCheckMaps(LCheckMaps* instr) {
void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) {
XMMRegister value_reg = ToDoubleRegister(instr->unclamped()); XMMRegister value_reg = ToDoubleRegister(instr->unclamped());
Register result_reg = ToRegister(instr->result()); Register result_reg = ToRegister(instr->result());
Register temp_reg = ToRegister(instr->TempAt(0)); Register temp_reg = ToRegister(instr->temp());
__ ClampDoubleToUint8(value_reg, xmm0, result_reg, temp_reg); __ ClampDoubleToUint8(value_reg, xmm0, result_reg, temp_reg);
} }
@ -4505,8 +4505,8 @@ void LCodeGen::DoClampIToUint8(LClampIToUint8* instr) {
void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) { void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) {
ASSERT(instr->unclamped()->Equals(instr->result())); ASSERT(instr->unclamped()->Equals(instr->result()));
Register input_reg = ToRegister(instr->unclamped()); Register input_reg = ToRegister(instr->unclamped());
Register temp_reg = ToRegister(instr->TempAt(0)); Register temp_reg = ToRegister(instr->temp());
XMMRegister temp_xmm_reg = ToDoubleRegister(instr->TempAt(1)); XMMRegister temp_xmm_reg = ToDoubleRegister(instr->temp2());
Label is_smi, done, heap_number; Label is_smi, done, heap_number;
__ JumpIfSmi(input_reg, &is_smi); __ JumpIfSmi(input_reg, &is_smi);
@ -4539,7 +4539,7 @@ void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) {
void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) {
Register reg = ToRegister(instr->TempAt(0)); Register reg = ToRegister(instr->temp());
Handle<JSObject> holder = instr->holder(); Handle<JSObject> holder = instr->holder();
Handle<JSObject> current_prototype = instr->prototype(); Handle<JSObject> current_prototype = instr->prototype();
@ -4578,7 +4578,7 @@ 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());
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();
@ -4880,7 +4880,7 @@ void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) {
void LCodeGen::DoToFastProperties(LToFastProperties* instr) { void LCodeGen::DoToFastProperties(LToFastProperties* instr) {
ASSERT(ToRegister(instr->InputAt(0)).is(rax)); ASSERT(ToRegister(instr->value()).is(rax));
__ push(rax); __ push(rax);
CallRuntime(Runtime::kToFastProperties, 1, instr); CallRuntime(Runtime::kToFastProperties, 1, instr);
} }
@ -4957,7 +4957,7 @@ void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) {
void LCodeGen::DoTypeof(LTypeof* instr) { void LCodeGen::DoTypeof(LTypeof* instr) {
LOperand* input = instr->InputAt(0); LOperand* input = instr->value();
EmitPushTaggedOperand(input); EmitPushTaggedOperand(input);
CallRuntime(Runtime::kTypeof, 1, instr); CallRuntime(Runtime::kTypeof, 1, instr);
} }
@ -4981,7 +4981,7 @@ void LCodeGen::EmitPushTaggedOperand(LOperand* operand) {
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);
@ -5067,7 +5067,7 @@ Condition LCodeGen::EmitTypeofIs(Label* true_label,
void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) { void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) {
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());

View File

@ -196,22 +196,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());
@ -220,57 +220,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(),
@ -280,7 +280,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());
@ -294,26 +294,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());
} }
@ -342,7 +342,7 @@ 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());
} }

File diff suppressed because it is too large Load Diff