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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
8 | 8 |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 // Check that the object isn't a smi. | 150 // Check that the object isn't a smi. |
151 __ JumpIfSmi(receiver, slow); | 151 __ JumpIfSmi(receiver, slow); |
152 | 152 |
153 // Get the map of the receiver. | 153 // Get the map of the receiver. |
154 __ mov(map, FieldOperand(receiver, HeapObject::kMapOffset)); | 154 __ mov(map, FieldOperand(receiver, HeapObject::kMapOffset)); |
155 | 155 |
156 // Check bit field. | 156 // Check bit field. |
157 __ test_b(FieldOperand(map, Map::kBitFieldOffset), | 157 __ test_b(FieldOperand(map, Map::kBitFieldOffset), |
158 (1 << Map::kIsAccessCheckNeeded) | (1 << interceptor_bit)); | 158 (1 << Map::kIsAccessCheckNeeded) | (1 << interceptor_bit)); |
159 __ j(not_zero, slow); | 159 __ j(not_zero, slow); |
160 // Check that the object is some kind of JS object EXCEPT JS Value type. | 160 // Check that the object is some kind of JS object EXCEPT JS Value type. In |
161 // In the case that the object is a value-wrapper object, | 161 // the case that the object is a value-wrapper object, we enter the runtime |
162 // we enter the runtime system to make sure that indexing | 162 // system to make sure that indexing into string objects works as intended. |
163 // into string objects works as intended. | |
164 DCHECK(JS_OBJECT_TYPE > JS_VALUE_TYPE); | 163 DCHECK(JS_OBJECT_TYPE > JS_VALUE_TYPE); |
165 | 164 |
166 __ CmpInstanceType(map, JS_OBJECT_TYPE); | 165 __ CmpInstanceType(map, JS_OBJECT_TYPE); |
167 __ j(below, slow); | 166 __ j(below, slow); |
168 } | 167 } |
169 | 168 |
170 | 169 |
171 // Loads an indexed element from a fast case array. | 170 // Loads an indexed element from a fast case array. |
172 static void GenerateFastArrayLoad(MacroAssembler* masm, Register receiver, | 171 static void GenerateFastArrayLoad(MacroAssembler* masm, Register receiver, |
173 Register key, Register scratch, | 172 Register key, Register scratch, |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 __ mov(edi, FieldOperand(receiver, HeapObject::kMapOffset)); | 531 __ mov(edi, FieldOperand(receiver, HeapObject::kMapOffset)); |
533 // Check that the receiver does not require access checks and is not observed. | 532 // Check that the receiver does not require access checks and is not observed. |
534 // The generic stub does not perform map checks or handle observed objects. | 533 // The generic stub does not perform map checks or handle observed objects. |
535 __ test_b(FieldOperand(edi, Map::kBitFieldOffset), | 534 __ test_b(FieldOperand(edi, Map::kBitFieldOffset), |
536 1 << Map::kIsAccessCheckNeeded | 1 << Map::kIsObserved); | 535 1 << Map::kIsAccessCheckNeeded | 1 << Map::kIsObserved); |
537 __ j(not_zero, &slow); | 536 __ j(not_zero, &slow); |
538 // Check that the key is a smi. | 537 // Check that the key is a smi. |
539 __ JumpIfNotSmi(key, &maybe_name_key); | 538 __ JumpIfNotSmi(key, &maybe_name_key); |
540 __ CmpInstanceType(edi, JS_ARRAY_TYPE); | 539 __ CmpInstanceType(edi, JS_ARRAY_TYPE); |
541 __ j(equal, &array); | 540 __ j(equal, &array); |
542 // Check that the object is some kind of JSObject. | 541 // Check that the object is some kind of JS object EXCEPT JS Value type. In |
543 __ CmpInstanceType(edi, FIRST_JS_OBJECT_TYPE); | 542 // the case that the object is a value-wrapper object, we enter the runtime |
| 543 // system to make sure that indexing into string objects works as intended. |
| 544 STATIC_ASSERT(JS_VALUE_TYPE < JS_OBJECT_TYPE); |
| 545 __ CmpInstanceType(edi, JS_OBJECT_TYPE); |
544 __ j(below, &slow); | 546 __ j(below, &slow); |
545 | 547 |
546 // Object case: Check key against length in the elements array. | 548 // Object case: Check key against length in the elements array. |
547 // Key is a smi. | 549 // Key is a smi. |
548 // edi: receiver map | 550 // edi: receiver map |
549 __ mov(ebx, FieldOperand(receiver, JSObject::kElementsOffset)); | 551 __ mov(ebx, FieldOperand(receiver, JSObject::kElementsOffset)); |
550 // Check array bounds. Both the key and the length of FixedArray are smis. | 552 // Check array bounds. Both the key and the length of FixedArray are smis. |
551 __ cmp(key, FieldOperand(ebx, FixedArray::kLengthOffset)); | 553 __ cmp(key, FieldOperand(ebx, FixedArray::kLengthOffset)); |
552 __ j(below, &fast_object); | 554 __ j(below, &fast_object); |
553 | 555 |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 Condition cc = | 881 Condition cc = |
880 (check == ENABLE_INLINED_SMI_CHECK) | 882 (check == ENABLE_INLINED_SMI_CHECK) |
881 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 883 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
882 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 884 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
883 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 885 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
884 } | 886 } |
885 } // namespace internal | 887 } // namespace internal |
886 } // namespace v8 | 888 } // namespace v8 |
887 | 889 |
888 #endif // V8_TARGET_ARCH_X87 | 890 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |