OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #if V8_TARGET_ARCH_X87 | 5 #if V8_TARGET_ARCH_X87 |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 } | 1105 } |
1106 #ifdef DEBUG | 1106 #ifdef DEBUG |
1107 __ Abort(kUnexpectedFallThroughFromStringComparison); | 1107 __ Abort(kUnexpectedFallThroughFromStringComparison); |
1108 #endif | 1108 #endif |
1109 | 1109 |
1110 __ bind(&check_unequal_objects); | 1110 __ bind(&check_unequal_objects); |
1111 if (cc == equal && !strict()) { | 1111 if (cc == equal && !strict()) { |
1112 // Non-strict equality. Objects are unequal if | 1112 // Non-strict equality. Objects are unequal if |
1113 // they are both JSObjects and not undetectable, | 1113 // they are both JSObjects and not undetectable, |
1114 // and their pointers are different. | 1114 // and their pointers are different. |
1115 Label return_unequal, undetectable; | 1115 Label return_equal, return_unequal, undetectable; |
1116 // At most one is a smi, so we can test for smi by adding the two. | 1116 // At most one is a smi, so we can test for smi by adding the two. |
1117 // A smi plus a heap object has the low bit set, a heap object plus | 1117 // A smi plus a heap object has the low bit set, a heap object plus |
1118 // a heap object has the low bit clear. | 1118 // a heap object has the low bit clear. |
1119 STATIC_ASSERT(kSmiTag == 0); | 1119 STATIC_ASSERT(kSmiTag == 0); |
1120 STATIC_ASSERT(kSmiTagMask == 1); | 1120 STATIC_ASSERT(kSmiTagMask == 1); |
1121 __ lea(ecx, Operand(eax, edx, times_1, 0)); | 1121 __ lea(ecx, Operand(eax, edx, times_1, 0)); |
1122 __ test(ecx, Immediate(kSmiTagMask)); | 1122 __ test(ecx, Immediate(kSmiTagMask)); |
1123 __ j(not_zero, &runtime_call, Label::kNear); | 1123 __ j(not_zero, &runtime_call); |
1124 | 1124 |
1125 __ mov(ecx, FieldOperand(eax, HeapObject::kMapOffset)); | 1125 __ mov(ecx, FieldOperand(eax, HeapObject::kMapOffset)); |
1126 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); | 1126 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); |
1127 | 1127 |
1128 __ test_b(FieldOperand(ebx, Map::kBitFieldOffset), | 1128 __ test_b(FieldOperand(ebx, Map::kBitFieldOffset), |
1129 1 << Map::kIsUndetectable); | 1129 1 << Map::kIsUndetectable); |
1130 __ j(not_zero, &undetectable, Label::kNear); | 1130 __ j(not_zero, &undetectable, Label::kNear); |
1131 __ test_b(FieldOperand(ecx, Map::kBitFieldOffset), | 1131 __ test_b(FieldOperand(ecx, Map::kBitFieldOffset), |
1132 1 << Map::kIsUndetectable); | 1132 1 << Map::kIsUndetectable); |
1133 __ j(not_zero, &return_unequal, Label::kNear); | 1133 __ j(not_zero, &return_unequal, Label::kNear); |
1134 | 1134 |
1135 __ CmpInstanceType(ebx, FIRST_JS_RECEIVER_TYPE); | 1135 __ CmpInstanceType(ebx, FIRST_JS_RECEIVER_TYPE); |
1136 __ j(below, &runtime_call, Label::kNear); | 1136 __ j(below, &runtime_call, Label::kNear); |
1137 __ CmpInstanceType(ecx, FIRST_JS_RECEIVER_TYPE); | 1137 __ CmpInstanceType(ecx, FIRST_JS_RECEIVER_TYPE); |
1138 __ j(below, &runtime_call, Label::kNear); | 1138 __ j(below, &runtime_call, Label::kNear); |
1139 | 1139 |
1140 __ bind(&return_unequal); | 1140 __ bind(&return_unequal); |
1141 // Return non-equal by returning the non-zero object pointer in eax. | 1141 // Return non-equal by returning the non-zero object pointer in eax. |
1142 __ ret(0); // eax, edx were pushed | 1142 __ ret(0); // eax, edx were pushed |
1143 | 1143 |
1144 __ bind(&undetectable); | 1144 __ bind(&undetectable); |
1145 __ test_b(FieldOperand(ecx, Map::kBitFieldOffset), | 1145 __ test_b(FieldOperand(ecx, Map::kBitFieldOffset), |
1146 1 << Map::kIsUndetectable); | 1146 1 << Map::kIsUndetectable); |
1147 __ j(zero, &return_unequal, Label::kNear); | 1147 __ j(zero, &return_unequal, Label::kNear); |
| 1148 |
| 1149 // If both sides are JSReceivers, then the result is false according to |
| 1150 // the HTML specification, which says that only comparisons with null or |
| 1151 // undefined are affected by special casing for document.all. |
| 1152 __ CmpInstanceType(ebx, ODDBALL_TYPE); |
| 1153 __ j(zero, &return_equal, Label::kNear); |
| 1154 __ CmpInstanceType(ecx, ODDBALL_TYPE); |
| 1155 __ j(not_zero, &return_unequal, Label::kNear); |
| 1156 |
| 1157 __ bind(&return_equal); |
1148 __ Move(eax, Immediate(EQUAL)); | 1158 __ Move(eax, Immediate(EQUAL)); |
1149 __ ret(0); // eax, edx were pushed | 1159 __ ret(0); // eax, edx were pushed |
1150 } | 1160 } |
1151 __ bind(&runtime_call); | 1161 __ bind(&runtime_call); |
1152 | 1162 |
1153 if (cc == equal) { | 1163 if (cc == equal) { |
1154 { | 1164 { |
1155 FrameScope scope(masm, StackFrame::INTERNAL); | 1165 FrameScope scope(masm, StackFrame::INTERNAL); |
1156 __ Push(edx); | 1166 __ Push(edx); |
1157 __ Push(eax); | 1167 __ Push(eax); |
(...skipping 4360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5518 return_value_operand, NULL); | 5528 return_value_operand, NULL); |
5519 } | 5529 } |
5520 | 5530 |
5521 | 5531 |
5522 #undef __ | 5532 #undef __ |
5523 | 5533 |
5524 } // namespace internal | 5534 } // namespace internal |
5525 } // namespace v8 | 5535 } // namespace v8 |
5526 | 5536 |
5527 #endif // V8_TARGET_ARCH_X87 | 5537 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |