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

Side by Side Diff: src/arm/virtual-frame-arm.cc

Issue 515012: Use a loop in generated code to allocate stack slots for function with many l... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years 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/virtual-frame-arm.h ('k') | src/ia32/virtual-frame-ia32.h » ('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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 __ mov(sp, fp); 136 __ mov(sp, fp);
137 __ ldm(ia_w, sp, fp.bit() | lr.bit()); 137 __ ldm(ia_w, sp, fp.bit() | lr.bit());
138 } 138 }
139 139
140 140
141 void VirtualFrame::AllocateStackSlots() { 141 void VirtualFrame::AllocateStackSlots() {
142 int count = local_count(); 142 int count = local_count();
143 if (count > 0) { 143 if (count > 0) {
144 Comment cmnt(masm(), "[ Allocate space for locals"); 144 Comment cmnt(masm(), "[ Allocate space for locals");
145 Adjust(count); 145 Adjust(count);
146 // Initialize stack slots with 'undefined' value. 146 // Initialize stack slots with 'undefined' value.
147 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); 147 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
148 } 148 __ LoadRoot(r2, Heap::kStackLimitRootIndex);
149 __ LoadRoot(r2, Heap::kStackLimitRootIndex); 149 if (count < kLocalVarBound) {
150 for (int i = 0; i < count; i++) { 150 // For less locals the unrolled loop is more compact.
151 __ push(ip); 151 for (int i = 0; i < count; i++) {
152 __ push(ip);
153 }
154 } else {
155 // For more locals a loop in generated code is more compact.
156 Label alloc_locals_loop;
157 __ mov(r1, Operand(count));
158 __ bind(&alloc_locals_loop);
159 __ push(ip);
160 __ sub(r1, r1, Operand(1), SetCC);
161 __ b(ne, &alloc_locals_loop);
162 }
163 } else {
164 __ LoadRoot(r2, Heap::kStackLimitRootIndex);
152 } 165 }
153 // Check the stack for overflow or a break request. 166 // Check the stack for overflow or a break request.
154 // Put the lr setup instruction in the delay slot. The kInstrSize is added 167 // Put the lr setup instruction in the delay slot. The kInstrSize is added
155 // to the implicit 8 byte offset that always applies to operations with pc 168 // to the implicit 8 byte offset that always applies to operations with pc
156 // and gives a return address 12 bytes down. 169 // and gives a return address 12 bytes down.
157 masm()->add(lr, pc, Operand(Assembler::kInstrSize)); 170 masm()->add(lr, pc, Operand(Assembler::kInstrSize));
158 masm()->cmp(sp, Operand(r2)); 171 masm()->cmp(sp, Operand(r2));
159 StackCheckStub stub; 172 StackCheckStub stub;
160 // Call the stub if lower. 173 // Call the stub if lower.
161 masm()->mov(pc, 174 masm()->mov(pc,
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 void VirtualFrame::EmitPushMultiple(int count, int src_regs) { 403 void VirtualFrame::EmitPushMultiple(int count, int src_regs) {
391 ASSERT(stack_pointer_ == element_count() - 1); 404 ASSERT(stack_pointer_ == element_count() - 1);
392 Adjust(count); 405 Adjust(count);
393 __ stm(db_w, sp, src_regs); 406 __ stm(db_w, sp, src_regs);
394 } 407 }
395 408
396 409
397 #undef __ 410 #undef __
398 411
399 } } // namespace v8::internal 412 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/virtual-frame-arm.h ('k') | src/ia32/virtual-frame-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698