 Chromium Code Reviews
 Chromium Code Reviews Issue 19749004:
  With >= 64 non-string instance types, I removed an optimization  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
    
  
    Issue 19749004:
  With >= 64 non-string instance types, I removed an optimization  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge| OLD | NEW | 
|---|---|
| 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 4094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4105 } | 4105 } | 
| 4106 | 4106 | 
| 4107 | 4107 | 
| 4108 static void BranchIfNotInternalizedString(MacroAssembler* masm, | 4108 static void BranchIfNotInternalizedString(MacroAssembler* masm, | 
| 4109 Label* label, | 4109 Label* label, | 
| 4110 Register object, | 4110 Register object, | 
| 4111 Register scratch) { | 4111 Register scratch) { | 
| 4112 __ JumpIfSmi(object, label); | 4112 __ JumpIfSmi(object, label); | 
| 4113 __ mov(scratch, FieldOperand(object, HeapObject::kMapOffset)); | 4113 __ mov(scratch, FieldOperand(object, HeapObject::kMapOffset)); | 
| 4114 __ movzx_b(scratch, FieldOperand(scratch, Map::kInstanceTypeOffset)); | 4114 __ movzx_b(scratch, FieldOperand(scratch, Map::kInstanceTypeOffset)); | 
| 4115 __ and_(scratch, kIsInternalizedMask | kIsNotStringMask); | 4115 __ and_(scratch, kIsNotStringMask | kIsNotInternalizedMask); | 
| 4116 __ cmp(scratch, kInternalizedTag | kStringTag); | 4116 __ cmp(scratch, kStringTag | kInternalizedTag); | 
| 
Yang
2013/07/19 09:52:18
change that to a test, saving one instruction.
 
mvstanton
2013/07/19 11:07:42
Done. It's done on x64 as well (ARM is formulated
 | |
| 4117 __ j(not_equal, label); | 4117 __ j(not_equal, label); | 
| 4118 } | 4118 } | 
| 4119 | 4119 | 
| 4120 | 4120 | 
| 4121 void ICCompareStub::GenerateGeneric(MacroAssembler* masm) { | 4121 void ICCompareStub::GenerateGeneric(MacroAssembler* masm) { | 
| 4122 Label check_unequal_objects; | 4122 Label check_unequal_objects; | 
| 4123 Condition cc = GetCondition(); | 4123 Condition cc = GetCondition(); | 
| 4124 | 4124 | 
| 4125 Label miss; | 4125 Label miss; | 
| 4126 CheckInputType(masm, edx, left_, &miss); | 4126 CheckInputType(masm, edx, left_, &miss); | 
| (...skipping 2475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6602 __ mov(tmp1, left); | 6602 __ mov(tmp1, left); | 
| 6603 STATIC_ASSERT(kSmiTag == 0); | 6603 STATIC_ASSERT(kSmiTag == 0); | 
| 6604 __ and_(tmp1, right); | 6604 __ and_(tmp1, right); | 
| 6605 __ JumpIfSmi(tmp1, &miss, Label::kNear); | 6605 __ JumpIfSmi(tmp1, &miss, Label::kNear); | 
| 6606 | 6606 | 
| 6607 // Check that both operands are internalized strings. | 6607 // Check that both operands are internalized strings. | 
| 6608 __ mov(tmp1, FieldOperand(left, HeapObject::kMapOffset)); | 6608 __ mov(tmp1, FieldOperand(left, HeapObject::kMapOffset)); | 
| 6609 __ mov(tmp2, FieldOperand(right, HeapObject::kMapOffset)); | 6609 __ mov(tmp2, FieldOperand(right, HeapObject::kMapOffset)); | 
| 6610 __ movzx_b(tmp1, FieldOperand(tmp1, Map::kInstanceTypeOffset)); | 6610 __ movzx_b(tmp1, FieldOperand(tmp1, Map::kInstanceTypeOffset)); | 
| 6611 __ movzx_b(tmp2, FieldOperand(tmp2, Map::kInstanceTypeOffset)); | 6611 __ movzx_b(tmp2, FieldOperand(tmp2, Map::kInstanceTypeOffset)); | 
| 6612 STATIC_ASSERT(kInternalizedTag != 0); | 6612 STATIC_ASSERT(kInternalizedTag == 0 && kStringTag == 0); | 
| 6613 __ and_(tmp1, Immediate(kIsNotStringMask | kIsInternalizedMask)); | 6613 __ or_(tmp1, tmp2); | 
| 6614 __ cmpb(tmp1, kInternalizedTag | kStringTag); | 6614 __ test(tmp1, Immediate(kIsNotStringMask | kIsNotInternalizedMask)); | 
| 6615 __ j(not_equal, &miss, Label::kNear); | 6615 __ j(not_zero, &miss, Label::kNear); | 
| 6616 | |
| 6617 __ and_(tmp2, Immediate(kIsNotStringMask | kIsInternalizedMask)); | |
| 6618 __ cmpb(tmp2, kInternalizedTag | kStringTag); | |
| 6619 __ j(not_equal, &miss, Label::kNear); | |
| 6620 | 6616 | 
| 6621 // Internalized strings are compared by identity. | 6617 // Internalized strings are compared by identity. | 
| 6622 Label done; | 6618 Label done; | 
| 6623 __ cmp(left, right); | 6619 __ cmp(left, right); | 
| 6624 // Make sure eax is non-zero. At this point input operands are | 6620 // Make sure eax is non-zero. At this point input operands are | 
| 6625 // guaranteed to be non-zero. | 6621 // guaranteed to be non-zero. | 
| 6626 ASSERT(right.is(eax)); | 6622 ASSERT(right.is(eax)); | 
| 6627 __ j(not_equal, &done, Label::kNear); | 6623 __ j(not_equal, &done, Label::kNear); | 
| 6628 STATIC_ASSERT(EQUAL == 0); | 6624 STATIC_ASSERT(EQUAL == 0); | 
| 6629 STATIC_ASSERT(kSmiTag == 0); | 6625 STATIC_ASSERT(kSmiTag == 0); | 
| (...skipping 18 matching lines...) Expand all Loading... | |
| 6648 | 6644 | 
| 6649 // Check that both operands are heap objects. | 6645 // Check that both operands are heap objects. | 
| 6650 Label miss; | 6646 Label miss; | 
| 6651 __ mov(tmp1, left); | 6647 __ mov(tmp1, left); | 
| 6652 STATIC_ASSERT(kSmiTag == 0); | 6648 STATIC_ASSERT(kSmiTag == 0); | 
| 6653 __ and_(tmp1, right); | 6649 __ and_(tmp1, right); | 
| 6654 __ JumpIfSmi(tmp1, &miss, Label::kNear); | 6650 __ JumpIfSmi(tmp1, &miss, Label::kNear); | 
| 6655 | 6651 | 
| 6656 // Check that both operands are unique names. This leaves the instance | 6652 // Check that both operands are unique names. This leaves the instance | 
| 6657 // types loaded in tmp1 and tmp2. | 6653 // types loaded in tmp1 and tmp2. | 
| 6658 STATIC_ASSERT(kInternalizedTag != 0); | |
| 6659 __ mov(tmp1, FieldOperand(left, HeapObject::kMapOffset)); | 6654 __ mov(tmp1, FieldOperand(left, HeapObject::kMapOffset)); | 
| 6660 __ mov(tmp2, FieldOperand(right, HeapObject::kMapOffset)); | 6655 __ mov(tmp2, FieldOperand(right, HeapObject::kMapOffset)); | 
| 6661 __ movzx_b(tmp1, FieldOperand(tmp1, Map::kInstanceTypeOffset)); | 6656 __ movzx_b(tmp1, FieldOperand(tmp1, Map::kInstanceTypeOffset)); | 
| 6662 __ movzx_b(tmp2, FieldOperand(tmp2, Map::kInstanceTypeOffset)); | 6657 __ movzx_b(tmp2, FieldOperand(tmp2, Map::kInstanceTypeOffset)); | 
| 6663 | 6658 | 
| 6664 __ JumpIfNotUniqueName(tmp1, &miss, Label::kNear); | 6659 __ JumpIfNotUniqueName(tmp1, &miss, Label::kNear); | 
| 6665 __ JumpIfNotUniqueName(tmp2, &miss, Label::kNear); | 6660 __ JumpIfNotUniqueName(tmp2, &miss, Label::kNear); | 
| 6666 | 6661 | 
| 6667 // Unique names are compared by identity. | 6662 // Unique names are compared by identity. | 
| 6668 Label done; | 6663 Label done; | 
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6724 | 6719 | 
| 6725 // Handle not identical strings. | 6720 // Handle not identical strings. | 
| 6726 __ bind(¬_same); | 6721 __ bind(¬_same); | 
| 6727 | 6722 | 
| 6728 // Check that both strings are internalized. If they are, we're done | 6723 // Check that both strings are internalized. If they are, we're done | 
| 6729 // because we already know they are not identical. But in the case of | 6724 // because we already know they are not identical. But in the case of | 
| 6730 // non-equality compare, we still need to determine the order. We | 6725 // non-equality compare, we still need to determine the order. We | 
| 6731 // also know they are both strings. | 6726 // also know they are both strings. | 
| 6732 if (equality) { | 6727 if (equality) { | 
| 6733 Label do_compare; | 6728 Label do_compare; | 
| 6734 STATIC_ASSERT(kInternalizedTag != 0); | 6729 STATIC_ASSERT(kInternalizedTag == 0); | 
| 6735 __ and_(tmp1, tmp2); | 6730 __ or_(tmp1, tmp2); | 
| 6736 __ test(tmp1, Immediate(kIsInternalizedMask)); | 6731 __ test(tmp1, Immediate(kIsNotInternalizedMask)); | 
| 6737 __ j(zero, &do_compare, Label::kNear); | 6732 __ j(not_zero, &do_compare, Label::kNear); | 
| 6738 // Make sure eax is non-zero. At this point input operands are | 6733 // Make sure eax is non-zero. At this point input operands are | 
| 6739 // guaranteed to be non-zero. | 6734 // guaranteed to be non-zero. | 
| 6740 ASSERT(right.is(eax)); | 6735 ASSERT(right.is(eax)); | 
| 6741 __ ret(0); | 6736 __ ret(0); | 
| 6742 __ bind(&do_compare); | 6737 __ bind(&do_compare); | 
| 6743 } | 6738 } | 
| 6744 | 6739 | 
| 6745 // Check that both strings are sequential ASCII. | 6740 // Check that both strings are sequential ASCII. | 
| 6746 Label runtime; | 6741 Label runtime; | 
| 6747 __ JumpIfNotBothSequentialAsciiStrings(left, right, tmp1, tmp2, &runtime); | 6742 __ JumpIfNotBothSequentialAsciiStrings(left, right, tmp1, tmp2, &runtime); | 
| (...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7781 __ bind(&fast_elements_case); | 7776 __ bind(&fast_elements_case); | 
| 7782 GenerateCase(masm, FAST_ELEMENTS); | 7777 GenerateCase(masm, FAST_ELEMENTS); | 
| 7783 } | 7778 } | 
| 7784 | 7779 | 
| 7785 | 7780 | 
| 7786 #undef __ | 7781 #undef __ | 
| 7787 | 7782 | 
| 7788 } } // namespace v8::internal | 7783 } } // namespace v8::internal | 
| 7789 | 7784 | 
| 7790 #endif // V8_TARGET_ARCH_IA32 | 7785 #endif // V8_TARGET_ARCH_IA32 | 
| OLD | NEW |