Chromium Code Reviews| 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 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 741 }; | 741 }; |
| 742 | 742 |
| 743 | 743 |
| 744 std::ostream& operator<<(std::ostream& os, const HEnvironment& env); | 744 std::ostream& operator<<(std::ostream& os, const HEnvironment& env); |
| 745 | 745 |
| 746 | 746 |
| 747 class HOptimizedGraphBuilder; | 747 class HOptimizedGraphBuilder; |
| 748 | 748 |
| 749 enum ArgumentsAllowedFlag { | 749 enum ArgumentsAllowedFlag { |
| 750 ARGUMENTS_NOT_ALLOWED, | 750 ARGUMENTS_NOT_ALLOWED, |
| 751 ARGUMENTS_ALLOWED | 751 ARGUMENTS_ALLOWED, |
| 752 ARGUMENTS_FAKED | |
| 752 }; | 753 }; |
| 753 | 754 |
| 754 | 755 |
| 755 class HIfContinuation; | 756 class HIfContinuation; |
| 756 | 757 |
| 757 // This class is not BASE_EMBEDDED because our inlining implementation uses | 758 // This class is not BASE_EMBEDDED because our inlining implementation uses |
| 758 // new and delete. | 759 // new and delete. |
| 759 class AstContext { | 760 class AstContext { |
| 760 public: | 761 public: |
| 761 bool IsEffect() const { return kind_ == Expression::kEffect; } | 762 bool IsEffect() const { return kind_ == Expression::kEffect; } |
| (...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2254 env->Bind(index, value); | 2255 env->Bind(index, value); |
| 2255 if (IsEligibleForEnvironmentLivenessAnalysis(var, index, value, env)) { | 2256 if (IsEligibleForEnvironmentLivenessAnalysis(var, index, value, env)) { |
| 2256 HEnvironmentMarker* bind = | 2257 HEnvironmentMarker* bind = |
| 2257 Add<HEnvironmentMarker>(HEnvironmentMarker::BIND, index); | 2258 Add<HEnvironmentMarker>(HEnvironmentMarker::BIND, index); |
| 2258 USE(bind); | 2259 USE(bind); |
| 2259 #ifdef DEBUG | 2260 #ifdef DEBUG |
| 2260 bind->set_closure(env->closure()); | 2261 bind->set_closure(env->closure()); |
| 2261 #endif | 2262 #endif |
| 2262 } | 2263 } |
| 2263 } | 2264 } |
| 2264 | 2265 HValue* Lookup(Variable* var) { |
|
Jakob Kummerow
2014/11/19 20:46:16
Why do you need this variant? The "!value->IsArgum
ulan
2014/11/20 15:23:30
Indeed, node.
| |
| 2266 HEnvironment* env = environment(); | |
| 2267 int index = env->IndexFor(var); | |
| 2268 return env->Lookup(index); | |
| 2269 } | |
| 2265 HValue* LookupAndMakeLive(Variable* var) { | 2270 HValue* LookupAndMakeLive(Variable* var) { |
| 2266 HEnvironment* env = environment(); | 2271 HEnvironment* env = environment(); |
| 2267 int index = env->IndexFor(var); | 2272 int index = env->IndexFor(var); |
| 2268 HValue* value = env->Lookup(index); | 2273 HValue* value = env->Lookup(index); |
| 2269 if (IsEligibleForEnvironmentLivenessAnalysis(var, index, value, env)) { | 2274 if (IsEligibleForEnvironmentLivenessAnalysis(var, index, value, env)) { |
| 2270 HEnvironmentMarker* lookup = | 2275 HEnvironmentMarker* lookup = |
| 2271 Add<HEnvironmentMarker>(HEnvironmentMarker::LOOKUP, index); | 2276 Add<HEnvironmentMarker>(HEnvironmentMarker::LOOKUP, index); |
| 2272 USE(lookup); | 2277 USE(lookup); |
| 2273 #ifdef DEBUG | 2278 #ifdef DEBUG |
| 2274 lookup->set_closure(env->closure()); | 2279 lookup->set_closure(env->closure()); |
| 2275 #endif | 2280 #endif |
| 2276 } | 2281 } |
| 2277 return value; | 2282 return value; |
| 2278 } | 2283 } |
| 2279 | 2284 |
| 2280 // The value of the arguments object is allowed in some but not most value | 2285 // The value of the arguments object is allowed in some but not most value |
| 2281 // contexts. (It's allowed in all effect contexts and disallowed in all | 2286 // contexts. (It's allowed in all effect contexts and disallowed in all |
| 2282 // test contexts.) | 2287 // test contexts.) |
| 2283 void VisitForValue(Expression* expr, | 2288 void VisitForValue(Expression* expr, |
| 2284 ArgumentsAllowedFlag flag = ARGUMENTS_NOT_ALLOWED); | 2289 ArgumentsAllowedFlag flag = ARGUMENTS_NOT_ALLOWED); |
| 2285 void VisitForTypeOf(Expression* expr); | 2290 void VisitForTypeOf(Expression* expr); |
| 2286 void VisitForEffect(Expression* expr); | 2291 void VisitForEffect(Expression* expr); |
| 2287 void VisitForControl(Expression* expr, | 2292 void VisitForControl(Expression* expr, |
| 2288 HBasicBlock* true_block, | 2293 HBasicBlock* true_block, |
| 2289 HBasicBlock* false_block); | 2294 HBasicBlock* false_block); |
| 2290 | 2295 |
| 2291 // Visit a list of expressions from left to right, each in a value context. | 2296 // Visit a list of expressions from left to right, each in a value context. |
| 2292 void VisitExpressions(ZoneList<Expression*>* exprs); | 2297 void VisitExpressions(ZoneList<Expression*>* exprs); |
| 2298 void VisitExpressions(ZoneList<Expression*>* exprs, | |
| 2299 ArgumentsAllowedFlag flag); | |
| 2293 | 2300 |
| 2294 // Remove the arguments from the bailout environment and emit instructions | 2301 // Remove the arguments from the bailout environment and emit instructions |
| 2295 // to push them as outgoing parameters. | 2302 // to push them as outgoing parameters. |
| 2296 template <class Instruction> HInstruction* PreProcessCall(Instruction* call); | 2303 template <class Instruction> HInstruction* PreProcessCall(Instruction* call); |
| 2297 void PushArgumentsFromEnvironment(int count); | 2304 void PushArgumentsFromEnvironment(int count); |
| 2298 | 2305 |
| 2299 void SetUpScope(Scope* scope); | 2306 void SetUpScope(Scope* scope); |
| 2300 virtual void VisitStatements(ZoneList<Statement*>* statements) OVERRIDE; | 2307 virtual void VisitStatements(ZoneList<Statement*>* statements) OVERRIDE; |
| 2301 | 2308 |
| 2302 #define DECLARE_VISIT(type) virtual void Visit##type(type* node) OVERRIDE; | 2309 #define DECLARE_VISIT(type) virtual void Visit##type(type* node) OVERRIDE; |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2716 int argument_count, | 2723 int argument_count, |
| 2717 bool pass_argument_count); | 2724 bool pass_argument_count); |
| 2718 | 2725 |
| 2719 HInstruction* NewArgumentAdaptorCall(HValue* fun, HValue* context, | 2726 HInstruction* NewArgumentAdaptorCall(HValue* fun, HValue* context, |
| 2720 int argument_count, | 2727 int argument_count, |
| 2721 HValue* expected_param_count); | 2728 HValue* expected_param_count); |
| 2722 | 2729 |
| 2723 HInstruction* BuildCallConstantFunction(Handle<JSFunction> target, | 2730 HInstruction* BuildCallConstantFunction(Handle<JSFunction> target, |
| 2724 int argument_count); | 2731 int argument_count); |
| 2725 | 2732 |
| 2733 bool CanBeFunctionApplyArguments(Call* expr, bool mark_arguments_as_live); | |
| 2734 | |
| 2726 // The translation state of the currently-being-translated function. | 2735 // The translation state of the currently-being-translated function. |
| 2727 FunctionState* function_state_; | 2736 FunctionState* function_state_; |
| 2728 | 2737 |
| 2729 // The base of the function state stack. | 2738 // The base of the function state stack. |
| 2730 FunctionState initial_function_state_; | 2739 FunctionState initial_function_state_; |
| 2731 | 2740 |
| 2732 // Expression context of the currently visited subexpression. NULL when | 2741 // Expression context of the currently visited subexpression. NULL when |
| 2733 // visiting statements. | 2742 // visiting statements. |
| 2734 AstContext* ast_context_; | 2743 AstContext* ast_context_; |
| 2735 | 2744 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2915 } | 2924 } |
| 2916 | 2925 |
| 2917 private: | 2926 private: |
| 2918 HGraphBuilder* builder_; | 2927 HGraphBuilder* builder_; |
| 2919 }; | 2928 }; |
| 2920 | 2929 |
| 2921 | 2930 |
| 2922 } } // namespace v8::internal | 2931 } } // namespace v8::internal |
| 2923 | 2932 |
| 2924 #endif // V8_HYDROGEN_H_ | 2933 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |