| 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 | 294 |
| 295 GenerateKeyedLoadReceiverCheck(masm, receiver, rax, | 295 GenerateKeyedLoadReceiverCheck(masm, receiver, rax, |
| 296 Map::kHasIndexedInterceptor, &slow); | 296 Map::kHasIndexedInterceptor, &slow); |
| 297 | 297 |
| 298 // Check the receiver's map to see if it has fast elements. | 298 // Check the receiver's map to see if it has fast elements. |
| 299 __ CheckFastElements(rax, &check_number_dictionary); | 299 __ CheckFastElements(rax, &check_number_dictionary); |
| 300 | 300 |
| 301 GenerateFastArrayLoad(masm, receiver, key, rax, rbx, rax, &slow, | 301 GenerateFastArrayLoad(masm, receiver, key, rax, rbx, rax, &slow, |
| 302 language_mode); | 302 language_mode); |
| 303 Counters* counters = masm->isolate()->counters(); | 303 Counters* counters = masm->isolate()->counters(); |
| 304 __ IncrementCounter(counters->keyed_load_generic_smi(), 1); | 304 __ IncrementCounter(counters->ic_keyed_load_generic_smi(), 1); |
| 305 __ ret(0); | 305 __ ret(0); |
| 306 | 306 |
| 307 __ bind(&check_number_dictionary); | 307 __ bind(&check_number_dictionary); |
| 308 __ SmiToInteger32(rbx, key); | 308 __ SmiToInteger32(rbx, key); |
| 309 __ movp(rax, FieldOperand(receiver, JSObject::kElementsOffset)); | 309 __ movp(rax, FieldOperand(receiver, JSObject::kElementsOffset)); |
| 310 | 310 |
| 311 // Check whether the elements is a number dictionary. | 311 // Check whether the elements is a number dictionary. |
| 312 // rbx: key as untagged int32 | 312 // rbx: key as untagged int32 |
| 313 // rax: elements | 313 // rax: elements |
| 314 __ CompareRoot(FieldOperand(rax, HeapObject::kMapOffset), | 314 __ CompareRoot(FieldOperand(rax, HeapObject::kMapOffset), |
| 315 Heap::kHashTableMapRootIndex); | 315 Heap::kHashTableMapRootIndex); |
| 316 __ j(not_equal, &slow); | 316 __ j(not_equal, &slow); |
| 317 __ LoadFromNumberDictionary(&slow, rax, key, rbx, r9, rdi, rax); | 317 __ LoadFromNumberDictionary(&slow, rax, key, rbx, r9, rdi, rax); |
| 318 __ ret(0); | 318 __ ret(0); |
| 319 | 319 |
| 320 __ bind(&slow); | 320 __ bind(&slow); |
| 321 // Slow case: Jump to runtime. | 321 // Slow case: Jump to runtime. |
| 322 __ IncrementCounter(counters->keyed_load_generic_slow(), 1); | 322 __ IncrementCounter(counters->ic_keyed_load_generic_slow(), 1); |
| 323 KeyedLoadIC::GenerateRuntimeGetProperty(masm, language_mode); | 323 KeyedLoadIC::GenerateRuntimeGetProperty(masm, language_mode); |
| 324 | 324 |
| 325 __ bind(&check_name); | 325 __ bind(&check_name); |
| 326 GenerateKeyNameCheck(masm, key, rax, rbx, &index_name, &slow); | 326 GenerateKeyNameCheck(masm, key, rax, rbx, &index_name, &slow); |
| 327 | 327 |
| 328 GenerateKeyedLoadReceiverCheck(masm, receiver, rax, Map::kHasNamedInterceptor, | 328 GenerateKeyedLoadReceiverCheck(masm, receiver, rax, Map::kHasNamedInterceptor, |
| 329 &slow); | 329 &slow); |
| 330 | 330 |
| 331 // If the receiver is a fast-case object, check the stub cache. Otherwise | 331 // If the receiver is a fast-case object, check the stub cache. Otherwise |
| 332 // probe the dictionary. | 332 // probe the dictionary. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 359 // Do a quick inline probe of the receiver's dictionary, if it | 359 // Do a quick inline probe of the receiver's dictionary, if it |
| 360 // exists. | 360 // exists. |
| 361 __ bind(&probe_dictionary); | 361 __ bind(&probe_dictionary); |
| 362 // rbx: elements | 362 // rbx: elements |
| 363 | 363 |
| 364 __ movp(rax, FieldOperand(receiver, JSObject::kMapOffset)); | 364 __ movp(rax, FieldOperand(receiver, JSObject::kMapOffset)); |
| 365 __ movb(rax, FieldOperand(rax, Map::kInstanceTypeOffset)); | 365 __ movb(rax, FieldOperand(rax, Map::kInstanceTypeOffset)); |
| 366 GenerateGlobalInstanceTypeCheck(masm, rax, &slow); | 366 GenerateGlobalInstanceTypeCheck(masm, rax, &slow); |
| 367 | 367 |
| 368 GenerateDictionaryLoad(masm, &slow, rbx, key, rax, rdi, rax); | 368 GenerateDictionaryLoad(masm, &slow, rbx, key, rax, rdi, rax); |
| 369 __ IncrementCounter(counters->keyed_load_generic_symbol(), 1); | 369 __ IncrementCounter(counters->ic_keyed_load_generic_symbol(), 1); |
| 370 __ ret(0); | 370 __ ret(0); |
| 371 | 371 |
| 372 __ bind(&index_name); | 372 __ bind(&index_name); |
| 373 __ IndexFromHash(rbx, key); | 373 __ IndexFromHash(rbx, key); |
| 374 __ jmp(&index_smi); | 374 __ jmp(&index_smi); |
| 375 } | 375 } |
| 376 | 376 |
| 377 | 377 |
| 378 static void KeyedStoreGenerateMegamorphicHelper( | 378 static void KeyedStoreGenerateMegamorphicHelper( |
| 379 MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow, | 379 MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow, |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 __ Push(slot); | 660 __ Push(slot); |
| 661 __ Push(vector); | 661 __ Push(vector); |
| 662 __ PushReturnAddressFrom(rdi); | 662 __ PushReturnAddressFrom(rdi); |
| 663 } | 663 } |
| 664 | 664 |
| 665 | 665 |
| 666 void LoadIC::GenerateMiss(MacroAssembler* masm) { | 666 void LoadIC::GenerateMiss(MacroAssembler* masm) { |
| 667 // The return address is on the stack. | 667 // The return address is on the stack. |
| 668 | 668 |
| 669 Counters* counters = masm->isolate()->counters(); | 669 Counters* counters = masm->isolate()->counters(); |
| 670 __ IncrementCounter(counters->load_miss(), 1); | 670 __ IncrementCounter(counters->ic_load_miss(), 1); |
| 671 | 671 |
| 672 LoadIC_PushArgs(masm); | 672 LoadIC_PushArgs(masm); |
| 673 | 673 |
| 674 // Perform tail call to the entry. | 674 // Perform tail call to the entry. |
| 675 __ TailCallRuntime(Runtime::kLoadIC_Miss); | 675 __ TailCallRuntime(Runtime::kLoadIC_Miss); |
| 676 } | 676 } |
| 677 | 677 |
| 678 | 678 |
| 679 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm, | 679 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm, |
| 680 LanguageMode language_mode) { | 680 LanguageMode language_mode) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 691 | 691 |
| 692 // Do tail-call to runtime routine. | 692 // Do tail-call to runtime routine. |
| 693 __ TailCallRuntime(is_strong(language_mode) ? Runtime::kGetPropertyStrong | 693 __ TailCallRuntime(is_strong(language_mode) ? Runtime::kGetPropertyStrong |
| 694 : Runtime::kGetProperty); | 694 : Runtime::kGetProperty); |
| 695 } | 695 } |
| 696 | 696 |
| 697 | 697 |
| 698 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { | 698 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { |
| 699 // The return address is on the stack. | 699 // The return address is on the stack. |
| 700 Counters* counters = masm->isolate()->counters(); | 700 Counters* counters = masm->isolate()->counters(); |
| 701 __ IncrementCounter(counters->keyed_load_miss(), 1); | 701 __ IncrementCounter(counters->ic_keyed_load_miss(), 1); |
| 702 | 702 |
| 703 LoadIC_PushArgs(masm); | 703 LoadIC_PushArgs(masm); |
| 704 | 704 |
| 705 // Perform tail call to the entry. | 705 // Perform tail call to the entry. |
| 706 __ TailCallRuntime(Runtime::kKeyedLoadIC_Miss); | 706 __ TailCallRuntime(Runtime::kKeyedLoadIC_Miss); |
| 707 } | 707 } |
| 708 | 708 |
| 709 | 709 |
| 710 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm, | 710 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm, |
| 711 LanguageMode language_mode) { | 711 LanguageMode language_mode) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 Register value = StoreDescriptor::ValueRegister(); | 767 Register value = StoreDescriptor::ValueRegister(); |
| 768 Register dictionary = r11; | 768 Register dictionary = r11; |
| 769 DCHECK(!AreAliased(dictionary, VectorStoreICDescriptor::VectorRegister(), | 769 DCHECK(!AreAliased(dictionary, VectorStoreICDescriptor::VectorRegister(), |
| 770 VectorStoreICDescriptor::SlotRegister())); | 770 VectorStoreICDescriptor::SlotRegister())); |
| 771 | 771 |
| 772 Label miss; | 772 Label miss; |
| 773 | 773 |
| 774 __ movp(dictionary, FieldOperand(receiver, JSObject::kPropertiesOffset)); | 774 __ movp(dictionary, FieldOperand(receiver, JSObject::kPropertiesOffset)); |
| 775 GenerateDictionaryStore(masm, &miss, dictionary, name, value, r8, r9); | 775 GenerateDictionaryStore(masm, &miss, dictionary, name, value, r8, r9); |
| 776 Counters* counters = masm->isolate()->counters(); | 776 Counters* counters = masm->isolate()->counters(); |
| 777 __ IncrementCounter(counters->store_normal_hit(), 1); | 777 __ IncrementCounter(counters->ic_store_normal_hit(), 1); |
| 778 __ ret(0); | 778 __ ret(0); |
| 779 | 779 |
| 780 __ bind(&miss); | 780 __ bind(&miss); |
| 781 __ IncrementCounter(counters->store_normal_miss(), 1); | 781 __ IncrementCounter(counters->ic_store_normal_miss(), 1); |
| 782 GenerateMiss(masm); | 782 GenerateMiss(masm); |
| 783 } | 783 } |
| 784 | 784 |
| 785 | 785 |
| 786 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { | 786 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { |
| 787 // Return address is on the stack. | 787 // Return address is on the stack. |
| 788 StoreIC_PushArgs(masm); | 788 StoreIC_PushArgs(masm); |
| 789 | 789 |
| 790 // Do tail-call to runtime routine. | 790 // Do tail-call to runtime routine. |
| 791 __ TailCallRuntime(Runtime::kKeyedStoreIC_Miss); | 791 __ TailCallRuntime(Runtime::kKeyedStoreIC_Miss); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 Condition cc = | 860 Condition cc = |
| 861 (check == ENABLE_INLINED_SMI_CHECK) | 861 (check == ENABLE_INLINED_SMI_CHECK) |
| 862 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 862 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
| 863 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 863 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
| 864 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 864 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
| 865 } | 865 } |
| 866 } // namespace internal | 866 } // namespace internal |
| 867 } // namespace v8 | 867 } // namespace v8 |
| 868 | 868 |
| 869 #endif // V8_TARGET_ARCH_X64 | 869 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |