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 #ifndef V8_COMPILER_OSR_H_ | 5 #ifndef V8_COMPILER_OSR_H_ |
6 #define V8_COMPILER_OSR_H_ | 6 #define V8_COMPILER_OSR_H_ |
7 | 7 |
8 #include "src/zone.h" | 8 #include "src/zone.h" |
9 | 9 |
10 // TurboFan structures OSR graphs in a way that separates almost all phases of | 10 // TurboFan structures OSR graphs in a way that separates almost all phases of |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 class OsrHelper { | 92 class OsrHelper { |
93 public: | 93 public: |
94 explicit OsrHelper(CompilationInfo* info); | 94 explicit OsrHelper(CompilationInfo* info); |
95 // Only for testing. | 95 // Only for testing. |
96 OsrHelper(size_t parameter_count, size_t stack_slot_count) | 96 OsrHelper(size_t parameter_count, size_t stack_slot_count) |
97 : parameter_count_(parameter_count), | 97 : parameter_count_(parameter_count), |
98 stack_slot_count_(stack_slot_count) {} | 98 stack_slot_count_(stack_slot_count) {} |
99 | 99 |
100 // Deconstructs the artificial {OsrNormalEntry} and rewrites the graph so | 100 // Deconstructs the artificial {OsrNormalEntry} and rewrites the graph so |
101 // that only the path corresponding to {OsrLoopEntry} remains. | 101 // that only the path corresponding to {OsrLoopEntry} remains. |
102 // Return {false} if the OSR deconstruction failed somehow. | 102 void Deconstruct(JSGraph* jsgraph, CommonOperatorBuilder* common, |
103 bool Deconstruct(JSGraph* jsgraph, CommonOperatorBuilder* common, | |
104 Zone* tmp_zone); | 103 Zone* tmp_zone); |
105 | 104 |
106 // Prepares the frame w.r.t. OSR. | 105 // Prepares the frame w.r.t. OSR. |
107 void SetupFrame(Frame* frame); | 106 void SetupFrame(Frame* frame); |
108 | 107 |
109 // Returns the number of unoptimized frame slots for this OSR. | 108 // Returns the number of unoptimized frame slots for this OSR. |
110 size_t UnoptimizedFrameSlots() { return stack_slot_count_; } | 109 size_t UnoptimizedFrameSlots() { return stack_slot_count_; } |
111 | 110 |
112 // Returns the environment index of the first stack slot. | 111 // Returns the environment index of the first stack slot. |
113 static int FirstStackSlotIndex(int parameter_count) { | 112 static int FirstStackSlotIndex(int parameter_count) { |
114 // n.b. unlike Crankshaft, TurboFan environments do not contain the context. | 113 // n.b. unlike Crankshaft, TurboFan environments do not contain the context. |
115 return 1 + parameter_count; // receiver + params | 114 return 1 + parameter_count; // receiver + params |
116 } | 115 } |
117 | 116 |
118 private: | 117 private: |
119 size_t parameter_count_; | 118 size_t parameter_count_; |
120 size_t stack_slot_count_; | 119 size_t stack_slot_count_; |
121 }; | 120 }; |
122 | 121 |
123 } // namespace compiler | 122 } // namespace compiler |
124 } // namespace internal | 123 } // namespace internal |
125 } // namespace v8 | 124 } // namespace v8 |
126 | 125 |
127 #endif // V8_COMPILER_OSR_H_ | 126 #endif // V8_COMPILER_OSR_H_ |
OLD | NEW |