| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
| 6 | 6 |
| 7 #include "src/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
| 8 #include "src/compiler/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
| 9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
| 10 #include "src/compiler/node-properties-inl.h" | 10 #include "src/compiler/node-properties-inl.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 __ jmp(code_->GetLabel(i.InputBlock(0))); | 208 __ jmp(code_->GetLabel(i.InputBlock(0))); |
| 209 break; | 209 break; |
| 210 case kArchNop: | 210 case kArchNop: |
| 211 // don't emit code for nops. | 211 // don't emit code for nops. |
| 212 break; | 212 break; |
| 213 case kArchRet: | 213 case kArchRet: |
| 214 AssembleReturn(); | 214 AssembleReturn(); |
| 215 break; | 215 break; |
| 216 case kArchDeoptimize: { | 216 case kArchDeoptimize: { |
| 217 int deoptimization_id = MiscField::decode(instr->opcode()); | 217 int deoptimization_id = MiscField::decode(instr->opcode()); |
| 218 BuildTranslation(instr, deoptimization_id); | 218 BuildTranslation(instr, 0, deoptimization_id); |
| 219 | 219 |
| 220 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 220 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( |
| 221 isolate(), deoptimization_id, Deoptimizer::LAZY); | 221 isolate(), deoptimization_id, Deoptimizer::LAZY); |
| 222 __ call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 222 __ call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
| 223 break; | 223 break; |
| 224 } | 224 } |
| 225 case kArchTruncateDoubleToI: | 225 case kArchTruncateDoubleToI: |
| 226 __ TruncateDoubleToI(i.OutputRegister(), i.InputDoubleRegister(0)); | 226 __ TruncateDoubleToI(i.OutputRegister(), i.InputDoubleRegister(0)); |
| 227 break; | 227 break; |
| 228 case kX64Add32: | 228 case kX64Add32: |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 } | 411 } |
| 412 case kX64CallCodeObject: { | 412 case kX64CallCodeObject: { |
| 413 if (HasImmediateInput(instr, 0)) { | 413 if (HasImmediateInput(instr, 0)) { |
| 414 Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0)); | 414 Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0)); |
| 415 __ Call(code, RelocInfo::CODE_TARGET); | 415 __ Call(code, RelocInfo::CODE_TARGET); |
| 416 } else { | 416 } else { |
| 417 Register reg = i.InputRegister(0); | 417 Register reg = i.InputRegister(0); |
| 418 int entry = Code::kHeaderSize - kHeapObjectTag; | 418 int entry = Code::kHeaderSize - kHeapObjectTag; |
| 419 __ Call(Operand(reg, entry)); | 419 __ Call(Operand(reg, entry)); |
| 420 } | 420 } |
| 421 RecordSafepoint(instr->pointer_map(), Safepoint::kSimple, 0, | 421 |
| 422 Safepoint::kNoLazyDeopt); | 422 AddSafepointAndDeopt(instr); |
| 423 bool lazy_deopt = (MiscField::decode(instr->opcode()) == 1); | 423 |
| 424 if (lazy_deopt) { | |
| 425 RecordLazyDeoptimizationEntry(instr); | |
| 426 } | |
| 427 AddNopForSmiCodeInlining(); | 424 AddNopForSmiCodeInlining(); |
| 428 break; | 425 break; |
| 429 } | 426 } |
| 430 case kX64CallAddress: | 427 case kX64CallAddress: |
| 431 if (HasImmediateInput(instr, 0)) { | 428 if (HasImmediateInput(instr, 0)) { |
| 432 Immediate64 imm = i.InputImmediate64(0); | 429 Immediate64 imm = i.InputImmediate64(0); |
| 433 DCHECK_EQ(kImm64Value, imm.type); | 430 DCHECK_EQ(kImm64Value, imm.type); |
| 434 __ Call(reinterpret_cast<byte*>(imm.value), RelocInfo::NONE64); | 431 __ Call(reinterpret_cast<byte*>(imm.value), RelocInfo::NONE64); |
| 435 } else { | 432 } else { |
| 436 __ call(i.InputRegister(0)); | 433 __ call(i.InputRegister(0)); |
| 437 } | 434 } |
| 438 break; | 435 break; |
| 439 case kPopStack: { | 436 case kPopStack: { |
| 440 int words = MiscField::decode(instr->opcode()); | 437 int words = MiscField::decode(instr->opcode()); |
| 441 __ addq(rsp, Immediate(kPointerSize * words)); | 438 __ addq(rsp, Immediate(kPointerSize * words)); |
| 442 break; | 439 break; |
| 443 } | 440 } |
| 444 case kX64CallJSFunction: { | 441 case kX64CallJSFunction: { |
| 445 Register func = i.InputRegister(0); | 442 Register func = i.InputRegister(0); |
| 446 | 443 |
| 447 // TODO(jarin) The load of the context should be separated from the call. | 444 // TODO(jarin) The load of the context should be separated from the call. |
| 448 __ movp(rsi, FieldOperand(func, JSFunction::kContextOffset)); | 445 __ movp(rsi, FieldOperand(func, JSFunction::kContextOffset)); |
| 449 __ Call(FieldOperand(func, JSFunction::kCodeEntryOffset)); | 446 __ Call(FieldOperand(func, JSFunction::kCodeEntryOffset)); |
| 450 | 447 |
| 451 RecordSafepoint(instr->pointer_map(), Safepoint::kSimple, 0, | 448 AddSafepointAndDeopt(instr); |
| 452 Safepoint::kNoLazyDeopt); | |
| 453 RecordLazyDeoptimizationEntry(instr); | |
| 454 break; | 449 break; |
| 455 } | 450 } |
| 456 case kSSEFloat64Cmp: { | 451 case kSSEFloat64Cmp: { |
| 457 RegisterOrOperand input = i.InputRegisterOrOperand(1); | 452 RegisterOrOperand input = i.InputRegisterOrOperand(1); |
| 458 if (input.type == kDoubleRegister) { | 453 if (input.type == kDoubleRegister) { |
| 459 __ ucomisd(i.InputDoubleRegister(0), input.double_reg); | 454 __ ucomisd(i.InputDoubleRegister(0), input.double_reg); |
| 460 } else { | 455 } else { |
| 461 __ ucomisd(i.InputDoubleRegister(0), input.operand); | 456 __ ucomisd(i.InputDoubleRegister(0), input.operand); |
| 462 } | 457 } |
| 463 break; | 458 break; |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 } | 994 } |
| 1000 | 995 |
| 1001 | 996 |
| 1002 void CodeGenerator::AddNopForSmiCodeInlining() { __ nop(); } | 997 void CodeGenerator::AddNopForSmiCodeInlining() { __ nop(); } |
| 1003 | 998 |
| 1004 #undef __ | 999 #undef __ |
| 1005 | 1000 |
| 1006 } // namespace internal | 1001 } // namespace internal |
| 1007 } // namespace compiler | 1002 } // namespace compiler |
| 1008 } // namespace v8 | 1003 } // namespace v8 |
| OLD | NEW |