V8 Project
frame.h
Go to the documentation of this file.
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
3 // found in the LICENSE file.
4 
5 #ifndef V8_COMPILER_FRAME_H_
6 #define V8_COMPILER_FRAME_H_
7 
8 #include "src/v8.h"
9 
10 #include "src/data-flow.h"
11 
12 namespace v8 {
13 namespace internal {
14 namespace compiler {
15 
16 // Collects the spill slot requirements and the allocated general and double
17 // registers for a compiled function. Frames are usually populated by the
18 // register allocator and are used by Linkage to generate code for the prologue
19 // and epilogue to compiled code.
20 class Frame {
21  public:
28 
29  inline int GetSpillSlotCount() { return spill_slot_count_; }
31 
34  allocated_registers_ = regs;
35  }
36 
40  }
41 
44  }
45 
49  }
50 
52 
53  int AllocateSpillSlot(bool is_double) {
54  // If 32-bit, skip one if the new slot is a double.
55  if (is_double) {
56  if (kDoubleSize > kPointerSize) {
59  spill_slot_count_ |= 1;
60  }
62  }
63  return spill_slot_count_++;
64  }
65 
66  private:
72 };
73 
74 
75 // Represents an offset from either the stack pointer or frame pointer.
76 class FrameOffset {
77  public:
78  inline bool from_stack_pointer() { return (offset_ & 1) == kFromSp; }
79  inline bool from_frame_pointer() { return (offset_ & 1) == kFromFp; }
80  inline int offset() { return offset_ & ~1; }
81 
82  inline static FrameOffset FromStackPointer(int offset) {
83  DCHECK((offset & 1) == 0);
84  return FrameOffset(offset | kFromSp);
85  }
86 
87  inline static FrameOffset FromFramePointer(int offset) {
88  DCHECK((offset & 1) == 0);
89  return FrameOffset(offset | kFromFp);
90  }
91 
92  private:
93  explicit FrameOffset(int offset) : offset_(offset) {}
94 
95  int offset_; // Encodes SP or FP in the low order bit.
96 
97  static const int kFromSp = 1;
98  static const int kFromFp = 0;
99 };
100 }
101 }
102 } // namespace v8::internal::compiler
103 
104 #endif // V8_COMPILER_FRAME_H_
bool IsEmpty() const
Definition: data-flow.h:164
static FrameOffset FromFramePointer(int offset)
Definition: frame.h:87
static FrameOffset FromStackPointer(int offset)
Definition: frame.h:82
static const int kFromFp
Definition: frame.h:98
static const int kFromSp
Definition: frame.h:97
void SetAllocatedRegisters(BitVector *regs)
Definition: frame.h:32
void SetRegisterSaveAreaSize(int size)
Definition: frame.h:46
void SetAllocatedDoubleRegisters(BitVector *regs)
Definition: frame.h:37
bool DidAllocateDoubleRegisters()
Definition: frame.h:42
BitVector * allocated_registers_
Definition: frame.h:70
BitVector * allocated_double_registers_
Definition: frame.h:71
int AllocateSpillSlot(bool is_double)
Definition: frame.h:53
enable harmony numeric enable harmony object literal extensions Optimize object size
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define DCHECK(condition)
Definition: logging.h:205
const int kPointerSize
Definition: globals.h:129
const int kDoubleSize
Definition: globals.h:127
bool IsAligned(T value, U alignment)
Definition: utils.h:123
Debugger support for the V8 JavaScript engine.
Definition: accessors.cc:20