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

Side by Side Diff: src/ic/mips/handler-compiler-mips.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/ia32/handler-compiler-ia32.cc ('k') | src/ic/mips64/handler-compiler-mips64.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_MIPS 7 #if V8_TARGET_ARCH_MIPS
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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // Write the arguments to stack frame. 242 // Write the arguments to stack frame.
243 if (is_store) { 243 if (is_store) {
244 DCHECK(!receiver.is(store_parameter)); 244 DCHECK(!receiver.is(store_parameter));
245 DCHECK(!scratch_in.is(store_parameter)); 245 DCHECK(!scratch_in.is(store_parameter));
246 __ push(store_parameter); 246 __ push(store_parameter);
247 } 247 }
248 DCHECK(optimization.is_simple_api_call()); 248 DCHECK(optimization.is_simple_api_call());
249 249
250 // Abi for CallApiFunctionStub. 250 // Abi for CallApiFunctionStub.
251 Register callee = a0; 251 Register callee = a0;
252 Register call_data = t0; 252 Register data = t0;
253 Register holder = a2; 253 Register holder = a2;
254 Register api_function_address = a1; 254 Register api_function_address = a1;
255 255
256 // Put callee in place. 256 // Put callee in place.
257 __ LoadAccessor(callee, holder, accessor_index, 257 __ LoadAccessor(callee, holder, accessor_index,
258 is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER); 258 is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER);
259 259
260 // Put holder in place. 260 // Put holder in place.
261 CallOptimization::HolderLookup holder_lookup; 261 CallOptimization::HolderLookup holder_lookup;
262 Handle<JSObject> api_holder = 262 Handle<JSObject> api_holder =
263 optimization.LookupHolderOfExpectedType(receiver_map, &holder_lookup); 263 optimization.LookupHolderOfExpectedType(receiver_map, &holder_lookup);
264 switch (holder_lookup) { 264 switch (holder_lookup) {
265 case CallOptimization::kHolderIsReceiver: 265 case CallOptimization::kHolderIsReceiver:
266 __ Move(holder, receiver); 266 __ Move(holder, receiver);
267 break; 267 break;
268 case CallOptimization::kHolderFound: 268 case CallOptimization::kHolderFound:
269 __ li(holder, api_holder); 269 __ li(holder, api_holder);
270 break; 270 break;
271 case CallOptimization::kHolderNotFound: 271 case CallOptimization::kHolderNotFound:
272 UNREACHABLE(); 272 UNREACHABLE();
273 break; 273 break;
274 } 274 }
275 275
276 Isolate* isolate = masm->isolate(); 276 Isolate* isolate = masm->isolate();
277 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); 277 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
278 Handle<Object> call_data_obj(api_call_info->data(), isolate);
279
280 bool call_data_undefined = false; 278 bool call_data_undefined = false;
281 // Put call_data in place. 279 // Put call data in place.
282 if (isolate->heap()->InNewSpace(*call_data_obj)) { 280 if (api_call_info->data()->IsUndefined()) {
283 __ li(call_data, api_call_info);
284 __ lw(call_data, FieldMemOperand(call_data, CallHandlerInfo::kDataOffset));
285 } else if (call_data_obj->IsUndefined()) {
286 call_data_undefined = true; 281 call_data_undefined = true;
287 __ LoadRoot(call_data, Heap::kUndefinedValueRootIndex); 282 __ LoadRoot(data, Heap::kUndefinedValueRootIndex);
288 } else { 283 } else {
289 __ li(call_data, call_data_obj); 284 __ lw(data, FieldMemOperand(callee, JSFunction::kSharedFunctionInfoOffset));
285 __ lw(data, FieldMemOperand(data, SharedFunctionInfo::kFunctionDataOffset));
286 __ lw(data, FieldMemOperand(data, FunctionTemplateInfo::kCallCodeOffset));
287 __ lw(data, FieldMemOperand(data, CallHandlerInfo::kDataOffset));
290 } 288 }
291 // Put api_function_address in place. 289 // Put api_function_address in place.
292 Address function_address = v8::ToCData<Address>(api_call_info->callback()); 290 Address function_address = v8::ToCData<Address>(api_call_info->callback());
293 ApiFunction fun(function_address); 291 ApiFunction fun(function_address);
294 ExternalReference::Type type = ExternalReference::DIRECT_API_CALL; 292 ExternalReference::Type type = ExternalReference::DIRECT_API_CALL;
295 ExternalReference ref = ExternalReference(&fun, type, masm->isolate()); 293 ExternalReference ref = ExternalReference(&fun, type, masm->isolate());
296 __ li(api_function_address, Operand(ref)); 294 __ li(api_function_address, Operand(ref));
297 295
298 // Jump to stub. 296 // Jump to stub.
299 CallApiAccessorStub stub(isolate, is_store, call_data_undefined); 297 CallApiAccessorStub stub(isolate, is_store, call_data_undefined);
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 // Return the generated code. 733 // Return the generated code.
736 return GetCode(kind(), Code::NORMAL, name); 734 return GetCode(kind(), Code::NORMAL, name);
737 } 735 }
738 736
739 737
740 #undef __ 738 #undef __
741 } 739 }
742 } // namespace v8::internal 740 } // namespace v8::internal
743 741
744 #endif // V8_TARGET_ARCH_MIPS 742 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ic/ia32/handler-compiler-ia32.cc ('k') | src/ic/mips64/handler-compiler-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698