Revision: 23429
Author: [email protected]
Date: Wed Aug 27 06:25:02 2014 UTC
Log: [turbofan] Refactor code generation for calls.
[email protected]
TEST=cctest
Review URL: https://codereview.chromium.org/508863002
https://code.google.com/p/v8/source/detail?r=23429
Modified:
/branches/bleeding_edge/src/compiler/arm/code-generator-arm.cc
/branches/bleeding_edge/src/compiler/arm/instruction-codes-arm.h
/branches/bleeding_edge/src/compiler/arm/instruction-selector-arm.cc
/branches/bleeding_edge/src/compiler/arm64/code-generator-arm64.cc
/branches/bleeding_edge/src/compiler/arm64/instruction-codes-arm64.h
/branches/bleeding_edge/src/compiler/arm64/instruction-selector-arm64.cc
/branches/bleeding_edge/src/compiler/ia32/code-generator-ia32.cc
/branches/bleeding_edge/src/compiler/ia32/instruction-codes-ia32.h
/branches/bleeding_edge/src/compiler/ia32/instruction-selector-ia32.cc
/branches/bleeding_edge/src/compiler/instruction-codes.h
/branches/bleeding_edge/src/compiler/x64/code-generator-x64.cc
/branches/bleeding_edge/src/compiler/x64/instruction-codes-x64.h
/branches/bleeding_edge/src/compiler/x64/instruction-selector-x64.cc
=======================================
--- /branches/bleeding_edge/src/compiler/arm/code-generator-arm.cc Tue Aug
26 08:29:12 2014 UTC
+++ /branches/bleeding_edge/src/compiler/arm/code-generator-arm.cc Wed Aug
27 06:25:02 2014 UTC
@@ -136,28 +136,63 @@
ArmOperandConverter i(this, instr);
switch (ArchOpcodeField::decode(instr->opcode())) {
- case kArchJmp:
- __ b(code_->GetLabel(i.InputBlock(0)));
+ case kArchCallAddress: {
+ DirectCEntryStub stub(isolate());
+ stub.GenerateCall(masm(), i.InputRegister(0));
DCHECK_EQ(LeaveCC, i.OutputSBit());
break;
- case kArchNop:
- // don't emit code for nops.
+ }
+ case kArchCallCodeObject: {
+ if (instr->InputAt(0)->IsImmediate()) {
+ __ Call(Handle<Code>::cast(i.InputHeapObject(0)),
+ RelocInfo::CODE_TARGET);
+ } else {
+ __ add(ip, i.InputRegister(0),
+ Operand(Code::kHeaderSize - kHeapObjectTag));
+ __ Call(ip);
+ }
+ AddSafepointAndDeopt(instr);
DCHECK_EQ(LeaveCC, i.OutputSBit());
break;
- case kArchRet:
- AssembleReturn();
+ }
+ case kArchCallJSFunction: {
+ // TODO(jarin) The load of the context should be separated from the
call.
+ Register func = i.InputRegister(0);
+ __ ldr(cp, FieldMemOperand(func, JSFunction::kContextOffset));
+ __ ldr(ip, FieldMemOperand(func, JSFunction::kCodeEntryOffset));
+ __ Call(ip);
+ AddSafepointAndDeopt(instr);
DCHECK_EQ(LeaveCC, i.OutputSBit());
break;
+ }
case kArchDeoptimize: {
int deoptimization_id = MiscField::decode(instr->opcode());
BuildTranslation(instr, 0, deoptimization_id);
-
Address deopt_entry = Deoptimizer::GetDeoptimizationEntry(
isolate(), deoptimization_id, Deoptimizer::LAZY);
__ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY);
DCHECK_EQ(LeaveCC, i.OutputSBit());
break;
}
+ case kArchDrop: {
+ int words = MiscField::decode(instr->opcode());
+ __ Drop(words);
+ DCHECK_LT(0, words);
+ DCHECK_EQ(LeaveCC, i.OutputSBit());
+ break;
+ }
+ case kArchJmp:
+ __ b(code_->GetLabel(i.InputBlock(0)));
+ DCHECK_EQ(LeaveCC, i.OutputSBit());
+ break;
+ case kArchNop:
+ // don't emit code for nops.
+ DCHECK_EQ(LeaveCC, i.OutputSBit());
+ break;
+ case kArchRet:
+ AssembleReturn();
+ DCHECK_EQ(LeaveCC, i.OutputSBit());
+ break;
case kArchTruncateDoubleToI:
__ TruncateDoubleToI(i.OutputRegister(), i.InputDoubleRegister(0));
DCHECK_EQ(LeaveCC, i.OutputSBit());
@@ -236,51 +271,6 @@
DCHECK_EQ(LeaveCC, i.OutputSBit());
break;
}
- case kArmCallCodeObject: {
- if (instr->InputAt(0)->IsImmediate()) {
- Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0));
- __ Call(code, RelocInfo::CODE_TARGET);
- } else {
- Register reg = i.InputRegister(0);
- int entry = Code::kHeaderSize - kHeapObjectTag;
- __ ldr(reg, MemOperand(reg, entry));
- __ Call(reg);
- }
-
- AddSafepointAndDeopt(instr);
-
- DCHECK_EQ(LeaveCC, i.OutputSBit());
- break;
- }
- case kArmCallJSFunction: {
- Register func = i.InputRegister(0);
-
- // TODO(jarin) The load of the context should be separated from the
call.
- __ ldr(cp, FieldMemOperand(func, JSFunction::kContextOffset));
- __ ldr(ip, FieldMemOperand(func, JSFunction::kCodeEntryOffset));
- __ Call(ip);
-
- AddSafepointAndDeopt(instr);
-
- DCHECK_EQ(LeaveCC, i.OutputSBit());
- break;
- }
- case kArmCallAddress: {
- DirectCEntryStub stub(isolate());
- stub.GenerateCall(masm(), i.InputRegister(0));
- DCHECK_EQ(LeaveCC, i.OutputSBit());
- break;
- }
- case kArmPush:
- __ Push(i.InputRegister(0));
- DCHECK_EQ(LeaveCC, i.OutputSBit());
- break;
- case kArmDrop: {
- int words = MiscField::decode(instr->opcode());
- __ Drop(words);
- DCHECK_EQ(LeaveCC, i.OutputSBit());
- break;
- }
case kArmCmp:
__ cmp(i.InputRegister(0), i.InputOperand2(1));
DCHECK_EQ(SetCC, i.OutputSBit());
@@ -442,6 +432,10 @@
DCHECK_EQ(LeaveCC, i.OutputSBit());
break;
}
+ case kArmPush:
+ __ Push(i.InputRegister(0));
+ DCHECK_EQ(LeaveCC, i.OutputSBit());
+ break;
case kArmStoreWriteBarrier: {
Register object = i.InputRegister(0);
Register index = i.InputRegister(1);
=======================================
--- /branches/bleeding_edge/src/compiler/arm/instruction-codes-arm.h Tue
Aug 26 08:29:12 2014 UTC
+++ /branches/bleeding_edge/src/compiler/arm/instruction-codes-arm.h Wed
Aug 27 06:25:02 2014 UTC
@@ -32,11 +32,6 @@
V(ArmMvn) \
V(ArmBfc) \
V(ArmUbfx) \
- V(ArmCallCodeObject) \
- V(ArmCallJSFunction) \
- V(ArmCallAddress) \
- V(ArmPush) \
- V(ArmDrop) \
V(ArmVcmpF64) \
V(ArmVaddF64) \
V(ArmVsubF64) \
@@ -62,6 +57,7 @@
V(ArmStrh) \
V(ArmLdr) \
V(ArmStr) \
+ V(ArmPush) \
V(ArmStoreWriteBarrier)
=======================================
--- /branches/bleeding_edge/src/compiler/arm/instruction-selector-arm.cc
Tue Aug 26 09:19:24 2014 UTC
+++ /branches/bleeding_edge/src/compiler/arm/instruction-selector-arm.cc
Wed Aug 27 06:25:02 2014 UTC
@@ -74,10 +74,14 @@
case kArmStrh:
return value >= -255 && value <= 255;
+ case kArchCallAddress:
+ case kArchCallCodeObject:
+ case kArchCallJSFunction:
+ case kArchDeoptimize:
+ case kArchDrop:
case kArchJmp:
case kArchNop:
case kArchRet:
- case kArchDeoptimize:
case kArchTruncateDoubleToI:
case kArmMul:
case kArmMla:
@@ -86,11 +90,6 @@
case kArmUdiv:
case kArmBfc:
case kArmUbfx:
- case kArmCallCodeObject:
- case kArmCallJSFunction:
- case kArmCallAddress:
- case kArmPush:
- case kArmDrop:
case kArmVcmpF64:
case kArmVaddF64:
case kArmVsubF64:
@@ -104,6 +103,7 @@
case kArmVcvtF64U32:
case kArmVcvtS32F64:
case kArmVcvtU32F64:
+ case kArmPush:
return false;
}
UNREACHABLE();
@@ -808,14 +808,14 @@
InstructionCode opcode;
switch (descriptor->kind()) {
case CallDescriptor::kCallCodeObject: {
- opcode = kArmCallCodeObject;
+ opcode = kArchCallCodeObject;
break;
}
case CallDescriptor::kCallAddress:
- opcode = kArmCallAddress;
+ opcode = kArchCallAddress;
break;
case CallDescriptor::kCallJSFunction:
- opcode = kArmCallJSFunction;
+ opcode = kArchCallJSFunction;
break;
default:
UNREACHABLE();
@@ -838,7 +838,7 @@
if (descriptor->kind() == CallDescriptor::kCallAddress &&
!buffer.pushed_nodes.empty()) {
DCHECK(deoptimization == NULL && continuation == NULL);
- Emit(kArmDrop | MiscField::encode(buffer.pushed_nodes.size()), NULL);
+ Emit(kArchDrop | MiscField::encode(buffer.pushed_nodes.size()), NULL);
}
}
=======================================
--- /branches/bleeding_edge/src/compiler/arm64/code-generator-arm64.cc Tue
Aug 26 08:29:12 2014 UTC
+++ /branches/bleeding_edge/src/compiler/arm64/code-generator-arm64.cc Wed
Aug 27 06:25:02 2014 UTC
@@ -131,24 +131,56 @@
Arm64OperandConverter i(this, instr);
InstructionCode opcode = instr->opcode();
switch (ArchOpcodeField::decode(opcode)) {
- case kArchJmp:
- __ B(code_->GetLabel(i.InputBlock(0)));
+ case kArchCallAddress: {
+ DirectCEntryStub stub(isolate());
+ stub.GenerateCall(masm(), i.InputRegister(0));
break;
- case kArchNop:
- // don't emit code for nops.
+ }
+ case kArchCallCodeObject: {
+ if (instr->InputAt(0)->IsImmediate()) {
+ __ Call(Handle<Code>::cast(i.InputHeapObject(0)),
+ RelocInfo::CODE_TARGET);
+ } else {
+ Register target = i.InputRegister(0);
+ __ Add(target, target, Code::kHeaderSize - kHeapObjectTag);
+ __ Call(target);
+ }
+ AddSafepointAndDeopt(instr);
+ // Meaningless instruction for ICs to overwrite.
+ AddNopForSmiCodeInlining();
break;
- case kArchRet:
- AssembleReturn();
+ }
+ case kArchCallJSFunction: {
+ // TODO(jarin) The load of the context should be separated from the
call.
+ Register func = i.InputRegister(0);
+ __ Ldr(cp, FieldMemOperand(func, JSFunction::kContextOffset));
+ __ Ldr(x10, FieldMemOperand(func, JSFunction::kCodeEntryOffset));
+ __ Call(x10);
+ AddSafepointAndDeopt(instr);
break;
+ }
case kArchDeoptimize: {
int deoptimization_id = MiscField::decode(instr->opcode());
BuildTranslation(instr, 0, deoptimization_id);
-
Address deopt_entry = Deoptimizer::GetDeoptimizationEntry(
isolate(), deoptimization_id, Deoptimizer::LAZY);
__ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY);
break;
}
+ case kArchDrop: {
+ int words = MiscField::decode(instr->opcode());
+ __ Drop(words);
+ break;
+ }
+ case kArchJmp:
+ __ B(code_->GetLabel(i.InputBlock(0)));
+ break;
+ case kArchNop:
+ // don't emit code for nops.
+ break;
+ case kArchRet:
+ AssembleReturn();
+ break;
case kArchTruncateDoubleToI:
__ TruncateDoubleToI(i.OutputRegister(), i.InputDoubleRegister(0));
break;
@@ -283,38 +315,6 @@
case kArm64Sxtw:
__ Sxtw(i.OutputRegister(), i.InputRegister32(0));
break;
- case kArm64CallCodeObject: {
- if (instr->InputAt(0)->IsImmediate()) {
- Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0));
- __ Call(code, RelocInfo::CODE_TARGET);
- } else {
- Register reg = i.InputRegister(0);
- int entry = Code::kHeaderSize - kHeapObjectTag;
- __ Ldr(reg, MemOperand(reg, entry));
- __ Call(reg);
- }
-
- AddSafepointAndDeopt(instr);
- // Meaningless instruction for ICs to overwrite.
- AddNopForSmiCodeInlining();
- break;
- }
- case kArm64CallJSFunction: {
- Register func = i.InputRegister(0);
-
- // TODO(jarin) The load of the context should be separated from the
call.
- __ Ldr(cp, FieldMemOperand(func, JSFunction::kContextOffset));
- __ Ldr(x10, FieldMemOperand(func, JSFunction::kCodeEntryOffset));
- __ Call(x10);
-
- AddSafepointAndDeopt(instr);
- break;
- }
- case kArm64CallAddress: {
- DirectCEntryStub stub(isolate());
- stub.GenerateCall(masm(), i.InputRegister(0));
- break;
- }
case kArm64Claim: {
int words = MiscField::decode(instr->opcode());
__ Claim(words);
@@ -337,11 +337,6 @@
__ PokePair(i.InputRegister(1), i.InputRegister(0), slot *
kPointerSize);
break;
}
- case kArm64Drop: {
- int words = MiscField::decode(instr->opcode());
- __ Drop(words);
- break;
- }
case kArm64Cmp:
__ Cmp(i.InputRegister(0), i.InputOperand(1));
break;
=======================================
--- /branches/bleeding_edge/src/compiler/arm64/instruction-codes-arm64.h
Tue Aug 26 08:29:12 2014 UTC
+++ /branches/bleeding_edge/src/compiler/arm64/instruction-codes-arm64.h
Wed Aug 27 06:25:02 2014 UTC
@@ -50,14 +50,10 @@
V(Arm64Ror32) \
V(Arm64Mov32) \
V(Arm64Sxtw) \
- V(Arm64CallCodeObject) \
- V(Arm64CallJSFunction) \
- V(Arm64CallAddress) \
V(Arm64Claim) \
V(Arm64Poke) \
V(Arm64PokePairZero) \
V(Arm64PokePair) \
- V(Arm64Drop) \
V(Arm64Float64Cmp) \
V(Arm64Float64Add) \
V(Arm64Float64Sub) \
=======================================
---
/branches/bleeding_edge/src/compiler/arm64/instruction-selector-arm64.cc
Tue Aug 26 09:19:24 2014 UTC
+++
/branches/bleeding_edge/src/compiler/arm64/instruction-selector-arm64.cc
Wed Aug 27 06:25:02 2014 UTC
@@ -638,14 +638,14 @@
InstructionCode opcode;
switch (descriptor->kind()) {
case CallDescriptor::kCallCodeObject: {
- opcode = kArm64CallCodeObject;
+ opcode = kArchCallCodeObject;
break;
}
case CallDescriptor::kCallAddress:
- opcode = kArm64CallAddress;
+ opcode = kArchCallAddress;
break;
case CallDescriptor::kCallJSFunction:
- opcode = kArm64CallJSFunction;
+ opcode = kArchCallJSFunction;
break;
default:
UNREACHABLE();
@@ -667,7 +667,7 @@
// Caller clean up of stack for C-style calls.
if (is_c_frame && aligned_push_count > 0) {
DCHECK(deoptimization == NULL && continuation == NULL);
- Emit(kArm64Drop | MiscField::encode(aligned_push_count), NULL);
+ Emit(kArchDrop | MiscField::encode(aligned_push_count), NULL);
}
}
=======================================
--- /branches/bleeding_edge/src/compiler/ia32/code-generator-ia32.cc Tue
Aug 26 08:29:12 2014 UTC
+++ /branches/bleeding_edge/src/compiler/ia32/code-generator-ia32.cc Wed
Aug 27 06:25:02 2014 UTC
@@ -111,15 +111,35 @@
IA32OperandConverter i(this, instr);
switch (ArchOpcodeField::decode(instr->opcode())) {
- case kArchJmp:
- __ jmp(code()->GetLabel(i.InputBlock(0)));
+ case kArchCallAddress:
+ if (HasImmediateInput(instr, 0)) {
+ // TODO(dcarney): wire up EXTERNAL_REFERENCE instead of
RUNTIME_ENTRY.
+ __ call(reinterpret_cast<byte*>(i.InputInt32(0)),
+ RelocInfo::RUNTIME_ENTRY);
+ } else {
+ __ call(i.InputRegister(0));
+ }
break;
- case kArchNop:
- // don't emit code for nops.
+ case kArchCallCodeObject: {
+ if (HasImmediateInput(instr, 0)) {
+ Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0));
+ __ call(code, RelocInfo::CODE_TARGET);
+ } else {
+ Register reg = i.InputRegister(0);
+ __ call(Operand(reg, Code::kHeaderSize - kHeapObjectTag));
+ }
+ AddSafepointAndDeopt(instr);
+ AddNopForSmiCodeInlining();
break;
- case kArchRet:
- AssembleReturn();
+ }
+ case kArchCallJSFunction: {
+ // TODO(jarin) The load of the context should be separated from the
call.
+ Register func = i.InputRegister(0);
+ __ mov(esi, FieldOperand(func, JSFunction::kContextOffset));
+ __ call(FieldOperand(func, JSFunction::kCodeEntryOffset));
+ AddSafepointAndDeopt(instr);
break;
+ }
case kArchDeoptimize: {
int deoptimization_id = MiscField::decode(instr->opcode());
BuildTranslation(instr, 0, deoptimization_id);
@@ -129,6 +149,20 @@
__ call(deopt_entry, RelocInfo::RUNTIME_ENTRY);
break;
}
+ case kArchDrop: {
+ int words = MiscField::decode(instr->opcode());
+ __ add(esp, Immediate(kPointerSize * words));
+ break;
+ }
+ case kArchJmp:
+ __ jmp(code()->GetLabel(i.InputBlock(0)));
+ break;
+ case kArchNop:
+ // don't emit code for nops.
+ break;
+ case kArchRet:
+ AssembleReturn();
+ break;
case kArchTruncateDoubleToI:
__ TruncateDoubleToI(i.OutputRegister(), i.InputDoubleRegister(0));
break;
@@ -230,52 +264,6 @@
__ ror_cl(i.OutputRegister());
}
break;
- case kIA32Push:
- if (HasImmediateInput(instr, 0)) {
- __ push(i.InputImmediate(0));
- } else {
- __ push(i.InputOperand(0));
- }
- break;
- case kIA32CallCodeObject: {
- if (HasImmediateInput(instr, 0)) {
- Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0));
- __ call(code, RelocInfo::CODE_TARGET);
- } else {
- Register reg = i.InputRegister(0);
- int entry = Code::kHeaderSize - kHeapObjectTag;
- __ call(Operand(reg, entry));
- }
-
- AddSafepointAndDeopt(instr);
-
- AddNopForSmiCodeInlining();
- break;
- }
- case kIA32CallAddress:
- if (HasImmediateInput(instr, 0)) {
- // TODO(dcarney): wire up EXTERNAL_REFERENCE instead of
RUNTIME_ENTRY.
- __ call(reinterpret_cast<byte*>(i.InputInt32(0)),
- RelocInfo::RUNTIME_ENTRY);
- } else {
- __ call(i.InputRegister(0));
- }
- break;
- case kPopStack: {
- int words = MiscField::decode(instr->opcode());
- __ add(esp, Immediate(kPointerSize * words));
- break;
- }
- case kIA32CallJSFunction: {
- Register func = i.InputRegister(0);
-
- // TODO(jarin) The load of the context should be separated from the
call.
- __ mov(esi, FieldOperand(func, JSFunction::kContextOffset));
- __ call(FieldOperand(func, JSFunction::kCodeEntryOffset));
-
- AddSafepointAndDeopt(instr);
- break;
- }
case kSSEFloat64Cmp:
__ ucomisd(i.InputDoubleRegister(0), i.InputOperand(1));
break;
@@ -399,6 +387,13 @@
__ cvtsd2ss(xmm0, i.InputDoubleRegister(index));
__ movss(operand, xmm0);
}
+ break;
+ case kIA32Push:
+ if (HasImmediateInput(instr, 0)) {
+ __ push(i.InputImmediate(0));
+ } else {
+ __ push(i.InputOperand(0));
+ }
break;
case kIA32StoreWriteBarrier: {
Register object = i.InputRegister(0);
=======================================
--- /branches/bleeding_edge/src/compiler/ia32/instruction-codes-ia32.h Tue
Aug 26 08:29:12 2014 UTC
+++ /branches/bleeding_edge/src/compiler/ia32/instruction-codes-ia32.h Wed
Aug 27 06:25:02 2014 UTC
@@ -28,11 +28,6 @@
V(IA32Shr) \
V(IA32Sar) \
V(IA32Ror) \
- V(IA32Push) \
- V(IA32CallCodeObject) \
- V(IA32CallAddress) \
- V(PopStack) \
- V(IA32CallJSFunction) \
V(SSEFloat64Cmp) \
V(SSEFloat64Add) \
V(SSEFloat64Sub) \
@@ -52,6 +47,7 @@
V(IA32Movl) \
V(IA32Movss) \
V(IA32Movsd) \
+ V(IA32Push) \
V(IA32StoreWriteBarrier)
=======================================
--- /branches/bleeding_edge/src/compiler/ia32/instruction-selector-ia32.cc
Tue Aug 26 09:19:24 2014 UTC
+++ /branches/bleeding_edge/src/compiler/ia32/instruction-selector-ia32.cc
Wed Aug 27 06:25:02 2014 UTC
@@ -530,14 +530,14 @@
InstructionCode opcode;
switch (descriptor->kind()) {
case CallDescriptor::kCallCodeObject: {
- opcode = kIA32CallCodeObject;
+ opcode = kArchCallCodeObject;
break;
}
case CallDescriptor::kCallAddress:
- opcode = kIA32CallAddress;
+ opcode = kArchCallAddress;
break;
case CallDescriptor::kCallJSFunction:
- opcode = kIA32CallJSFunction;
+ opcode = kArchCallJSFunction;
break;
default:
UNREACHABLE();
@@ -560,7 +560,7 @@
if (descriptor->kind() == CallDescriptor::kCallAddress &&
buffer.pushed_nodes.size() > 0) {
DCHECK(deoptimization == NULL && continuation == NULL);
- Emit(kPopStack | MiscField::encode(buffer.pushed_nodes.size()), NULL);
+ Emit(kArchDrop | MiscField::encode(buffer.pushed_nodes.size()), NULL);
}
}
=======================================
--- /branches/bleeding_edge/src/compiler/instruction-codes.h Wed Aug 20
04:01:00 2014 UTC
+++ /branches/bleeding_edge/src/compiler/instruction-codes.h Wed Aug 27
06:25:02 2014 UTC
@@ -29,7 +29,11 @@
// Target-specific opcodes that specify which assembly sequence to emit.
// Most opcodes specify a single instruction.
#define ARCH_OPCODE_LIST(V) \
+ V(ArchCallAddress) \
+ V(ArchCallCodeObject) \
+ V(ArchCallJSFunction) \
V(ArchDeoptimize) \
+ V(ArchDrop) \
V(ArchJmp) \
V(ArchNop) \
V(ArchRet) \
=======================================
--- /branches/bleeding_edge/src/compiler/x64/code-generator-x64.cc Tue Aug
26 08:29:12 2014 UTC
+++ /branches/bleeding_edge/src/compiler/x64/code-generator-x64.cc Wed Aug
27 06:25:02 2014 UTC
@@ -204,24 +204,58 @@
X64OperandConverter i(this, instr);
switch (ArchOpcodeField::decode(instr->opcode())) {
- case kArchJmp:
- __ jmp(code_->GetLabel(i.InputBlock(0)));
+ case kArchCallCodeObject: {
+ if (HasImmediateInput(instr, 0)) {
+ Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0));
+ __ Call(code, RelocInfo::CODE_TARGET);
+ } else {
+ Register reg = i.InputRegister(0);
+ int entry = Code::kHeaderSize - kHeapObjectTag;
+ __ Call(Operand(reg, entry));
+ }
+ AddSafepointAndDeopt(instr);
+ AddNopForSmiCodeInlining();
break;
- case kArchNop:
- // don't emit code for nops.
+ }
+ case kArchCallAddress:
+ if (HasImmediateInput(instr, 0)) {
+ Immediate64 imm = i.InputImmediate64(0);
+ DCHECK_EQ(kImm64Value, imm.type);
+ __ Call(reinterpret_cast<byte*>(imm.value), RelocInfo::NONE64);
+ } else {
+ __ call(i.InputRegister(0));
+ }
break;
- case kArchRet:
- AssembleReturn();
+ case kArchCallJSFunction: {
+ // TODO(jarin) The load of the context should be separated from the
call.
+ Register func = i.InputRegister(0);
+ __ movp(rsi, FieldOperand(func, JSFunction::kContextOffset));
+ __ Call(FieldOperand(func, JSFunction::kCodeEntryOffset));
+ AddSafepointAndDeopt(instr);
break;
+ }
case kArchDeoptimize: {
int deoptimization_id = MiscField::decode(instr->opcode());
BuildTranslation(instr, 0, deoptimization_id);
-
Address deopt_entry = Deoptimizer::GetDeoptimizationEntry(
isolate(), deoptimization_id, Deoptimizer::LAZY);
__ call(deopt_entry, RelocInfo::RUNTIME_ENTRY);
break;
}
+ case kArchDrop: {
+ int words = MiscField::decode(instr->opcode());
+ __ addq(rsp, Immediate(kPointerSize * words));
+ break;
+ }
+ case kArchJmp:
+ __ jmp(code_->GetLabel(i.InputBlock(0)));
+ break;
+ case kArchNop:
+ // don't emit code for nops.
+ break;
+ case kArchRet:
+ AssembleReturn();
+ break;
case kArchTruncateDoubleToI:
__ TruncateDoubleToI(i.OutputRegister(), i.InputDoubleRegister(0));
break;
@@ -379,57 +413,6 @@
case kX64Ror:
ASSEMBLE_SHIFT(rorq, 6);
break;
- case kX64Push: {
- RegisterOrOperand input = i.InputRegisterOrOperand(0);
- if (input.type == kRegister) {
- __ pushq(input.reg);
- } else {
- __ pushq(input.operand);
- }
- break;
- }
- case kX64PushI:
- __ pushq(i.InputImmediate(0));
- break;
- case kX64CallCodeObject: {
- if (HasImmediateInput(instr, 0)) {
- Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0));
- __ Call(code, RelocInfo::CODE_TARGET);
- } else {
- Register reg = i.InputRegister(0);
- int entry = Code::kHeaderSize - kHeapObjectTag;
- __ Call(Operand(reg, entry));
- }
-
- AddSafepointAndDeopt(instr);
-
- AddNopForSmiCodeInlining();
- break;
- }
- case kX64CallAddress:
- if (HasImmediateInput(instr, 0)) {
- Immediate64 imm = i.InputImmediate64(0);
- DCHECK_EQ(kImm64Value, imm.type);
- __ Call(reinterpret_cast<byte*>(imm.value), RelocInfo::NONE64);
- } else {
- __ call(i.InputRegister(0));
- }
- break;
- case kPopStack: {
- int words = MiscField::decode(instr->opcode());
- __ addq(rsp, Immediate(kPointerSize * words));
- break;
- }
- case kX64CallJSFunction: {
- Register func = i.InputRegister(0);
-
- // TODO(jarin) The load of the context should be separated from the
call.
- __ movp(rsi, FieldOperand(func, JSFunction::kContextOffset));
- __ Call(FieldOperand(func, JSFunction::kCodeEntryOffset));
-
- AddSafepointAndDeopt(instr);
- break;
- }
case kSSEFloat64Cmp: {
RegisterOrOperand input = i.InputRegisterOrOperand(1);
if (input.type == kDoubleRegister) {
@@ -513,7 +496,6 @@
__ cvtqsi2sd(i.OutputDoubleRegister(), i.InputRegister(0));
break;
}
-
case kX64Movsxbl:
__ movsxbl(i.OutputRegister(), i.MemoryOperand());
break;
@@ -609,6 +591,18 @@
Operand operand = i.MemoryOperand(&index);
__ movsd(operand, i.InputDoubleRegister(index));
}
+ break;
+ case kX64Push:
+ if (HasImmediateInput(instr, 0)) {
+ __ pushq(i.InputImmediate(0));
+ } else {
+ RegisterOrOperand input = i.InputRegisterOrOperand(0);
+ if (input.type == kRegister) {
+ __ pushq(input.reg);
+ } else {
+ __ pushq(input.operand);
+ }
+ }
break;
case kX64StoreWriteBarrier: {
Register object = i.InputRegister(0);
=======================================
--- /branches/bleeding_edge/src/compiler/x64/instruction-codes-x64.h Tue
Aug 26 08:29:12 2014 UTC
+++ /branches/bleeding_edge/src/compiler/x64/instruction-codes-x64.h Wed
Aug 27 06:25:02 2014 UTC
@@ -44,12 +44,6 @@
V(X64Sar32) \
V(X64Ror) \
V(X64Ror32) \
- V(X64Push) \
- V(X64PushI) \
- V(X64CallCodeObject) \
- V(X64CallAddress) \
- V(PopStack) \
- V(X64CallJSFunction) \
V(SSEFloat64Cmp) \
V(SSEFloat64Add) \
V(SSEFloat64Sub) \
@@ -71,6 +65,7 @@
V(X64Movq) \
V(X64Movsd) \
V(X64Movss) \
+ V(X64Push) \
V(X64StoreWriteBarrier)
=======================================
--- /branches/bleeding_edge/src/compiler/x64/instruction-selector-x64.cc
Tue Aug 26 09:19:24 2014 UTC
+++ /branches/bleeding_edge/src/compiler/x64/instruction-selector-x64.cc
Wed Aug 27 06:25:02 2014 UTC
@@ -686,25 +686,22 @@
for (NodeVectorRIter input = buffer.pushed_nodes.rbegin();
input != buffer.pushed_nodes.rend(); input++) {
// TODO(titzer): handle pushing double parameters.
- if (g.CanBeImmediate(*input)) {
- Emit(kX64PushI, NULL, g.UseImmediate(*input));
- } else {
- Emit(kX64Push, NULL, g.Use(*input));
- }
+ Emit(kX64Push, NULL,
+ g.CanBeImmediate(*input) ? g.UseImmediate(*input) :
g.Use(*input));
}
// Select the appropriate opcode based on the call type.
InstructionCode opcode;
switch (descriptor->kind()) {
case CallDescriptor::kCallCodeObject: {
- opcode = kX64CallCodeObject;
+ opcode = kArchCallCodeObject;
break;
}
case CallDescriptor::kCallAddress:
- opcode = kX64CallAddress;
+ opcode = kArchCallAddress;
break;
case CallDescriptor::kCallJSFunction:
- opcode = kX64CallJSFunction;
+ opcode = kArchCallJSFunction;
break;
default:
UNREACHABLE();
@@ -727,7 +724,7 @@
if (descriptor->kind() == CallDescriptor::kCallAddress &&
!buffer.pushed_nodes.empty()) {
DCHECK(deoptimization == NULL && continuation == NULL);
- Emit(kPopStack |
+ Emit(kArchDrop |
MiscField::encode(static_cast<int>(buffer.pushed_nodes.size())),
NULL);
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.