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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 GenerateKeyedLoadReceiverCheck(masm, receiver, eax, | 283 GenerateKeyedLoadReceiverCheck(masm, receiver, eax, |
284 Map::kHasIndexedInterceptor, &slow); | 284 Map::kHasIndexedInterceptor, &slow); |
285 | 285 |
286 // Check the receiver's map to see if it has fast elements. | 286 // Check the receiver's map to see if it has fast elements. |
287 __ CheckFastElements(eax, &check_number_dictionary); | 287 __ CheckFastElements(eax, &check_number_dictionary); |
288 | 288 |
289 GenerateFastArrayLoad(masm, receiver, key, eax, ebx, eax, &slow, | 289 GenerateFastArrayLoad(masm, receiver, key, eax, ebx, eax, &slow, |
290 language_mode); | 290 language_mode); |
291 Isolate* isolate = masm->isolate(); | 291 Isolate* isolate = masm->isolate(); |
292 Counters* counters = isolate->counters(); | 292 Counters* counters = isolate->counters(); |
293 __ IncrementCounter(counters->keyed_load_generic_smi(), 1); | 293 __ IncrementCounter(counters->ic_keyed_load_generic_smi(), 1); |
294 __ ret(0); | 294 __ ret(0); |
295 | 295 |
296 __ bind(&check_number_dictionary); | 296 __ bind(&check_number_dictionary); |
297 __ mov(ebx, key); | 297 __ mov(ebx, key); |
298 __ SmiUntag(ebx); | 298 __ SmiUntag(ebx); |
299 __ mov(eax, FieldOperand(receiver, JSObject::kElementsOffset)); | 299 __ mov(eax, FieldOperand(receiver, JSObject::kElementsOffset)); |
300 | 300 |
301 // Check whether the elements is a number dictionary. | 301 // Check whether the elements is a number dictionary. |
302 // ebx: untagged index | 302 // ebx: untagged index |
303 // eax: elements | 303 // eax: elements |
304 __ CheckMap(eax, isolate->factory()->hash_table_map(), &slow, | 304 __ CheckMap(eax, isolate->factory()->hash_table_map(), &slow, |
305 DONT_DO_SMI_CHECK); | 305 DONT_DO_SMI_CHECK); |
306 Label slow_pop_receiver; | 306 Label slow_pop_receiver; |
307 // Push receiver on the stack to free up a register for the dictionary | 307 // Push receiver on the stack to free up a register for the dictionary |
308 // probing. | 308 // probing. |
309 __ push(receiver); | 309 __ push(receiver); |
310 __ LoadFromNumberDictionary(&slow_pop_receiver, eax, key, ebx, edx, edi, eax); | 310 __ LoadFromNumberDictionary(&slow_pop_receiver, eax, key, ebx, edx, edi, eax); |
311 // Pop receiver before returning. | 311 // Pop receiver before returning. |
312 __ pop(receiver); | 312 __ pop(receiver); |
313 __ ret(0); | 313 __ ret(0); |
314 | 314 |
315 __ bind(&slow_pop_receiver); | 315 __ bind(&slow_pop_receiver); |
316 // Pop the receiver from the stack and jump to runtime. | 316 // Pop the receiver from the stack and jump to runtime. |
317 __ pop(receiver); | 317 __ pop(receiver); |
318 | 318 |
319 __ bind(&slow); | 319 __ bind(&slow); |
320 // Slow case: jump to runtime. | 320 // Slow case: jump to runtime. |
321 __ IncrementCounter(counters->keyed_load_generic_slow(), 1); | 321 __ IncrementCounter(counters->ic_keyed_load_generic_slow(), 1); |
322 GenerateRuntimeGetProperty(masm, language_mode); | 322 GenerateRuntimeGetProperty(masm, language_mode); |
323 | 323 |
324 __ bind(&check_name); | 324 __ bind(&check_name); |
325 GenerateKeyNameCheck(masm, key, eax, ebx, &index_name, &slow); | 325 GenerateKeyNameCheck(masm, key, eax, ebx, &index_name, &slow); |
326 | 326 |
327 GenerateKeyedLoadReceiverCheck(masm, receiver, eax, Map::kHasNamedInterceptor, | 327 GenerateKeyedLoadReceiverCheck(masm, receiver, eax, Map::kHasNamedInterceptor, |
328 &slow); | 328 &slow); |
329 | 329 |
330 // If the receiver is a fast-case object, check the stub cache. Otherwise | 330 // If the receiver is a fast-case object, check the stub cache. Otherwise |
331 // probe the dictionary. | 331 // probe the dictionary. |
(...skipping 24 matching lines...) Expand all Loading... |
356 | 356 |
357 // Do a quick inline probe of the receiver's dictionary, if it | 357 // Do a quick inline probe of the receiver's dictionary, if it |
358 // exists. | 358 // exists. |
359 __ bind(&probe_dictionary); | 359 __ bind(&probe_dictionary); |
360 | 360 |
361 __ mov(eax, FieldOperand(receiver, JSObject::kMapOffset)); | 361 __ mov(eax, FieldOperand(receiver, JSObject::kMapOffset)); |
362 __ movzx_b(eax, FieldOperand(eax, Map::kInstanceTypeOffset)); | 362 __ movzx_b(eax, FieldOperand(eax, Map::kInstanceTypeOffset)); |
363 GenerateGlobalInstanceTypeCheck(masm, eax, &slow); | 363 GenerateGlobalInstanceTypeCheck(masm, eax, &slow); |
364 | 364 |
365 GenerateDictionaryLoad(masm, &slow, ebx, key, eax, edi, eax); | 365 GenerateDictionaryLoad(masm, &slow, ebx, key, eax, edi, eax); |
366 __ IncrementCounter(counters->keyed_load_generic_symbol(), 1); | 366 __ IncrementCounter(counters->ic_keyed_load_generic_symbol(), 1); |
367 __ ret(0); | 367 __ ret(0); |
368 | 368 |
369 __ bind(&index_name); | 369 __ bind(&index_name); |
370 __ IndexFromHash(ebx, key); | 370 __ IndexFromHash(ebx, key); |
371 // Now jump to the place where smi keys are handled. | 371 // Now jump to the place where smi keys are handled. |
372 __ jmp(&index_smi); | 372 __ jmp(&index_smi); |
373 } | 373 } |
374 | 374 |
375 | 375 |
376 static void KeyedStoreGenerateMegamorphicHelper( | 376 static void KeyedStoreGenerateMegamorphicHelper( |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 __ push(receiver); | 661 __ push(receiver); |
662 __ push(name); | 662 __ push(name); |
663 __ push(slot); | 663 __ push(slot); |
664 __ push(vector); | 664 __ push(vector); |
665 __ push(edi); | 665 __ push(edi); |
666 } | 666 } |
667 | 667 |
668 | 668 |
669 void LoadIC::GenerateMiss(MacroAssembler* masm) { | 669 void LoadIC::GenerateMiss(MacroAssembler* masm) { |
670 // Return address is on the stack. | 670 // Return address is on the stack. |
671 __ IncrementCounter(masm->isolate()->counters()->load_miss(), 1); | 671 __ IncrementCounter(masm->isolate()->counters()->ic_load_miss(), 1); |
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) { |
681 // Return address is on the stack. | 681 // Return address is on the stack. |
682 Register receiver = LoadDescriptor::ReceiverRegister(); | 682 Register receiver = LoadDescriptor::ReceiverRegister(); |
683 Register name = LoadDescriptor::NameRegister(); | 683 Register name = LoadDescriptor::NameRegister(); |
684 DCHECK(!ebx.is(receiver) && !ebx.is(name)); | 684 DCHECK(!ebx.is(receiver) && !ebx.is(name)); |
685 | 685 |
686 __ pop(ebx); | 686 __ pop(ebx); |
687 __ push(receiver); | 687 __ push(receiver); |
688 __ push(name); | 688 __ push(name); |
689 __ push(ebx); | 689 __ push(ebx); |
690 | 690 |
691 // Do tail-call to runtime routine. | 691 // Do tail-call to runtime routine. |
692 __ TailCallRuntime(is_strong(language_mode) ? Runtime::kGetPropertyStrong | 692 __ TailCallRuntime(is_strong(language_mode) ? Runtime::kGetPropertyStrong |
693 : Runtime::kGetProperty); | 693 : Runtime::kGetProperty); |
694 } | 694 } |
695 | 695 |
696 | 696 |
697 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { | 697 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { |
698 // Return address is on the stack. | 698 // Return address is on the stack. |
699 __ IncrementCounter(masm->isolate()->counters()->keyed_load_miss(), 1); | 699 __ IncrementCounter(masm->isolate()->counters()->ic_keyed_load_miss(), 1); |
700 | 700 |
701 LoadIC_PushArgs(masm); | 701 LoadIC_PushArgs(masm); |
702 | 702 |
703 // Perform tail call to the entry. | 703 // Perform tail call to the entry. |
704 __ TailCallRuntime(Runtime::kKeyedLoadIC_Miss); | 704 __ TailCallRuntime(Runtime::kKeyedLoadIC_Miss); |
705 } | 705 } |
706 | 706 |
707 | 707 |
708 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm, | 708 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm, |
709 LanguageMode language_mode) { | 709 LanguageMode language_mode) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 __ push(receiver); | 770 __ push(receiver); |
771 __ push(vector); | 771 __ push(vector); |
772 __ push(slot); | 772 __ push(slot); |
773 | 773 |
774 Register dictionary = ebx; | 774 Register dictionary = ebx; |
775 __ mov(dictionary, FieldOperand(receiver, JSObject::kPropertiesOffset)); | 775 __ mov(dictionary, FieldOperand(receiver, JSObject::kPropertiesOffset)); |
776 GenerateDictionaryStore(masm, &restore_miss, dictionary, name, value, | 776 GenerateDictionaryStore(masm, &restore_miss, dictionary, name, value, |
777 receiver, edi); | 777 receiver, edi); |
778 __ Drop(3); | 778 __ Drop(3); |
779 Counters* counters = masm->isolate()->counters(); | 779 Counters* counters = masm->isolate()->counters(); |
780 __ IncrementCounter(counters->store_normal_hit(), 1); | 780 __ IncrementCounter(counters->ic_store_normal_hit(), 1); |
781 __ ret(0); | 781 __ ret(0); |
782 | 782 |
783 __ bind(&restore_miss); | 783 __ bind(&restore_miss); |
784 __ pop(slot); | 784 __ pop(slot); |
785 __ pop(vector); | 785 __ pop(vector); |
786 __ pop(receiver); | 786 __ pop(receiver); |
787 __ IncrementCounter(counters->store_normal_miss(), 1); | 787 __ IncrementCounter(counters->ic_store_normal_miss(), 1); |
788 GenerateMiss(masm); | 788 GenerateMiss(masm); |
789 } | 789 } |
790 | 790 |
791 | 791 |
792 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { | 792 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { |
793 // Return address is on the stack. | 793 // Return address is on the stack. |
794 StoreIC_PushArgs(masm); | 794 StoreIC_PushArgs(masm); |
795 | 795 |
796 // Do tail-call to runtime routine. | 796 // Do tail-call to runtime routine. |
797 __ TailCallRuntime(Runtime::kKeyedStoreIC_Miss); | 797 __ TailCallRuntime(Runtime::kKeyedStoreIC_Miss); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 Condition cc = | 866 Condition cc = |
867 (check == ENABLE_INLINED_SMI_CHECK) | 867 (check == ENABLE_INLINED_SMI_CHECK) |
868 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 868 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
869 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 869 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
870 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 870 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
871 } | 871 } |
872 } // namespace internal | 872 } // namespace internal |
873 } // namespace v8 | 873 } // namespace v8 |
874 | 874 |
875 #endif // V8_TARGET_ARCH_X87 | 875 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |