| 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_HYDROGEN_H_ | 5 #ifndef V8_HYDROGEN_H_ |
| 6 #define V8_HYDROGEN_H_ | 6 #define V8_HYDROGEN_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 dominates_loop_successors_ = true; | 152 dominates_loop_successors_ = true; |
| 153 } | 153 } |
| 154 | 154 |
| 155 bool IsOrdered() const { return is_ordered_; } | 155 bool IsOrdered() const { return is_ordered_; } |
| 156 void MarkAsOrdered() { is_ordered_ = true; } | 156 void MarkAsOrdered() { is_ordered_ = true; } |
| 157 | 157 |
| 158 void MarkSuccEdgeUnreachable(int succ); | 158 void MarkSuccEdgeUnreachable(int succ); |
| 159 | 159 |
| 160 inline Zone* zone() const; | 160 inline Zone* zone() const; |
| 161 | 161 |
| 162 #ifdef DEBUG | 162 #if DCHECK_IS_ON |
| 163 void Verify(); | 163 void Verify(); |
| 164 #endif | 164 #endif |
| 165 | 165 |
| 166 protected: | 166 protected: |
| 167 friend class HGraphBuilder; | 167 friend class HGraphBuilder; |
| 168 | 168 |
| 169 HSimulate* CreateSimulate(BailoutId ast_id, RemovableSimulate removable); | 169 HSimulate* CreateSimulate(BailoutId ast_id, RemovableSimulate removable); |
| 170 void Finish(HControlInstruction* last, HSourcePosition position); | 170 void Finish(HControlInstruction* last, HSourcePosition position); |
| 171 void FinishExit(HControlInstruction* instruction, HSourcePosition position); | 171 void FinishExit(HControlInstruction* instruction, HSourcePosition position); |
| 172 void Goto(HBasicBlock* block, | 172 void Goto(HBasicBlock* block, |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 HValue* LookupValue(int id) const { | 368 HValue* LookupValue(int id) const { |
| 369 if (id >= 0 && id < values_.length()) return values_[id]; | 369 if (id >= 0 && id < values_.length()) return values_[id]; |
| 370 return NULL; | 370 return NULL; |
| 371 } | 371 } |
| 372 void DisallowAddingNewValues() { | 372 void DisallowAddingNewValues() { |
| 373 disallow_adding_new_values_ = true; | 373 disallow_adding_new_values_ = true; |
| 374 } | 374 } |
| 375 | 375 |
| 376 bool Optimize(BailoutReason* bailout_reason); | 376 bool Optimize(BailoutReason* bailout_reason); |
| 377 | 377 |
| 378 #ifdef DEBUG | 378 #if DCHECK_IS_ON |
| 379 void Verify(bool do_full_verify) const; | 379 void Verify(bool do_full_verify) const; |
| 380 #endif | 380 #endif |
| 381 | 381 |
| 382 bool has_osr() { | 382 bool has_osr() { |
| 383 return osr_ != NULL; | 383 return osr_ != NULL; |
| 384 } | 384 } |
| 385 | 385 |
| 386 void set_osr(HOsrBuilder* osr) { | 386 void set_osr(HOsrBuilder* osr) { |
| 387 osr_ = osr; | 387 osr_ = osr; |
| 388 } | 388 } |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 protected: | 793 protected: |
| 794 AstContext(HOptimizedGraphBuilder* owner, Expression::Context kind); | 794 AstContext(HOptimizedGraphBuilder* owner, Expression::Context kind); |
| 795 virtual ~AstContext(); | 795 virtual ~AstContext(); |
| 796 | 796 |
| 797 HOptimizedGraphBuilder* owner() const { return owner_; } | 797 HOptimizedGraphBuilder* owner() const { return owner_; } |
| 798 | 798 |
| 799 inline Zone* zone() const; | 799 inline Zone* zone() const; |
| 800 | 800 |
| 801 // We want to be able to assert, in a context-specific way, that the stack | 801 // We want to be able to assert, in a context-specific way, that the stack |
| 802 // height makes sense when the context is filled. | 802 // height makes sense when the context is filled. |
| 803 #ifdef DEBUG | 803 #if DCHECK_IS_ON |
| 804 int original_length_; | 804 int original_length_; |
| 805 #endif | 805 #endif |
| 806 | 806 |
| 807 private: | 807 private: |
| 808 HOptimizedGraphBuilder* owner_; | 808 HOptimizedGraphBuilder* owner_; |
| 809 Expression::Context kind_; | 809 Expression::Context kind_; |
| 810 AstContext* outer_; | 810 AstContext* outer_; |
| 811 bool for_typeof_; | 811 bool for_typeof_; |
| 812 }; | 812 }; |
| 813 | 813 |
| (...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2246 env->is_local_index(index); | 2246 env->is_local_index(index); |
| 2247 } | 2247 } |
| 2248 void BindIfLive(Variable* var, HValue* value) { | 2248 void BindIfLive(Variable* var, HValue* value) { |
| 2249 HEnvironment* env = environment(); | 2249 HEnvironment* env = environment(); |
| 2250 int index = env->IndexFor(var); | 2250 int index = env->IndexFor(var); |
| 2251 env->Bind(index, value); | 2251 env->Bind(index, value); |
| 2252 if (IsEligibleForEnvironmentLivenessAnalysis(var, index, value, env)) { | 2252 if (IsEligibleForEnvironmentLivenessAnalysis(var, index, value, env)) { |
| 2253 HEnvironmentMarker* bind = | 2253 HEnvironmentMarker* bind = |
| 2254 Add<HEnvironmentMarker>(HEnvironmentMarker::BIND, index); | 2254 Add<HEnvironmentMarker>(HEnvironmentMarker::BIND, index); |
| 2255 USE(bind); | 2255 USE(bind); |
| 2256 #ifdef DEBUG | 2256 #if DCHECK_IS_ON |
| 2257 bind->set_closure(env->closure()); | 2257 bind->set_closure(env->closure()); |
| 2258 #endif | 2258 #endif |
| 2259 } | 2259 } |
| 2260 } | 2260 } |
| 2261 HValue* LookupAndMakeLive(Variable* var) { | 2261 HValue* LookupAndMakeLive(Variable* var) { |
| 2262 HEnvironment* env = environment(); | 2262 HEnvironment* env = environment(); |
| 2263 int index = env->IndexFor(var); | 2263 int index = env->IndexFor(var); |
| 2264 HValue* value = env->Lookup(index); | 2264 HValue* value = env->Lookup(index); |
| 2265 if (IsEligibleForEnvironmentLivenessAnalysis(var, index, value, env)) { | 2265 if (IsEligibleForEnvironmentLivenessAnalysis(var, index, value, env)) { |
| 2266 HEnvironmentMarker* lookup = | 2266 HEnvironmentMarker* lookup = |
| 2267 Add<HEnvironmentMarker>(HEnvironmentMarker::LOOKUP, index); | 2267 Add<HEnvironmentMarker>(HEnvironmentMarker::LOOKUP, index); |
| 2268 USE(lookup); | 2268 USE(lookup); |
| 2269 #ifdef DEBUG | 2269 #if DCHECK_IS_ON |
| 2270 lookup->set_closure(env->closure()); | 2270 lookup->set_closure(env->closure()); |
| 2271 #endif | 2271 #endif |
| 2272 } | 2272 } |
| 2273 return value; | 2273 return value; |
| 2274 } | 2274 } |
| 2275 | 2275 |
| 2276 // The value of the arguments object is allowed in some but not most value | 2276 // The value of the arguments object is allowed in some but not most value |
| 2277 // contexts. (It's allowed in all effect contexts and disallowed in all | 2277 // contexts. (It's allowed in all effect contexts and disallowed in all |
| 2278 // test contexts.) | 2278 // test contexts.) |
| 2279 void VisitForValue(Expression* expr, | 2279 void VisitForValue(Expression* expr, |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2926 } | 2926 } |
| 2927 | 2927 |
| 2928 private: | 2928 private: |
| 2929 HGraphBuilder* builder_; | 2929 HGraphBuilder* builder_; |
| 2930 }; | 2930 }; |
| 2931 | 2931 |
| 2932 | 2932 |
| 2933 } } // namespace v8::internal | 2933 } } // namespace v8::internal |
| 2934 | 2934 |
| 2935 #endif // V8_HYDROGEN_H_ | 2935 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |