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

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 110573004: Merge bleeding_edge 17696:18016. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 Isolate* isolate, 111 Isolate* isolate,
112 CodeStubInterfaceDescriptor* descriptor) { 112 CodeStubInterfaceDescriptor* descriptor) {
113 static Register registers[] = { edx, ecx }; 113 static Register registers[] = { edx, ecx };
114 descriptor->register_param_count_ = 2; 114 descriptor->register_param_count_ = 2;
115 descriptor->register_params_ = registers; 115 descriptor->register_params_ = registers;
116 descriptor->deoptimization_handler_ = 116 descriptor->deoptimization_handler_ =
117 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); 117 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure);
118 } 118 }
119 119
120 120
121 void KeyedLoadDictionaryElementStub::InitializeInterfaceDescriptor(
122 Isolate* isolate,
123 CodeStubInterfaceDescriptor* descriptor) {
124 static Register registers[] = { edx, ecx };
125 descriptor->register_param_count_ = 2;
126 descriptor->register_params_ = registers;
127 descriptor->deoptimization_handler_ =
128 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure);
129 }
130
131
121 void LoadFieldStub::InitializeInterfaceDescriptor( 132 void LoadFieldStub::InitializeInterfaceDescriptor(
122 Isolate* isolate, 133 Isolate* isolate,
123 CodeStubInterfaceDescriptor* descriptor) { 134 CodeStubInterfaceDescriptor* descriptor) {
124 static Register registers[] = { edx }; 135 static Register registers[] = { edx };
125 descriptor->register_param_count_ = 1; 136 descriptor->register_param_count_ = 1;
126 descriptor->register_params_ = registers; 137 descriptor->register_params_ = registers;
127 descriptor->deoptimization_handler_ = NULL; 138 descriptor->deoptimization_handler_ = NULL;
128 } 139 }
129 140
130 141
131 void KeyedLoadFieldStub::InitializeInterfaceDescriptor( 142 void KeyedLoadFieldStub::InitializeInterfaceDescriptor(
132 Isolate* isolate, 143 Isolate* isolate,
133 CodeStubInterfaceDescriptor* descriptor) { 144 CodeStubInterfaceDescriptor* descriptor) {
134 static Register registers[] = { edx }; 145 static Register registers[] = { edx };
135 descriptor->register_param_count_ = 1; 146 descriptor->register_param_count_ = 1;
136 descriptor->register_params_ = registers; 147 descriptor->register_params_ = registers;
137 descriptor->deoptimization_handler_ = NULL; 148 descriptor->deoptimization_handler_ = NULL;
138 } 149 }
139 150
140 151
152 void KeyedArrayCallStub::InitializeInterfaceDescriptor(
153 Isolate* isolate,
154 CodeStubInterfaceDescriptor* descriptor) {
155 static Register registers[] = { ecx };
156 descriptor->register_param_count_ = 1;
157 descriptor->register_params_ = registers;
158 descriptor->continuation_type_ = TAIL_CALL_CONTINUATION;
159 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS;
160 descriptor->deoptimization_handler_ =
161 FUNCTION_ADDR(KeyedCallIC_MissFromStubFailure);
162 }
163
164
141 void KeyedStoreFastElementStub::InitializeInterfaceDescriptor( 165 void KeyedStoreFastElementStub::InitializeInterfaceDescriptor(
142 Isolate* isolate, 166 Isolate* isolate,
143 CodeStubInterfaceDescriptor* descriptor) { 167 CodeStubInterfaceDescriptor* descriptor) {
144 static Register registers[] = { edx, ecx, eax }; 168 static Register registers[] = { edx, ecx, eax };
145 descriptor->register_param_count_ = 3; 169 descriptor->register_param_count_ = 3;
146 descriptor->register_params_ = registers; 170 descriptor->register_params_ = registers;
147 descriptor->deoptimization_handler_ = 171 descriptor->deoptimization_handler_ =
148 FUNCTION_ADDR(KeyedStoreIC_MissFromStubFailure); 172 FUNCTION_ADDR(KeyedStoreIC_MissFromStubFailure);
149 } 173 }
150 174
(...skipping 5501 matching lines...) Expand 10 before | Expand all | Expand 10 after
5652 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); 5676 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE);
5653 __ pop(ecx); 5677 __ pop(ecx);
5654 int additional_offset = function_mode_ == JS_FUNCTION_STUB_MODE 5678 int additional_offset = function_mode_ == JS_FUNCTION_STUB_MODE
5655 ? kPointerSize 5679 ? kPointerSize
5656 : 0; 5680 : 0;
5657 __ lea(esp, MemOperand(esp, ebx, times_pointer_size, additional_offset)); 5681 __ lea(esp, MemOperand(esp, ebx, times_pointer_size, additional_offset));
5658 __ jmp(ecx); // Return to IC Miss stub, continuation still on stack. 5682 __ jmp(ecx); // Return to IC Miss stub, continuation still on stack.
5659 } 5683 }
5660 5684
5661 5685
5686 void StubFailureTailCallTrampolineStub::Generate(MacroAssembler* masm) {
5687 CEntryStub ces(1, fp_registers_ ? kSaveFPRegs : kDontSaveFPRegs);
5688 __ call(ces.GetCode(masm->isolate()), RelocInfo::CODE_TARGET);
5689 __ mov(edi, eax);
5690 int parameter_count_offset =
5691 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset;
5692 __ mov(eax, MemOperand(ebp, parameter_count_offset));
5693 // The parameter count above includes the receiver for the arguments passed to
5694 // the deoptimization handler. Subtract the receiver for the parameter count
5695 // for the call.
5696 __ sub(eax, Immediate(1));
5697 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE);
5698 ParameterCount argument_count(eax);
5699 __ InvokeFunction(
5700 edi, argument_count, JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD);
5701 }
5702
5703
5662 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { 5704 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) {
5663 if (masm->isolate()->function_entry_hook() != NULL) { 5705 if (masm->isolate()->function_entry_hook() != NULL) {
5664 // It's always safe to call the entry hook stub, as the hook itself 5706 // It's always safe to call the entry hook stub, as the hook itself
5665 // is not allowed to call back to V8. 5707 // is not allowed to call back to V8.
5666 AllowStubCallsScope allow_stub_calls(masm, true); 5708 AllowStubCallsScope allow_stub_calls(masm, true);
5667 5709
5668 ProfileEntryHookStub stub; 5710 ProfileEntryHookStub stub;
5669 masm->CallStub(&stub); 5711 masm->CallStub(&stub);
5670 } 5712 }
5671 } 5713 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
5778 // Fix kind and retry. 5820 // Fix kind and retry.
5779 __ inc(edx); 5821 __ inc(edx);
5780 __ mov(ecx, FieldOperand(ebx, Cell::kValueOffset)); 5822 __ mov(ecx, FieldOperand(ebx, Cell::kValueOffset));
5781 if (FLAG_debug_code) { 5823 if (FLAG_debug_code) {
5782 Handle<Map> allocation_site_map = 5824 Handle<Map> allocation_site_map =
5783 masm->isolate()->factory()->allocation_site_map(); 5825 masm->isolate()->factory()->allocation_site_map();
5784 __ cmp(FieldOperand(ecx, 0), Immediate(allocation_site_map)); 5826 __ cmp(FieldOperand(ecx, 0), Immediate(allocation_site_map));
5785 __ Assert(equal, kExpectedAllocationSiteInCell); 5827 __ Assert(equal, kExpectedAllocationSiteInCell);
5786 } 5828 }
5787 5829
5788 // Save the resulting elements kind in type info 5830 // Save the resulting elements kind in type info. We can't just store r3
5789 __ SmiTag(edx); 5831 // in the AllocationSite::transition_info field because elements kind is
5790 __ mov(FieldOperand(ecx, AllocationSite::kTransitionInfoOffset), edx); 5832 // restricted to a portion of the field...upper bits need to be left alone.
5791 __ SmiUntag(edx); 5833 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0);
5834 __ add(FieldOperand(ecx, AllocationSite::kTransitionInfoOffset),
5835 Immediate(Smi::FromInt(kFastElementsKindPackedToHoley)));
5792 5836
5793 __ bind(&normal_sequence); 5837 __ bind(&normal_sequence);
5794 int last_index = GetSequenceIndexFromFastElementsKind( 5838 int last_index = GetSequenceIndexFromFastElementsKind(
5795 TERMINAL_FAST_ELEMENTS_KIND); 5839 TERMINAL_FAST_ELEMENTS_KIND);
5796 for (int i = 0; i <= last_index; ++i) { 5840 for (int i = 0; i <= last_index; ++i) {
5797 Label next; 5841 Label next;
5798 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); 5842 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
5799 __ cmp(edx, kind); 5843 __ cmp(edx, kind);
5800 __ j(not_equal, &next); 5844 __ j(not_equal, &next);
5801 ArraySingleArgumentConstructorStub stub(kind); 5845 ArraySingleArgumentConstructorStub stub(kind);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
5922 Label no_info; 5966 Label no_info;
5923 // If the type cell is undefined, or contains anything other than an 5967 // If the type cell is undefined, or contains anything other than an
5924 // AllocationSite, call an array constructor that doesn't use AllocationSites. 5968 // AllocationSite, call an array constructor that doesn't use AllocationSites.
5925 __ cmp(ebx, Immediate(undefined_sentinel)); 5969 __ cmp(ebx, Immediate(undefined_sentinel));
5926 __ j(equal, &no_info); 5970 __ j(equal, &no_info);
5927 __ mov(edx, FieldOperand(ebx, Cell::kValueOffset)); 5971 __ mov(edx, FieldOperand(ebx, Cell::kValueOffset));
5928 __ cmp(FieldOperand(edx, 0), Immediate( 5972 __ cmp(FieldOperand(edx, 0), Immediate(
5929 masm->isolate()->factory()->allocation_site_map())); 5973 masm->isolate()->factory()->allocation_site_map()));
5930 __ j(not_equal, &no_info); 5974 __ j(not_equal, &no_info);
5931 5975
5976 // Only look at the lower 16 bits of the transition info.
5932 __ mov(edx, FieldOperand(edx, AllocationSite::kTransitionInfoOffset)); 5977 __ mov(edx, FieldOperand(edx, AllocationSite::kTransitionInfoOffset));
5933 __ SmiUntag(edx); 5978 __ SmiUntag(edx);
5979 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0);
5980 __ and_(edx, Immediate(AllocationSite::ElementsKindBits::kMask));
5934 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); 5981 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE);
5935 5982
5936 __ bind(&no_info); 5983 __ bind(&no_info);
5937 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); 5984 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);
5938 } 5985 }
5939 5986
5940 5987
5941 void InternalArrayConstructorStub::GenerateCase( 5988 void InternalArrayConstructorStub::GenerateCase(
5942 MacroAssembler* masm, ElementsKind kind) { 5989 MacroAssembler* masm, ElementsKind kind) {
5943 Label not_zero_case, not_one_case; 5990 Label not_zero_case, not_one_case;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
6024 __ bind(&fast_elements_case); 6071 __ bind(&fast_elements_case);
6025 GenerateCase(masm, FAST_ELEMENTS); 6072 GenerateCase(masm, FAST_ELEMENTS);
6026 } 6073 }
6027 6074
6028 6075
6029 #undef __ 6076 #undef __
6030 6077
6031 } } // namespace v8::internal 6078 } } // namespace v8::internal
6032 6079
6033 #endif // V8_TARGET_ARCH_IA32 6080 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698