| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 // have already been inserted in the instruction stream (or not need to | 446 // have already been inserted in the instruction stream (or not need to |
| 447 // be, e.g., HPhi). Call this function in tail position in the Visit | 447 // be, e.g., HPhi). Call this function in tail position in the Visit |
| 448 // functions for expressions. | 448 // functions for expressions. |
| 449 virtual void ReturnValue(HValue* value) = 0; | 449 virtual void ReturnValue(HValue* value) = 0; |
| 450 | 450 |
| 451 // Add a hydrogen instruction to the instruction stream (recording an | 451 // Add a hydrogen instruction to the instruction stream (recording an |
| 452 // environment simulation if necessary) and then fill this context with | 452 // environment simulation if necessary) and then fill this context with |
| 453 // the instruction as value. | 453 // the instruction as value. |
| 454 virtual void ReturnInstruction(HInstruction* instr, int ast_id) = 0; | 454 virtual void ReturnInstruction(HInstruction* instr, int ast_id) = 0; |
| 455 | 455 |
| 456 void set_for_typeof(bool for_typeof) { for_typeof_ = for_typeof; } | |
| 457 bool is_for_typeof() { return for_typeof_; } | |
| 458 | |
| 459 protected: | 456 protected: |
| 460 AstContext(HGraphBuilder* owner, Expression::Context kind); | 457 AstContext(HGraphBuilder* owner, Expression::Context kind); |
| 461 virtual ~AstContext(); | 458 virtual ~AstContext(); |
| 462 | 459 |
| 463 HGraphBuilder* owner() const { return owner_; } | 460 HGraphBuilder* owner() const { return owner_; } |
| 464 | 461 |
| 465 // We want to be able to assert, in a context-specific way, that the stack | 462 // We want to be able to assert, in a context-specific way, that the stack |
| 466 // height makes sense when the context is filled. | 463 // height makes sense when the context is filled. |
| 467 #ifdef DEBUG | 464 #ifdef DEBUG |
| 468 int original_length_; | 465 int original_length_; |
| 469 #endif | 466 #endif |
| 470 | 467 |
| 471 private: | 468 private: |
| 472 HGraphBuilder* owner_; | 469 HGraphBuilder* owner_; |
| 473 Expression::Context kind_; | 470 Expression::Context kind_; |
| 474 AstContext* outer_; | 471 AstContext* outer_; |
| 475 bool for_typeof_; | |
| 476 }; | 472 }; |
| 477 | 473 |
| 478 | 474 |
| 479 class EffectContext: public AstContext { | 475 class EffectContext: public AstContext { |
| 480 public: | 476 public: |
| 481 explicit EffectContext(HGraphBuilder* owner) | 477 explicit EffectContext(HGraphBuilder* owner) |
| 482 : AstContext(owner, Expression::kEffect) { | 478 : AstContext(owner, Expression::kEffect) { |
| 483 } | 479 } |
| 484 virtual ~EffectContext(); | 480 virtual ~EffectContext(); |
| 485 | 481 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 CompilationInfo* compilation_info() { return compilation_info_; } | 537 CompilationInfo* compilation_info() { return compilation_info_; } |
| 542 TypeFeedbackOracle* oracle() { return oracle_; } | 538 TypeFeedbackOracle* oracle() { return oracle_; } |
| 543 AstContext* call_context() { return call_context_; } | 539 AstContext* call_context() { return call_context_; } |
| 544 HBasicBlock* function_return() { return function_return_; } | 540 HBasicBlock* function_return() { return function_return_; } |
| 545 TestContext* test_context() { return test_context_; } | 541 TestContext* test_context() { return test_context_; } |
| 546 void ClearInlinedTestContext() { | 542 void ClearInlinedTestContext() { |
| 547 delete test_context_; | 543 delete test_context_; |
| 548 test_context_ = NULL; | 544 test_context_ = NULL; |
| 549 } | 545 } |
| 550 | 546 |
| 551 FunctionState* outer() { return outer_; } | |
| 552 | |
| 553 private: | 547 private: |
| 554 HGraphBuilder* owner_; | 548 HGraphBuilder* owner_; |
| 555 | 549 |
| 556 CompilationInfo* compilation_info_; | 550 CompilationInfo* compilation_info_; |
| 557 TypeFeedbackOracle* oracle_; | 551 TypeFeedbackOracle* oracle_; |
| 558 | 552 |
| 559 // During function inlining, expression context of the call being | 553 // During function inlining, expression context of the call being |
| 560 // inlined. NULL when not inlining. | 554 // inlined. NULL when not inlining. |
| 561 AstContext* call_context_; | 555 AstContext* call_context_; |
| 562 | 556 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 | 728 |
| 735 HBasicBlock* JoinContinue(IterationStatement* statement, | 729 HBasicBlock* JoinContinue(IterationStatement* statement, |
| 736 HBasicBlock* exit_block, | 730 HBasicBlock* exit_block, |
| 737 HBasicBlock* continue_block); | 731 HBasicBlock* continue_block); |
| 738 | 732 |
| 739 HValue* Top() const { return environment()->Top(); } | 733 HValue* Top() const { return environment()->Top(); } |
| 740 void Drop(int n) { environment()->Drop(n); } | 734 void Drop(int n) { environment()->Drop(n); } |
| 741 void Bind(Variable* var, HValue* value) { environment()->Bind(var, value); } | 735 void Bind(Variable* var, HValue* value) { environment()->Bind(var, value); } |
| 742 | 736 |
| 743 void VisitForValue(Expression* expr); | 737 void VisitForValue(Expression* expr); |
| 744 void VisitForTypeOf(Expression* expr); | |
| 745 void VisitForEffect(Expression* expr); | 738 void VisitForEffect(Expression* expr); |
| 746 void VisitForControl(Expression* expr, | 739 void VisitForControl(Expression* expr, |
| 747 HBasicBlock* true_block, | 740 HBasicBlock* true_block, |
| 748 HBasicBlock* false_block); | 741 HBasicBlock* false_block); |
| 749 | 742 |
| 750 // Visit an argument subexpression and emit a push to the outgoing | 743 // Visit an argument subexpression and emit a push to the outgoing |
| 751 // arguments. | 744 // arguments. |
| 752 void VisitArgument(Expression* expr); | 745 void VisitArgument(Expression* expr); |
| 753 void VisitArgumentList(ZoneList<Expression*>* arguments); | 746 void VisitArgumentList(ZoneList<Expression*>* arguments); |
| 754 | 747 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 770 virtual void VisitStatements(ZoneList<Statement*>* statements); | 763 virtual void VisitStatements(ZoneList<Statement*>* statements); |
| 771 | 764 |
| 772 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); | 765 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); |
| 773 AST_NODE_LIST(DECLARE_VISIT) | 766 AST_NODE_LIST(DECLARE_VISIT) |
| 774 #undef DECLARE_VISIT | 767 #undef DECLARE_VISIT |
| 775 | 768 |
| 776 HBasicBlock* CreateBasicBlock(HEnvironment* env); | 769 HBasicBlock* CreateBasicBlock(HEnvironment* env); |
| 777 HBasicBlock* CreateLoopHeaderBlock(); | 770 HBasicBlock* CreateLoopHeaderBlock(); |
| 778 | 771 |
| 779 // Helpers for flow graph construction. | 772 // Helpers for flow graph construction. |
| 780 enum GlobalPropertyAccess { | 773 void LookupGlobalPropertyCell(Variable* var, |
| 781 kUseCell, | 774 LookupResult* lookup, |
| 782 kUseGeneric | 775 bool is_store); |
| 783 }; | |
| 784 GlobalPropertyAccess LookupGlobalProperty(Variable* var, | |
| 785 LookupResult* lookup, | |
| 786 bool is_store); | |
| 787 | 776 |
| 788 bool TryArgumentsAccess(Property* expr); | 777 bool TryArgumentsAccess(Property* expr); |
| 789 bool TryCallApply(Call* expr); | 778 bool TryCallApply(Call* expr); |
| 790 bool TryInline(Call* expr); | 779 bool TryInline(Call* expr); |
| 791 bool TryInlineBuiltinFunction(Call* expr, | 780 bool TryInlineBuiltinFunction(Call* expr, |
| 792 HValue* receiver, | 781 HValue* receiver, |
| 793 Handle<Map> receiver_map, | 782 Handle<Map> receiver_map, |
| 794 CheckType check_type); | 783 CheckType check_type); |
| 795 | 784 |
| 796 // If --trace-inlining, print a line of the inlining trace. Inlining | 785 // If --trace-inlining, print a line of the inlining trace. Inlining |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 const char* filename_; | 1099 const char* filename_; |
| 1111 HeapStringAllocator string_allocator_; | 1100 HeapStringAllocator string_allocator_; |
| 1112 StringStream trace_; | 1101 StringStream trace_; |
| 1113 int indent_; | 1102 int indent_; |
| 1114 }; | 1103 }; |
| 1115 | 1104 |
| 1116 | 1105 |
| 1117 } } // namespace v8::internal | 1106 } } // namespace v8::internal |
| 1118 | 1107 |
| 1119 #endif // V8_HYDROGEN_H_ | 1108 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |