OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/arm/lithium-codegen-arm.h" | 5 #include "src/crankshaft/arm/lithium-codegen-arm.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/arm/lithium-gap-resolver-arm.h" | 10 #include "src/crankshaft/arm/lithium-gap-resolver-arm.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // r1: Callee's JS function. | 106 // r1: Callee's JS function. |
107 // cp: Callee's context. | 107 // cp: Callee's context. |
108 // pp: Callee's constant pool pointer (if enabled) | 108 // pp: Callee's constant pool pointer (if enabled) |
109 // fp: Caller's frame pointer. | 109 // fp: Caller's frame pointer. |
110 // lr: Caller's pc. | 110 // lr: Caller's pc. |
111 } | 111 } |
112 | 112 |
113 info()->set_prologue_offset(masm_->pc_offset()); | 113 info()->set_prologue_offset(masm_->pc_offset()); |
114 if (NeedsEagerFrame()) { | 114 if (NeedsEagerFrame()) { |
115 if (info()->IsStub()) { | 115 if (info()->IsStub()) { |
116 __ StubPrologue(); | 116 __ StubPrologue(StackFrame::STUB); |
117 } else { | 117 } else { |
118 __ Prologue(info()->GeneratePreagedPrologue()); | 118 __ Prologue(info()->GeneratePreagedPrologue()); |
119 } | 119 } |
120 frame_is_built_ = true; | 120 frame_is_built_ = true; |
121 } | 121 } |
122 | 122 |
123 // Reserve space for the stack slots needed by the code. | 123 // Reserve space for the stack slots needed by the code. |
124 int slots = GetStackSlotCount(); | 124 int slots = GetStackSlotCount(); |
125 if (slots > 0) { | 125 if (slots > 0) { |
126 if (FLAG_debug_code) { | 126 if (FLAG_debug_code) { |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 "-------------------- Deferred %s --------------------", | 256 "-------------------- Deferred %s --------------------", |
257 code->instruction_index(), | 257 code->instruction_index(), |
258 code->instr()->hydrogen_value()->id(), | 258 code->instr()->hydrogen_value()->id(), |
259 code->instr()->Mnemonic()); | 259 code->instr()->Mnemonic()); |
260 __ bind(code->entry()); | 260 __ bind(code->entry()); |
261 if (NeedsDeferredFrame()) { | 261 if (NeedsDeferredFrame()) { |
262 Comment(";;; Build frame"); | 262 Comment(";;; Build frame"); |
263 DCHECK(!frame_is_built_); | 263 DCHECK(!frame_is_built_); |
264 DCHECK(info()->IsStub()); | 264 DCHECK(info()->IsStub()); |
265 frame_is_built_ = true; | 265 frame_is_built_ = true; |
266 __ PushFixedFrame(); | 266 __ Move(scratch0(), Smi::FromInt(StackFrame::STUB)); |
267 __ mov(scratch0(), Operand(Smi::FromInt(StackFrame::STUB))); | 267 __ PushCommonFrame(scratch0()); |
268 __ push(scratch0()); | |
269 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | |
270 Comment(";;; Deferred code"); | 268 Comment(";;; Deferred code"); |
271 } | 269 } |
272 code->Generate(); | 270 code->Generate(); |
273 if (NeedsDeferredFrame()) { | 271 if (NeedsDeferredFrame()) { |
274 Comment(";;; Destroy frame"); | 272 Comment(";;; Destroy frame"); |
275 DCHECK(frame_is_built_); | 273 DCHECK(frame_is_built_); |
276 __ pop(ip); | 274 __ PopCommonFrame(scratch0()); |
277 __ PopFixedFrame(); | |
278 frame_is_built_ = false; | 275 frame_is_built_ = false; |
279 } | 276 } |
280 __ jmp(code->exit()); | 277 __ jmp(code->exit()); |
281 } | 278 } |
282 } | 279 } |
283 | 280 |
284 // Force constant pool emission at the end of the deferred code to make | 281 // Force constant pool emission at the end of the deferred code to make |
285 // sure that no constant pools are emitted after. | 282 // sure that no constant pools are emitted after. |
286 masm()->CheckConstPool(true, false); | 283 masm()->CheckConstPool(true, false); |
287 | 284 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 DeoptComment(table_entry->deopt_info); | 317 DeoptComment(table_entry->deopt_info); |
321 | 318 |
322 // Second-level deopt table entries are contiguous and small, so instead | 319 // Second-level deopt table entries are contiguous and small, so instead |
323 // of loading the full, absolute address of each one, load an immediate | 320 // of loading the full, absolute address of each one, load an immediate |
324 // offset which will be added to the base address later. | 321 // offset which will be added to the base address later. |
325 __ mov(entry_offset, Operand(entry - base)); | 322 __ mov(entry_offset, Operand(entry - base)); |
326 | 323 |
327 if (table_entry->needs_frame) { | 324 if (table_entry->needs_frame) { |
328 DCHECK(!info()->saves_caller_doubles()); | 325 DCHECK(!info()->saves_caller_doubles()); |
329 Comment(";;; call deopt with frame"); | 326 Comment(";;; call deopt with frame"); |
330 __ PushFixedFrame(); | 327 __ PushCommonFrame(); |
331 __ bl(&needs_frame); | 328 __ bl(&needs_frame); |
332 } else { | 329 } else { |
333 __ bl(&call_deopt_entry); | 330 __ bl(&call_deopt_entry); |
334 } | 331 } |
335 info()->LogDeoptCallPosition(masm()->pc_offset(), | 332 info()->LogDeoptCallPosition(masm()->pc_offset(), |
336 table_entry->deopt_info.inlining_id); | 333 table_entry->deopt_info.inlining_id); |
337 masm()->CheckConstPool(false, false); | 334 masm()->CheckConstPool(false, false); |
338 } | 335 } |
339 | 336 |
340 if (needs_frame.is_linked()) { | 337 if (needs_frame.is_linked()) { |
341 __ bind(&needs_frame); | 338 __ bind(&needs_frame); |
342 // This variant of deopt can only be used with stubs. Since we don't | 339 // This variant of deopt can only be used with stubs. Since we don't |
343 // have a function pointer to install in the stack frame that we're | 340 // have a function pointer to install in the stack frame that we're |
344 // building, install a special marker there instead. | 341 // building, install a special marker there instead. |
345 DCHECK(info()->IsStub()); | |
346 __ mov(ip, Operand(Smi::FromInt(StackFrame::STUB))); | 342 __ mov(ip, Operand(Smi::FromInt(StackFrame::STUB))); |
347 __ push(ip); | 343 __ push(ip); |
348 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | 344 DCHECK(info()->IsStub()); |
349 } | 345 } |
350 | 346 |
351 Comment(";;; call deopt"); | 347 Comment(";;; call deopt"); |
352 __ bind(&call_deopt_entry); | 348 __ bind(&call_deopt_entry); |
353 | 349 |
354 if (info()->saves_caller_doubles()) { | 350 if (info()->saves_caller_doubles()) { |
355 DCHECK(info()->IsStub()); | 351 DCHECK(info()->IsStub()); |
356 RestoreCallerDoubles(); | 352 RestoreCallerDoubles(); |
357 } | 353 } |
358 | 354 |
(...skipping 2694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3053 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { | 3049 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { |
3054 Register scratch = scratch0(); | 3050 Register scratch = scratch0(); |
3055 Register result = ToRegister(instr->result()); | 3051 Register result = ToRegister(instr->result()); |
3056 | 3052 |
3057 if (instr->hydrogen()->from_inlined()) { | 3053 if (instr->hydrogen()->from_inlined()) { |
3058 __ sub(result, sp, Operand(2 * kPointerSize)); | 3054 __ sub(result, sp, Operand(2 * kPointerSize)); |
3059 } else { | 3055 } else { |
3060 // Check if the calling frame is an arguments adaptor frame. | 3056 // Check if the calling frame is an arguments adaptor frame. |
3061 Label done, adapted; | 3057 Label done, adapted; |
3062 __ ldr(scratch, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 3058 __ ldr(scratch, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
3063 __ ldr(result, MemOperand(scratch, StandardFrameConstants::kContextOffset)); | 3059 __ ldr(result, MemOperand(scratch, |
| 3060 CommonFrameConstants::kContextOrFrameTypeOffset)); |
3064 __ cmp(result, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 3061 __ cmp(result, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
3065 | 3062 |
3066 // Result is the frame pointer for the frame if not adapted and for the real | 3063 // Result is the frame pointer for the frame if not adapted and for the real |
3067 // frame below the adaptor frame if adapted. | 3064 // frame below the adaptor frame if adapted. |
3068 __ mov(result, fp, LeaveCC, ne); | 3065 __ mov(result, fp, LeaveCC, ne); |
3069 __ mov(result, scratch, LeaveCC, eq); | 3066 __ mov(result, scratch, LeaveCC, eq); |
3070 } | 3067 } |
3071 } | 3068 } |
3072 | 3069 |
3073 | 3070 |
(...skipping 2477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5551 void LCodeGen::DoStoreFrameContext(LStoreFrameContext* instr) { | 5548 void LCodeGen::DoStoreFrameContext(LStoreFrameContext* instr) { |
5552 Register context = ToRegister(instr->context()); | 5549 Register context = ToRegister(instr->context()); |
5553 __ str(context, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 5550 __ str(context, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
5554 } | 5551 } |
5555 | 5552 |
5556 | 5553 |
5557 #undef __ | 5554 #undef __ |
5558 | 5555 |
5559 } // namespace internal | 5556 } // namespace internal |
5560 } // namespace v8 | 5557 } // namespace v8 |
OLD | NEW |