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

Unified Diff: src/compiler/ia32/code-generator-ia32.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/ia32/code-generator-ia32.cc
diff --git a/src/compiler/ia32/code-generator-ia32.cc b/src/compiler/ia32/code-generator-ia32.cc
index ea641f77421bb1e3525736088b6dbe02adbcdc2b..b84e7ec64c028a9f5bd679260e6b573938384606 100644
--- a/src/compiler/ia32/code-generator-ia32.cc
+++ b/src/compiler/ia32/code-generator-ia32.cc
@@ -111,15 +111,35 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
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 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
__ 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 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
__ 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;
@@ -400,6 +388,13 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
__ 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);
Register index = i.InputRegister(1);

Powered by Google App Engine
This is Rietveld 408576698