| 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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 // have already been inserted in the instruction stream (or not need to | 438 // have already been inserted in the instruction stream (or not need to |
| 439 // be, e.g., HPhi). Call this function in tail position in the Visit | 439 // be, e.g., HPhi). Call this function in tail position in the Visit |
| 440 // functions for expressions. | 440 // functions for expressions. |
| 441 virtual void ReturnValue(HValue* value) = 0; | 441 virtual void ReturnValue(HValue* value) = 0; |
| 442 | 442 |
| 443 // Add a hydrogen instruction to the instruction stream (recording an | 443 // Add a hydrogen instruction to the instruction stream (recording an |
| 444 // environment simulation if necessary) and then fill this context with | 444 // environment simulation if necessary) and then fill this context with |
| 445 // the instruction as value. | 445 // the instruction as value. |
| 446 virtual void ReturnInstruction(HInstruction* instr, int ast_id) = 0; | 446 virtual void ReturnInstruction(HInstruction* instr, int ast_id) = 0; |
| 447 | 447 |
| 448 void set_for_typeof(bool for_typeof) { for_typeof_ = for_typeof; } | |
| 449 bool is_for_typeof() { return for_typeof_; } | |
| 450 | |
| 451 protected: | 448 protected: |
| 452 AstContext(HGraphBuilder* owner, Expression::Context kind); | 449 AstContext(HGraphBuilder* owner, Expression::Context kind); |
| 453 virtual ~AstContext(); | 450 virtual ~AstContext(); |
| 454 | 451 |
| 455 HGraphBuilder* owner() const { return owner_; } | 452 HGraphBuilder* owner() const { return owner_; } |
| 456 | 453 |
| 457 // We want to be able to assert, in a context-specific way, that the stack | 454 // We want to be able to assert, in a context-specific way, that the stack |
| 458 // height makes sense when the context is filled. | 455 // height makes sense when the context is filled. |
| 459 #ifdef DEBUG | 456 #ifdef DEBUG |
| 460 int original_length_; | 457 int original_length_; |
| 461 #endif | 458 #endif |
| 462 | 459 |
| 463 private: | 460 private: |
| 464 HGraphBuilder* owner_; | 461 HGraphBuilder* owner_; |
| 465 Expression::Context kind_; | 462 Expression::Context kind_; |
| 466 AstContext* outer_; | 463 AstContext* outer_; |
| 467 bool for_typeof_; | |
| 468 }; | 464 }; |
| 469 | 465 |
| 470 | 466 |
| 471 class EffectContext: public AstContext { | 467 class EffectContext: public AstContext { |
| 472 public: | 468 public: |
| 473 explicit EffectContext(HGraphBuilder* owner) | 469 explicit EffectContext(HGraphBuilder* owner) |
| 474 : AstContext(owner, Expression::kEffect) { | 470 : AstContext(owner, Expression::kEffect) { |
| 475 } | 471 } |
| 476 virtual ~EffectContext(); | 472 virtual ~EffectContext(); |
| 477 | 473 |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 | 720 |
| 725 HBasicBlock* JoinContinue(IterationStatement* statement, | 721 HBasicBlock* JoinContinue(IterationStatement* statement, |
| 726 HBasicBlock* exit_block, | 722 HBasicBlock* exit_block, |
| 727 HBasicBlock* continue_block); | 723 HBasicBlock* continue_block); |
| 728 | 724 |
| 729 HValue* Top() const { return environment()->Top(); } | 725 HValue* Top() const { return environment()->Top(); } |
| 730 void Drop(int n) { environment()->Drop(n); } | 726 void Drop(int n) { environment()->Drop(n); } |
| 731 void Bind(Variable* var, HValue* value) { environment()->Bind(var, value); } | 727 void Bind(Variable* var, HValue* value) { environment()->Bind(var, value); } |
| 732 | 728 |
| 733 void VisitForValue(Expression* expr); | 729 void VisitForValue(Expression* expr); |
| 734 void VisitForTypeOf(Expression* expr); | |
| 735 void VisitForEffect(Expression* expr); | 730 void VisitForEffect(Expression* expr); |
| 736 void VisitForControl(Expression* expr, | 731 void VisitForControl(Expression* expr, |
| 737 HBasicBlock* true_block, | 732 HBasicBlock* true_block, |
| 738 HBasicBlock* false_block); | 733 HBasicBlock* false_block); |
| 739 | 734 |
| 740 // Visit an argument subexpression and emit a push to the outgoing | 735 // Visit an argument subexpression and emit a push to the outgoing |
| 741 // arguments. | 736 // arguments. |
| 742 void VisitArgument(Expression* expr); | 737 void VisitArgument(Expression* expr); |
| 743 void VisitArgumentList(ZoneList<Expression*>* arguments); | 738 void VisitArgumentList(ZoneList<Expression*>* arguments); |
| 744 | 739 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 760 virtual void VisitStatements(ZoneList<Statement*>* statements); | 755 virtual void VisitStatements(ZoneList<Statement*>* statements); |
| 761 | 756 |
| 762 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); | 757 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); |
| 763 AST_NODE_LIST(DECLARE_VISIT) | 758 AST_NODE_LIST(DECLARE_VISIT) |
| 764 #undef DECLARE_VISIT | 759 #undef DECLARE_VISIT |
| 765 | 760 |
| 766 HBasicBlock* CreateBasicBlock(HEnvironment* env); | 761 HBasicBlock* CreateBasicBlock(HEnvironment* env); |
| 767 HBasicBlock* CreateLoopHeaderBlock(); | 762 HBasicBlock* CreateLoopHeaderBlock(); |
| 768 | 763 |
| 769 // Helpers for flow graph construction. | 764 // Helpers for flow graph construction. |
| 770 enum GlobalPropertyAccess { | 765 void LookupGlobalPropertyCell(Variable* var, |
| 771 kUseCell, | 766 LookupResult* lookup, |
| 772 kUseGeneric | 767 bool is_store); |
| 773 }; | |
| 774 GlobalPropertyAccess LookupGlobalProperty(Variable* var, | |
| 775 LookupResult* lookup, | |
| 776 bool is_store); | |
| 777 | 768 |
| 778 bool TryArgumentsAccess(Property* expr); | 769 bool TryArgumentsAccess(Property* expr); |
| 779 bool TryCallApply(Call* expr); | 770 bool TryCallApply(Call* expr); |
| 780 bool TryInline(Call* expr); | 771 bool TryInline(Call* expr); |
| 781 bool TryInlineBuiltinFunction(Call* expr, | 772 bool TryInlineBuiltinFunction(Call* expr, |
| 782 HValue* receiver, | 773 HValue* receiver, |
| 783 Handle<Map> receiver_map, | 774 Handle<Map> receiver_map, |
| 784 CheckType check_type); | 775 CheckType check_type); |
| 785 | 776 |
| 786 // If --trace-inlining, print a line of the inlining trace. Inlining | 777 // If --trace-inlining, print a line of the inlining trace. Inlining |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 const char* filename_; | 1094 const char* filename_; |
| 1104 HeapStringAllocator string_allocator_; | 1095 HeapStringAllocator string_allocator_; |
| 1105 StringStream trace_; | 1096 StringStream trace_; |
| 1106 int indent_; | 1097 int indent_; |
| 1107 }; | 1098 }; |
| 1108 | 1099 |
| 1109 | 1100 |
| 1110 } } // namespace v8::internal | 1101 } } // namespace v8::internal |
| 1111 | 1102 |
| 1112 #endif // V8_HYDROGEN_H_ | 1103 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |