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

Side by Side Diff: src/x64/lithium-codegen-x64.cc

Issue 6529024: X64 Crankshaft: Implement InstanceOf and InstanceOfKnownGlobal (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/lithium-codegen-x64.h ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 Register reg = ToRegister(instr->InputAt(0)); 1592 Register reg = ToRegister(instr->InputAt(0));
1593 int true_block = instr->true_block_id(); 1593 int true_block = instr->true_block_id();
1594 int false_block = instr->false_block_id(); 1594 int false_block = instr->false_block_id();
1595 1595
1596 __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), instr->map()); 1596 __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), instr->map());
1597 EmitBranch(true_block, false_block, equal); 1597 EmitBranch(true_block, false_block, equal);
1598 } 1598 }
1599 1599
1600 1600
1601 void LCodeGen::DoInstanceOf(LInstanceOf* instr) { 1601 void LCodeGen::DoInstanceOf(LInstanceOf* instr) {
1602 Abort("Unimplemented: %s", "DoInstanceOf"); 1602 InstanceofStub stub(InstanceofStub::kNoFlags);
1603 __ push(ToRegister(instr->InputAt(0)));
1604 __ push(ToRegister(instr->InputAt(1)));
1605 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1606 NearLabel true_value, done;
1607 __ testq(rax, rax);
1608 __ j(zero, &true_value);
1609 __ LoadRoot(ToRegister(instr->result()), Heap::kFalseValueRootIndex);
1610 __ jmp(&done);
1611 __ bind(&true_value);
1612 __ LoadRoot(ToRegister(instr->result()), Heap::kTrueValueRootIndex);
1613 __ bind(&done);
1603 } 1614 }
1604 1615
1605 1616
1606 void LCodeGen::DoInstanceOfAndBranch(LInstanceOfAndBranch* instr) { 1617 void LCodeGen::DoInstanceOfAndBranch(LInstanceOfAndBranch* instr) {
1607 int true_block = chunk_->LookupDestination(instr->true_block_id()); 1618 int true_block = chunk_->LookupDestination(instr->true_block_id());
1608 int false_block = chunk_->LookupDestination(instr->false_block_id()); 1619 int false_block = chunk_->LookupDestination(instr->false_block_id());
1609 1620
1610 InstanceofStub stub(InstanceofStub::kArgsInRegisters); 1621 InstanceofStub stub(InstanceofStub::kNoFlags);
1622 __ push(ToRegister(instr->InputAt(0)));
1623 __ push(ToRegister(instr->InputAt(1)));
1611 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 1624 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1612 __ testq(rax, rax); 1625 __ testq(rax, rax);
1613 EmitBranch(true_block, false_block, zero); 1626 EmitBranch(true_block, false_block, zero);
1614 } 1627 }
1615 1628
1616 1629
1617 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { 1630 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
1618 Abort("Unimplemented: %s", "DoInstanceOfKnowGLobal"); 1631 class DeferredInstanceOfKnownGlobal: public LDeferredCode {
1632 public:
1633 DeferredInstanceOfKnownGlobal(LCodeGen* codegen,
1634 LInstanceOfKnownGlobal* instr)
1635 : LDeferredCode(codegen), instr_(instr) { }
1636 virtual void Generate() {
1637 codegen()->DoDeferredLInstanceOfKnownGlobal(instr_);
1638 }
1639
1640 private:
1641 LInstanceOfKnownGlobal* instr_;
1642 };
1643
1644
1645 DeferredInstanceOfKnownGlobal* deferred;
1646 deferred = new DeferredInstanceOfKnownGlobal(this, instr);
1647
1648 Label false_result;
1649 Register object = ToRegister(instr->InputAt(0));
1650
1651 // A Smi is not an instance of anything.
1652 __ JumpIfSmi(object, &false_result);
1653
1654 // Null is not an instance of anything.
1655 __ CompareRoot(object, Heap::kNullValueRootIndex);
1656 __ j(equal, &false_result);
1657
1658 // String values are not instances of anything.
1659 __ JumpIfNotString(object, kScratchRegister, deferred->entry());
1660
1661 __ bind(&false_result);
1662 __ LoadRoot(ToRegister(instr->result()), Heap::kFalseValueRootIndex);
1663
1664 __ bind(deferred->exit());
1619 } 1665 }
1620 1666
1621 1667
1622 void LCodeGen::DoDeferredLInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, 1668 void LCodeGen::DoDeferredLInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
1623 Label* map_check) { 1669 __ PushSafepointRegisters();
1624 Abort("Unimplemented: %s", "DoDeferredLInstanceOfKnownGlobakl"); 1670
1671 InstanceofStub stub(InstanceofStub::kNoFlags);
1672
1673 __ push(ToRegister(instr->InputAt(0)));
1674 __ Push(instr->function());
1675 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
1676 __ Call(stub.GetCode(), RelocInfo::CODE_TARGET);
1677 RecordSafepointWithRegisters(
1678 instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex);
1679 __ movq(kScratchRegister, rax);
1680 __ PopSafepointRegisters();
1681 __ testq(kScratchRegister, kScratchRegister);
1682 Label load_false;
1683 Label done;
1684 __ j(not_zero, &load_false);
1685 __ LoadRoot(rax, Heap::kTrueValueRootIndex);
1686 __ jmp(&done);
1687 __ bind(&load_false);
1688 __ LoadRoot(rax, Heap::kFalseValueRootIndex);
1689 __ bind(&done);
1625 } 1690 }
1626 1691
1627 1692
1628 void LCodeGen::DoCmpT(LCmpT* instr) { 1693 void LCodeGen::DoCmpT(LCmpT* instr) {
1629 Token::Value op = instr->op(); 1694 Token::Value op = instr->op();
1630 1695
1631 Handle<Code> ic = CompareIC::GetUninitialized(op); 1696 Handle<Code> ic = CompareIC::GetUninitialized(op);
1632 CallCode(ic, RelocInfo::CODE_TARGET, instr); 1697 CallCode(ic, RelocInfo::CODE_TARGET, instr);
1633 1698
1634 Condition condition = TokenToCondition(op, false); 1699 Condition condition = TokenToCondition(op, false);
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
2772 RegisterEnvironmentForDeoptimization(environment); 2837 RegisterEnvironmentForDeoptimization(environment);
2773 ASSERT(osr_pc_offset_ == -1); 2838 ASSERT(osr_pc_offset_ == -1);
2774 osr_pc_offset_ = masm()->pc_offset(); 2839 osr_pc_offset_ = masm()->pc_offset();
2775 } 2840 }
2776 2841
2777 #undef __ 2842 #undef __
2778 2843
2779 } } // namespace v8::internal 2844 } } // namespace v8::internal
2780 2845
2781 #endif // V8_TARGET_ARCH_X64 2846 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-codegen-x64.h ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698