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

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 6534022: Optimize functions needing a local context.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/lithium-codegen-arm.h ('k') | src/hydrogen.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 Label loop; 137 Label loop;
138 __ bind(&loop); 138 __ bind(&loop);
139 __ push(r2); 139 __ push(r2);
140 __ sub(r0, r0, Operand(1), SetCC); 140 __ sub(r0, r0, Operand(1), SetCC);
141 __ b(ne, &loop); 141 __ b(ne, &loop);
142 } else { 142 } else {
143 __ sub(sp, sp, Operand(slots * kPointerSize)); 143 __ sub(sp, sp, Operand(slots * kPointerSize));
144 } 144 }
145 } 145 }
146 146
147 // Possibly allocate a local context.
148 int heap_slots = scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
149 if (heap_slots > 0) {
150 Comment(";;; Allocate local context");
151 // Argument to NewContext is the function, which is in r1.
152 __ push(r1);
153 if (heap_slots <= FastNewContextStub::kMaximumSlots) {
154 FastNewContextStub stub(heap_slots);
155 __ CallStub(&stub);
156 } else {
157 __ CallRuntime(Runtime::kNewContext, 1);
158 }
159 RecordSafepoint(Safepoint::kNoDeoptimizationIndex);
160 // Context is returned in both r0 and cp. It replaces the context
161 // passed to us. It's saved in the stack and kept live in cp.
162 __ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
163 // Copy any necessary parameters into the context.
164 int num_parameters = scope()->num_parameters();
165 for (int i = 0; i < num_parameters; i++) {
166 Slot* slot = scope()->parameter(i)->AsSlot();
167 if (slot != NULL && slot->type() == Slot::CONTEXT) {
168 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
169 (num_parameters - 1 - i) * kPointerSize;
170 // Load parameter from stack.
171 __ ldr(r0, MemOperand(fp, parameter_offset));
172 // Store it in the context.
173 __ mov(r1, Operand(Context::SlotOffset(slot->index())));
174 __ str(r0, MemOperand(cp, r1));
175 // Update the write barrier. This clobbers all involved
176 // registers, so we have to use two more registers to avoid
177 // clobbering cp.
178 __ mov(r2, Operand(cp));
179 __ RecordWrite(r2, Operand(r1), r3, r0);
180 }
181 }
182 Comment(";;; End allocate local context");
183 }
184
147 // Trace the call. 185 // Trace the call.
148 if (FLAG_trace) { 186 if (FLAG_trace) {
149 __ CallRuntime(Runtime::kTraceEnter, 0); 187 __ CallRuntime(Runtime::kTraceEnter, 0);
150 } 188 }
151 return !is_aborted(); 189 return !is_aborted();
152 } 190 }
153 191
154 192
155 bool LCodeGen::GenerateBody() { 193 bool LCodeGen::GenerateBody() {
156 ASSERT(is_generating()); 194 ASSERT(is_generating());
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 } 646 }
609 } 647 }
610 648
611 649
612 void LCodeGen::RecordSafepoint(LPointerMap* pointers, 650 void LCodeGen::RecordSafepoint(LPointerMap* pointers,
613 int deoptimization_index) { 651 int deoptimization_index) {
614 RecordSafepoint(pointers, Safepoint::kSimple, 0, deoptimization_index); 652 RecordSafepoint(pointers, Safepoint::kSimple, 0, deoptimization_index);
615 } 653 }
616 654
617 655
656 void LCodeGen::RecordSafepoint(int deoptimization_index) {
657 LPointerMap empty_pointers(RelocInfo::kNoPosition);
658 RecordSafepoint(&empty_pointers, deoptimization_index);
659 }
660
661
618 void LCodeGen::RecordSafepointWithRegisters(LPointerMap* pointers, 662 void LCodeGen::RecordSafepointWithRegisters(LPointerMap* pointers,
619 int arguments, 663 int arguments,
620 int deoptimization_index) { 664 int deoptimization_index) {
621 RecordSafepoint(pointers, Safepoint::kWithRegisters, arguments, 665 RecordSafepoint(pointers, Safepoint::kWithRegisters, arguments,
622 deoptimization_index); 666 deoptimization_index);
623 } 667 }
624 668
625 669
626 void LCodeGen::RecordSafepointWithRegistersAndDoubles( 670 void LCodeGen::RecordSafepointWithRegistersAndDoubles(
627 LPointerMap* pointers, 671 LPointerMap* pointers,
(...skipping 3094 matching lines...) Expand 10 before | Expand all | Expand 10 after
3722 ASSERT(!environment->HasBeenRegistered()); 3766 ASSERT(!environment->HasBeenRegistered());
3723 RegisterEnvironmentForDeoptimization(environment); 3767 RegisterEnvironmentForDeoptimization(environment);
3724 ASSERT(osr_pc_offset_ == -1); 3768 ASSERT(osr_pc_offset_ == -1);
3725 osr_pc_offset_ = masm()->pc_offset(); 3769 osr_pc_offset_ = masm()->pc_offset();
3726 } 3770 }
3727 3771
3728 3772
3729 #undef __ 3773 #undef __
3730 3774
3731 } } // namespace v8::internal 3775 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698