Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1076)

Unified Diff: src/compiler/arm/code-generator-arm.cc

Issue 508863002: [turbofan] Refactor code generation for calls. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/compiler/arm/code-generator-arm.cc
diff --git a/src/compiler/arm/code-generator-arm.cc b/src/compiler/arm/code-generator-arm.cc
index 169d7005b21ce57e03a3f1413282b432f9cb236e..4ae67e3ff0ab45b28ee8469d639e81e08fec92f1 100644
--- a/src/compiler/arm/code-generator-arm.cc
+++ b/src/compiler/arm/code-generator-arm.cc
@@ -136,28 +136,63 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
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 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
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 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
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);
« no previous file with comments | « no previous file | src/compiler/arm/instruction-codes-arm.h » ('j') | src/compiler/arm64/instruction-selector-arm64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698