OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |