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

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

Issue 59853002: MIPS: Use loop to initialize locals when optimizing for size. (Closed) Base URL: https://github.com/v8/v8.git@gbl
Patch Set: 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
« 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 info->set_prologue_offset(masm_->pc_offset()); 173 info->set_prologue_offset(masm_->pc_offset());
174 __ Prologue(BUILD_FUNCTION_FRAME); 174 __ Prologue(BUILD_FUNCTION_FRAME);
175 info->AddNoFrameRange(0, masm_->pc_offset()); 175 info->AddNoFrameRange(0, masm_->pc_offset());
176 176
177 { Comment cmnt(masm_, "[ Allocate locals"); 177 { Comment cmnt(masm_, "[ Allocate locals");
178 int locals_count = info->scope()->num_stack_slots(); 178 int locals_count = info->scope()->num_stack_slots();
179 // Generators allocate locals, if any, in context slots. 179 // Generators allocate locals, if any, in context slots.
180 ASSERT(!info->function()->is_generator() || locals_count == 0); 180 ASSERT(!info->function()->is_generator() || locals_count == 0);
181 if (locals_count > 0) { 181 if (locals_count > 0) {
182 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); 182 __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
183 for (int i = 0; i < locals_count; i++) { 183 // Emit a loop to initialize stack cells for locals when optimizing for
184 __ push(at); 184 // size. Otherwise, unroll the loop for maximum performance.
185 __ LoadRoot(t5, Heap::kUndefinedValueRootIndex);
186 if (FLAG_optimize_for_size && locals_count > 4) {
187 Label loop;
188 __ li(a2, Operand(locals_count));
189 __ bind(&loop);
190 __ Subu(a2, a2, 1);
191 __ push(t5);
192 __ Branch(&loop, gt, a2, Operand(zero_reg));
193 } else {
194 for (int i = 0; i < locals_count; i++) {
195 __ push(t5);
196 }
185 } 197 }
186 } 198 }
187 } 199 }
188 200
189 bool function_in_register = true; 201 bool function_in_register = true;
190 202
191 // Possibly allocate a local context. 203 // Possibly allocate a local context.
192 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; 204 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
193 if (heap_slots > 0) { 205 if (heap_slots > 0) {
194 Comment cmnt(masm_, "[ Allocate context"); 206 Comment cmnt(masm_, "[ Allocate context");
(...skipping 4796 matching lines...) Expand 10 before | Expand all | Expand 10 after
4991 Assembler::target_address_at(pc_immediate_load_address)) == 5003 Assembler::target_address_at(pc_immediate_load_address)) ==
4992 reinterpret_cast<uint32_t>( 5004 reinterpret_cast<uint32_t>(
4993 isolate->builtins()->OsrAfterStackCheck()->entry())); 5005 isolate->builtins()->OsrAfterStackCheck()->entry()));
4994 return OSR_AFTER_STACK_CHECK; 5006 return OSR_AFTER_STACK_CHECK;
4995 } 5007 }
4996 5008
4997 5009
4998 } } // namespace v8::internal 5010 } } // namespace v8::internal
4999 5011
5000 #endif // V8_TARGET_ARCH_MIPS 5012 #endif // V8_TARGET_ARCH_MIPS
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