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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 __ sw(a2, MemOperand(sp, receiver_offset)); | 164 __ sw(a2, MemOperand(sp, receiver_offset)); |
165 __ bind(&ok); | 165 __ bind(&ok); |
166 } | 166 } |
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 { |
175 // code aging to work properly. | 175 PredictableCodeSizeScope predictible_code_size_scope( |
176 __ Push(ra, fp, cp, a1); | 176 masm_, kNoCodeAgeSequenceLength * Assembler::kInstrSize); |
177 __ nop(Assembler::CODE_AGE_SEQUENCE_NOP); | 177 // The following three instructions must remain together and unmodified |
178 // Adjust fp to point to caller's fp. | 178 // for code aging to work properly. |
179 __ Addu(fp, sp, Operand(2 * kPointerSize)); | 179 if (FLAG_optimize_for_size && FLAG_age_code) { |
| 180 // Pre-age the code. |
| 181 Code* stub = Code::GetPreAgedCodeAgeStub(isolate()); |
| 182 __ nop(Assembler::CODE_AGE_MARKER_NOP); |
| 183 // Save the function's original return address |
| 184 // (it will be clobbered by Call(t9)) |
| 185 __ mov(at, ra); |
| 186 // Load the stub address to t9 and call it |
| 187 __ li(t9, |
| 188 Operand(reinterpret_cast<uint32_t>(stub->instruction_start()))); |
| 189 __ Call(t9); |
| 190 // Record the stub address in the empty space for GetCodeAgeAndParity() |
| 191 __ dd(reinterpret_cast<uint32_t>(stub->instruction_start())); |
| 192 } else { |
| 193 __ Push(ra, fp, cp, a1); |
| 194 __ nop(Assembler::CODE_AGE_SEQUENCE_NOP); |
| 195 // Adjust fp to point to caller's fp. |
| 196 __ Addu(fp, sp, Operand(2 * kPointerSize)); |
| 197 } |
| 198 } |
180 info->AddNoFrameRange(0, masm_->pc_offset()); | 199 info->AddNoFrameRange(0, masm_->pc_offset()); |
181 | 200 |
182 { Comment cmnt(masm_, "[ Allocate locals"); | 201 { Comment cmnt(masm_, "[ Allocate locals"); |
183 int locals_count = info->scope()->num_stack_slots(); | 202 int locals_count = info->scope()->num_stack_slots(); |
184 // Generators allocate locals, if any, in context slots. | 203 // Generators allocate locals, if any, in context slots. |
185 ASSERT(!info->function()->is_generator() || locals_count == 0); | 204 ASSERT(!info->function()->is_generator() || locals_count == 0); |
186 if (locals_count > 0) { | 205 if (locals_count > 0) { |
187 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 206 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
188 for (int i = 0; i < locals_count; i++) { | 207 for (int i = 0; i < locals_count; i++) { |
189 __ push(at); | 208 __ push(at); |
(...skipping 4808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4998 Assembler::target_address_at(pc_immediate_load_address)) == | 5017 Assembler::target_address_at(pc_immediate_load_address)) == |
4999 reinterpret_cast<uint32_t>( | 5018 reinterpret_cast<uint32_t>( |
5000 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5019 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5001 return OSR_AFTER_STACK_CHECK; | 5020 return OSR_AFTER_STACK_CHECK; |
5002 } | 5021 } |
5003 | 5022 |
5004 | 5023 |
5005 } } // namespace v8::internal | 5024 } } // namespace v8::internal |
5006 | 5025 |
5007 #endif // V8_TARGET_ARCH_MIPS | 5026 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |