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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 167 |
168 // Open a frame scope to indicate that there is a frame on the stack. The | 168 // Open a frame scope to indicate that there is a frame on the stack. The |
169 // MANUAL indicates that the scope shouldn't actually generate code to set up | 169 // MANUAL indicates that the scope shouldn't actually generate code to set up |
170 // the frame (that is done below). | 170 // the frame (that is done below). |
171 FrameScope frame_scope(masm_, StackFrame::MANUAL); | 171 FrameScope frame_scope(masm_, StackFrame::MANUAL); |
172 | 172 |
173 info->set_prologue_offset(masm_->pc_offset()); | 173 info->set_prologue_offset(masm_->pc_offset()); |
174 // The following three instructions must remain together and unmodified for | 174 // The following three instructions must remain together and unmodified for |
175 // code aging to work properly. | 175 // code aging to work properly. |
176 __ Push(ra, fp, cp, a1); | 176 __ Push(ra, fp, cp, a1); |
177 // Load undefined value here, so the value is ready for the loop | 177 __ nop(Assembler::CODE_AGE_SEQUENCE_NOP); |
178 // below. | |
179 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | |
180 // Adjust fp to point to caller's fp. | 178 // Adjust fp to point to caller's fp. |
181 __ Addu(fp, sp, Operand(2 * kPointerSize)); | 179 __ Addu(fp, sp, Operand(2 * kPointerSize)); |
182 info->AddNoFrameRange(0, masm_->pc_offset()); | 180 info->AddNoFrameRange(0, masm_->pc_offset()); |
183 | 181 |
184 { Comment cmnt(masm_, "[ Allocate locals"); | 182 { Comment cmnt(masm_, "[ Allocate locals"); |
185 int locals_count = info->scope()->num_stack_slots(); | 183 int locals_count = info->scope()->num_stack_slots(); |
186 // Generators allocate locals, if any, in context slots. | 184 // Generators allocate locals, if any, in context slots. |
187 ASSERT(!info->function()->is_generator() || locals_count == 0); | 185 ASSERT(!info->function()->is_generator() || locals_count == 0); |
188 for (int i = 0; i < locals_count; i++) { | 186 if (locals_count > 0) { |
189 __ push(at); | 187 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
| 188 for (int i = 0; i < locals_count; i++) { |
| 189 __ push(at); |
| 190 } |
190 } | 191 } |
191 } | 192 } |
192 | 193 |
193 bool function_in_register = true; | 194 bool function_in_register = true; |
194 | 195 |
195 // Possibly allocate a local context. | 196 // Possibly allocate a local context. |
196 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 197 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
197 if (heap_slots > 0) { | 198 if (heap_slots > 0) { |
198 Comment cmnt(masm_, "[ Allocate context"); | 199 Comment cmnt(masm_, "[ Allocate context"); |
199 // Argument to NewContext is the function, which is still in a1. | 200 // Argument to NewContext is the function, which is still in a1. |
(...skipping 4745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4945 *context_length = 0; | 4946 *context_length = 0; |
4946 return previous_; | 4947 return previous_; |
4947 } | 4948 } |
4948 | 4949 |
4949 | 4950 |
4950 #undef __ | 4951 #undef __ |
4951 | 4952 |
4952 } } // namespace v8::internal | 4953 } } // namespace v8::internal |
4953 | 4954 |
4954 #endif // V8_TARGET_ARCH_MIPS | 4955 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |