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