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

Side by Side Diff: src/crankshaft/ppc/lithium-codegen-ppc.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 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/crankshaft/ppc/lithium-codegen-ppc.h" 5 #include "src/crankshaft/ppc/lithium-codegen-ppc.h"
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/crankshaft/hydrogen-osr.h" 10 #include "src/crankshaft/hydrogen-osr.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // Possibly allocate a local context. 168 // Possibly allocate a local context.
169 if (info()->scope()->num_heap_slots() > 0) { 169 if (info()->scope()->num_heap_slots() > 0) {
170 Comment(";;; Allocate local context"); 170 Comment(";;; Allocate local context");
171 bool need_write_barrier = true; 171 bool need_write_barrier = true;
172 // Argument to NewContext is the function, which is in r4. 172 // Argument to NewContext is the function, which is in r4.
173 int slots = info()->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; 173 int slots = info()->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
174 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; 174 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt;
175 if (info()->scope()->is_script_scope()) { 175 if (info()->scope()->is_script_scope()) {
176 __ push(r4); 176 __ push(r4);
177 __ Push(info()->scope()->GetScopeInfo(info()->isolate())); 177 __ Push(info()->scope()->GetScopeInfo(info()->isolate()));
178 __ CallRuntime(Runtime::kNewScriptContext, 2); 178 __ CallRuntime(Runtime::kNewScriptContext);
179 deopt_mode = Safepoint::kLazyDeopt; 179 deopt_mode = Safepoint::kLazyDeopt;
180 } else if (slots <= FastNewContextStub::kMaximumSlots) { 180 } else if (slots <= FastNewContextStub::kMaximumSlots) {
181 FastNewContextStub stub(isolate(), slots); 181 FastNewContextStub stub(isolate(), slots);
182 __ CallStub(&stub); 182 __ CallStub(&stub);
183 // Result of FastNewContextStub is always in new space. 183 // Result of FastNewContextStub is always in new space.
184 need_write_barrier = false; 184 need_write_barrier = false;
185 } else { 185 } else {
186 __ push(r4); 186 __ push(r4);
187 __ CallRuntime(Runtime::kNewFunctionContext, 1); 187 __ CallRuntime(Runtime::kNewFunctionContext);
188 } 188 }
189 RecordSafepoint(deopt_mode); 189 RecordSafepoint(deopt_mode);
190 190
191 // Context is returned in both r3 and cp. It replaces the context 191 // Context is returned in both r3 and cp. It replaces the context
192 // passed to us. It's saved in the stack and kept live in cp. 192 // passed to us. It's saved in the stack and kept live in cp.
193 __ mr(cp, r3); 193 __ mr(cp, r3);
194 __ StoreP(r3, MemOperand(fp, StandardFrameConstants::kContextOffset)); 194 __ StoreP(r3, MemOperand(fp, StandardFrameConstants::kContextOffset));
195 // Copy any necessary parameters into the context. 195 // Copy any necessary parameters into the context.
196 int num_parameters = scope()->num_parameters(); 196 int num_parameters = scope()->num_parameters();
197 int first_parameter = scope()->has_this_declaration() ? -1 : 0; 197 int first_parameter = scope()->has_this_declaration() ? -1 : 0;
(...skipping 2553 matching lines...) Expand 10 before | Expand all | Expand 10 after
2751 2751
2752 2752
2753 void LCodeGen::DoReturn(LReturn* instr) { 2753 void LCodeGen::DoReturn(LReturn* instr) {
2754 if (FLAG_trace && info()->IsOptimizing()) { 2754 if (FLAG_trace && info()->IsOptimizing()) {
2755 // Push the return value on the stack as the parameter. 2755 // Push the return value on the stack as the parameter.
2756 // Runtime::TraceExit returns its parameter in r3. We're leaving the code 2756 // Runtime::TraceExit returns its parameter in r3. We're leaving the code
2757 // managed by the register allocator and tearing down the frame, it's 2757 // managed by the register allocator and tearing down the frame, it's
2758 // safe to write to the context register. 2758 // safe to write to the context register.
2759 __ push(r3); 2759 __ push(r3);
2760 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2760 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2761 __ CallRuntime(Runtime::kTraceExit, 1); 2761 __ CallRuntime(Runtime::kTraceExit);
2762 } 2762 }
2763 if (info()->saves_caller_doubles()) { 2763 if (info()->saves_caller_doubles()) {
2764 RestoreCallerDoubles(); 2764 RestoreCallerDoubles();
2765 } 2765 }
2766 if (instr->has_constant_parameter_count()) { 2766 if (instr->has_constant_parameter_count()) {
2767 int parameter_count = ToInteger32(instr->constant_parameter_count()); 2767 int parameter_count = ToInteger32(instr->constant_parameter_count());
2768 int32_t sp_delta = (parameter_count + 1) * kPointerSize; 2768 int32_t sp_delta = (parameter_count + 1) * kPointerSize;
2769 if (NeedsEagerFrame()) { 2769 if (NeedsEagerFrame()) {
2770 masm_->LeaveFrame(StackFrame::JAVA_SCRIPT, sp_delta); 2770 masm_->LeaveFrame(StackFrame::JAVA_SCRIPT, sp_delta);
2771 } else if (sp_delta != 0) { 2771 } else if (sp_delta != 0) {
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
3500 } 3500 }
3501 } 3501 }
3502 3502
3503 3503
3504 void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) { 3504 void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) {
3505 DCHECK(ToRegister(instr->context()).is(cp)); 3505 DCHECK(ToRegister(instr->context()).is(cp));
3506 __ Move(scratch0(), instr->hydrogen()->pairs()); 3506 __ Move(scratch0(), instr->hydrogen()->pairs());
3507 __ push(scratch0()); 3507 __ push(scratch0());
3508 __ LoadSmiLiteral(scratch0(), Smi::FromInt(instr->hydrogen()->flags())); 3508 __ LoadSmiLiteral(scratch0(), Smi::FromInt(instr->hydrogen()->flags()));
3509 __ push(scratch0()); 3509 __ push(scratch0());
3510 CallRuntime(Runtime::kDeclareGlobals, 2, instr); 3510 CallRuntime(Runtime::kDeclareGlobals, instr);
3511 } 3511 }
3512 3512
3513 3513
3514 void LCodeGen::CallKnownFunction(Handle<JSFunction> function, 3514 void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
3515 int formal_parameter_count, int arity, 3515 int formal_parameter_count, int arity,
3516 LInstruction* instr) { 3516 LInstruction* instr) {
3517 bool dont_adapt_arguments = 3517 bool dont_adapt_arguments =
3518 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel; 3518 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel;
3519 bool can_invoke_directly = 3519 bool can_invoke_directly =
3520 dont_adapt_arguments || formal_parameter_count == arity; 3520 dont_adapt_arguments || formal_parameter_count == arity;
(...skipping 2252 matching lines...) Expand 10 before | Expand all | Expand 10 after
5773 Register null_value = r8; 5773 Register null_value = r8;
5774 __ LoadRoot(null_value, Heap::kNullValueRootIndex); 5774 __ LoadRoot(null_value, Heap::kNullValueRootIndex);
5775 __ CheckEnumCache(null_value, &call_runtime); 5775 __ CheckEnumCache(null_value, &call_runtime);
5776 5776
5777 __ LoadP(r3, FieldMemOperand(r3, HeapObject::kMapOffset)); 5777 __ LoadP(r3, FieldMemOperand(r3, HeapObject::kMapOffset));
5778 __ b(&use_cache); 5778 __ b(&use_cache);
5779 5779
5780 // Get the set of properties to enumerate. 5780 // Get the set of properties to enumerate.
5781 __ bind(&call_runtime); 5781 __ bind(&call_runtime);
5782 __ push(r3); 5782 __ push(r3);
5783 CallRuntime(Runtime::kGetPropertyNamesFast, 1, instr); 5783 CallRuntime(Runtime::kGetPropertyNamesFast, instr);
5784 5784
5785 __ LoadP(r4, FieldMemOperand(r3, HeapObject::kMapOffset)); 5785 __ LoadP(r4, FieldMemOperand(r3, HeapObject::kMapOffset));
5786 __ LoadRoot(ip, Heap::kMetaMapRootIndex); 5786 __ LoadRoot(ip, Heap::kMetaMapRootIndex);
5787 __ cmp(r4, ip); 5787 __ cmp(r4, ip);
5788 DeoptimizeIf(ne, instr, Deoptimizer::kWrongMap); 5788 DeoptimizeIf(ne, instr, Deoptimizer::kWrongMap);
5789 __ bind(&use_cache); 5789 __ bind(&use_cache);
5790 } 5790 }
5791 5791
5792 5792
5793 void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) { 5793 void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
5894 void LCodeGen::DoStoreFrameContext(LStoreFrameContext* instr) { 5894 void LCodeGen::DoStoreFrameContext(LStoreFrameContext* instr) {
5895 Register context = ToRegister(instr->context()); 5895 Register context = ToRegister(instr->context());
5896 __ StoreP(context, MemOperand(fp, StandardFrameConstants::kContextOffset)); 5896 __ StoreP(context, MemOperand(fp, StandardFrameConstants::kContextOffset));
5897 } 5897 }
5898 5898
5899 5899
5900 void LCodeGen::DoAllocateBlockContext(LAllocateBlockContext* instr) { 5900 void LCodeGen::DoAllocateBlockContext(LAllocateBlockContext* instr) {
5901 Handle<ScopeInfo> scope_info = instr->scope_info(); 5901 Handle<ScopeInfo> scope_info = instr->scope_info();
5902 __ Push(scope_info); 5902 __ Push(scope_info);
5903 __ push(ToRegister(instr->function())); 5903 __ push(ToRegister(instr->function()));
5904 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5904 CallRuntime(Runtime::kPushBlockContext, instr);
5905 RecordSafepoint(Safepoint::kNoLazyDeopt); 5905 RecordSafepoint(Safepoint::kNoLazyDeopt);
5906 } 5906 }
5907 5907
5908 5908
5909 #undef __ 5909 #undef __
5910 } // namespace internal 5910 } // namespace internal
5911 } // namespace v8 5911 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698