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

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

Issue 52163002: ARM: Use loop to initialize locals when optimizing for size. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use r9 as suggested by Vincent. Created 7 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 info->set_prologue_offset(masm_->pc_offset()); 162 info->set_prologue_offset(masm_->pc_offset());
163 __ Prologue(BUILD_FUNCTION_FRAME); 163 __ Prologue(BUILD_FUNCTION_FRAME);
164 info->AddNoFrameRange(0, masm_->pc_offset()); 164 info->AddNoFrameRange(0, masm_->pc_offset());
165 165
166 { Comment cmnt(masm_, "[ Allocate locals"); 166 { Comment cmnt(masm_, "[ Allocate locals");
167 int locals_count = info->scope()->num_stack_slots(); 167 int locals_count = info->scope()->num_stack_slots();
168 // Generators allocate locals, if any, in context slots. 168 // Generators allocate locals, if any, in context slots.
169 ASSERT(!info->function()->is_generator() || locals_count == 0); 169 ASSERT(!info->function()->is_generator() || locals_count == 0);
170 if (locals_count > 0) { 170 if (locals_count > 0) {
171 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); 171 // Emit a loop to initialize stack cells for locals when optimizing for
172 for (int i = 0; i < locals_count; i++) { 172 // size. Otherwise, unroll the loop for maximum performance.
173 __ push(ip); 173 __ LoadRoot(r9, Heap::kUndefinedValueRootIndex);
174 if (FLAG_optimize_for_size && locals_count > 4) {
175 Label loop;
176 __ mov(r2, Operand(locals_count));
177 __ bind(&loop);
178 __ sub(r2, r2, Operand(1), SetCC);
179 __ push(r9);
180 __ b(&loop, ne);
181 } else {
182 for (int i = 0; i < locals_count; i++) {
183 __ push(r9);
184 }
174 } 185 }
175 } 186 }
176 } 187 }
177 188
178 bool function_in_register = true; 189 bool function_in_register = true;
179 190
180 // Possibly allocate a local context. 191 // Possibly allocate a local context.
181 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; 192 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
182 if (heap_slots > 0) { 193 if (heap_slots > 0) {
183 // Argument to NewContext is the function, which is still in r1. 194 // Argument to NewContext is the function, which is still in r1.
(...skipping 4775 matching lines...) Expand 10 before | Expand all | Expand 10 after
4959 ASSERT(Memory::uint32_at(interrupt_address_pointer) == 4970 ASSERT(Memory::uint32_at(interrupt_address_pointer) ==
4960 reinterpret_cast<uint32_t>( 4971 reinterpret_cast<uint32_t>(
4961 isolate->builtins()->OsrAfterStackCheck()->entry())); 4972 isolate->builtins()->OsrAfterStackCheck()->entry()));
4962 return OSR_AFTER_STACK_CHECK; 4973 return OSR_AFTER_STACK_CHECK;
4963 } 4974 }
4964 4975
4965 4976
4966 } } // namespace v8::internal 4977 } } // namespace v8::internal
4967 4978
4968 #endif // V8_TARGET_ARCH_ARM 4979 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698