| 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 void Deconstruct(JSGraph* jsgraph, CommonOperatorBuilder* common, | 102 // Return {false} if the OSR deconstruction failed somehow. |
| 103 bool Deconstruct(JSGraph* jsgraph, CommonOperatorBuilder* common, |
| 103 Zone* tmp_zone); | 104 Zone* tmp_zone); |
| 104 | 105 |
| 105 // Prepares the frame w.r.t. OSR. | 106 // Prepares the frame w.r.t. OSR. |
| 106 void SetupFrame(Frame* frame); | 107 void SetupFrame(Frame* frame); |
| 107 | 108 |
| 108 // Returns the number of unoptimized frame slots for this OSR. | 109 // Returns the number of unoptimized frame slots for this OSR. |
| 109 size_t UnoptimizedFrameSlots() { return stack_slot_count_; } | 110 size_t UnoptimizedFrameSlots() { return stack_slot_count_; } |
| 110 | 111 |
| 111 // Returns the environment index of the first stack slot. | 112 // Returns the environment index of the first stack slot. |
| 112 static int FirstStackSlotIndex(int parameter_count) { | 113 static int FirstStackSlotIndex(int parameter_count) { |
| 113 // n.b. unlike Crankshaft, TurboFan environments do not contain the context. | 114 // n.b. unlike Crankshaft, TurboFan environments do not contain the context. |
| 114 return 1 + parameter_count; // receiver + params | 115 return 1 + parameter_count; // receiver + params |
| 115 } | 116 } |
| 116 | 117 |
| 117 private: | 118 private: |
| 118 size_t parameter_count_; | 119 size_t parameter_count_; |
| 119 size_t stack_slot_count_; | 120 size_t stack_slot_count_; |
| 120 }; | 121 }; |
| 121 | 122 |
| 122 } // namespace compiler | 123 } // namespace compiler |
| 123 } // namespace internal | 124 } // namespace internal |
| 124 } // namespace v8 | 125 } // namespace v8 |
| 125 | 126 |
| 126 #endif // V8_COMPILER_OSR_H_ | 127 #endif // V8_COMPILER_OSR_H_ |
| OLD | NEW |