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

Side by Side Diff: src/crankshaft/mips/lithium-codegen-mips.cc

Issue 1553703002: [runtime] TailCallRuntime and CallRuntime should use default argument counts (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@2015-12-29_TailCallRuntime_default_result_size_1_1550923002
Patch Set: Created 4 years, 11 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved.7 1 // Copyright 2012 the V8 project authors. All rights reserved.7
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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 // Possibly allocate a local context. 182 // Possibly allocate a local context.
183 if (info()->scope()->num_heap_slots() > 0) { 183 if (info()->scope()->num_heap_slots() > 0) {
184 Comment(";;; Allocate local context"); 184 Comment(";;; Allocate local context");
185 bool need_write_barrier = true; 185 bool need_write_barrier = true;
186 // Argument to NewContext is the function, which is in a1. 186 // Argument to NewContext is the function, which is in a1.
187 int slots = info()->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; 187 int slots = info()->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
188 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; 188 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt;
189 if (info()->scope()->is_script_scope()) { 189 if (info()->scope()->is_script_scope()) {
190 __ push(a1); 190 __ push(a1);
191 __ Push(info()->scope()->GetScopeInfo(info()->isolate())); 191 __ Push(info()->scope()->GetScopeInfo(info()->isolate()));
192 __ CallRuntime(Runtime::kNewScriptContext, 2); 192 __ CallRuntime(Runtime::kNewScriptContext);
193 deopt_mode = Safepoint::kLazyDeopt; 193 deopt_mode = Safepoint::kLazyDeopt;
194 } else if (slots <= FastNewContextStub::kMaximumSlots) { 194 } else if (slots <= FastNewContextStub::kMaximumSlots) {
195 FastNewContextStub stub(isolate(), slots); 195 FastNewContextStub stub(isolate(), slots);
196 __ CallStub(&stub); 196 __ CallStub(&stub);
197 // Result of FastNewContextStub is always in new space. 197 // Result of FastNewContextStub is always in new space.
198 need_write_barrier = false; 198 need_write_barrier = false;
199 } else { 199 } else {
200 __ push(a1); 200 __ push(a1);
201 __ CallRuntime(Runtime::kNewFunctionContext, 1); 201 __ CallRuntime(Runtime::kNewFunctionContext);
202 } 202 }
203 RecordSafepoint(deopt_mode); 203 RecordSafepoint(deopt_mode);
204 204
205 // Context is returned in both v0. It replaces the context passed to us. 205 // Context is returned in both v0. It replaces the context passed to us.
206 // It's saved in the stack and kept live in cp. 206 // It's saved in the stack and kept live in cp.
207 __ mov(cp, v0); 207 __ mov(cp, v0);
208 __ sw(v0, MemOperand(fp, StandardFrameConstants::kContextOffset)); 208 __ sw(v0, MemOperand(fp, StandardFrameConstants::kContextOffset));
209 // Copy any necessary parameters into the context. 209 // Copy any necessary parameters into the context.
210 int num_parameters = scope()->num_parameters(); 210 int num_parameters = scope()->num_parameters();
211 int first_parameter = scope()->has_this_declaration() ? -1 : 0; 211 int first_parameter = scope()->has_this_declaration() ? -1 : 0;
(...skipping 2371 matching lines...) Expand 10 before | Expand all | Expand 10 after
2583 2583
2584 2584
2585 void LCodeGen::DoReturn(LReturn* instr) { 2585 void LCodeGen::DoReturn(LReturn* instr) {
2586 if (FLAG_trace && info()->IsOptimizing()) { 2586 if (FLAG_trace && info()->IsOptimizing()) {
2587 // Push the return value on the stack as the parameter. 2587 // Push the return value on the stack as the parameter.
2588 // Runtime::TraceExit returns its parameter in v0. We're leaving the code 2588 // Runtime::TraceExit returns its parameter in v0. We're leaving the code
2589 // managed by the register allocator and tearing down the frame, it's 2589 // managed by the register allocator and tearing down the frame, it's
2590 // safe to write to the context register. 2590 // safe to write to the context register.
2591 __ push(v0); 2591 __ push(v0);
2592 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2592 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2593 __ CallRuntime(Runtime::kTraceExit, 1); 2593 __ CallRuntime(Runtime::kTraceExit);
2594 } 2594 }
2595 if (info()->saves_caller_doubles()) { 2595 if (info()->saves_caller_doubles()) {
2596 RestoreCallerDoubles(); 2596 RestoreCallerDoubles();
2597 } 2597 }
2598 if (NeedsEagerFrame()) { 2598 if (NeedsEagerFrame()) {
2599 __ mov(sp, fp); 2599 __ mov(sp, fp);
2600 __ Pop(ra, fp); 2600 __ Pop(ra, fp);
2601 } 2601 }
2602 if (instr->has_constant_parameter_count()) { 2602 if (instr->has_constant_parameter_count()) {
2603 int parameter_count = ToInteger32(instr->constant_parameter_count()); 2603 int parameter_count = ToInteger32(instr->constant_parameter_count());
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
3265 DCHECK(result.is(cp)); 3265 DCHECK(result.is(cp));
3266 } 3266 }
3267 } 3267 }
3268 3268
3269 3269
3270 void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) { 3270 void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) {
3271 DCHECK(ToRegister(instr->context()).is(cp)); 3271 DCHECK(ToRegister(instr->context()).is(cp));
3272 __ li(scratch0(), instr->hydrogen()->pairs()); 3272 __ li(scratch0(), instr->hydrogen()->pairs());
3273 __ li(scratch1(), Operand(Smi::FromInt(instr->hydrogen()->flags()))); 3273 __ li(scratch1(), Operand(Smi::FromInt(instr->hydrogen()->flags())));
3274 __ Push(scratch0(), scratch1()); 3274 __ Push(scratch0(), scratch1());
3275 CallRuntime(Runtime::kDeclareGlobals, 2, instr); 3275 CallRuntime(Runtime::kDeclareGlobals, instr);
3276 } 3276 }
3277 3277
3278 3278
3279 void LCodeGen::CallKnownFunction(Handle<JSFunction> function, 3279 void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
3280 int formal_parameter_count, int arity, 3280 int formal_parameter_count, int arity,
3281 LInstruction* instr) { 3281 LInstruction* instr) {
3282 bool dont_adapt_arguments = 3282 bool dont_adapt_arguments =
3283 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel; 3283 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel;
3284 bool can_invoke_directly = 3284 bool can_invoke_directly =
3285 dont_adapt_arguments || formal_parameter_count == arity; 3285 dont_adapt_arguments || formal_parameter_count == arity;
(...skipping 2242 matching lines...) Expand 10 before | Expand all | Expand 10 after
5528 Register null_value = t1; 5528 Register null_value = t1;
5529 __ LoadRoot(null_value, Heap::kNullValueRootIndex); 5529 __ LoadRoot(null_value, Heap::kNullValueRootIndex);
5530 __ CheckEnumCache(null_value, &call_runtime); 5530 __ CheckEnumCache(null_value, &call_runtime);
5531 5531
5532 __ lw(result, FieldMemOperand(object, HeapObject::kMapOffset)); 5532 __ lw(result, FieldMemOperand(object, HeapObject::kMapOffset));
5533 __ Branch(&use_cache); 5533 __ Branch(&use_cache);
5534 5534
5535 // Get the set of properties to enumerate. 5535 // Get the set of properties to enumerate.
5536 __ bind(&call_runtime); 5536 __ bind(&call_runtime);
5537 __ push(object); 5537 __ push(object);
5538 CallRuntime(Runtime::kGetPropertyNamesFast, 1, instr); 5538 CallRuntime(Runtime::kGetPropertyNamesFast, instr);
5539 5539
5540 __ lw(a1, FieldMemOperand(v0, HeapObject::kMapOffset)); 5540 __ lw(a1, FieldMemOperand(v0, HeapObject::kMapOffset));
5541 DCHECK(result.is(v0)); 5541 DCHECK(result.is(v0));
5542 __ LoadRoot(at, Heap::kMetaMapRootIndex); 5542 __ LoadRoot(at, Heap::kMetaMapRootIndex);
5543 DeoptimizeIf(ne, instr, Deoptimizer::kWrongMap, a1, Operand(at)); 5543 DeoptimizeIf(ne, instr, Deoptimizer::kWrongMap, a1, Operand(at));
5544 __ bind(&use_cache); 5544 __ bind(&use_cache);
5545 } 5545 }
5546 5546
5547 5547
5548 void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) { 5548 void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
5652 void LCodeGen::DoStoreFrameContext(LStoreFrameContext* instr) { 5652 void LCodeGen::DoStoreFrameContext(LStoreFrameContext* instr) {
5653 Register context = ToRegister(instr->context()); 5653 Register context = ToRegister(instr->context());
5654 __ sw(context, MemOperand(fp, StandardFrameConstants::kContextOffset)); 5654 __ sw(context, MemOperand(fp, StandardFrameConstants::kContextOffset));
5655 } 5655 }
5656 5656
5657 5657
5658 void LCodeGen::DoAllocateBlockContext(LAllocateBlockContext* instr) { 5658 void LCodeGen::DoAllocateBlockContext(LAllocateBlockContext* instr) {
5659 Handle<ScopeInfo> scope_info = instr->scope_info(); 5659 Handle<ScopeInfo> scope_info = instr->scope_info();
5660 __ li(at, scope_info); 5660 __ li(at, scope_info);
5661 __ Push(at, ToRegister(instr->function())); 5661 __ Push(at, ToRegister(instr->function()));
5662 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5662 CallRuntime(Runtime::kPushBlockContext, instr);
5663 RecordSafepoint(Safepoint::kNoLazyDeopt); 5663 RecordSafepoint(Safepoint::kNoLazyDeopt);
5664 } 5664 }
5665 5665
5666 5666
5667 #undef __ 5667 #undef __
5668 5668
5669 } // namespace internal 5669 } // namespace internal
5670 } // namespace v8 5670 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698