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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // Scratch registers: | 143 // Scratch registers: |
144 // map - used to hold the map of the receiver. | 144 // map - used to hold the map of the receiver. |
145 | 145 |
146 // Check that the object isn't a smi. | 146 // Check that the object isn't a smi. |
147 __ JumpIfSmi(receiver, slow); | 147 __ JumpIfSmi(receiver, slow); |
148 | 148 |
149 // Get the map of the receiver. | 149 // Get the map of the receiver. |
150 __ mov(map, FieldOperand(receiver, HeapObject::kMapOffset)); | 150 __ mov(map, FieldOperand(receiver, HeapObject::kMapOffset)); |
151 | 151 |
152 // Check bit field. | 152 // Check bit field. |
153 __ test_b(FieldOperand(map, Map::kBitFieldOffset), | 153 __ test_b( |
154 (1 << Map::kIsAccessCheckNeeded) | (1 << interceptor_bit)); | 154 FieldOperand(map, Map::kBitFieldOffset), |
| 155 Immediate((1 << Map::kIsAccessCheckNeeded) | (1 << interceptor_bit))); |
155 __ j(not_zero, slow); | 156 __ j(not_zero, slow); |
156 // Check that the object is some kind of JS object EXCEPT JS Value type. In | 157 // Check that the object is some kind of JS object EXCEPT JS Value type. In |
157 // the case that the object is a value-wrapper object, we enter the runtime | 158 // the case that the object is a value-wrapper object, we enter the runtime |
158 // system to make sure that indexing into string objects works as intended. | 159 // system to make sure that indexing into string objects works as intended. |
159 DCHECK(JS_OBJECT_TYPE > JS_VALUE_TYPE); | 160 DCHECK(JS_OBJECT_TYPE > JS_VALUE_TYPE); |
160 | 161 |
161 __ CmpInstanceType(map, JS_OBJECT_TYPE); | 162 __ CmpInstanceType(map, JS_OBJECT_TYPE); |
162 __ j(below, slow); | 163 __ j(below, slow); |
163 } | 164 } |
164 | 165 |
(...skipping 30 matching lines...) Expand all Loading... |
195 __ mov(scratch2, FieldOperand(scratch2, Map::kPrototypeOffset)); | 196 __ mov(scratch2, FieldOperand(scratch2, Map::kPrototypeOffset)); |
196 // scratch2: current prototype | 197 // scratch2: current prototype |
197 __ cmp(scratch2, masm->isolate()->factory()->null_value()); | 198 __ cmp(scratch2, masm->isolate()->factory()->null_value()); |
198 __ j(equal, &absent); | 199 __ j(equal, &absent); |
199 __ mov(scratch, FieldOperand(scratch2, JSObject::kElementsOffset)); | 200 __ mov(scratch, FieldOperand(scratch2, JSObject::kElementsOffset)); |
200 __ mov(scratch2, FieldOperand(scratch2, HeapObject::kMapOffset)); | 201 __ mov(scratch2, FieldOperand(scratch2, HeapObject::kMapOffset)); |
201 // scratch: elements of current prototype | 202 // scratch: elements of current prototype |
202 // scratch2: map of current prototype | 203 // scratch2: map of current prototype |
203 __ CmpInstanceType(scratch2, JS_OBJECT_TYPE); | 204 __ CmpInstanceType(scratch2, JS_OBJECT_TYPE); |
204 __ j(below, slow); | 205 __ j(below, slow); |
205 __ test_b( | 206 __ test_b(FieldOperand(scratch2, Map::kBitFieldOffset), |
206 FieldOperand(scratch2, Map::kBitFieldOffset), | 207 Immediate((1 << Map::kIsAccessCheckNeeded) | |
207 (1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor)); | 208 (1 << Map::kHasIndexedInterceptor))); |
208 __ j(not_zero, slow); | 209 __ j(not_zero, slow); |
209 __ cmp(scratch, masm->isolate()->factory()->empty_fixed_array()); | 210 __ cmp(scratch, masm->isolate()->factory()->empty_fixed_array()); |
210 __ j(not_equal, slow); | 211 __ j(not_equal, slow); |
211 __ jmp(&check_next_prototype); | 212 __ jmp(&check_next_prototype); |
212 | 213 |
213 __ bind(&absent); | 214 __ bind(&absent); |
214 __ mov(result, masm->isolate()->factory()->undefined_value()); | 215 __ mov(result, masm->isolate()->factory()->undefined_value()); |
215 __ jmp(&done); | 216 __ jmp(&done); |
216 | 217 |
217 __ bind(&in_bounds); | 218 __ bind(&in_bounds); |
(...skipping 26 matching lines...) Expand all Loading... |
244 | 245 |
245 // Is the string an array index, with cached numeric value? | 246 // Is the string an array index, with cached numeric value? |
246 __ mov(hash, FieldOperand(key, Name::kHashFieldOffset)); | 247 __ mov(hash, FieldOperand(key, Name::kHashFieldOffset)); |
247 __ test(hash, Immediate(Name::kContainsCachedArrayIndexMask)); | 248 __ test(hash, Immediate(Name::kContainsCachedArrayIndexMask)); |
248 __ j(zero, index_string); | 249 __ j(zero, index_string); |
249 | 250 |
250 // Is the string internalized? We already know it's a string so a single | 251 // Is the string internalized? We already know it's a string so a single |
251 // bit test is enough. | 252 // bit test is enough. |
252 STATIC_ASSERT(kNotInternalizedTag != 0); | 253 STATIC_ASSERT(kNotInternalizedTag != 0); |
253 __ test_b(FieldOperand(map, Map::kInstanceTypeOffset), | 254 __ test_b(FieldOperand(map, Map::kInstanceTypeOffset), |
254 kIsNotInternalizedMask); | 255 Immediate(kIsNotInternalizedMask)); |
255 __ j(not_zero, not_unique); | 256 __ j(not_zero, not_unique); |
256 | 257 |
257 __ bind(&unique); | 258 __ bind(&unique); |
258 } | 259 } |
259 | 260 |
260 void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm) { | 261 void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm) { |
261 // The return address is on the stack. | 262 // The return address is on the stack. |
262 Label slow, check_name, index_smi, index_name, property_array_property; | 263 Label slow, check_name, index_smi, index_name, property_array_property; |
263 Label probe_dictionary, check_number_dictionary; | 264 Label probe_dictionary, check_number_dictionary; |
264 | 265 |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 DCHECK(receiver.is(edx)); | 515 DCHECK(receiver.is(edx)); |
515 DCHECK(key.is(ecx)); | 516 DCHECK(key.is(ecx)); |
516 | 517 |
517 // Check that the object isn't a smi. | 518 // Check that the object isn't a smi. |
518 __ JumpIfSmi(receiver, &slow); | 519 __ JumpIfSmi(receiver, &slow); |
519 // Get the map from the receiver. | 520 // Get the map from the receiver. |
520 __ mov(edi, FieldOperand(receiver, HeapObject::kMapOffset)); | 521 __ mov(edi, FieldOperand(receiver, HeapObject::kMapOffset)); |
521 // Check that the receiver does not require access checks and is not observed. | 522 // Check that the receiver does not require access checks and is not observed. |
522 // The generic stub does not perform map checks or handle observed objects. | 523 // The generic stub does not perform map checks or handle observed objects. |
523 __ test_b(FieldOperand(edi, Map::kBitFieldOffset), | 524 __ test_b(FieldOperand(edi, Map::kBitFieldOffset), |
524 1 << Map::kIsAccessCheckNeeded | 1 << Map::kIsObserved); | 525 Immediate(1 << Map::kIsAccessCheckNeeded | 1 << Map::kIsObserved)); |
525 __ j(not_zero, &slow); | 526 __ j(not_zero, &slow); |
526 // Check that the key is a smi. | 527 // Check that the key is a smi. |
527 __ JumpIfNotSmi(key, &maybe_name_key); | 528 __ JumpIfNotSmi(key, &maybe_name_key); |
528 __ CmpInstanceType(edi, JS_ARRAY_TYPE); | 529 __ CmpInstanceType(edi, JS_ARRAY_TYPE); |
529 __ j(equal, &array); | 530 __ j(equal, &array); |
530 // Check that the object is some kind of JS object EXCEPT JS Value type. In | 531 // Check that the object is some kind of JS object EXCEPT JS Value type. In |
531 // the case that the object is a value-wrapper object, we enter the runtime | 532 // the case that the object is a value-wrapper object, we enter the runtime |
532 // system to make sure that indexing into string objects works as intended. | 533 // system to make sure that indexing into string objects works as intended. |
533 STATIC_ASSERT(JS_VALUE_TYPE < JS_OBJECT_TYPE); | 534 STATIC_ASSERT(JS_VALUE_TYPE < JS_OBJECT_TYPE); |
534 __ CmpInstanceType(edi, JS_OBJECT_TYPE); | 535 __ CmpInstanceType(edi, JS_OBJECT_TYPE); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 Condition cc = | 852 Condition cc = |
852 (check == ENABLE_INLINED_SMI_CHECK) | 853 (check == ENABLE_INLINED_SMI_CHECK) |
853 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 854 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
854 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 855 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
855 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 856 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
856 } | 857 } |
857 } // namespace internal | 858 } // namespace internal |
858 } // namespace v8 | 859 } // namespace v8 |
859 | 860 |
860 #endif // V8_TARGET_ARCH_IA32 | 861 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |