| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 172 |
| 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); | |
| 183 // Emit a loop to initialize stack cells for locals when optimizing for | 182 // Emit a loop to initialize stack cells for locals when optimizing for |
| 184 // size. Otherwise, unroll the loop for maximum performance. | 183 // size. Otherwise, unroll the loop for maximum performance. |
| 185 __ LoadRoot(t5, Heap::kUndefinedValueRootIndex); | 184 __ LoadRoot(t5, Heap::kUndefinedValueRootIndex); |
| 186 if (FLAG_optimize_for_size && locals_count > 4) { | 185 if ((FLAG_optimize_for_size && locals_count > 4) || |
| 186 !is_int16(locals_count)) { |
| 187 Label loop; | 187 Label loop; |
| 188 __ li(a2, Operand(locals_count)); | 188 __ Subu(a2, sp, Operand(locals_count * kPointerSize)); |
| 189 __ bind(&loop); | 189 __ bind(&loop); |
| 190 __ Subu(a2, a2, 1); | 190 __ Subu(sp, sp, Operand(kPointerSize)); |
| 191 __ push(t5); | 191 __ Branch(&loop, gt, sp, Operand(a2), USE_DELAY_SLOT); |
| 192 __ Branch(&loop, gt, a2, Operand(zero_reg)); | 192 __ sw(t5, MemOperand(sp, 0)); // Push in the delay slot. |
| 193 } else { | 193 } else { |
| 194 __ Subu(sp, sp, Operand(locals_count * kPointerSize)); |
| 194 for (int i = 0; i < locals_count; i++) { | 195 for (int i = 0; i < locals_count; i++) { |
| 195 __ push(t5); | 196 __ sw(t5, MemOperand(sp, i * kPointerSize)); |
| 196 } | 197 } |
| 197 } | 198 } |
| 198 } | 199 } |
| 199 } | 200 } |
| 200 | 201 |
| 201 bool function_in_register = true; | 202 bool function_in_register = true; |
| 202 | 203 |
| 203 // Possibly allocate a local context. | 204 // Possibly allocate a local context. |
| 204 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 205 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
| 205 if (heap_slots > 0) { | 206 if (heap_slots > 0) { |
| (...skipping 4762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4968 Assembler::target_address_at(pc_immediate_load_address)) == | 4969 Assembler::target_address_at(pc_immediate_load_address)) == |
| 4969 reinterpret_cast<uint32_t>( | 4970 reinterpret_cast<uint32_t>( |
| 4970 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4971 isolate->builtins()->OsrAfterStackCheck()->entry())); |
| 4971 return OSR_AFTER_STACK_CHECK; | 4972 return OSR_AFTER_STACK_CHECK; |
| 4972 } | 4973 } |
| 4973 | 4974 |
| 4974 | 4975 |
| 4975 } } // namespace v8::internal | 4976 } } // namespace v8::internal |
| 4976 | 4977 |
| 4977 #endif // V8_TARGET_ARCH_MIPS | 4978 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |