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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 Register vector = LoadWithVectorDescriptor::VectorRegister(); | 333 Register vector = LoadWithVectorDescriptor::VectorRegister(); |
334 Register slot = LoadDescriptor::SlotRegister(); | 334 Register slot = LoadDescriptor::SlotRegister(); |
335 DCHECK(!AreAliased(megamorphic_scratch, vector, slot)); | 335 DCHECK(!AreAliased(megamorphic_scratch, vector, slot)); |
336 Handle<TypeFeedbackVector> dummy_vector = | 336 Handle<TypeFeedbackVector> dummy_vector = |
337 TypeFeedbackVector::DummyVector(masm->isolate()); | 337 TypeFeedbackVector::DummyVector(masm->isolate()); |
338 int slot_index = dummy_vector->GetIndex( | 338 int slot_index = dummy_vector->GetIndex( |
339 FeedbackVectorSlot(TypeFeedbackVector::kDummyKeyedLoadICSlot)); | 339 FeedbackVectorSlot(TypeFeedbackVector::kDummyKeyedLoadICSlot)); |
340 __ Move(vector, dummy_vector); | 340 __ Move(vector, dummy_vector); |
341 __ Move(slot, Smi::FromInt(slot_index)); | 341 __ Move(slot, Smi::FromInt(slot_index)); |
342 | 342 |
343 Code::Flags flags = | 343 masm->isolate()->load_stub_cache()->GenerateProbe( |
344 Code::RemoveHolderFromFlags(Code::ComputeHandlerFlags(Code::LOAD_IC)); | 344 masm, receiver, key, megamorphic_scratch, no_reg); |
345 masm->isolate()->stub_cache()->GenerateProbe(masm, Code::KEYED_LOAD_IC, flags, | |
346 receiver, key, | |
347 megamorphic_scratch, no_reg); | |
348 // Cache miss. | 345 // Cache miss. |
349 GenerateMiss(masm); | 346 GenerateMiss(masm); |
350 | 347 |
351 // Do a quick inline probe of the receiver's dictionary, if it | 348 // Do a quick inline probe of the receiver's dictionary, if it |
352 // exists. | 349 // exists. |
353 __ bind(&probe_dictionary); | 350 __ bind(&probe_dictionary); |
354 // rbx: elements | 351 // rbx: elements |
355 | 352 |
356 __ movp(rax, FieldOperand(receiver, JSObject::kMapOffset)); | 353 __ movp(rax, FieldOperand(receiver, JSObject::kMapOffset)); |
357 __ movb(rax, FieldOperand(rax, Map::kInstanceTypeOffset)); | 354 __ movb(rax, FieldOperand(rax, Map::kInstanceTypeOffset)); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 Register slot = VectorStoreICDescriptor::SlotRegister(); | 557 Register slot = VectorStoreICDescriptor::SlotRegister(); |
561 // The handlers in the stub cache expect a vector and slot. Since we won't | 558 // The handlers in the stub cache expect a vector and slot. Since we won't |
562 // change the IC from any downstream misses, a dummy vector can be used. | 559 // change the IC from any downstream misses, a dummy vector can be used. |
563 Handle<TypeFeedbackVector> dummy_vector = | 560 Handle<TypeFeedbackVector> dummy_vector = |
564 TypeFeedbackVector::DummyVector(masm->isolate()); | 561 TypeFeedbackVector::DummyVector(masm->isolate()); |
565 int slot_index = dummy_vector->GetIndex( | 562 int slot_index = dummy_vector->GetIndex( |
566 FeedbackVectorSlot(TypeFeedbackVector::kDummyKeyedStoreICSlot)); | 563 FeedbackVectorSlot(TypeFeedbackVector::kDummyKeyedStoreICSlot)); |
567 __ Move(vector, dummy_vector); | 564 __ Move(vector, dummy_vector); |
568 __ Move(slot, Smi::FromInt(slot_index)); | 565 __ Move(slot, Smi::FromInt(slot_index)); |
569 | 566 |
570 Code::Flags flags = | 567 masm->isolate()->store_stub_cache()->GenerateProbe(masm, receiver, key, r9, |
571 Code::RemoveHolderFromFlags(Code::ComputeHandlerFlags(Code::STORE_IC)); | 568 no_reg); |
572 masm->isolate()->stub_cache()->GenerateProbe( | |
573 masm, Code::KEYED_STORE_IC, flags, receiver, key, r9, no_reg); | |
574 // Cache miss. | 569 // Cache miss. |
575 __ jmp(&miss); | 570 __ jmp(&miss); |
576 | 571 |
577 // Extra capacity case: Check if there is extra capacity to | 572 // Extra capacity case: Check if there is extra capacity to |
578 // perform the store and update the length. Used for adding one | 573 // perform the store and update the length. Used for adding one |
579 // element to the array by writing to array[array.length]. | 574 // element to the array by writing to array[array.length]. |
580 __ bind(&extra); | 575 __ bind(&extra); |
581 // receiver is a JSArray. | 576 // receiver is a JSArray. |
582 // rbx: receiver's elements array (a FixedArray) | 577 // rbx: receiver's elements array (a FixedArray) |
583 // flags: smicompare (receiver.length(), rbx) | 578 // flags: smicompare (receiver.length(), rbx) |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 Condition cc = | 834 Condition cc = |
840 (check == ENABLE_INLINED_SMI_CHECK) | 835 (check == ENABLE_INLINED_SMI_CHECK) |
841 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 836 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
842 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 837 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
843 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 838 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
844 } | 839 } |
845 } // namespace internal | 840 } // namespace internal |
846 } // namespace v8 | 841 } // namespace v8 |
847 | 842 |
848 #endif // V8_TARGET_ARCH_X64 | 843 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |