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

Side by Side Diff: src/ic/ia32/handler-compiler-ia32.cc

Issue 883253002: Load API call data from function instead of embedding it in handler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rename scratch_in Created 5 years, 10 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
« no previous file with comments | « src/ic/arm64/handler-compiler-arm64.cc ('k') | src/ic/mips/handler-compiler-mips.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_IA32 7 #if V8_TARGET_ARCH_IA32
8 8
9 #include "src/ic/call-optimization.h" 9 #include "src/ic/call-optimization.h"
10 #include "src/ic/handler-compiler.h" 10 #include "src/ic/handler-compiler.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 __ ret(0); 137 __ ret(0);
138 } 138 }
139 139
140 140
141 // Generate call to api function. 141 // Generate call to api function.
142 // This function uses push() to generate smaller, faster code than 142 // This function uses push() to generate smaller, faster code than
143 // the version above. It is an optimization that should will be removed 143 // the version above. It is an optimization that should will be removed
144 // when api call ICs are generated in hydrogen. 144 // when api call ICs are generated in hydrogen.
145 void PropertyHandlerCompiler::GenerateApiAccessorCall( 145 void PropertyHandlerCompiler::GenerateApiAccessorCall(
146 MacroAssembler* masm, const CallOptimization& optimization, 146 MacroAssembler* masm, const CallOptimization& optimization,
147 Handle<Map> receiver_map, Register receiver, Register scratch_in, 147 Handle<Map> receiver_map, Register receiver, Register scratch,
148 bool is_store, Register store_parameter, Register accessor_holder, 148 bool is_store, Register store_parameter, Register accessor_holder,
149 int accessor_index) { 149 int accessor_index) {
150 DCHECK(!accessor_holder.is(scratch_in)); 150 DCHECK(!accessor_holder.is(scratch));
151 // Copy return value. 151 // Copy return value.
152 __ pop(scratch_in); 152 __ pop(scratch);
153 // receiver 153 // receiver
154 __ push(receiver); 154 __ push(receiver);
155 // Write the arguments to stack frame. 155 // Write the arguments to stack frame.
156 if (is_store) { 156 if (is_store) {
157 DCHECK(!receiver.is(store_parameter)); 157 DCHECK(!receiver.is(store_parameter));
158 DCHECK(!scratch_in.is(store_parameter)); 158 DCHECK(!scratch.is(store_parameter));
159 __ push(store_parameter); 159 __ push(store_parameter);
160 } 160 }
161 __ push(scratch_in); 161 __ push(scratch);
162 // Stack now matches JSFunction abi. 162 // Stack now matches JSFunction abi.
163 DCHECK(optimization.is_simple_api_call()); 163 DCHECK(optimization.is_simple_api_call());
164 164
165 // Abi for CallApiFunctionStub. 165 // Abi for CallApiFunctionStub.
166 Register callee = edi; 166 Register callee = edi;
167 Register call_data = ebx; 167 Register data = ebx;
168 Register holder = ecx; 168 Register holder = ecx;
169 Register api_function_address = edx; 169 Register api_function_address = edx;
170 Register scratch = eax; // scratch_in is no longer valid. 170 scratch = no_reg;
171 171
172 // Put callee in place. 172 // Put callee in place.
173 __ LoadAccessor(callee, accessor_holder, accessor_index, 173 __ LoadAccessor(callee, accessor_holder, accessor_index,
174 is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER); 174 is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER);
175 175
176 // Put holder in place. 176 // Put holder in place.
177 CallOptimization::HolderLookup holder_lookup; 177 CallOptimization::HolderLookup holder_lookup;
178 Handle<JSObject> api_holder = 178 Handle<JSObject> api_holder =
179 optimization.LookupHolderOfExpectedType(receiver_map, &holder_lookup); 179 optimization.LookupHolderOfExpectedType(receiver_map, &holder_lookup);
180 switch (holder_lookup) { 180 switch (holder_lookup) {
181 case CallOptimization::kHolderIsReceiver: 181 case CallOptimization::kHolderIsReceiver:
182 __ Move(holder, receiver); 182 __ Move(holder, receiver);
183 break; 183 break;
184 case CallOptimization::kHolderFound: 184 case CallOptimization::kHolderFound:
185 __ LoadHeapObject(holder, api_holder); 185 __ LoadHeapObject(holder, api_holder);
186 break; 186 break;
187 case CallOptimization::kHolderNotFound: 187 case CallOptimization::kHolderNotFound:
188 UNREACHABLE(); 188 UNREACHABLE();
189 break; 189 break;
190 } 190 }
191 191
192 Isolate* isolate = masm->isolate(); 192 Isolate* isolate = masm->isolate();
193 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); 193 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
194 Handle<Object> call_data_obj(api_call_info->data(), isolate);
195
196
197 bool call_data_undefined = false; 194 bool call_data_undefined = false;
198 // Put call_data in place. 195 // Put call data in place.
199 if (isolate->heap()->InNewSpace(*call_data_obj)) { 196 if (api_call_info->data()->IsUndefined()) {
200 __ mov(scratch, api_call_info);
201 __ mov(call_data, FieldOperand(scratch, CallHandlerInfo::kDataOffset));
202 } else if (call_data_obj->IsUndefined()) {
203 call_data_undefined = true; 197 call_data_undefined = true;
204 __ mov(call_data, Immediate(isolate->factory()->undefined_value())); 198 __ mov(data, Immediate(isolate->factory()->undefined_value()));
205 } else { 199 } else {
206 __ mov(call_data, call_data_obj); 200 __ mov(data, FieldOperand(callee, JSFunction::kSharedFunctionInfoOffset));
201 __ mov(data, FieldOperand(data, SharedFunctionInfo::kFunctionDataOffset));
202 __ mov(data, FieldOperand(data, FunctionTemplateInfo::kCallCodeOffset));
203 __ mov(data, FieldOperand(data, CallHandlerInfo::kDataOffset));
207 } 204 }
208 205
209 // Put api_function_address in place. 206 // Put api_function_address in place.
210 Address function_address = v8::ToCData<Address>(api_call_info->callback()); 207 Address function_address = v8::ToCData<Address>(api_call_info->callback());
211 __ mov(api_function_address, Immediate(function_address)); 208 __ mov(api_function_address, Immediate(function_address));
212 209
213 // Jump to stub. 210 // Jump to stub.
214 CallApiAccessorStub stub(isolate, is_store, call_data_undefined); 211 CallApiAccessorStub stub(isolate, is_store, call_data_undefined);
215 __ TailCallStub(&stub); 212 __ TailCallStub(&stub);
216 } 213 }
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 // Return the generated code. 764 // Return the generated code.
768 return GetCode(kind(), Code::NORMAL, name); 765 return GetCode(kind(), Code::NORMAL, name);
769 } 766 }
770 767
771 768
772 #undef __ 769 #undef __
773 } 770 }
774 } // namespace v8::internal 771 } // namespace v8::internal
775 772
776 #endif // V8_TARGET_ARCH_IA32 773 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ic/arm64/handler-compiler-arm64.cc ('k') | src/ic/mips/handler-compiler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698