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 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 | 660 |
661 __ PopReturnAddressTo(rdi); | 661 __ PopReturnAddressTo(rdi); |
662 __ Push(receiver); | 662 __ Push(receiver); |
663 __ Push(name); | 663 __ Push(name); |
664 __ Push(slot); | 664 __ Push(slot); |
665 __ Push(vector); | 665 __ Push(vector); |
666 __ PushReturnAddressFrom(rdi); | 666 __ PushReturnAddressFrom(rdi); |
667 } | 667 } |
668 | 668 |
669 | 669 |
670 void LoadIC::GenerateMiss(MacroAssembler* masm) { | 670 void LoadIC::GenerateMiss(MacroAssembler* masm, int stress) { |
671 // The return address is on the stack. | 671 // The return address is on the stack. |
672 | 672 |
673 Counters* counters = masm->isolate()->counters(); | 673 Counters* counters = masm->isolate()->counters(); |
674 __ IncrementCounter(counters->load_miss(), 1); | 674 __ IncrementCounter(counters->load_miss(), 1); |
675 | 675 |
676 LoadIC_PushArgs(masm); | 676 LoadIC_PushArgs(masm); |
677 | 677 |
| 678 Register receiver = LoadDescriptor::ReceiverRegister(); |
| 679 |
| 680 // Sanity check: The receiver must be a JS-exposed kind of object, |
| 681 // not something internal (like a Map, or FixedArray). Check this here |
| 682 // to chase after a rare but recurring crash bug. |
| 683 // TODO(jkummerow): Remove this when it has generated a few crash reports. |
| 684 |
| 685 Label ok, sound_alarm; |
| 686 __ JumpIfSmi(receiver, &ok, Label::kNear); |
| 687 __ movp(rbx, FieldOperand(receiver, HeapObject::kMapOffset)); |
| 688 __ CompareRoot(rbx, Heap::kMetaMapRootIndex); |
| 689 __ j(equal, &sound_alarm); |
| 690 __ CompareRoot(rbx, Heap::kFixedArrayMapRootIndex); |
| 691 __ j(not_equal, &ok, Label::kNear); |
| 692 |
| 693 // This cmpp instruction is only here to identify which of several kinds |
| 694 // of code blocks embedded the MISS code. (handler, dispatcher). |
| 695 __ cmpp(receiver, Immediate(stress)); |
| 696 |
| 697 __ bind(&sound_alarm); |
| 698 __ Push(Smi::FromInt(0xaabbccdd)); |
| 699 __ Push(receiver); |
| 700 __ movp(rbx, FieldOperand(receiver, HeapObject::kMapOffset)); |
| 701 __ Push(rbx); |
| 702 __ movp(rbx, FieldOperand(receiver, JSObject::kPropertiesOffset)); |
| 703 __ Push(rbx); |
| 704 __ int3(); |
| 705 |
| 706 __ bind(&ok); |
| 707 |
678 // Perform tail call to the entry. | 708 // Perform tail call to the entry. |
679 int arg_count = 4; | 709 int arg_count = 4; |
680 __ TailCallRuntime(Runtime::kLoadIC_Miss, arg_count, 1); | 710 __ TailCallRuntime(Runtime::kLoadIC_Miss, arg_count, 1); |
681 } | 711 } |
682 | 712 |
683 | 713 |
684 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm, | 714 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm, |
685 LanguageMode language_mode) { | 715 LanguageMode language_mode) { |
686 // The return address is on the stack. | 716 // The return address is on the stack. |
687 Register receiver = LoadDescriptor::ReceiverRegister(); | 717 Register receiver = LoadDescriptor::ReceiverRegister(); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 Condition cc = | 916 Condition cc = |
887 (check == ENABLE_INLINED_SMI_CHECK) | 917 (check == ENABLE_INLINED_SMI_CHECK) |
888 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 918 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
889 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 919 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
890 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 920 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
891 } | 921 } |
892 } // namespace internal | 922 } // namespace internal |
893 } // namespace v8 | 923 } // namespace v8 |
894 | 924 |
895 #endif // V8_TARGET_ARCH_X64 | 925 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |