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* LookupAndMakeLive(Variable* var) { | 2265 HValue* LookupAndMakeLive(Variable* var) { |
2266 HEnvironment* env = environment(); | 2266 HEnvironment* env = environment(); |
2267 int index = env->IndexFor(var); | 2267 int index = env->IndexFor(var); |
2268 HValue* value = env->Lookup(index); | 2268 HValue* value = env->Lookup(index); |
2269 if (IsEligibleForEnvironmentLivenessAnalysis(var, index, value, env)) { | 2269 if (IsEligibleForEnvironmentLivenessAnalysis(var, index, value, env)) { |
2270 HEnvironmentMarker* lookup = | 2270 HEnvironmentMarker* lookup = |
2271 Add<HEnvironmentMarker>(HEnvironmentMarker::LOOKUP, index); | 2271 Add<HEnvironmentMarker>(HEnvironmentMarker::LOOKUP, index); |
2272 USE(lookup); | 2272 USE(lookup); |
2273 #ifdef DEBUG | 2273 #ifdef DEBUG |
2274 lookup->set_closure(env->closure()); | 2274 lookup->set_closure(env->closure()); |
2275 #endif | 2275 #endif |
2276 } | 2276 } |
2277 return value; | 2277 return value; |
2278 } | 2278 } |
2279 | 2279 |
2280 // The value of the arguments object is allowed in some but not most value | 2280 // 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 | 2281 // contexts. (It's allowed in all effect contexts and disallowed in all |
2282 // test contexts.) | 2282 // test contexts.) |
2283 void VisitForValue(Expression* expr, | 2283 void VisitForValue(Expression* expr, |
2284 ArgumentsAllowedFlag flag = ARGUMENTS_NOT_ALLOWED); | 2284 ArgumentsAllowedFlag flag = ARGUMENTS_NOT_ALLOWED); |
2285 void VisitForTypeOf(Expression* expr); | 2285 void VisitForTypeOf(Expression* expr); |
2286 void VisitForEffect(Expression* expr); | 2286 void VisitForEffect(Expression* expr); |
2287 void VisitForControl(Expression* expr, | 2287 void VisitForControl(Expression* expr, |
2288 HBasicBlock* true_block, | 2288 HBasicBlock* true_block, |
2289 HBasicBlock* false_block); | 2289 HBasicBlock* false_block); |
2290 | 2290 |
2291 // Visit a list of expressions from left to right, each in a value context. | 2291 // Visit a list of expressions from left to right, each in a value context. |
2292 void VisitExpressions(ZoneList<Expression*>* exprs); | 2292 void VisitExpressions(ZoneList<Expression*>* exprs); |
| 2293 void VisitExpressions(ZoneList<Expression*>* exprs, |
| 2294 ArgumentsAllowedFlag flag); |
2293 | 2295 |
2294 // Remove the arguments from the bailout environment and emit instructions | 2296 // Remove the arguments from the bailout environment and emit instructions |
2295 // to push them as outgoing parameters. | 2297 // to push them as outgoing parameters. |
2296 template <class Instruction> HInstruction* PreProcessCall(Instruction* call); | 2298 template <class Instruction> HInstruction* PreProcessCall(Instruction* call); |
2297 void PushArgumentsFromEnvironment(int count); | 2299 void PushArgumentsFromEnvironment(int count); |
2298 | 2300 |
2299 void SetUpScope(Scope* scope); | 2301 void SetUpScope(Scope* scope); |
2300 virtual void VisitStatements(ZoneList<Statement*>* statements) OVERRIDE; | 2302 virtual void VisitStatements(ZoneList<Statement*>* statements) OVERRIDE; |
2301 | 2303 |
2302 #define DECLARE_VISIT(type) virtual void Visit##type(type* node) OVERRIDE; | 2304 #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, | 2718 int argument_count, |
2717 bool pass_argument_count); | 2719 bool pass_argument_count); |
2718 | 2720 |
2719 HInstruction* NewArgumentAdaptorCall(HValue* fun, HValue* context, | 2721 HInstruction* NewArgumentAdaptorCall(HValue* fun, HValue* context, |
2720 int argument_count, | 2722 int argument_count, |
2721 HValue* expected_param_count); | 2723 HValue* expected_param_count); |
2722 | 2724 |
2723 HInstruction* BuildCallConstantFunction(Handle<JSFunction> target, | 2725 HInstruction* BuildCallConstantFunction(Handle<JSFunction> target, |
2724 int argument_count); | 2726 int argument_count); |
2725 | 2727 |
| 2728 bool CanBeFunctionApplyArguments(Call* expr); |
| 2729 |
2726 // The translation state of the currently-being-translated function. | 2730 // The translation state of the currently-being-translated function. |
2727 FunctionState* function_state_; | 2731 FunctionState* function_state_; |
2728 | 2732 |
2729 // The base of the function state stack. | 2733 // The base of the function state stack. |
2730 FunctionState initial_function_state_; | 2734 FunctionState initial_function_state_; |
2731 | 2735 |
2732 // Expression context of the currently visited subexpression. NULL when | 2736 // Expression context of the currently visited subexpression. NULL when |
2733 // visiting statements. | 2737 // visiting statements. |
2734 AstContext* ast_context_; | 2738 AstContext* ast_context_; |
2735 | 2739 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2915 } | 2919 } |
2916 | 2920 |
2917 private: | 2921 private: |
2918 HGraphBuilder* builder_; | 2922 HGraphBuilder* builder_; |
2919 }; | 2923 }; |
2920 | 2924 |
2921 | 2925 |
2922 } } // namespace v8::internal | 2926 } } // namespace v8::internal |
2923 | 2927 |
2924 #endif // V8_HYDROGEN_H_ | 2928 #endif // V8_HYDROGEN_H_ |
OLD | NEW |