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/mips64/lithium-codegen-mips64.h" | 5 #include "src/crankshaft/mips64/lithium-codegen-mips64.h" |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/crankshaft/hydrogen-osr.h" | 9 #include "src/crankshaft/hydrogen-osr.h" |
10 #include "src/crankshaft/mips64/lithium-gap-resolver-mips64.h" | 10 #include "src/crankshaft/mips64/lithium-gap-resolver-mips64.h" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 "-------------------- Deferred %s --------------------", | 246 "-------------------- Deferred %s --------------------", |
247 code->instruction_index(), | 247 code->instruction_index(), |
248 code->instr()->hydrogen_value()->id(), | 248 code->instr()->hydrogen_value()->id(), |
249 code->instr()->Mnemonic()); | 249 code->instr()->Mnemonic()); |
250 __ bind(code->entry()); | 250 __ bind(code->entry()); |
251 if (NeedsDeferredFrame()) { | 251 if (NeedsDeferredFrame()) { |
252 Comment(";;; Build frame"); | 252 Comment(";;; Build frame"); |
253 DCHECK(!frame_is_built_); | 253 DCHECK(!frame_is_built_); |
254 DCHECK(info()->IsStub()); | 254 DCHECK(info()->IsStub()); |
255 frame_is_built_ = true; | 255 frame_is_built_ = true; |
256 __ MultiPush(cp.bit() | fp.bit() | ra.bit()); | |
257 __ li(scratch0(), Operand(Smi::FromInt(StackFrame::STUB))); | 256 __ li(scratch0(), Operand(Smi::FromInt(StackFrame::STUB))); |
258 __ push(scratch0()); | 257 __ PushCommonFrame(scratch0()); |
259 __ Daddu(fp, sp, | |
260 Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | |
261 Comment(";;; Deferred code"); | 258 Comment(";;; Deferred code"); |
262 } | 259 } |
263 code->Generate(); | 260 code->Generate(); |
264 if (NeedsDeferredFrame()) { | 261 if (NeedsDeferredFrame()) { |
265 Comment(";;; Destroy frame"); | 262 Comment(";;; Destroy frame"); |
266 DCHECK(frame_is_built_); | 263 DCHECK(frame_is_built_); |
267 __ pop(at); | 264 __ PopCommonFrame(scratch0()); |
268 __ MultiPop(cp.bit() | fp.bit() | ra.bit()); | |
269 frame_is_built_ = false; | 265 frame_is_built_ = false; |
270 } | 266 } |
271 __ jmp(code->exit()); | 267 __ jmp(code->exit()); |
272 } | 268 } |
273 } | 269 } |
274 // Deferred code is the last part of the instruction sequence. Mark | 270 // Deferred code is the last part of the instruction sequence. Mark |
275 // the generated code as done unless we bailed out. | 271 // the generated code as done unless we bailed out. |
276 if (!is_aborted()) status_ = DONE; | 272 if (!is_aborted()) status_ = DONE; |
277 return !is_aborted(); | 273 return !is_aborted(); |
278 } | 274 } |
(...skipping 14 matching lines...) Expand all Loading... |
293 Address entry = table_entry->address; | 289 Address entry = table_entry->address; |
294 DeoptComment(table_entry->deopt_info); | 290 DeoptComment(table_entry->deopt_info); |
295 | 291 |
296 // Second-level deopt table entries are contiguous and small, so instead | 292 // Second-level deopt table entries are contiguous and small, so instead |
297 // of loading the full, absolute address of each one, load the base | 293 // of loading the full, absolute address of each one, load the base |
298 // address and add an immediate offset. | 294 // address and add an immediate offset. |
299 if (is_int16(entry - base)) { | 295 if (is_int16(entry - base)) { |
300 if (table_entry->needs_frame) { | 296 if (table_entry->needs_frame) { |
301 DCHECK(!info()->saves_caller_doubles()); | 297 DCHECK(!info()->saves_caller_doubles()); |
302 Comment(";;; call deopt with frame"); | 298 Comment(";;; call deopt with frame"); |
303 __ MultiPush(cp.bit() | fp.bit() | ra.bit()); | 299 __ PushCommonFrame(); |
304 __ BranchAndLink(&needs_frame, USE_DELAY_SLOT); | 300 __ BranchAndLink(&needs_frame, USE_DELAY_SLOT); |
305 __ li(t9, Operand(entry - base)); | 301 __ li(t9, Operand(entry - base)); |
306 } else { | 302 } else { |
307 __ BranchAndLink(&call_deopt_entry, USE_DELAY_SLOT); | 303 __ BranchAndLink(&call_deopt_entry, USE_DELAY_SLOT); |
308 __ li(t9, Operand(entry - base)); | 304 __ li(t9, Operand(entry - base)); |
309 } | 305 } |
310 | 306 |
311 } else { | 307 } else { |
312 __ li(t9, Operand(entry - base)); | 308 __ li(t9, Operand(entry - base)); |
313 if (table_entry->needs_frame) { | 309 if (table_entry->needs_frame) { |
314 DCHECK(!info()->saves_caller_doubles()); | 310 DCHECK(!info()->saves_caller_doubles()); |
315 Comment(";;; call deopt with frame"); | 311 Comment(";;; call deopt with frame"); |
316 __ MultiPush(cp.bit() | fp.bit() | ra.bit()); | 312 __ PushCommonFrame(); |
317 __ BranchAndLink(&needs_frame); | 313 __ BranchAndLink(&needs_frame); |
318 } else { | 314 } else { |
319 __ BranchAndLink(&call_deopt_entry); | 315 __ BranchAndLink(&call_deopt_entry); |
320 } | 316 } |
321 } | 317 } |
322 info()->LogDeoptCallPosition(masm()->pc_offset(), | 318 info()->LogDeoptCallPosition(masm()->pc_offset(), |
323 table_entry->deopt_info.inlining_id); | 319 table_entry->deopt_info.inlining_id); |
324 } | 320 } |
325 if (needs_frame.is_linked()) { | 321 if (needs_frame.is_linked()) { |
326 __ bind(&needs_frame); | 322 __ bind(&needs_frame); |
327 // This variant of deopt can only be used with stubs. Since we don't | 323 // This variant of deopt can only be used with stubs. Since we don't |
328 // have a function pointer to install in the stack frame that we're | 324 // have a function pointer to install in the stack frame that we're |
329 // building, install a special marker there instead. | 325 // building, install a special marker there instead. |
330 DCHECK(info()->IsStub()); | |
331 __ li(at, Operand(Smi::FromInt(StackFrame::STUB))); | 326 __ li(at, Operand(Smi::FromInt(StackFrame::STUB))); |
332 __ push(at); | 327 __ push(at); |
333 __ Daddu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | 328 DCHECK(info()->IsStub()); |
334 } | 329 } |
335 | 330 |
336 Comment(";;; call deopt"); | 331 Comment(";;; call deopt"); |
337 __ bind(&call_deopt_entry); | 332 __ bind(&call_deopt_entry); |
338 | 333 |
339 if (info()->saves_caller_doubles()) { | 334 if (info()->saves_caller_doubles()) { |
340 DCHECK(info()->IsStub()); | 335 DCHECK(info()->IsStub()); |
341 RestoreCallerDoubles(); | 336 RestoreCallerDoubles(); |
342 } | 337 } |
343 | 338 |
(...skipping 2821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3165 Register scratch = scratch0(); | 3160 Register scratch = scratch0(); |
3166 Register temp = scratch1(); | 3161 Register temp = scratch1(); |
3167 Register result = ToRegister(instr->result()); | 3162 Register result = ToRegister(instr->result()); |
3168 | 3163 |
3169 if (instr->hydrogen()->from_inlined()) { | 3164 if (instr->hydrogen()->from_inlined()) { |
3170 __ Dsubu(result, sp, 2 * kPointerSize); | 3165 __ Dsubu(result, sp, 2 * kPointerSize); |
3171 } else { | 3166 } else { |
3172 // Check if the calling frame is an arguments adaptor frame. | 3167 // Check if the calling frame is an arguments adaptor frame. |
3173 Label done, adapted; | 3168 Label done, adapted; |
3174 __ ld(scratch, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 3169 __ ld(scratch, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
3175 __ ld(result, MemOperand(scratch, StandardFrameConstants::kContextOffset)); | 3170 __ ld(result, |
| 3171 MemOperand(scratch, CommonFrameConstants::kContextOrFrameTypeOffset)); |
3176 __ Xor(temp, result, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 3172 __ Xor(temp, result, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
3177 | 3173 |
3178 // Result is the frame pointer for the frame if not adapted and for the real | 3174 // Result is the frame pointer for the frame if not adapted and for the real |
3179 // frame below the adaptor frame if adapted. | 3175 // frame below the adaptor frame if adapted. |
3180 __ Movn(result, fp, temp); // Move only if temp is not equal to zero (ne). | 3176 __ Movn(result, fp, temp); // Move only if temp is not equal to zero (ne). |
3181 __ Movz(result, scratch, temp); // Move only if temp is equal to zero (eq). | 3177 __ Movz(result, scratch, temp); // Move only if temp is equal to zero (eq). |
3182 } | 3178 } |
3183 } | 3179 } |
3184 | 3180 |
3185 | 3181 |
(...skipping 2506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5692 void LCodeGen::DoStoreFrameContext(LStoreFrameContext* instr) { | 5688 void LCodeGen::DoStoreFrameContext(LStoreFrameContext* instr) { |
5693 Register context = ToRegister(instr->context()); | 5689 Register context = ToRegister(instr->context()); |
5694 __ sd(context, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 5690 __ sd(context, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
5695 } | 5691 } |
5696 | 5692 |
5697 | 5693 |
5698 #undef __ | 5694 #undef __ |
5699 | 5695 |
5700 } // namespace internal | 5696 } // namespace internal |
5701 } // namespace v8 | 5697 } // namespace v8 |
OLD | NEW |