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

Side by Side Diff: src/crankshaft/mips64/lithium-codegen-mips64.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. 1 // Copyright 2012 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/crankshaft/mips64/lithium-codegen-mips64.h" 5 #include "src/crankshaft/mips64/lithium-codegen-mips64.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/crankshaft/hydrogen-osr.h" 9 #include "src/crankshaft/hydrogen-osr.h"
10 #include "src/crankshaft/mips64/lithium-gap-resolver-mips64.h" 10 #include "src/crankshaft/mips64/lithium-gap-resolver-mips64.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // Possibly allocate a local context. 157 // Possibly allocate a local context.
158 if (info()->scope()->num_heap_slots() > 0) { 158 if (info()->scope()->num_heap_slots() > 0) {
159 Comment(";;; Allocate local context"); 159 Comment(";;; Allocate local context");
160 bool need_write_barrier = true; 160 bool need_write_barrier = true;
161 // Argument to NewContext is the function, which is in a1. 161 // Argument to NewContext is the function, which is in a1.
162 int slots = info()->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; 162 int slots = info()->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
163 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; 163 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt;
164 if (info()->scope()->is_script_scope()) { 164 if (info()->scope()->is_script_scope()) {
165 __ push(a1); 165 __ push(a1);
166 __ Push(info()->scope()->GetScopeInfo(info()->isolate())); 166 __ Push(info()->scope()->GetScopeInfo(info()->isolate()));
167 __ CallRuntime(Runtime::kNewScriptContext, 2); 167 __ CallRuntime(Runtime::kNewScriptContext);
168 deopt_mode = Safepoint::kLazyDeopt; 168 deopt_mode = Safepoint::kLazyDeopt;
169 } else if (slots <= FastNewContextStub::kMaximumSlots) { 169 } else if (slots <= FastNewContextStub::kMaximumSlots) {
170 FastNewContextStub stub(isolate(), slots); 170 FastNewContextStub stub(isolate(), slots);
171 __ CallStub(&stub); 171 __ CallStub(&stub);
172 // Result of FastNewContextStub is always in new space. 172 // Result of FastNewContextStub is always in new space.
173 need_write_barrier = false; 173 need_write_barrier = false;
174 } else { 174 } else {
175 __ push(a1); 175 __ push(a1);
176 __ CallRuntime(Runtime::kNewFunctionContext, 1); 176 __ CallRuntime(Runtime::kNewFunctionContext);
177 } 177 }
178 RecordSafepoint(deopt_mode); 178 RecordSafepoint(deopt_mode);
179 179
180 // Context is returned in both v0. It replaces the context passed to us. 180 // Context is returned in both v0. It replaces the context passed to us.
181 // It's saved in the stack and kept live in cp. 181 // It's saved in the stack and kept live in cp.
182 __ mov(cp, v0); 182 __ mov(cp, v0);
183 __ sd(v0, MemOperand(fp, StandardFrameConstants::kContextOffset)); 183 __ sd(v0, MemOperand(fp, StandardFrameConstants::kContextOffset));
184 // Copy any necessary parameters into the context. 184 // Copy any necessary parameters into the context.
185 int num_parameters = scope()->num_parameters(); 185 int num_parameters = scope()->num_parameters();
186 int first_parameter = scope()->has_this_declaration() ? -1 : 0; 186 int first_parameter = scope()->has_this_declaration() ? -1 : 0;
(...skipping 2521 matching lines...) Expand 10 before | Expand all | Expand 10 after
2708 2708
2709 2709
2710 void LCodeGen::DoReturn(LReturn* instr) { 2710 void LCodeGen::DoReturn(LReturn* instr) {
2711 if (FLAG_trace && info()->IsOptimizing()) { 2711 if (FLAG_trace && info()->IsOptimizing()) {
2712 // Push the return value on the stack as the parameter. 2712 // Push the return value on the stack as the parameter.
2713 // Runtime::TraceExit returns its parameter in v0. We're leaving the code 2713 // Runtime::TraceExit returns its parameter in v0. We're leaving the code
2714 // managed by the register allocator and tearing down the frame, it's 2714 // managed by the register allocator and tearing down the frame, it's
2715 // safe to write to the context register. 2715 // safe to write to the context register.
2716 __ push(v0); 2716 __ push(v0);
2717 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2717 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2718 __ CallRuntime(Runtime::kTraceExit, 1); 2718 __ CallRuntime(Runtime::kTraceExit);
2719 } 2719 }
2720 if (info()->saves_caller_doubles()) { 2720 if (info()->saves_caller_doubles()) {
2721 RestoreCallerDoubles(); 2721 RestoreCallerDoubles();
2722 } 2722 }
2723 if (NeedsEagerFrame()) { 2723 if (NeedsEagerFrame()) {
2724 __ mov(sp, fp); 2724 __ mov(sp, fp);
2725 __ Pop(ra, fp); 2725 __ Pop(ra, fp);
2726 } 2726 }
2727 if (instr->has_constant_parameter_count()) { 2727 if (instr->has_constant_parameter_count()) {
2728 int parameter_count = ToInteger32(instr->constant_parameter_count()); 2728 int parameter_count = ToInteger32(instr->constant_parameter_count());
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
3451 DCHECK(result.is(cp)); 3451 DCHECK(result.is(cp));
3452 } 3452 }
3453 } 3453 }
3454 3454
3455 3455
3456 void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) { 3456 void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) {
3457 DCHECK(ToRegister(instr->context()).is(cp)); 3457 DCHECK(ToRegister(instr->context()).is(cp));
3458 __ li(scratch0(), instr->hydrogen()->pairs()); 3458 __ li(scratch0(), instr->hydrogen()->pairs());
3459 __ li(scratch1(), Operand(Smi::FromInt(instr->hydrogen()->flags()))); 3459 __ li(scratch1(), Operand(Smi::FromInt(instr->hydrogen()->flags())));
3460 __ Push(scratch0(), scratch1()); 3460 __ Push(scratch0(), scratch1());
3461 CallRuntime(Runtime::kDeclareGlobals, 2, instr); 3461 CallRuntime(Runtime::kDeclareGlobals, instr);
3462 } 3462 }
3463 3463
3464 3464
3465 void LCodeGen::CallKnownFunction(Handle<JSFunction> function, 3465 void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
3466 int formal_parameter_count, int arity, 3466 int formal_parameter_count, int arity,
3467 LInstruction* instr) { 3467 LInstruction* instr) {
3468 bool dont_adapt_arguments = 3468 bool dont_adapt_arguments =
3469 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel; 3469 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel;
3470 bool can_invoke_directly = 3470 bool can_invoke_directly =
3471 dont_adapt_arguments || formal_parameter_count == arity; 3471 dont_adapt_arguments || formal_parameter_count == arity;
(...skipping 2263 matching lines...) Expand 10 before | Expand all | Expand 10 after
5735 Register null_value = a5; 5735 Register null_value = a5;
5736 __ LoadRoot(null_value, Heap::kNullValueRootIndex); 5736 __ LoadRoot(null_value, Heap::kNullValueRootIndex);
5737 __ CheckEnumCache(null_value, &call_runtime); 5737 __ CheckEnumCache(null_value, &call_runtime);
5738 5738
5739 __ ld(result, FieldMemOperand(object, HeapObject::kMapOffset)); 5739 __ ld(result, FieldMemOperand(object, HeapObject::kMapOffset));
5740 __ Branch(&use_cache); 5740 __ Branch(&use_cache);
5741 5741
5742 // Get the set of properties to enumerate. 5742 // Get the set of properties to enumerate.
5743 __ bind(&call_runtime); 5743 __ bind(&call_runtime);
5744 __ push(object); 5744 __ push(object);
5745 CallRuntime(Runtime::kGetPropertyNamesFast, 1, instr); 5745 CallRuntime(Runtime::kGetPropertyNamesFast, instr);
5746 5746
5747 __ ld(a1, FieldMemOperand(v0, HeapObject::kMapOffset)); 5747 __ ld(a1, FieldMemOperand(v0, HeapObject::kMapOffset));
5748 DCHECK(result.is(v0)); 5748 DCHECK(result.is(v0));
5749 __ LoadRoot(at, Heap::kMetaMapRootIndex); 5749 __ LoadRoot(at, Heap::kMetaMapRootIndex);
5750 DeoptimizeIf(ne, instr, Deoptimizer::kWrongMap, a1, Operand(at)); 5750 DeoptimizeIf(ne, instr, Deoptimizer::kWrongMap, a1, Operand(at));
5751 __ bind(&use_cache); 5751 __ bind(&use_cache);
5752 } 5752 }
5753 5753
5754 5754
5755 void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) { 5755 void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
5857 void LCodeGen::DoStoreFrameContext(LStoreFrameContext* instr) { 5857 void LCodeGen::DoStoreFrameContext(LStoreFrameContext* instr) {
5858 Register context = ToRegister(instr->context()); 5858 Register context = ToRegister(instr->context());
5859 __ sd(context, MemOperand(fp, StandardFrameConstants::kContextOffset)); 5859 __ sd(context, MemOperand(fp, StandardFrameConstants::kContextOffset));
5860 } 5860 }
5861 5861
5862 5862
5863 void LCodeGen::DoAllocateBlockContext(LAllocateBlockContext* instr) { 5863 void LCodeGen::DoAllocateBlockContext(LAllocateBlockContext* instr) {
5864 Handle<ScopeInfo> scope_info = instr->scope_info(); 5864 Handle<ScopeInfo> scope_info = instr->scope_info();
5865 __ li(at, scope_info); 5865 __ li(at, scope_info);
5866 __ Push(at, ToRegister(instr->function())); 5866 __ Push(at, ToRegister(instr->function()));
5867 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5867 CallRuntime(Runtime::kPushBlockContext, instr);
5868 RecordSafepoint(Safepoint::kNoLazyDeopt); 5868 RecordSafepoint(Safepoint::kNoLazyDeopt);
5869 } 5869 }
5870 5870
5871 5871
5872 #undef __ 5872 #undef __
5873 5873
5874 } // namespace internal 5874 } // namespace internal
5875 } // namespace v8 5875 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698