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

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

Issue 9166007: Tiny improvement of register constraints in LClassOfTest instructions. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 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/ia32/lithium-ia32.cc ('k') | src/x64/lithium-x64.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1737 matching lines...) Expand 10 before | Expand all | Expand 10 after
1748 int true_block = chunk_->LookupDestination(instr->true_block_id()); 1748 int true_block = chunk_->LookupDestination(instr->true_block_id());
1749 int false_block = chunk_->LookupDestination(instr->false_block_id()); 1749 int false_block = chunk_->LookupDestination(instr->false_block_id());
1750 1750
1751 __ testl(FieldOperand(input, String::kHashFieldOffset), 1751 __ testl(FieldOperand(input, String::kHashFieldOffset),
1752 Immediate(String::kContainsCachedArrayIndexMask)); 1752 Immediate(String::kContainsCachedArrayIndexMask));
1753 EmitBranch(true_block, false_block, equal); 1753 EmitBranch(true_block, false_block, equal);
1754 } 1754 }
1755 1755
1756 1756
1757 // Branches to a label or falls through with the answer in the z flag. 1757 // Branches to a label or falls through with the answer in the z flag.
1758 // Trashes the temp register and possibly input (if it and temp are aliased). 1758 // Trashes the temp register.
1759 void LCodeGen::EmitClassOfTest(Label* is_true, 1759 void LCodeGen::EmitClassOfTest(Label* is_true,
1760 Label* is_false, 1760 Label* is_false,
1761 Handle<String> class_name, 1761 Handle<String> class_name,
1762 Register input, 1762 Register input,
1763 Register temp, 1763 Register temp,
1764 Register scratch) { 1764 Register temp2) {
1765 ASSERT(!input.is(temp));
1766 ASSERT(!input.is(temp2));
1767 ASSERT(!temp.is(temp2));
1768
1765 __ JumpIfSmi(input, is_false); 1769 __ JumpIfSmi(input, is_false);
1766 1770
1767 if (class_name->IsEqualTo(CStrVector("Function"))) { 1771 if (class_name->IsEqualTo(CStrVector("Function"))) {
1768 // Assuming the following assertions, we can use the same compares to test 1772 // Assuming the following assertions, we can use the same compares to test
1769 // for both being a function type and being in the object type range. 1773 // for both being a function type and being in the object type range.
1770 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); 1774 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
1771 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == 1775 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE ==
1772 FIRST_SPEC_OBJECT_TYPE + 1); 1776 FIRST_SPEC_OBJECT_TYPE + 1);
1773 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == 1777 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE ==
1774 LAST_SPEC_OBJECT_TYPE - 1); 1778 LAST_SPEC_OBJECT_TYPE - 1);
1775 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); 1779 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE);
1776 __ CmpObjectType(input, FIRST_SPEC_OBJECT_TYPE, temp); 1780 __ CmpObjectType(input, FIRST_SPEC_OBJECT_TYPE, temp);
1777 __ j(below, is_false); 1781 __ j(below, is_false);
1778 __ j(equal, is_true); 1782 __ j(equal, is_true);
1779 __ CmpInstanceType(temp, LAST_SPEC_OBJECT_TYPE); 1783 __ CmpInstanceType(temp, LAST_SPEC_OBJECT_TYPE);
1780 __ j(equal, is_true); 1784 __ j(equal, is_true);
1781 } else { 1785 } else {
1782 // Faster code path to avoid two compares: subtract lower bound from the 1786 // Faster code path to avoid two compares: subtract lower bound from the
1783 // actual type and do a signed compare with the width of the type range. 1787 // actual type and do a signed compare with the width of the type range.
1784 __ movq(temp, FieldOperand(input, HeapObject::kMapOffset)); 1788 __ movq(temp, FieldOperand(input, HeapObject::kMapOffset));
1785 __ movq(scratch, FieldOperand(temp, Map::kInstanceTypeOffset)); 1789 __ movq(temp2, FieldOperand(temp, Map::kInstanceTypeOffset));
1786 __ subb(scratch, Immediate(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); 1790 __ subb(temp2, Immediate(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE));
1787 __ cmpb(scratch, 1791 __ cmpb(temp2,
1788 Immediate(static_cast<int8_t>(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - 1792 Immediate(static_cast<int8_t>(LAST_NONCALLABLE_SPEC_OBJECT_TYPE -
1789 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE))); 1793 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)));
1790 __ j(above, is_false); 1794 __ j(above, is_false);
1791 } 1795 }
1792 1796
1793 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. 1797 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range.
1794 // Check if the constructor in the map is a function. 1798 // Check if the constructor in the map is a function.
1795 __ movq(temp, FieldOperand(temp, Map::kConstructorOffset)); 1799 __ movq(temp, FieldOperand(temp, Map::kConstructorOffset));
1796 1800
1797 // Objects with a non-function constructor have class 'Object'. 1801 // Objects with a non-function constructor have class 'Object'.
(...skipping 2539 matching lines...) Expand 10 before | Expand all | Expand 10 after
4337 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); 4341 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
4338 ASSERT(osr_pc_offset_ == -1); 4342 ASSERT(osr_pc_offset_ == -1);
4339 osr_pc_offset_ = masm()->pc_offset(); 4343 osr_pc_offset_ = masm()->pc_offset();
4340 } 4344 }
4341 4345
4342 #undef __ 4346 #undef __
4343 4347
4344 } } // namespace v8::internal 4348 } } // namespace v8::internal
4345 4349
4346 #endif // V8_TARGET_ARCH_X64 4350 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.cc ('k') | src/x64/lithium-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698