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