Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: src/x64/stub-cache-x64.cc

Issue 7535004: Merge bleeding edge up to 8774 into the GC branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/regexp-macro-assembler-x64.cc ('k') | src/zone.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 Register scratch1, 1084 Register scratch1,
1085 Register scratch2, 1085 Register scratch2,
1086 Register scratch3, 1086 Register scratch3,
1087 Object* value, 1087 Object* value,
1088 String* name, 1088 String* name,
1089 Label* miss) { 1089 Label* miss) {
1090 // Check that the receiver isn't a smi. 1090 // Check that the receiver isn't a smi.
1091 __ JumpIfSmi(receiver, miss); 1091 __ JumpIfSmi(receiver, miss);
1092 1092
1093 // Check that the maps haven't changed. 1093 // Check that the maps haven't changed.
1094 Register reg = 1094 CheckPrototypes(object, receiver, holder,
1095 CheckPrototypes(object, receiver, holder, 1095 scratch1, scratch2, scratch3, name, miss);
1096 scratch1, scratch2, scratch3, name, miss);
1097 1096
1098 // Return the constant value. 1097 // Return the constant value.
1099 __ Move(rax, Handle<Object>(value)); 1098 __ Move(rax, Handle<Object>(value));
1100 __ ret(0); 1099 __ ret(0);
1101 } 1100 }
1102 1101
1103 1102
1104 void StubCompiler::GenerateLoadInterceptor(JSObject* object, 1103 void StubCompiler::GenerateLoadInterceptor(JSObject* object,
1105 JSObject* interceptor_holder, 1104 JSObject* interceptor_holder,
1106 LookupResult* lookup, 1105 LookupResult* lookup,
(...skipping 2493 matching lines...) Expand 10 before | Expand all | Expand 10 after
3600 __ ret(0); 3599 __ ret(0);
3601 3600
3602 __ bind(&miss_force_generic); 3601 __ bind(&miss_force_generic);
3603 Code* code = masm->isolate()->builtins()->builtin( 3602 Code* code = masm->isolate()->builtins()->builtin(
3604 Builtins::kKeyedLoadIC_MissForceGeneric); 3603 Builtins::kKeyedLoadIC_MissForceGeneric);
3605 Handle<Code> ic(code); 3604 Handle<Code> ic(code);
3606 __ jmp(ic, RelocInfo::CODE_TARGET); 3605 __ jmp(ic, RelocInfo::CODE_TARGET);
3607 } 3606 }
3608 3607
3609 3608
3609 void KeyedLoadStubCompiler::GenerateLoadFastDoubleElement(
3610 MacroAssembler* masm) {
3611 // ----------- S t a t e -------------
3612 // -- rax : key
3613 // -- rdx : receiver
3614 // -- rsp[0] : return address
3615 // -----------------------------------
3616 Label miss_force_generic, slow_allocate_heapnumber;
3617
3618 // This stub is meant to be tail-jumped to, the receiver must already
3619 // have been verified by the caller to not be a smi.
3620
3621 // Check that the key is a smi.
3622 __ JumpIfNotSmi(rax, &miss_force_generic);
3623
3624 // Get the elements array.
3625 __ movq(rcx, FieldOperand(rdx, JSObject::kElementsOffset));
3626 __ AssertFastElements(rcx);
3627
3628 // Check that the key is within bounds.
3629 __ SmiCompare(rax, FieldOperand(rcx, FixedArray::kLengthOffset));
3630 __ j(above_equal, &miss_force_generic);
3631
3632 // Check for the hole
3633 __ SmiToInteger32(kScratchRegister, rax);
3634 uint32_t offset = FixedDoubleArray::kHeaderSize + sizeof(kHoleNanLower32);
3635 __ cmpl(FieldOperand(rcx, kScratchRegister, times_8, offset),
3636 Immediate(kHoleNanUpper32));
3637 __ j(equal, &miss_force_generic);
3638
3639 // Always allocate a heap number for the result.
3640 __ movsd(xmm0, FieldOperand(rcx, kScratchRegister, times_8,
3641 FixedDoubleArray::kHeaderSize));
3642 __ AllocateHeapNumber(rcx, rbx, &slow_allocate_heapnumber);
3643 // Set the value.
3644 __ movq(rax, rcx);
3645 __ movsd(FieldOperand(rcx, HeapNumber::kValueOffset), xmm0);
3646 __ ret(0);
3647
3648 __ bind(&slow_allocate_heapnumber);
3649 Handle<Code> slow_ic =
3650 masm->isolate()->builtins()->KeyedLoadIC_Slow();
3651 __ jmp(slow_ic, RelocInfo::CODE_TARGET);
3652
3653 __ bind(&miss_force_generic);
3654 Handle<Code> miss_ic =
3655 masm->isolate()->builtins()->KeyedLoadIC_MissForceGeneric();
3656 __ jmp(miss_ic, RelocInfo::CODE_TARGET);
3657 }
3658
3659
3610 void KeyedStoreStubCompiler::GenerateStoreFastElement(MacroAssembler* masm, 3660 void KeyedStoreStubCompiler::GenerateStoreFastElement(MacroAssembler* masm,
3611 bool is_js_array) { 3661 bool is_js_array) {
3612 // ----------- S t a t e ------------- 3662 // ----------- S t a t e -------------
3613 // -- rax : value 3663 // -- rax : value
3614 // -- rcx : key 3664 // -- rcx : key
3615 // -- rdx : receiver 3665 // -- rdx : receiver
3616 // -- rsp[0] : return address 3666 // -- rsp[0] : return address
3617 // ----------------------------------- 3667 // -----------------------------------
3618 Label miss_force_generic; 3668 Label miss_force_generic;
3619 3669
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
3651 __ ret(0); 3701 __ ret(0);
3652 3702
3653 // Handle store cache miss. 3703 // Handle store cache miss.
3654 __ bind(&miss_force_generic); 3704 __ bind(&miss_force_generic);
3655 Handle<Code> ic_force_generic = 3705 Handle<Code> ic_force_generic =
3656 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); 3706 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric();
3657 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); 3707 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET);
3658 } 3708 }
3659 3709
3660 3710
3711 void KeyedStoreStubCompiler::GenerateStoreFastDoubleElement(
3712 MacroAssembler* masm,
3713 bool is_js_array) {
3714 // ----------- S t a t e -------------
3715 // -- rax : value
3716 // -- rcx : key
3717 // -- rdx : receiver
3718 // -- rsp[0] : return address
3719 // -----------------------------------
3720 Label miss_force_generic, smi_value, is_nan, maybe_nan;
3721 Label have_double_value, not_nan;
3722
3723 // This stub is meant to be tail-jumped to, the receiver must already
3724 // have been verified by the caller to not be a smi.
3725
3726 // Check that the key is a smi.
3727 __ JumpIfNotSmi(rcx, &miss_force_generic);
3728
3729 // Get the elements array.
3730 __ movq(rdi, FieldOperand(rdx, JSObject::kElementsOffset));
3731 __ AssertFastElements(rdi);
3732
3733 // Check that the key is within bounds.
3734 if (is_js_array) {
3735 __ SmiCompare(rcx, FieldOperand(rdx, JSArray::kLengthOffset));
3736 } else {
3737 __ SmiCompare(rcx, FieldOperand(rdi, FixedDoubleArray::kLengthOffset));
3738 }
3739 __ j(above_equal, &miss_force_generic);
3740
3741 // Handle smi values specially
3742 __ JumpIfSmi(rax, &smi_value, Label::kNear);
3743
3744 __ CheckMap(rax,
3745 masm->isolate()->factory()->heap_number_map(),
3746 &miss_force_generic,
3747 DONT_DO_SMI_CHECK);
3748
3749 // Double value, canonicalize NaN.
3750 uint32_t offset = HeapNumber::kValueOffset + sizeof(kHoleNanLower32);
3751 __ cmpl(FieldOperand(rax, offset),
3752 Immediate(kNaNOrInfinityLowerBoundUpper32));
3753 __ j(greater_equal, &maybe_nan, Label::kNear);
3754
3755 __ bind(&not_nan);
3756 __ movsd(xmm0, FieldOperand(rax, HeapNumber::kValueOffset));
3757 __ bind(&have_double_value);
3758 __ SmiToInteger32(rcx, rcx);
3759 __ movsd(FieldOperand(rdi, rcx, times_8, FixedDoubleArray::kHeaderSize),
3760 xmm0);
3761 __ ret(0);
3762
3763 __ bind(&maybe_nan);
3764 // Could be NaN or Infinity. If fraction is not zero, it's NaN, otherwise
3765 // it's an Infinity, and the non-NaN code path applies.
3766 __ j(greater, &is_nan, Label::kNear);
3767 __ cmpl(FieldOperand(rax, HeapNumber::kValueOffset), Immediate(0));
3768 __ j(zero, &not_nan);
3769 __ bind(&is_nan);
3770 // Convert all NaNs to the same canonical NaN value when they are stored in
3771 // the double array.
3772 __ Set(kScratchRegister, BitCast<uint64_t>(
3773 FixedDoubleArray::canonical_not_the_hole_nan_as_double()));
3774 __ movq(xmm0, kScratchRegister);
3775 __ jmp(&have_double_value, Label::kNear);
3776
3777 __ bind(&smi_value);
3778 // Value is a smi. convert to a double and store.
3779 __ SmiToInteger32(rax, rax);
3780 __ push(rax);
3781 __ fild_s(Operand(rsp, 0));
3782 __ pop(rax);
3783 __ SmiToInteger32(rcx, rcx);
3784 __ fstp_d(FieldOperand(rdi, rcx, times_8, FixedDoubleArray::kHeaderSize));
3785 __ ret(0);
3786
3787 // Handle store cache miss, replacing the ic with the generic stub.
3788 __ bind(&miss_force_generic);
3789 Handle<Code> ic_force_generic =
3790 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric();
3791 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET);
3792 }
3793
3794
3661 #undef __ 3795 #undef __
3662 3796
3663 } } // namespace v8::internal 3797 } } // namespace v8::internal
3664 3798
3665 #endif // V8_TARGET_ARCH_X64 3799 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/regexp-macro-assembler-x64.cc ('k') | src/zone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698