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_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/ic/ic.h" | 8 #include "src/ic/ic.h" |
9 #include "src/ic/ic-compiler.h" | 9 #include "src/ic/ic-compiler.h" |
10 #include "src/ic/stub-cache.h" | 10 #include "src/ic/stub-cache.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 191 |
192 __ movp(elements, FieldOperand(receiver, JSObject::kElementsOffset)); | 192 __ movp(elements, FieldOperand(receiver, JSObject::kElementsOffset)); |
193 __ AssertFastElements(elements); | 193 __ AssertFastElements(elements); |
194 // Check that the key (index) is within bounds. | 194 // Check that the key (index) is within bounds. |
195 __ SmiCompare(key, FieldOperand(elements, FixedArray::kLengthOffset)); | 195 __ SmiCompare(key, FieldOperand(elements, FixedArray::kLengthOffset)); |
196 // Unsigned comparison rejects negative indices. | 196 // Unsigned comparison rejects negative indices. |
197 __ j(below, &in_bounds); | 197 __ j(below, &in_bounds); |
198 | 198 |
199 // Out-of-bounds. Check the prototype chain to see if we can just return | 199 // Out-of-bounds. Check the prototype chain to see if we can just return |
200 // 'undefined'. | 200 // 'undefined'. |
201 __ SmiCompare(key, Smi::kZero); | 201 __ SmiCompare(key, Smi::FromInt(0)); |
202 __ j(less, slow); // Negative keys can't take the fast OOB path. | 202 __ j(less, slow); // Negative keys can't take the fast OOB path. |
203 __ bind(&check_prototypes); | 203 __ bind(&check_prototypes); |
204 __ movp(scratch, FieldOperand(receiver, HeapObject::kMapOffset)); | 204 __ movp(scratch, FieldOperand(receiver, HeapObject::kMapOffset)); |
205 __ bind(&check_next_prototype); | 205 __ bind(&check_next_prototype); |
206 __ movp(scratch, FieldOperand(scratch, Map::kPrototypeOffset)); | 206 __ movp(scratch, FieldOperand(scratch, Map::kPrototypeOffset)); |
207 // scratch: current prototype | 207 // scratch: current prototype |
208 __ CompareRoot(scratch, Heap::kNullValueRootIndex); | 208 __ CompareRoot(scratch, Heap::kNullValueRootIndex); |
209 __ j(equal, &absent); | 209 __ j(equal, &absent); |
210 __ movp(elements, FieldOperand(scratch, JSObject::kElementsOffset)); | 210 __ movp(elements, FieldOperand(scratch, JSObject::kElementsOffset)); |
211 __ movp(scratch, FieldOperand(scratch, HeapObject::kMapOffset)); | 211 __ movp(scratch, FieldOperand(scratch, HeapObject::kMapOffset)); |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 Condition cc = | 840 Condition cc = |
841 (check == ENABLE_INLINED_SMI_CHECK) | 841 (check == ENABLE_INLINED_SMI_CHECK) |
842 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 842 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
843 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 843 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
844 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 844 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
845 } | 845 } |
846 } // namespace internal | 846 } // namespace internal |
847 } // namespace v8 | 847 } // namespace v8 |
848 | 848 |
849 #endif // V8_TARGET_ARCH_X64 | 849 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |