Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: src/hydrogen.h

Issue 10033028: Reland arguments access support for inlined functions (r11109,r11118). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix Kevin's comments Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 24 matching lines...) Expand all
35 #include "compiler.h" 35 #include "compiler.h"
36 #include "hydrogen-instructions.h" 36 #include "hydrogen-instructions.h"
37 #include "type-info.h" 37 #include "type-info.h"
38 #include "zone.h" 38 #include "zone.h"
39 39
40 namespace v8 { 40 namespace v8 {
41 namespace internal { 41 namespace internal {
42 42
43 // Forward declarations. 43 // Forward declarations.
44 class BitVector; 44 class BitVector;
45 class FunctionState;
45 class HEnvironment; 46 class HEnvironment;
46 class HGraph; 47 class HGraph;
47 class HLoopInformation; 48 class HLoopInformation;
48 class HTracer; 49 class HTracer;
49 class LAllocator; 50 class LAllocator;
50 class LChunk; 51 class LChunk;
51 class LiveRange; 52 class LiveRange;
52 53
53 54
54 class HBasicBlock: public ZoneObject { 55 class HBasicBlock: public ZoneObject {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 ASSERT(parent_loop_header_ == NULL); 115 ASSERT(parent_loop_header_ == NULL);
115 parent_loop_header_ = block; 116 parent_loop_header_ = block;
116 } 117 }
117 118
118 bool HasParentLoopHeader() const { return parent_loop_header_ != NULL; } 119 bool HasParentLoopHeader() const { return parent_loop_header_ != NULL; }
119 120
120 void SetJoinId(int ast_id); 121 void SetJoinId(int ast_id);
121 122
122 void Finish(HControlInstruction* last); 123 void Finish(HControlInstruction* last);
123 void FinishExit(HControlInstruction* instruction); 124 void FinishExit(HControlInstruction* instruction);
124 void Goto(HBasicBlock* block, bool drop_extra = false); 125 void Goto(HBasicBlock* block, FunctionState* state = NULL);
125 126
126 int PredecessorIndexOf(HBasicBlock* predecessor) const; 127 int PredecessorIndexOf(HBasicBlock* predecessor) const;
127 void AddSimulate(int ast_id) { AddInstruction(CreateSimulate(ast_id)); } 128 void AddSimulate(int ast_id) { AddInstruction(CreateSimulate(ast_id)); }
128 void AssignCommonDominator(HBasicBlock* other); 129 void AssignCommonDominator(HBasicBlock* other);
129 void AssignLoopSuccessorDominators(); 130 void AssignLoopSuccessorDominators();
130 131
131 void FinishExitWithDeoptimization(HDeoptimize::UseEnvironment has_uses) { 132 void FinishExitWithDeoptimization(HDeoptimize::UseEnvironment has_uses) {
132 FinishExit(CreateDeoptimize(has_uses)); 133 FinishExit(CreateDeoptimize(has_uses));
133 } 134 }
134 135
135 // Add the inlined function exit sequence, adding an HLeaveInlined 136 // Add the inlined function exit sequence, adding an HLeaveInlined
136 // instruction and updating the bailout environment. 137 // instruction and updating the bailout environment.
137 void AddLeaveInlined(HValue* return_value, 138 void AddLeaveInlined(HValue* return_value,
138 HBasicBlock* target, 139 HBasicBlock* target,
139 bool drop_extra = false); 140 FunctionState* state = NULL);
140 141
141 // If a target block is tagged as an inline function return, all 142 // If a target block is tagged as an inline function return, all
142 // predecessors should contain the inlined exit sequence: 143 // predecessors should contain the inlined exit sequence:
143 // 144 //
144 // LeaveInlined 145 // LeaveInlined
145 // Simulate (caller's environment) 146 // Simulate (caller's environment)
146 // Goto (target block) 147 // Goto (target block)
147 bool IsInlineReturnTarget() const { return is_inline_return_target_; } 148 bool IsInlineReturnTarget() const { return is_inline_return_target_; }
148 void MarkAsInlineReturnTarget() { is_inline_return_target_ = true; } 149 void MarkAsInlineReturnTarget() { is_inline_return_target_ = true; }
149 150
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 bool is_construct() { return return_handling_ == CONSTRUCT_CALL_RETURN; } 709 bool is_construct() { return return_handling_ == CONSTRUCT_CALL_RETURN; }
709 HBasicBlock* function_return() { return function_return_; } 710 HBasicBlock* function_return() { return function_return_; }
710 TestContext* test_context() { return test_context_; } 711 TestContext* test_context() { return test_context_; }
711 void ClearInlinedTestContext() { 712 void ClearInlinedTestContext() {
712 delete test_context_; 713 delete test_context_;
713 test_context_ = NULL; 714 test_context_ = NULL;
714 } 715 }
715 716
716 FunctionState* outer() { return outer_; } 717 FunctionState* outer() { return outer_; }
717 718
719 HEnterInlined* entry() { return entry_; }
720 void set_entry(HEnterInlined* entry) { entry_ = entry; }
721
722 HArgumentsElements* arguments_elements() { return arguments_elements_; }
723 void set_arguments_elements(HArgumentsElements* arguments_elements) {
724 arguments_elements_ = arguments_elements;
725 }
726
727 bool arguments_pushed() { return arguments_elements() != NULL; }
728
718 private: 729 private:
719 HGraphBuilder* owner_; 730 HGraphBuilder* owner_;
720 731
721 CompilationInfo* compilation_info_; 732 CompilationInfo* compilation_info_;
722 TypeFeedbackOracle* oracle_; 733 TypeFeedbackOracle* oracle_;
723 734
724 // During function inlining, expression context of the call being 735 // During function inlining, expression context of the call being
725 // inlined. NULL when not inlining. 736 // inlined. NULL when not inlining.
726 AstContext* call_context_; 737 AstContext* call_context_;
727 738
728 // Indicate whether we have to perform special handling on return from 739 // Indicate whether we have to perform special handling on return from
729 // inlined functions. 740 // inlined functions.
730 // - DROP_EXTRA_ON_RETURN: Drop an extra value from the environment. 741 // - DROP_EXTRA_ON_RETURN: Drop an extra value from the environment.
731 // - CONSTRUCT_CALL_RETURN: Either use allocated receiver or return value. 742 // - CONSTRUCT_CALL_RETURN: Either use allocated receiver or return value.
732 ReturnHandlingFlag return_handling_; 743 ReturnHandlingFlag return_handling_;
733 744
734 // When inlining in an effect or value context, this is the return block. 745 // When inlining in an effect or value context, this is the return block.
735 // It is NULL otherwise. When inlining in a test context, there are a 746 // It is NULL otherwise. When inlining in a test context, there are a
736 // pair of return blocks in the context. When not inlining, there is no 747 // pair of return blocks in the context. When not inlining, there is no
737 // local return point. 748 // local return point.
738 HBasicBlock* function_return_; 749 HBasicBlock* function_return_;
739 750
740 // When inlining a call in a test context, a context containing a pair of 751 // When inlining a call in a test context, a context containing a pair of
741 // return blocks. NULL in all other cases. 752 // return blocks. NULL in all other cases.
742 TestContext* test_context_; 753 TestContext* test_context_;
743 754
755 // When inlining HEnterInlined instruction corresponding to the function
756 // entry.
757 HEnterInlined* entry_;
758
759 HArgumentsElements* arguments_elements_;
760
744 FunctionState* outer_; 761 FunctionState* outer_;
745 }; 762 };
746 763
747 764
748 class HGraphBuilder: public AstVisitor { 765 class HGraphBuilder: public AstVisitor {
749 public: 766 public:
750 enum BreakType { BREAK, CONTINUE }; 767 enum BreakType { BREAK, CONTINUE };
751 enum SwitchType { UNKNOWN_SWITCH, SMI_SWITCH, STRING_SWITCH }; 768 enum SwitchType { UNKNOWN_SWITCH, SMI_SWITCH, STRING_SWITCH };
752 769
753 // A class encapsulating (lazily-allocated) break and continue blocks for 770 // A class encapsulating (lazily-allocated) break and continue blocks for
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 1004
988 // Helpers for flow graph construction. 1005 // Helpers for flow graph construction.
989 enum GlobalPropertyAccess { 1006 enum GlobalPropertyAccess {
990 kUseCell, 1007 kUseCell,
991 kUseGeneric 1008 kUseGeneric
992 }; 1009 };
993 GlobalPropertyAccess LookupGlobalProperty(Variable* var, 1010 GlobalPropertyAccess LookupGlobalProperty(Variable* var,
994 LookupResult* lookup, 1011 LookupResult* lookup,
995 bool is_store); 1012 bool is_store);
996 1013
1014 void EnsureArgumentsArePushedForAccess();
997 bool TryArgumentsAccess(Property* expr); 1015 bool TryArgumentsAccess(Property* expr);
998 1016
999 // Try to optimize fun.apply(receiver, arguments) pattern. 1017 // Try to optimize fun.apply(receiver, arguments) pattern.
1000 bool TryCallApply(Call* expr); 1018 bool TryCallApply(Call* expr);
1001 1019
1002 bool TryInline(CallKind call_kind, 1020 bool TryInline(CallKind call_kind,
1003 Handle<JSFunction> target, 1021 Handle<JSFunction> target,
1004 ZoneList<Expression*>* arguments, 1022 ZoneList<Expression*>* arguments,
1005 HValue* receiver, 1023 HValue* receiver,
1006 int ast_id, 1024 int ast_id,
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 const char* filename_; 1392 const char* filename_;
1375 HeapStringAllocator string_allocator_; 1393 HeapStringAllocator string_allocator_;
1376 StringStream trace_; 1394 StringStream trace_;
1377 int indent_; 1395 int indent_;
1378 }; 1396 };
1379 1397
1380 1398
1381 } } // namespace v8::internal 1399 } } // namespace v8::internal
1382 1400
1383 #endif // V8_HYDROGEN_H_ 1401 #endif // V8_HYDROGEN_H_
OLDNEW
« src/arm/lithium-arm.h ('K') | « src/arm/lithium-codegen-arm.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698