LCOV - code coverage report
Current view: top level - src/compiler - frame.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 12 23 52.2 %
Date: 2019-04-17 Functions: 5 6 83.3 %

          Line data    Source code
       1             : // Copyright 2015 the V8 project authors. All rights reserved.
       2             : // Use of this source code is governed by a BSD-style license that can be
       3             : // found in the LICENSE file.
       4             : 
       5             : #include "src/compiler/frame.h"
       6             : 
       7             : #include "src/compiler/linkage.h"
       8             : 
       9             : namespace v8 {
      10             : namespace internal {
      11             : namespace compiler {
      12             : 
      13     2642030 : Frame::Frame(int fixed_frame_size_in_slots)
      14             :     : fixed_slot_count_(fixed_frame_size_in_slots),
      15             :       frame_slot_count_(fixed_frame_size_in_slots),
      16             :       spill_slot_count_(0),
      17             :       return_slot_count_(0),
      18             :       allocated_registers_(nullptr),
      19     2642030 :       allocated_double_registers_(nullptr) {}
      20             : 
      21           0 : int Frame::AlignFrame(int alignment) {
      22           0 :   int alignment_slots = alignment / kSystemPointerSize;
      23             :   // We have to align return slots separately, because they are claimed
      24             :   // separately on the stack.
      25             :   int return_delta =
      26           0 :       alignment_slots - (return_slot_count_ & (alignment_slots - 1));
      27           0 :   if (return_delta != alignment_slots) {
      28           0 :     frame_slot_count_ += return_delta;
      29             :   }
      30           0 :   int delta = alignment_slots - (frame_slot_count_ & (alignment_slots - 1));
      31           0 :   if (delta != alignment_slots) {
      32           0 :     frame_slot_count_ += delta;
      33           0 :     if (spill_slot_count_ != 0) {
      34           0 :       spill_slot_count_ += delta;
      35             :     }
      36             :   }
      37           0 :   return delta;
      38             : }
      39             : 
      40    20490357 : void FrameAccessState::MarkHasFrame(bool state) {
      41    20490357 :   has_frame_ = state;
      42             :   SetFrameAccessToDefault();
      43    20490357 : }
      44             : 
      45      145734 : void FrameAccessState::SetFrameAccessToDefault() {
      46    20636091 :   if (has_frame() && !FLAG_turbo_sp_frame_access) {
      47             :     SetFrameAccessToFP();
      48             :   } else {
      49             :     SetFrameAccessToSP();
      50             :   }
      51      145734 : }
      52             : 
      53             : 
      54    16204830 : FrameOffset FrameAccessState::GetFrameOffset(int spill_slot) const {
      55             :   const int frame_offset = FrameSlotToFPOffset(spill_slot);
      56    16204830 :   if (access_frame_with_fp()) {
      57             :     return FrameOffset::FromFramePointer(frame_offset);
      58             :   } else {
      59             :     // No frame. Retrieve all parameters relative to stack pointer.
      60      118680 :     int sp_offset = frame_offset + GetSPToFPOffset();
      61             :     return FrameOffset::FromStackPointer(sp_offset);
      62             :   }
      63             : }
      64             : 
      65             : 
      66             : }  // namespace compiler
      67             : }  // namespace internal
      68      122004 : }  // namespace v8

Generated by: LCOV version 1.10