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_X64 | 7 #if V8_TARGET_ARCH_X64 |
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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 GenerateKeyedLoadReceiverCheck(masm, receiver, rax, Map::kHasNamedInterceptor, | 325 GenerateKeyedLoadReceiverCheck(masm, receiver, rax, Map::kHasNamedInterceptor, |
326 &slow); | 326 &slow); |
327 | 327 |
328 // If the receiver is a fast-case object, check the stub cache. Otherwise | 328 // If the receiver is a fast-case object, check the stub cache. Otherwise |
329 // probe the dictionary. | 329 // probe the dictionary. |
330 __ movp(rbx, FieldOperand(receiver, JSObject::kPropertiesOffset)); | 330 __ movp(rbx, FieldOperand(receiver, JSObject::kPropertiesOffset)); |
331 __ CompareRoot(FieldOperand(rbx, HeapObject::kMapOffset), | 331 __ CompareRoot(FieldOperand(rbx, HeapObject::kMapOffset), |
332 Heap::kHashTableMapRootIndex); | 332 Heap::kHashTableMapRootIndex); |
333 __ j(equal, &probe_dictionary); | 333 __ j(equal, &probe_dictionary); |
334 | 334 |
| 335 Register megamorphic_scratch = rdi; |
| 336 if (FLAG_vector_ics) { |
| 337 // When vector ics are in use, the handlers in the stub cache expect a |
| 338 // vector and slot. Since we won't change the IC from any downstream |
| 339 // misses, a dummy vector can be used. |
| 340 Register vector = VectorLoadICDescriptor::VectorRegister(); |
| 341 Register slot = VectorLoadICDescriptor::SlotRegister(); |
| 342 DCHECK(!AreAliased(megamorphic_scratch, vector, slot)); |
| 343 Handle<TypeFeedbackVector> dummy_vector = Handle<TypeFeedbackVector>::cast( |
| 344 masm->isolate()->factory()->keyed_load_dummy_vector()); |
| 345 int int_slot = dummy_vector->GetIndex(FeedbackVectorICSlot(0)); |
| 346 __ Move(vector, dummy_vector); |
| 347 __ Move(slot, Smi::FromInt(int_slot)); |
| 348 } |
| 349 |
335 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( | 350 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( |
336 Code::ComputeHandlerFlags(Code::LOAD_IC)); | 351 Code::ComputeHandlerFlags(Code::LOAD_IC)); |
337 masm->isolate()->stub_cache()->GenerateProbe( | 352 masm->isolate()->stub_cache()->GenerateProbe(masm, Code::KEYED_LOAD_IC, flags, |
338 masm, Code::LOAD_IC, flags, false, receiver, key, rbx, no_reg); | 353 false, receiver, key, |
| 354 megamorphic_scratch, no_reg); |
339 // Cache miss. | 355 // Cache miss. |
340 GenerateMiss(masm); | 356 GenerateMiss(masm); |
341 | 357 |
342 // Do a quick inline probe of the receiver's dictionary, if it | 358 // Do a quick inline probe of the receiver's dictionary, if it |
343 // exists. | 359 // exists. |
344 __ bind(&probe_dictionary); | 360 __ bind(&probe_dictionary); |
345 // rbx: elements | 361 // rbx: elements |
346 | 362 |
347 __ movp(rax, FieldOperand(receiver, JSObject::kMapOffset)); | 363 __ movp(rax, FieldOperand(receiver, JSObject::kMapOffset)); |
348 __ movb(rax, FieldOperand(rax, Map::kInstanceTypeOffset)); | 364 __ movb(rax, FieldOperand(rax, Map::kInstanceTypeOffset)); |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 Condition cc = | 962 Condition cc = |
947 (check == ENABLE_INLINED_SMI_CHECK) | 963 (check == ENABLE_INLINED_SMI_CHECK) |
948 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 964 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
949 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 965 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
950 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 966 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
951 } | 967 } |
952 } | 968 } |
953 } // namespace v8::internal | 969 } // namespace v8::internal |
954 | 970 |
955 #endif // V8_TARGET_ARCH_X64 | 971 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |