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

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

Issue 6308012: ARM: Implement DoIsObject and DoIsObjectAndBranch in the lithium code generator.. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge/test
Patch Set: Adress comments and add comments. Created 9 years, 11 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/arm/lithium-arm.cc ('k') | no next file » | 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 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after
1722 EmitBranch(true_block, false_block, ne); 1722 EmitBranch(true_block, false_block, ne);
1723 } 1723 }
1724 } 1724 }
1725 1725
1726 1726
1727 Condition LCodeGen::EmitIsObject(Register input, 1727 Condition LCodeGen::EmitIsObject(Register input,
1728 Register temp1, 1728 Register temp1,
1729 Register temp2, 1729 Register temp2,
1730 Label* is_not_object, 1730 Label* is_not_object,
1731 Label* is_object) { 1731 Label* is_object) {
1732 Abort("EmitIsObject unimplemented."); 1732 __ BranchOnSmi(input, is_not_object);
1733 return ne; 1733
1734 __ LoadRoot(temp1, Heap::kNullValueRootIndex);
1735 __ cmp(input, temp1);
1736 __ b(eq, is_object);
1737
1738 // Load map.
1739 __ ldr(temp1, FieldMemOperand(input, HeapObject::kMapOffset));
1740 // Undetectable objects behave like undefined.
1741 __ ldrb(temp2, FieldMemOperand(temp1, Map::kBitFieldOffset));
1742 __ tst(temp2, Operand(1 << Map::kIsUndetectable));
1743 __ b(ne, is_not_object);
1744
1745 // Load instance type and check that it is in object type range.
1746 __ ldrb(temp2, FieldMemOperand(temp1, Map::kInstanceTypeOffset));
1747 __ cmp(temp2, Operand(FIRST_JS_OBJECT_TYPE));
1748 __ b(lt, is_not_object);
1749 __ cmp(temp2, Operand(LAST_JS_OBJECT_TYPE));
1750 return le;
1734 } 1751 }
1735 1752
1736 1753
1737 void LCodeGen::DoIsObject(LIsObject* instr) { 1754 void LCodeGen::DoIsObject(LIsObject* instr) {
1738 Abort("DoIsObject unimplemented."); 1755 Register reg = ToRegister(instr->input());
1756 Register result = ToRegister(instr->result());
1757 Register temp = scratch0();
1758 Label is_false, is_true, done;
1759
1760 Condition true_cond = EmitIsObject(reg, result, temp, &is_false, &is_true);
1761 __ b(true_cond, &is_true);
1762
1763 __ bind(&is_false);
1764 __ LoadRoot(result, Heap::kFalseValueRootIndex);
1765 __ b(al, &done);
Mads Ager (chromium) 2011/01/24 12:24:46 This is the same as __ b(&done); I'll change that
1766
1767 __ bind(&is_true);
1768 __ LoadRoot(result, Heap::kTrueValueRootIndex);
1769
1770 __ bind(&done);
1739 } 1771 }
1740 1772
1741 1773
1742 void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) { 1774 void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) {
1743 Abort("DoIsObjectAndBranch unimplemented."); 1775 Register reg = ToRegister(instr->input());
1776 Register temp1 = ToRegister(instr->temp());
1777 Register temp2 = scratch0();
1778
1779 int true_block = chunk_->LookupDestination(instr->true_block_id());
1780 int false_block = chunk_->LookupDestination(instr->false_block_id());
1781 Label* true_label = chunk_->GetAssemblyLabel(true_block);
1782 Label* false_label = chunk_->GetAssemblyLabel(false_block);
1783
1784 Condition true_cond = EmitIsObject(reg, temp1, temp2, false_label,
1785 true_label);
1786
1787 EmitBranch(true_block, false_block, true_cond);
1744 } 1788 }
1745 1789
1746 1790
1747 void LCodeGen::DoIsSmi(LIsSmi* instr) { 1791 void LCodeGen::DoIsSmi(LIsSmi* instr) {
1748 ASSERT(instr->hydrogen()->value()->representation().IsTagged()); 1792 ASSERT(instr->hydrogen()->value()->representation().IsTagged());
1749 Register result = ToRegister(instr->result()); 1793 Register result = ToRegister(instr->result());
1750 Register input_reg = EmitLoadRegister(instr->input(), ip); 1794 Register input_reg = EmitLoadRegister(instr->input(), ip);
1751 __ tst(input_reg, Operand(kSmiTagMask)); 1795 __ tst(input_reg, Operand(kSmiTagMask));
1752 __ LoadRoot(result, Heap::kTrueValueRootIndex); 1796 __ LoadRoot(result, Heap::kTrueValueRootIndex);
1753 Label done; 1797 Label done;
(...skipping 1878 matching lines...) Expand 10 before | Expand all | Expand 10 after
3632 3676
3633 3677
3634 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { 3678 void LCodeGen::DoOsrEntry(LOsrEntry* instr) {
3635 Abort("DoOsrEntry unimplemented."); 3679 Abort("DoOsrEntry unimplemented.");
3636 } 3680 }
3637 3681
3638 3682
3639 #undef __ 3683 #undef __
3640 3684
3641 } } // namespace v8::internal 3685 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698