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_CRANKSHAFT_HYDROGEN_H_ | 5 #ifndef V8_CRANKSHAFT_HYDROGEN_H_ |
6 #define V8_CRANKSHAFT_HYDROGEN_H_ | 6 #define V8_CRANKSHAFT_HYDROGEN_H_ |
7 | 7 |
8 #include "src/accessors.h" | 8 #include "src/accessors.h" |
9 #include "src/allocation.h" | 9 #include "src/allocation.h" |
10 #include "src/ast/ast-type-bounds.h" | 10 #include "src/ast/ast-type-bounds.h" |
(...skipping 2282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2293 BailoutId continue_id, HBasicBlock* exit_block, | 2293 BailoutId continue_id, HBasicBlock* exit_block, |
2294 HBasicBlock* continue_block); | 2294 HBasicBlock* continue_block); |
2295 | 2295 |
2296 HValue* Top() const { return environment()->Top(); } | 2296 HValue* Top() const { return environment()->Top(); } |
2297 void Drop(int n) { environment()->Drop(n); } | 2297 void Drop(int n) { environment()->Drop(n); } |
2298 void Bind(Variable* var, HValue* value) { environment()->Bind(var, value); } | 2298 void Bind(Variable* var, HValue* value) { environment()->Bind(var, value); } |
2299 bool IsEligibleForEnvironmentLivenessAnalysis(Variable* var, | 2299 bool IsEligibleForEnvironmentLivenessAnalysis(Variable* var, |
2300 int index, | 2300 int index, |
2301 HEnvironment* env) { | 2301 HEnvironment* env) { |
2302 if (!FLAG_analyze_environment_liveness) return false; | 2302 if (!FLAG_analyze_environment_liveness) return false; |
2303 // |this| and |arguments| are always live; zapping parameters isn't | 2303 // Zapping parameters isn't safe because function.arguments can inspect them |
2304 // safe because function.arguments can inspect them at any time. | 2304 // at any time. |
2305 return !var->is_this() && | 2305 return env->is_local_index(index); |
2306 !var->is_arguments() && | |
2307 env->is_local_index(index); | |
2308 } | 2306 } |
2309 void BindIfLive(Variable* var, HValue* value) { | 2307 void BindIfLive(Variable* var, HValue* value) { |
2310 HEnvironment* env = environment(); | 2308 HEnvironment* env = environment(); |
2311 int index = env->IndexFor(var); | 2309 int index = env->IndexFor(var); |
2312 env->Bind(index, value); | 2310 env->Bind(index, value); |
2313 if (IsEligibleForEnvironmentLivenessAnalysis(var, index, env)) { | 2311 if (IsEligibleForEnvironmentLivenessAnalysis(var, index, env)) { |
2314 HEnvironmentMarker* bind = | 2312 HEnvironmentMarker* bind = |
2315 Add<HEnvironmentMarker>(HEnvironmentMarker::BIND, index); | 2313 Add<HEnvironmentMarker>(HEnvironmentMarker::BIND, index); |
2316 USE(bind); | 2314 USE(bind); |
2317 #ifdef DEBUG | 2315 #ifdef DEBUG |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3035 } | 3033 } |
3036 | 3034 |
3037 private: | 3035 private: |
3038 HOptimizedGraphBuilder* builder_; | 3036 HOptimizedGraphBuilder* builder_; |
3039 }; | 3037 }; |
3040 | 3038 |
3041 } // namespace internal | 3039 } // namespace internal |
3042 } // namespace v8 | 3040 } // namespace v8 |
3043 | 3041 |
3044 #endif // V8_CRANKSHAFT_HYDROGEN_H_ | 3042 #endif // V8_CRANKSHAFT_HYDROGEN_H_ |
OLD | NEW |