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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 } | 132 } |
133 | 133 |
134 info()->set_prologue_offset(masm_->pc_offset()); | 134 info()->set_prologue_offset(masm_->pc_offset()); |
135 if (NeedsEagerFrame()) { | 135 if (NeedsEagerFrame()) { |
136 if (info()->IsStub()) { | 136 if (info()->IsStub()) { |
137 __ Push(ra, fp, cp); | 137 __ Push(ra, fp, cp); |
138 __ Push(Smi::FromInt(StackFrame::STUB)); | 138 __ Push(Smi::FromInt(StackFrame::STUB)); |
139 // Adjust FP to point to saved FP. | 139 // Adjust FP to point to saved FP. |
140 __ Addu(fp, sp, Operand(2 * kPointerSize)); | 140 __ Addu(fp, sp, Operand(2 * kPointerSize)); |
141 } else { | 141 } else { |
| 142 PredictableCodeSizeScope predictible_code_size_scope( |
| 143 masm_, kNoCodeAgeSequenceLength * Assembler::kInstrSize); |
142 // The following three instructions must remain together and unmodified | 144 // The following three instructions must remain together and unmodified |
143 // for code aging to work properly. | 145 // for code aging to work properly. |
144 __ Push(ra, fp, cp, a1); | 146 if (FLAG_optimize_for_size && FLAG_age_code) { |
145 // Add unused nop to ensure prologue sequence is identical for | 147 // Pre-age the code. |
146 // full-codegen and lithium-codegen. | 148 Code* stub = Code::GetPreAgedCodeAgeStub(isolate()); |
147 __ nop(Assembler::CODE_AGE_SEQUENCE_NOP); | 149 __ nop(Assembler::CODE_AGE_MARKER_NOP); |
148 // Adj. FP to point to saved FP. | 150 // Save the function's original return address |
149 __ Addu(fp, sp, Operand(2 * kPointerSize)); | 151 // (it will be clobbered by Call(t9)) |
| 152 __ mov(at, ra); |
| 153 // Load the stub address to t9 and call it |
| 154 __ li(t9, |
| 155 Operand(reinterpret_cast<uint32_t>(stub->instruction_start()))); |
| 156 __ Call(t9); |
| 157 // Record the stub address in the empty space for GetCodeAgeAndParity() |
| 158 __ dd(reinterpret_cast<uint32_t>(stub->instruction_start())); |
| 159 } else { |
| 160 __ Push(ra, fp, cp, a1); |
| 161 __ nop(Assembler::CODE_AGE_SEQUENCE_NOP); |
| 162 // Adjust fp to point to caller's fp. |
| 163 __ Addu(fp, sp, Operand(2 * kPointerSize)); |
| 164 } |
150 } | 165 } |
151 frame_is_built_ = true; | 166 frame_is_built_ = true; |
152 info_->AddNoFrameRange(0, masm_->pc_offset()); | 167 info_->AddNoFrameRange(0, masm_->pc_offset()); |
153 } | 168 } |
154 | 169 |
155 // Reserve space for the stack slots needed by the code. | 170 // Reserve space for the stack slots needed by the code. |
156 int slots = GetStackSlotCount(); | 171 int slots = GetStackSlotCount(); |
157 if (slots > 0) { | 172 if (slots > 0) { |
158 if (FLAG_debug_code) { | 173 if (FLAG_debug_code) { |
159 __ Subu(sp, sp, Operand(slots * kPointerSize)); | 174 __ Subu(sp, sp, Operand(slots * kPointerSize)); |
(...skipping 5665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5825 __ Subu(scratch, result, scratch); | 5840 __ Subu(scratch, result, scratch); |
5826 __ lw(result, FieldMemOperand(scratch, | 5841 __ lw(result, FieldMemOperand(scratch, |
5827 FixedArray::kHeaderSize - kPointerSize)); | 5842 FixedArray::kHeaderSize - kPointerSize)); |
5828 __ bind(&done); | 5843 __ bind(&done); |
5829 } | 5844 } |
5830 | 5845 |
5831 | 5846 |
5832 #undef __ | 5847 #undef __ |
5833 | 5848 |
5834 } } // namespace v8::internal | 5849 } } // namespace v8::internal |
OLD | NEW |