OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/crankshaft/ppc/lithium-codegen-ppc.h" | 5 #include "src/crankshaft/ppc/lithium-codegen-ppc.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/crankshaft/hydrogen-osr.h" | 10 #include "src/crankshaft/hydrogen-osr.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 if (prologue_offset) { | 117 if (prologue_offset) { |
118 // Prologue logic requires it's starting address in ip and the | 118 // Prologue logic requires it's starting address in ip and the |
119 // corresponding offset from the function entry. | 119 // corresponding offset from the function entry. |
120 prologue_offset += Instruction::kInstrSize; | 120 prologue_offset += Instruction::kInstrSize; |
121 __ addi(ip, ip, Operand(prologue_offset)); | 121 __ addi(ip, ip, Operand(prologue_offset)); |
122 } | 122 } |
123 info()->set_prologue_offset(prologue_offset); | 123 info()->set_prologue_offset(prologue_offset); |
124 if (NeedsEagerFrame()) { | 124 if (NeedsEagerFrame()) { |
125 if (info()->IsStub()) { | 125 if (info()->IsStub()) { |
126 __ StubPrologue(ip, prologue_offset); | 126 __ StubPrologue(StackFrame::STUB, ip, prologue_offset); |
127 } else { | 127 } else { |
128 __ Prologue(info()->GeneratePreagedPrologue(), ip, prologue_offset); | 128 __ Prologue(info()->GeneratePreagedPrologue(), ip, prologue_offset); |
129 } | 129 } |
130 frame_is_built_ = true; | 130 frame_is_built_ = true; |
131 } | 131 } |
132 | 132 |
133 // Reserve space for the stack slots needed by the code. | 133 // Reserve space for the stack slots needed by the code. |
134 int slots = GetStackSlotCount(); | 134 int slots = GetStackSlotCount(); |
135 if (slots > 0) { | 135 if (slots > 0) { |
136 __ subi(sp, sp, Operand(slots * kPointerSize)); | 136 __ subi(sp, sp, Operand(slots * kPointerSize)); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 "-------------------- Deferred %s --------------------", | 258 "-------------------- Deferred %s --------------------", |
259 code->instruction_index(), code->instr()->hydrogen_value()->id(), | 259 code->instruction_index(), code->instr()->hydrogen_value()->id(), |
260 code->instr()->Mnemonic()); | 260 code->instr()->Mnemonic()); |
261 __ bind(code->entry()); | 261 __ bind(code->entry()); |
262 if (NeedsDeferredFrame()) { | 262 if (NeedsDeferredFrame()) { |
263 Comment(";;; Build frame"); | 263 Comment(";;; Build frame"); |
264 DCHECK(!frame_is_built_); | 264 DCHECK(!frame_is_built_); |
265 DCHECK(info()->IsStub()); | 265 DCHECK(info()->IsStub()); |
266 frame_is_built_ = true; | 266 frame_is_built_ = true; |
267 __ LoadSmiLiteral(scratch0(), Smi::FromInt(StackFrame::STUB)); | 267 __ LoadSmiLiteral(scratch0(), Smi::FromInt(StackFrame::STUB)); |
268 __ PushFixedFrame(scratch0()); | 268 __ PushCommonFrame(scratch0()); |
269 __ addi(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | |
270 Comment(";;; Deferred code"); | 269 Comment(";;; Deferred code"); |
271 } | 270 } |
272 code->Generate(); | 271 code->Generate(); |
273 if (NeedsDeferredFrame()) { | 272 if (NeedsDeferredFrame()) { |
274 Comment(";;; Destroy frame"); | 273 Comment(";;; Destroy frame"); |
275 DCHECK(frame_is_built_); | 274 DCHECK(frame_is_built_); |
276 __ PopFixedFrame(ip); | 275 __ PopCommonFrame(scratch0()); |
277 frame_is_built_ = false; | 276 frame_is_built_ = false; |
278 } | 277 } |
279 __ b(code->exit()); | 278 __ b(code->exit()); |
280 } | 279 } |
281 } | 280 } |
282 | 281 |
283 return !is_aborted(); | 282 return !is_aborted(); |
284 } | 283 } |
285 | 284 |
286 | 285 |
(...skipping 28 matching lines...) Expand all Loading... |
315 DeoptComment(table_entry->deopt_info); | 314 DeoptComment(table_entry->deopt_info); |
316 | 315 |
317 // Second-level deopt table entries are contiguous and small, so instead | 316 // Second-level deopt table entries are contiguous and small, so instead |
318 // of loading the full, absolute address of each one, load an immediate | 317 // of loading the full, absolute address of each one, load an immediate |
319 // offset which will be added to the base address later. | 318 // offset which will be added to the base address later. |
320 __ mov(entry_offset, Operand(entry - base)); | 319 __ mov(entry_offset, Operand(entry - base)); |
321 | 320 |
322 if (table_entry->needs_frame) { | 321 if (table_entry->needs_frame) { |
323 DCHECK(!info()->saves_caller_doubles()); | 322 DCHECK(!info()->saves_caller_doubles()); |
324 Comment(";;; call deopt with frame"); | 323 Comment(";;; call deopt with frame"); |
325 __ PushFixedFrame(); | 324 __ PushCommonFrame(); |
326 __ b(&needs_frame, SetLK); | 325 __ b(&needs_frame, SetLK); |
327 } else { | 326 } else { |
328 __ b(&call_deopt_entry, SetLK); | 327 __ b(&call_deopt_entry, SetLK); |
329 } | 328 } |
330 info()->LogDeoptCallPosition(masm()->pc_offset(), | 329 info()->LogDeoptCallPosition(masm()->pc_offset(), |
331 table_entry->deopt_info.inlining_id); | 330 table_entry->deopt_info.inlining_id); |
332 } | 331 } |
333 | 332 |
334 if (needs_frame.is_linked()) { | 333 if (needs_frame.is_linked()) { |
335 __ bind(&needs_frame); | 334 __ bind(&needs_frame); |
336 // This variant of deopt can only be used with stubs. Since we don't | 335 // This variant of deopt can only be used with stubs. Since we don't |
337 // have a function pointer to install in the stack frame that we're | 336 // have a function pointer to install in the stack frame that we're |
338 // building, install a special marker there instead. | 337 // building, install a special marker there instead. |
339 DCHECK(info()->IsStub()); | |
340 __ LoadSmiLiteral(ip, Smi::FromInt(StackFrame::STUB)); | 338 __ LoadSmiLiteral(ip, Smi::FromInt(StackFrame::STUB)); |
341 __ push(ip); | 339 __ push(ip); |
342 __ addi(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | 340 DCHECK(info()->IsStub()); |
343 } | 341 } |
344 | 342 |
345 Comment(";;; call deopt"); | 343 Comment(";;; call deopt"); |
346 __ bind(&call_deopt_entry); | 344 __ bind(&call_deopt_entry); |
347 | 345 |
348 if (info()->saves_caller_doubles()) { | 346 if (info()->saves_caller_doubles()) { |
349 DCHECK(info()->IsStub()); | 347 DCHECK(info()->IsStub()); |
350 RestoreCallerDoubles(); | 348 RestoreCallerDoubles(); |
351 } | 349 } |
352 | 350 |
(...skipping 2851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3204 | 3202 |
3205 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { | 3203 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { |
3206 Register scratch = scratch0(); | 3204 Register scratch = scratch0(); |
3207 Register result = ToRegister(instr->result()); | 3205 Register result = ToRegister(instr->result()); |
3208 | 3206 |
3209 if (instr->hydrogen()->from_inlined()) { | 3207 if (instr->hydrogen()->from_inlined()) { |
3210 __ subi(result, sp, Operand(2 * kPointerSize)); | 3208 __ subi(result, sp, Operand(2 * kPointerSize)); |
3211 } else { | 3209 } else { |
3212 // Check if the calling frame is an arguments adaptor frame. | 3210 // Check if the calling frame is an arguments adaptor frame. |
3213 __ LoadP(scratch, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 3211 __ LoadP(scratch, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
3214 __ LoadP(result, | 3212 __ LoadP( |
3215 MemOperand(scratch, StandardFrameConstants::kContextOffset)); | 3213 result, |
| 3214 MemOperand(scratch, CommonFrameConstants::kContextOrFrameTypeOffset)); |
3216 __ CmpSmiLiteral(result, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); | 3215 __ CmpSmiLiteral(result, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); |
3217 | 3216 |
3218 // Result is the frame pointer for the frame if not adapted and for the real | 3217 // Result is the frame pointer for the frame if not adapted and for the real |
3219 // frame below the adaptor frame if adapted. | 3218 // frame below the adaptor frame if adapted. |
3220 if (CpuFeatures::IsSupported(ISELECT)) { | 3219 if (CpuFeatures::IsSupported(ISELECT)) { |
3221 __ isel(eq, result, scratch, fp); | 3220 __ isel(eq, result, scratch, fp); |
3222 } else { | 3221 } else { |
3223 Label done, adapted; | 3222 Label done, adapted; |
3224 __ beq(&adapted); | 3223 __ beq(&adapted); |
3225 __ mr(result, fp); | 3224 __ mr(result, fp); |
(...skipping 2527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5753 | 5752 |
5754 void LCodeGen::DoStoreFrameContext(LStoreFrameContext* instr) { | 5753 void LCodeGen::DoStoreFrameContext(LStoreFrameContext* instr) { |
5755 Register context = ToRegister(instr->context()); | 5754 Register context = ToRegister(instr->context()); |
5756 __ StoreP(context, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 5755 __ StoreP(context, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
5757 } | 5756 } |
5758 | 5757 |
5759 | 5758 |
5760 #undef __ | 5759 #undef __ |
5761 } // namespace internal | 5760 } // namespace internal |
5762 } // namespace v8 | 5761 } // namespace v8 |
OLD | NEW |