v8  3.25.30(node0.11.13)
V8 is Google's open source JavaScript engine
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
lithium-allocator-inl.h
Go to the documentation of this file.
1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 #ifndef V8_LITHIUM_ALLOCATOR_INL_H_
29 #define V8_LITHIUM_ALLOCATOR_INL_H_
30 
31 #include "lithium-allocator.h"
32 
33 #if V8_TARGET_ARCH_IA32
34 #include "ia32/lithium-ia32.h"
35 #elif V8_TARGET_ARCH_X64
36 #include "x64/lithium-x64.h"
37 #elif V8_TARGET_ARCH_ARM64
38 #include "arm64/lithium-arm64.h"
39 #elif V8_TARGET_ARCH_ARM
40 #include "arm/lithium-arm.h"
41 #elif V8_TARGET_ARCH_MIPS
42 #include "mips/lithium-mips.h"
43 #else
44 #error "Unknown architecture."
45 #endif
46 
47 namespace v8 {
48 namespace internal {
49 
50 bool LAllocator::IsGapAt(int index) { return chunk_->IsGapAt(index); }
51 
52 
53 LInstruction* LAllocator::InstructionAt(int index) {
54  return chunk_->instructions()->at(index);
55 }
56 
57 
58 LGap* LAllocator::GapAt(int index) {
59  return chunk_->GetGapAt(index);
60 }
61 
62 
63 TempIterator::TempIterator(LInstruction* instr)
64  : instr_(instr),
65  limit_(instr->TempCount()),
66  current_(0) {
67  SkipUninteresting();
68 }
69 
70 
71 bool TempIterator::Done() { return current_ >= limit_; }
72 
73 
74 LOperand* TempIterator::Current() {
75  ASSERT(!Done());
76  return instr_->TempAt(current_);
77 }
78 
79 
80 void TempIterator::SkipUninteresting() {
81  while (current_ < limit_ && instr_->TempAt(current_) == NULL) ++current_;
82 }
83 
84 
85 void TempIterator::Advance() {
86  ++current_;
87  SkipUninteresting();
88 }
89 
90 
91 InputIterator::InputIterator(LInstruction* instr)
92  : instr_(instr),
93  limit_(instr->InputCount()),
94  current_(0) {
95  SkipUninteresting();
96 }
97 
98 
99 bool InputIterator::Done() { return current_ >= limit_; }
100 
101 
102 LOperand* InputIterator::Current() {
103  ASSERT(!Done());
104  ASSERT(instr_->InputAt(current_) != NULL);
105  return instr_->InputAt(current_);
106 }
107 
108 
109 void InputIterator::Advance() {
110  ++current_;
111  SkipUninteresting();
112 }
113 
114 
115 void InputIterator::SkipUninteresting() {
116  while (current_ < limit_) {
117  LOperand* current = instr_->InputAt(current_);
118  if (current != NULL && !current->IsConstantOperand()) break;
119  ++current_;
120  }
121 }
122 
123 
124 UseIterator::UseIterator(LInstruction* instr)
125  : input_iterator_(instr), env_iterator_(instr->environment()) { }
126 
127 
128 bool UseIterator::Done() {
129  return input_iterator_.Done() && env_iterator_.Done();
130 }
131 
132 
133 LOperand* UseIterator::Current() {
134  ASSERT(!Done());
135  LOperand* result = input_iterator_.Done()
136  ? env_iterator_.Current()
137  : input_iterator_.Current();
138  ASSERT(result != NULL);
139  return result;
140 }
141 
142 
143 void UseIterator::Advance() {
144  input_iterator_.Done()
145  ? env_iterator_.Advance()
146  : input_iterator_.Advance();
147 }
148 
149 
150 void LAllocator::SetLiveRangeAssignedRegister(LiveRange* range, int reg) {
151  if (range->Kind() == DOUBLE_REGISTERS) {
152  assigned_double_registers_->Add(reg);
153  } else {
154  ASSERT(range->Kind() == GENERAL_REGISTERS);
155  assigned_registers_->Add(reg);
156  }
157  range->set_assigned_register(reg, chunk()->zone());
158 }
159 
160 
161 } } // namespace v8::internal
162 
163 #endif // V8_LITHIUM_ALLOCATOR_INL_H_
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
uint16_t current_
#define ASSERT(condition)
Definition: checks.h:329