| 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/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" | 
| 6 | 6 | 
| 7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" | 
| 8 #include "src/arm64/macro-assembler-arm64.h" | 8 #include "src/arm64/macro-assembler-arm64.h" | 
| 9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" | 
| 10 #include "src/compiler/code-generator-impl.h" | 10 #include "src/compiler/code-generator-impl.h" | 
| (...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1424 void CodeGenerator::AssembleDeoptimizerCall( | 1424 void CodeGenerator::AssembleDeoptimizerCall( | 
| 1425     int deoptimization_id, Deoptimizer::BailoutType bailout_type) { | 1425     int deoptimization_id, Deoptimizer::BailoutType bailout_type) { | 
| 1426   Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 1426   Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 
| 1427       isolate(), deoptimization_id, bailout_type); | 1427       isolate(), deoptimization_id, bailout_type); | 
| 1428   __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 1428   __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 
| 1429 } | 1429 } | 
| 1430 | 1430 | 
| 1431 | 1431 | 
| 1432 void CodeGenerator::AssemblePrologue() { | 1432 void CodeGenerator::AssemblePrologue() { | 
| 1433   CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1433   CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 
| 1434   if (descriptor->IsCFunctionCall()) { | 1434   frame()->AlignFrame(16); | 
| 1435     __ SetStackPointer(csp); | 1435   if (frame()->needs_frame()) { | 
| 1436     __ Push(lr, fp); | 1436     if (descriptor->flags() & CallDescriptor::kHasStandardFrameHeader) { | 
| 1437     __ Mov(fp, csp); | 1437       DCHECK(!descriptor->UseNativeStack()); | 
| 1438   } else if (descriptor->IsJSFunctionCall()) { | 1438       __ SetStackPointer(jssp); | 
| 1439     __ SetStackPointer(jssp); | 1439       __ Prologue(this->info()->GeneratePreagedPrologue()); | 
| 1440     __ Prologue(this->info()->GeneratePreagedPrologue()); |  | 
| 1441   } else if (frame()->needs_frame()) { |  | 
| 1442     if (descriptor->UseNativeStack()) { |  | 
| 1443       __ SetStackPointer(csp); |  | 
| 1444     } else { | 1440     } else { | 
| 1445       __ SetStackPointer(jssp); | 1441       if (descriptor->UseNativeStack() || descriptor->IsCFunctionCall()) { | 
|  | 1442         __ SetStackPointer(csp); | 
|  | 1443       } else { | 
|  | 1444         __ SetStackPointer(jssp); | 
|  | 1445       } | 
|  | 1446       __ StubPrologue(info()->GetOutputStackFrameType(), | 
|  | 1447                       frame()->GetTotalFrameSlotCount()); | 
| 1446     } | 1448     } | 
| 1447     __ StubPrologue(); |  | 
| 1448   } else { | 1449   } else { | 
| 1449     if (descriptor->UseNativeStack()) { | 1450     if (descriptor->UseNativeStack()) { | 
| 1450       __ SetStackPointer(csp); | 1451       __ SetStackPointer(csp); | 
| 1451     } else { | 1452     } else { | 
| 1452       __ SetStackPointer(jssp); | 1453       __ SetStackPointer(jssp); | 
| 1453     } | 1454     } | 
| 1454     frame()->SetElidedFrameSizeInSlots(0); | 1455     frame()->SetElidedFrameSizeInSlots(0); | 
| 1455   } | 1456   } | 
| 1456   frame_access_state()->SetFrameAccessToDefault(); | 1457   frame_access_state()->SetFrameAccessToDefault(); | 
| 1457 |  | 
| 1458   int stack_shrink_slots = frame()->GetSpillSlotCount(); | 1458   int stack_shrink_slots = frame()->GetSpillSlotCount(); | 
| 1459   if (info()->is_osr()) { | 1459   if (info()->is_osr()) { | 
| 1460     // TurboFan OSR-compiled functions cannot be entered directly. | 1460     // TurboFan OSR-compiled functions cannot be entered directly. | 
| 1461     __ Abort(kShouldNotDirectlyEnterOsrFunction); | 1461     __ Abort(kShouldNotDirectlyEnterOsrFunction); | 
| 1462 | 1462 | 
| 1463     // Unoptimized code jumps directly to this entrypoint while the unoptimized | 1463     // Unoptimized code jumps directly to this entrypoint while the unoptimized | 
| 1464     // frame is still on the stack. Optimized code uses OSR values directly from | 1464     // frame is still on the stack. Optimized code uses OSR values directly from | 
| 1465     // the unoptimized frame. Thus, all that needs to be done is to allocate the | 1465     // the unoptimized frame. Thus, all that needs to be done is to allocate the | 
| 1466     // remaining stack slots. | 1466     // remaining stack slots. | 
| 1467     if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); | 1467     if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); | 
| 1468     osr_pc_offset_ = __ pc_offset(); | 1468     osr_pc_offset_ = __ pc_offset(); | 
| 1469     stack_shrink_slots -= OsrHelper(info()).UnoptimizedFrameSlots(); | 1469     stack_shrink_slots -= OsrHelper(info()).UnoptimizedFrameSlots(); | 
| 1470   } | 1470   } | 
| 1471 | 1471 | 
| 1472   // If frame()->needs_frame() is false, then | 1472   if (descriptor->flags() & CallDescriptor::kHasStandardFrameHeader) { | 
| 1473   // frame()->AlignSavedCalleeRegisterSlots() is guaranteed to return 0. | 1473     __ Claim(stack_shrink_slots); | 
| 1474   if (csp.Is(masm()->StackPointer()) && frame()->needs_frame()) { |  | 
| 1475     // The system stack pointer requires 16-byte alignment at function call |  | 
| 1476     // boundaries. |  | 
| 1477 |  | 
| 1478     stack_shrink_slots += frame()->AlignSavedCalleeRegisterSlots(); |  | 
| 1479   } | 1474   } | 
| 1480   __ Claim(stack_shrink_slots); |  | 
| 1481 | 1475 | 
| 1482   // Save FP registers. | 1476   // Save FP registers. | 
| 1483   CPURegList saves_fp = CPURegList(CPURegister::kFPRegister, kDRegSizeInBits, | 1477   CPURegList saves_fp = CPURegList(CPURegister::kFPRegister, kDRegSizeInBits, | 
| 1484                                    descriptor->CalleeSavedFPRegisters()); | 1478                                    descriptor->CalleeSavedFPRegisters()); | 
| 1485   int saved_count = saves_fp.Count(); | 1479   int saved_count = saves_fp.Count(); | 
| 1486   if (saved_count != 0) { | 1480   if (saved_count != 0) { | 
| 1487     DCHECK(saves_fp.list() == CPURegList::GetCalleeSavedFP().list()); | 1481     DCHECK(saves_fp.list() == CPURegList::GetCalleeSavedFP().list()); | 
| 1488     __ PushCPURegList(saves_fp); | 1482     __ PushCPURegList(saves_fp); | 
| 1489     frame()->AllocateSavedCalleeRegisterSlots(saved_count * | 1483     frame()->AllocateSavedCalleeRegisterSlots(saved_count * | 
| 1490                                               (kDoubleSize / kPointerSize)); | 1484                                               (kDoubleSize / kPointerSize)); | 
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1729       padding_size -= kInstructionSize; | 1723       padding_size -= kInstructionSize; | 
| 1730     } | 1724     } | 
| 1731   } | 1725   } | 
| 1732 } | 1726 } | 
| 1733 | 1727 | 
| 1734 #undef __ | 1728 #undef __ | 
| 1735 | 1729 | 
| 1736 }  // namespace compiler | 1730 }  // namespace compiler | 
| 1737 }  // namespace internal | 1731 }  // namespace internal | 
| 1738 }  // namespace v8 | 1732 }  // namespace v8 | 
| OLD | NEW | 
|---|