| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_DEOPTIMIZER_H_ | 5 #ifndef V8_DEOPTIMIZER_H_ |
| 6 #define V8_DEOPTIMIZER_H_ | 6 #define V8_DEOPTIMIZER_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 static TranslatedValue NewArgumentsObject(TranslatedState* container, | 60 static TranslatedValue NewArgumentsObject(TranslatedState* container, |
| 61 int length, int object_index); | 61 int length, int object_index); |
| 62 static TranslatedValue NewDeferredObject(TranslatedState* container, | 62 static TranslatedValue NewDeferredObject(TranslatedState* container, |
| 63 int length, int object_index); | 63 int length, int object_index); |
| 64 static TranslatedValue NewDuplicateObject(TranslatedState* container, int id); | 64 static TranslatedValue NewDuplicateObject(TranslatedState* container, int id); |
| 65 static TranslatedValue NewDouble(TranslatedState* container, double value); | 65 static TranslatedValue NewDouble(TranslatedState* container, double value); |
| 66 static TranslatedValue NewInt32(TranslatedState* container, int32_t value); | 66 static TranslatedValue NewInt32(TranslatedState* container, int32_t value); |
| 67 static TranslatedValue NewUInt32(TranslatedState* container, uint32_t value); | 67 static TranslatedValue NewUInt32(TranslatedState* container, uint32_t value); |
| 68 static TranslatedValue NewBool(TranslatedState* container, uint32_t value); | 68 static TranslatedValue NewBool(TranslatedState* container, uint32_t value); |
| 69 static TranslatedValue NewTagged(TranslatedState* container, Object* literal); | 69 static TranslatedValue NewTagged(TranslatedState* container, Object* literal); |
| 70 static TranslatedValue NewInvalid(); | 70 static TranslatedValue NewInvalid(TranslatedState* container); |
| 71 | 71 |
| 72 Isolate* isolate() const; | 72 Isolate* isolate() const; |
| 73 void MaterializeSimple(); | 73 void MaterializeSimple(); |
| 74 | 74 |
| 75 Kind kind_; | 75 Kind kind_; |
| 76 TranslatedState* container_; // This is only needed for materialization of | 76 TranslatedState* container_; // This is only needed for materialization of |
| 77 // objects and constructing handles (to get | 77 // objects and constructing handles (to get |
| 78 // to the isolate). | 78 // to the isolate). |
| 79 | 79 |
| 80 MaybeHandle<Object> value_; // Before handlification, this is always null, | 80 MaybeHandle<Object> value_; // Before handlification, this is always null, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 kSetter, | 118 kSetter, |
| 119 kArgumentsAdaptor, | 119 kArgumentsAdaptor, |
| 120 kConstructStub, | 120 kConstructStub, |
| 121 kCompiledStub, | 121 kCompiledStub, |
| 122 kInvalid | 122 kInvalid |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 int GetValueCount(); | 125 int GetValueCount(); |
| 126 | 126 |
| 127 Kind kind() const { return kind_; } | 127 Kind kind() const { return kind_; } |
| 128 BailoutId node_id() { return node_id_; } | 128 BailoutId node_id() const { return node_id_; } |
| 129 JSFunction* raw_function() { return raw_function_; } | 129 JSFunction* raw_function() const { return raw_function_; } |
| 130 Handle<JSFunction> function() { return function_; } | 130 Handle<JSFunction> function() const { return function_; } |
| 131 int height() { return height_; } | 131 int height() const { return height_; } |
| 132 | 132 |
| 133 class iterator { | 133 class iterator { |
| 134 public: | 134 public: |
| 135 iterator& operator++() { | 135 iterator& operator++() { |
| 136 AdvanceIterator(&position_); | 136 AdvanceIterator(&position_); |
| 137 return *this; | 137 return *this; |
| 138 } | 138 } |
| 139 | 139 |
| 140 iterator operator++(int) { | 140 iterator operator++(int) { |
| 141 iterator original(position_); | 141 iterator original(position_); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 153 | 153 |
| 154 private: | 154 private: |
| 155 friend TranslatedFrame; | 155 friend TranslatedFrame; |
| 156 | 156 |
| 157 explicit iterator(std::deque<TranslatedValue>::iterator position) | 157 explicit iterator(std::deque<TranslatedValue>::iterator position) |
| 158 : position_(position) {} | 158 : position_(position) {} |
| 159 | 159 |
| 160 std::deque<TranslatedValue>::iterator position_; | 160 std::deque<TranslatedValue>::iterator position_; |
| 161 }; | 161 }; |
| 162 | 162 |
| 163 typedef TranslatedValue& reference; |
| 164 typedef TranslatedValue const& const_reference; |
| 165 |
| 163 iterator begin() { return iterator(values_.begin()); } | 166 iterator begin() { return iterator(values_.begin()); } |
| 164 iterator end() { return iterator(values_.end()); } | 167 iterator end() { return iterator(values_.end()); } |
| 168 reference front() { return values_.front(); } |
| 169 const_reference front() const { return values_.front(); } |
| 165 | 170 |
| 166 private: | 171 private: |
| 167 friend class TranslatedState; | 172 friend class TranslatedState; |
| 168 | 173 |
| 169 // Constructor static methods. | 174 // Constructor static methods. |
| 170 static TranslatedFrame JSFrame(BailoutId node_id, JSFunction* function, | 175 static TranslatedFrame JSFrame(BailoutId node_id, JSFunction* function, |
| 171 int height); | 176 int height); |
| 172 static TranslatedFrame AccessorFrame(Kind kind, JSFunction* function); | 177 static TranslatedFrame AccessorFrame(Kind kind, JSFunction* function); |
| 173 static TranslatedFrame ArgumentsAdaptorFrame(JSFunction* function, | 178 static TranslatedFrame ArgumentsAdaptorFrame(JSFunction* function, |
| 174 int height); | 179 int height); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 class TranslatedState { | 230 class TranslatedState { |
| 226 public: | 231 public: |
| 227 TranslatedState(); | 232 TranslatedState(); |
| 228 explicit TranslatedState(JavaScriptFrame* frame); | 233 explicit TranslatedState(JavaScriptFrame* frame); |
| 229 | 234 |
| 230 void Prepare(bool has_adapted_arguments, Address stack_frame_pointer); | 235 void Prepare(bool has_adapted_arguments, Address stack_frame_pointer); |
| 231 | 236 |
| 232 // Store newly materialized values into the isolate. | 237 // Store newly materialized values into the isolate. |
| 233 void StoreMaterializedValuesAndDeopt(); | 238 void StoreMaterializedValuesAndDeopt(); |
| 234 | 239 |
| 240 typedef std::vector<TranslatedFrame>::const_iterator const_iterator; |
| 241 const_iterator begin() const { return frames_.begin(); } |
| 242 const_iterator end() const { return frames_.end(); } |
| 243 |
| 235 std::vector<TranslatedFrame>& frames() { return frames_; } | 244 std::vector<TranslatedFrame>& frames() { return frames_; } |
| 236 | 245 |
| 237 TranslatedFrame* GetArgumentsInfoFromJSFrameIndex(int jsframe_index, | 246 TranslatedFrame* GetArgumentsInfoFromJSFrameIndex(int jsframe_index, |
| 238 int* arguments_count); | 247 int* arguments_count); |
| 239 | 248 |
| 240 Isolate* isolate() { return isolate_; } | 249 Isolate* isolate() { return isolate_; } |
| 241 | 250 |
| 242 void Init(Address input_frame_pointer, JSFunction* input_frame_function, | 251 void Init(Address input_frame_pointer, JSFunction* input_frame_function, |
| 243 TranslationIterator* iterator, FixedArray* literal_array, | 252 TranslationIterator* iterator, FixedArray* literal_array, |
| 244 RegisterValues* registers, FILE* trace_file); | 253 RegisterValues* registers, FILE* trace_file); |
| (...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1167 Object** expression_stack_; | 1176 Object** expression_stack_; |
| 1168 int source_position_; | 1177 int source_position_; |
| 1169 | 1178 |
| 1170 friend class Deoptimizer; | 1179 friend class Deoptimizer; |
| 1171 }; | 1180 }; |
| 1172 | 1181 |
| 1173 } // namespace internal | 1182 } // namespace internal |
| 1174 } // namespace v8 | 1183 } // namespace v8 |
| 1175 | 1184 |
| 1176 #endif // V8_DEOPTIMIZER_H_ | 1185 #endif // V8_DEOPTIMIZER_H_ |
| OLD | NEW |