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

Unified Diff: src/compiler/arm64/code-generator-arm64.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/arm64/code-generator-arm64.cc
diff --git a/src/compiler/arm64/code-generator-arm64.cc b/src/compiler/arm64/code-generator-arm64.cc
index edd023dc1838d8cf87af8c08b1cf1c9f15a0255a..51d377f89f30d6a0abe514f63f8028a346980487 100644
--- a/src/compiler/arm64/code-generator-arm64.cc
+++ b/src/compiler/arm64/code-generator-arm64.cc
@@ -131,24 +131,56 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
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 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
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 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
__ 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;

Powered by Google App Engine
This is Rietveld 408576698