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

Side by Side Diff: src/hydrogen.h

Issue 211393007: Backport https://code.google.com/p/v8/source/detail?r=19360 to 3.24.35 (Closed) Base URL: https://github.com/v8/v8.git@3.24
Patch Set: Created 6 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
« no previous file with comments | « src/flag-definitions.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 void AttachLoopInformation(); 104 void AttachLoopInformation();
105 void DetachLoopInformation(); 105 void DetachLoopInformation();
106 bool IsLoopHeader() const { return loop_information() != NULL; } 106 bool IsLoopHeader() const { return loop_information() != NULL; }
107 bool IsStartBlock() const { return block_id() == 0; } 107 bool IsStartBlock() const { return block_id() == 0; }
108 void PostProcessLoopHeader(IterationStatement* stmt); 108 void PostProcessLoopHeader(IterationStatement* stmt);
109 109
110 bool IsFinished() const { return end_ != NULL; } 110 bool IsFinished() const { return end_ != NULL; }
111 void AddPhi(HPhi* phi); 111 void AddPhi(HPhi* phi);
112 void RemovePhi(HPhi* phi); 112 void RemovePhi(HPhi* phi);
113 void AddInstruction(HInstruction* instr, int position); 113 void AddInstruction(HInstruction* instr, HSourcePosition position);
114 bool Dominates(HBasicBlock* other) const; 114 bool Dominates(HBasicBlock* other) const;
115 bool EqualToOrDominates(HBasicBlock* other) const; 115 bool EqualToOrDominates(HBasicBlock* other) const;
116 int LoopNestingDepth() const; 116 int LoopNestingDepth() const;
117 117
118 void SetInitialEnvironment(HEnvironment* env); 118 void SetInitialEnvironment(HEnvironment* env);
119 void ClearEnvironment() { 119 void ClearEnvironment() {
120 ASSERT(IsFinished()); 120 ASSERT(IsFinished());
121 ASSERT(end()->SuccessorCount() == 0); 121 ASSERT(end()->SuccessorCount() == 0);
122 last_environment_ = NULL; 122 last_environment_ = NULL;
123 } 123 }
124 bool HasEnvironment() const { return last_environment_ != NULL; } 124 bool HasEnvironment() const { return last_environment_ != NULL; }
125 void UpdateEnvironment(HEnvironment* env); 125 void UpdateEnvironment(HEnvironment* env);
126 HBasicBlock* parent_loop_header() const { return parent_loop_header_; } 126 HBasicBlock* parent_loop_header() const { return parent_loop_header_; }
127 127
128 void set_parent_loop_header(HBasicBlock* block) { 128 void set_parent_loop_header(HBasicBlock* block) {
129 ASSERT(parent_loop_header_ == NULL); 129 ASSERT(parent_loop_header_ == NULL);
130 parent_loop_header_ = block; 130 parent_loop_header_ = block;
131 } 131 }
132 132
133 bool HasParentLoopHeader() const { return parent_loop_header_ != NULL; } 133 bool HasParentLoopHeader() const { return parent_loop_header_ != NULL; }
134 134
135 void SetJoinId(BailoutId ast_id); 135 void SetJoinId(BailoutId ast_id);
136 136
137 int PredecessorIndexOf(HBasicBlock* predecessor) const; 137 int PredecessorIndexOf(HBasicBlock* predecessor) const;
138 HPhi* AddNewPhi(int merged_index); 138 HPhi* AddNewPhi(int merged_index);
139 HSimulate* AddNewSimulate(BailoutId ast_id, 139 HSimulate* AddNewSimulate(BailoutId ast_id,
140 int position, 140 HSourcePosition position,
141 RemovableSimulate removable = FIXED_SIMULATE) { 141 RemovableSimulate removable = FIXED_SIMULATE) {
142 HSimulate* instr = CreateSimulate(ast_id, removable); 142 HSimulate* instr = CreateSimulate(ast_id, removable);
143 AddInstruction(instr, position); 143 AddInstruction(instr, position);
144 return instr; 144 return instr;
145 } 145 }
146 void AssignCommonDominator(HBasicBlock* other); 146 void AssignCommonDominator(HBasicBlock* other);
147 void AssignLoopSuccessorDominators(); 147 void AssignLoopSuccessorDominators();
148 148
149 // If a target block is tagged as an inline function return, all 149 // If a target block is tagged as an inline function return, all
150 // predecessors should contain the inlined exit sequence: 150 // predecessors should contain the inlined exit sequence:
(...skipping 26 matching lines...) Expand all
177 inline Zone* zone() const; 177 inline Zone* zone() const;
178 178
179 #ifdef DEBUG 179 #ifdef DEBUG
180 void Verify(); 180 void Verify();
181 #endif 181 #endif
182 182
183 protected: 183 protected:
184 friend class HGraphBuilder; 184 friend class HGraphBuilder;
185 185
186 HSimulate* CreateSimulate(BailoutId ast_id, RemovableSimulate removable); 186 HSimulate* CreateSimulate(BailoutId ast_id, RemovableSimulate removable);
187 void Finish(HControlInstruction* last, int position); 187 void Finish(HControlInstruction* last, HSourcePosition position);
188 void FinishExit(HControlInstruction* instruction, int position); 188 void FinishExit(HControlInstruction* instruction, HSourcePosition position);
189 void Goto(HBasicBlock* block, 189 void Goto(HBasicBlock* block,
190 int position, 190 HSourcePosition position,
191 FunctionState* state = NULL, 191 FunctionState* state = NULL,
192 bool add_simulate = true); 192 bool add_simulate = true);
193 void GotoNoSimulate(HBasicBlock* block, int position) { 193 void GotoNoSimulate(HBasicBlock* block, HSourcePosition position) {
194 Goto(block, position, NULL, false); 194 Goto(block, position, NULL, false);
195 } 195 }
196 196
197 // Add the inlined function exit sequence, adding an HLeaveInlined 197 // Add the inlined function exit sequence, adding an HLeaveInlined
198 // instruction and updating the bailout environment. 198 // instruction and updating the bailout environment.
199 void AddLeaveInlined(HValue* return_value, 199 void AddLeaveInlined(HValue* return_value,
200 FunctionState* state, 200 FunctionState* state,
201 int position); 201 HSourcePosition position);
202 202
203 private: 203 private:
204 void RegisterPredecessor(HBasicBlock* pred); 204 void RegisterPredecessor(HBasicBlock* pred);
205 void AddDominatedBlock(HBasicBlock* block); 205 void AddDominatedBlock(HBasicBlock* block);
206 206
207 int block_id_; 207 int block_id_;
208 HGraph* graph_; 208 HGraph* graph_;
209 ZoneList<HPhi*> phis_; 209 ZoneList<HPhi*> phis_;
210 HInstruction* first_; 210 HInstruction* first_;
211 HInstruction* last_; 211 HInstruction* last_;
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 if (uint32_instructions_ == NULL) { 462 if (uint32_instructions_ == NULL) {
463 uint32_instructions_ = new(zone()) ZoneList<HInstruction*>(4, zone()); 463 uint32_instructions_ = new(zone()) ZoneList<HInstruction*>(4, zone());
464 } 464 }
465 uint32_instructions_->Add(instr, zone()); 465 uint32_instructions_->Add(instr, zone());
466 } 466 }
467 467
468 void IncrementInNoSideEffectsScope() { no_side_effects_scope_count_++; } 468 void IncrementInNoSideEffectsScope() { no_side_effects_scope_count_++; }
469 void DecrementInNoSideEffectsScope() { no_side_effects_scope_count_--; } 469 void DecrementInNoSideEffectsScope() { no_side_effects_scope_count_--; }
470 bool IsInsideNoSideEffectsScope() { return no_side_effects_scope_count_ > 0; } 470 bool IsInsideNoSideEffectsScope() { return no_side_effects_scope_count_ > 0; }
471 471
472 // If we are tracking source positions then this function assigns a unique
473 // identifier to each inlining and dumps function source if it was inlined
474 // for the first time during the current optimization.
475 int TraceInlinedFunction(Handle<SharedFunctionInfo> shared,
476 HSourcePosition position);
477
478 // Converts given HSourcePosition to the absolute offset from the start of
479 // the corresponding script.
480 int SourcePositionToScriptPosition(HSourcePosition position);
481
472 private: 482 private:
473 HConstant* ReinsertConstantIfNecessary(HConstant* constant); 483 HConstant* ReinsertConstantIfNecessary(HConstant* constant);
474 HConstant* GetConstant(SetOncePointer<HConstant>* pointer, 484 HConstant* GetConstant(SetOncePointer<HConstant>* pointer,
475 int32_t integer_value); 485 int32_t integer_value);
476 486
477 template<class Phase> 487 template<class Phase>
478 void Run() { 488 void Run() {
479 Phase phase(this); 489 Phase phase(this);
480 phase.Run(); 490 phase.Run();
481 } 491 }
(...skipping 25 matching lines...) Expand all
507 Zone* zone_; 517 Zone* zone_;
508 518
509 bool is_recursive_; 519 bool is_recursive_;
510 bool use_optimistic_licm_; 520 bool use_optimistic_licm_;
511 bool depends_on_empty_array_proto_elements_; 521 bool depends_on_empty_array_proto_elements_;
512 int type_change_checksum_; 522 int type_change_checksum_;
513 int maximum_environment_size_; 523 int maximum_environment_size_;
514 int no_side_effects_scope_count_; 524 int no_side_effects_scope_count_;
515 bool disallow_adding_new_values_; 525 bool disallow_adding_new_values_;
516 526
527 class InlinedFunctionInfo {
528 public:
529 explicit InlinedFunctionInfo(Handle<SharedFunctionInfo> shared)
530 : shared_(shared), start_position_(shared->start_position()) {
531 }
532
533 Handle<SharedFunctionInfo> shared() const { return shared_; }
534 int start_position() const { return start_position_; }
535
536 private:
537 Handle<SharedFunctionInfo> shared_;
538 int start_position_;
539 };
540
541 int next_inline_id_;
542 ZoneList<InlinedFunctionInfo> inlined_functions_;
543
517 DISALLOW_COPY_AND_ASSIGN(HGraph); 544 DISALLOW_COPY_AND_ASSIGN(HGraph);
518 }; 545 };
519 546
520 547
521 Zone* HBasicBlock::zone() const { return graph_->zone(); } 548 Zone* HBasicBlock::zone() const { return graph_->zone(); }
522 549
523 550
524 // Type of stack frame an environment might refer to. 551 // Type of stack frame an environment might refer to.
525 enum FrameType { 552 enum FrameType {
526 JS_FUNCTION, 553 JS_FUNCTION,
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 Expression* condition_; 900 Expression* condition_;
874 HBasicBlock* if_true_; 901 HBasicBlock* if_true_;
875 HBasicBlock* if_false_; 902 HBasicBlock* if_false_;
876 }; 903 };
877 904
878 905
879 class FunctionState V8_FINAL { 906 class FunctionState V8_FINAL {
880 public: 907 public:
881 FunctionState(HOptimizedGraphBuilder* owner, 908 FunctionState(HOptimizedGraphBuilder* owner,
882 CompilationInfo* info, 909 CompilationInfo* info,
883 InliningKind inlining_kind); 910 InliningKind inlining_kind,
911 int inlining_id);
884 ~FunctionState(); 912 ~FunctionState();
885 913
886 CompilationInfo* compilation_info() { return compilation_info_; } 914 CompilationInfo* compilation_info() { return compilation_info_; }
887 AstContext* call_context() { return call_context_; } 915 AstContext* call_context() { return call_context_; }
888 InliningKind inlining_kind() const { return inlining_kind_; } 916 InliningKind inlining_kind() const { return inlining_kind_; }
889 HBasicBlock* function_return() { return function_return_; } 917 HBasicBlock* function_return() { return function_return_; }
890 TestContext* test_context() { return test_context_; } 918 TestContext* test_context() { return test_context_; }
891 void ClearInlinedTestContext() { 919 void ClearInlinedTestContext() {
892 delete test_context_; 920 delete test_context_;
893 test_context_ = NULL; 921 test_context_ = NULL;
894 } 922 }
895 923
896 FunctionState* outer() { return outer_; } 924 FunctionState* outer() { return outer_; }
897 925
898 HEnterInlined* entry() { return entry_; } 926 HEnterInlined* entry() { return entry_; }
899 void set_entry(HEnterInlined* entry) { entry_ = entry; } 927 void set_entry(HEnterInlined* entry) { entry_ = entry; }
900 928
901 HArgumentsObject* arguments_object() { return arguments_object_; } 929 HArgumentsObject* arguments_object() { return arguments_object_; }
902 void set_arguments_object(HArgumentsObject* arguments_object) { 930 void set_arguments_object(HArgumentsObject* arguments_object) {
903 arguments_object_ = arguments_object; 931 arguments_object_ = arguments_object;
904 } 932 }
905 933
906 HArgumentsElements* arguments_elements() { return arguments_elements_; } 934 HArgumentsElements* arguments_elements() { return arguments_elements_; }
907 void set_arguments_elements(HArgumentsElements* arguments_elements) { 935 void set_arguments_elements(HArgumentsElements* arguments_elements) {
908 arguments_elements_ = arguments_elements; 936 arguments_elements_ = arguments_elements;
909 } 937 }
910 938
911 bool arguments_pushed() { return arguments_elements() != NULL; } 939 bool arguments_pushed() { return arguments_elements() != NULL; }
912 940
941 int inlining_id() const { return inlining_id_; }
942
913 private: 943 private:
914 HOptimizedGraphBuilder* owner_; 944 HOptimizedGraphBuilder* owner_;
915 945
916 CompilationInfo* compilation_info_; 946 CompilationInfo* compilation_info_;
917 947
918 // During function inlining, expression context of the call being 948 // During function inlining, expression context of the call being
919 // inlined. NULL when not inlining. 949 // inlined. NULL when not inlining.
920 AstContext* call_context_; 950 AstContext* call_context_;
921 951
922 // The kind of call which is currently being inlined. 952 // The kind of call which is currently being inlined.
923 InliningKind inlining_kind_; 953 InliningKind inlining_kind_;
924 954
925 // When inlining in an effect or value context, this is the return block. 955 // When inlining in an effect or value context, this is the return block.
926 // It is NULL otherwise. When inlining in a test context, there are a 956 // It is NULL otherwise. When inlining in a test context, there are a
927 // pair of return blocks in the context. When not inlining, there is no 957 // pair of return blocks in the context. When not inlining, there is no
928 // local return point. 958 // local return point.
929 HBasicBlock* function_return_; 959 HBasicBlock* function_return_;
930 960
931 // When inlining a call in a test context, a context containing a pair of 961 // When inlining a call in a test context, a context containing a pair of
932 // return blocks. NULL in all other cases. 962 // return blocks. NULL in all other cases.
933 TestContext* test_context_; 963 TestContext* test_context_;
934 964
935 // When inlining HEnterInlined instruction corresponding to the function 965 // When inlining HEnterInlined instruction corresponding to the function
936 // entry. 966 // entry.
937 HEnterInlined* entry_; 967 HEnterInlined* entry_;
938 968
939 HArgumentsObject* arguments_object_; 969 HArgumentsObject* arguments_object_;
940 HArgumentsElements* arguments_elements_; 970 HArgumentsElements* arguments_elements_;
941 971
972 int inlining_id_;
973 HSourcePosition outer_source_position_;
974
942 FunctionState* outer_; 975 FunctionState* outer_;
943 }; 976 };
944 977
945 978
946 class HIfContinuation V8_FINAL { 979 class HIfContinuation V8_FINAL {
947 public: 980 public:
948 HIfContinuation() 981 HIfContinuation()
949 : continuation_captured_(false), 982 : continuation_captured_(false),
950 true_branch_(NULL), 983 true_branch_(NULL),
951 false_branch_(NULL) {} 984 false_branch_(NULL) {}
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 PretenureFlag pretenure_flag_; 1048 PretenureFlag pretenure_flag_;
1016 }; 1049 };
1017 1050
1018 1051
1019 class HGraphBuilder { 1052 class HGraphBuilder {
1020 public: 1053 public:
1021 explicit HGraphBuilder(CompilationInfo* info) 1054 explicit HGraphBuilder(CompilationInfo* info)
1022 : info_(info), 1055 : info_(info),
1023 graph_(NULL), 1056 graph_(NULL),
1024 current_block_(NULL), 1057 current_block_(NULL),
1025 position_(RelocInfo::kNoPosition) {} 1058 position_(HSourcePosition::Unknown()),
1059 start_position_(0) {}
1026 virtual ~HGraphBuilder() {} 1060 virtual ~HGraphBuilder() {}
1027 1061
1028 HBasicBlock* current_block() const { return current_block_; } 1062 HBasicBlock* current_block() const { return current_block_; }
1029 void set_current_block(HBasicBlock* block) { current_block_ = block; } 1063 void set_current_block(HBasicBlock* block) { current_block_ = block; }
1030 HEnvironment* environment() const { 1064 HEnvironment* environment() const {
1031 return current_block()->last_environment(); 1065 return current_block()->last_environment();
1032 } 1066 }
1033 Zone* zone() const { return info_->zone(); } 1067 Zone* zone() const { return info_->zone(); }
1034 HGraph* graph() const { return graph_; } 1068 HGraph* graph() const { return graph_; }
1035 Isolate* isolate() const { return graph_->isolate(); } 1069 Isolate* isolate() const { return graph_->isolate(); }
1036 CompilationInfo* top_info() { return info_; } 1070 CompilationInfo* top_info() { return info_; }
1037 1071
1038 HGraph* CreateGraph(); 1072 HGraph* CreateGraph();
1039 1073
1040 // Bailout environment manipulation. 1074 // Bailout environment manipulation.
1041 void Push(HValue* value) { environment()->Push(value); } 1075 void Push(HValue* value) { environment()->Push(value); }
1042 HValue* Pop() { return environment()->Pop(); } 1076 HValue* Pop() { return environment()->Pop(); }
1043 1077
1044 virtual HValue* context() = 0; 1078 virtual HValue* context() = 0;
1045 1079
1046 // Adding instructions. 1080 // Adding instructions.
1047 HInstruction* AddInstruction(HInstruction* instr); 1081 HInstruction* AddInstruction(HInstruction* instr);
1048 void FinishCurrentBlock(HControlInstruction* last); 1082 void FinishCurrentBlock(HControlInstruction* last);
1049 void FinishExitCurrentBlock(HControlInstruction* instruction); 1083 void FinishExitCurrentBlock(HControlInstruction* instruction);
1050 1084
1051 void Goto(HBasicBlock* from, 1085 void Goto(HBasicBlock* from,
1052 HBasicBlock* target, 1086 HBasicBlock* target,
1053 FunctionState* state = NULL, 1087 FunctionState* state = NULL,
1054 bool add_simulate = true) { 1088 bool add_simulate = true) {
1055 from->Goto(target, position_, state, add_simulate); 1089 from->Goto(target, source_position(), state, add_simulate);
1056 } 1090 }
1057 void Goto(HBasicBlock* target, 1091 void Goto(HBasicBlock* target,
1058 FunctionState* state = NULL, 1092 FunctionState* state = NULL,
1059 bool add_simulate = true) { 1093 bool add_simulate = true) {
1060 Goto(current_block(), target, state, add_simulate); 1094 Goto(current_block(), target, state, add_simulate);
1061 } 1095 }
1062 void GotoNoSimulate(HBasicBlock* from, HBasicBlock* target) { 1096 void GotoNoSimulate(HBasicBlock* from, HBasicBlock* target) {
1063 Goto(from, target, NULL, false); 1097 Goto(from, target, NULL, false);
1064 } 1098 }
1065 void GotoNoSimulate(HBasicBlock* target) { 1099 void GotoNoSimulate(HBasicBlock* target) {
1066 Goto(target, NULL, false); 1100 Goto(target, NULL, false);
1067 } 1101 }
1068 void AddLeaveInlined(HBasicBlock* block, 1102 void AddLeaveInlined(HBasicBlock* block,
1069 HValue* return_value, 1103 HValue* return_value,
1070 FunctionState* state) { 1104 FunctionState* state) {
1071 block->AddLeaveInlined(return_value, state, position_); 1105 block->AddLeaveInlined(return_value, state, source_position());
1072 } 1106 }
1073 void AddLeaveInlined(HValue* return_value, FunctionState* state) { 1107 void AddLeaveInlined(HValue* return_value, FunctionState* state) {
1074 return AddLeaveInlined(current_block(), return_value, state); 1108 return AddLeaveInlined(current_block(), return_value, state);
1075 } 1109 }
1076 1110
1077 template<class I> 1111 template<class I>
1078 HInstruction* NewUncasted() { return I::New(zone(), context()); } 1112 HInstruction* NewUncasted() { return I::New(zone(), context()); }
1079 1113
1080 template<class I> 1114 template<class I>
1081 I* New() { return I::New(zone(), context()); } 1115 I* New() { return I::New(zone(), context()); }
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1267 } 1301 }
1268 1302
1269 template<class I, class P1, class P2, class P3, class P4, 1303 template<class I, class P1, class P2, class P3, class P4,
1270 class P5, class P6, class P7, class P8> 1304 class P5, class P6, class P7, class P8>
1271 I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) { 1305 I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) {
1272 return AddInstructionTyped(New<I>(p1, p2, p3, p4, p5, p6, p7, p8)); 1306 return AddInstructionTyped(New<I>(p1, p2, p3, p4, p5, p6, p7, p8));
1273 } 1307 }
1274 1308
1275 void AddSimulate(BailoutId id, RemovableSimulate removable = FIXED_SIMULATE); 1309 void AddSimulate(BailoutId id, RemovableSimulate removable = FIXED_SIMULATE);
1276 1310
1277 int position() const { return position_; }
1278
1279 protected: 1311 protected:
1280 virtual bool BuildGraph() = 0; 1312 virtual bool BuildGraph() = 0;
1281 1313
1282 HBasicBlock* CreateBasicBlock(HEnvironment* env); 1314 HBasicBlock* CreateBasicBlock(HEnvironment* env);
1283 HBasicBlock* CreateLoopHeaderBlock(); 1315 HBasicBlock* CreateLoopHeaderBlock();
1284 1316
1285 HValue* BuildCheckHeapObject(HValue* object); 1317 HValue* BuildCheckHeapObject(HValue* object);
1286 HValue* BuildCheckMap(HValue* obj, Handle<Map> map); 1318 HValue* BuildCheckMap(HValue* obj, Handle<Map> map);
1287 HValue* BuildCheckString(HValue* string); 1319 HValue* BuildCheckString(HValue* string);
1288 HValue* BuildWrapReceiver(HValue* object, HValue* function); 1320 HValue* BuildWrapReceiver(HValue* object, HValue* function);
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1770 HInstruction* BuildCheckPrototypeMaps(Handle<JSObject> prototype, 1802 HInstruction* BuildCheckPrototypeMaps(Handle<JSObject> prototype,
1771 Handle<JSObject> holder); 1803 Handle<JSObject> holder);
1772 1804
1773 HInstruction* BuildGetNativeContext(HValue* closure); 1805 HInstruction* BuildGetNativeContext(HValue* closure);
1774 HInstruction* BuildGetNativeContext(); 1806 HInstruction* BuildGetNativeContext();
1775 HInstruction* BuildGetArrayFunction(); 1807 HInstruction* BuildGetArrayFunction();
1776 1808
1777 protected: 1809 protected:
1778 void SetSourcePosition(int position) { 1810 void SetSourcePosition(int position) {
1779 ASSERT(position != RelocInfo::kNoPosition); 1811 ASSERT(position != RelocInfo::kNoPosition);
1812 position_.set_position(position - start_position_);
1813 }
1814
1815 void EnterInlinedSource(int start_position, int id) {
1816 if (FLAG_hydrogen_track_positions) {
1817 start_position_ = start_position;
1818 position_.set_inlining_id(id);
1819 }
1820 }
1821
1822 // Convert the given absolute offset from the start of the script to
1823 // the HSourcePosition assuming that this position corresponds to the
1824 // same function as current position_.
1825 HSourcePosition ScriptPositionToSourcePosition(int position) {
1826 HSourcePosition pos = position_;
1827 pos.set_position(position - start_position_);
1828 return pos;
1829 }
1830
1831 HSourcePosition source_position() { return position_; }
1832 void set_source_position(HSourcePosition position) {
1780 position_ = position; 1833 position_ = position;
1781 } 1834 }
1782 1835
1783 template <typename ViewClass> 1836 template <typename ViewClass>
1784 void BuildArrayBufferViewInitialization(HValue* obj, 1837 void BuildArrayBufferViewInitialization(HValue* obj,
1785 HValue* buffer, 1838 HValue* buffer,
1786 HValue* byte_offset, 1839 HValue* byte_offset,
1787 HValue* byte_length); 1840 HValue* byte_length);
1788 1841
1789 private: 1842 private:
(...skipping 10 matching lines...) Expand all
1800 HBasicBlock* continuation); 1853 HBasicBlock* continuation);
1801 1854
1802 template <class I> 1855 template <class I>
1803 I* AddInstructionTyped(I* instr) { 1856 I* AddInstructionTyped(I* instr) {
1804 return I::cast(AddInstruction(instr)); 1857 return I::cast(AddInstruction(instr));
1805 } 1858 }
1806 1859
1807 CompilationInfo* info_; 1860 CompilationInfo* info_;
1808 HGraph* graph_; 1861 HGraph* graph_;
1809 HBasicBlock* current_block_; 1862 HBasicBlock* current_block_;
1810 int position_; 1863 HSourcePosition position_;
1864 int start_position_;
1811 }; 1865 };
1812 1866
1813 1867
1814 template<> 1868 template<>
1815 inline HDeoptimize* HGraphBuilder::Add<HDeoptimize>( 1869 inline HDeoptimize* HGraphBuilder::Add<HDeoptimize>(
1816 const char* reason, Deoptimizer::BailoutType type) { 1870 const char* reason, Deoptimizer::BailoutType type) {
1817 if (type == Deoptimizer::SOFT) { 1871 if (type == Deoptimizer::SOFT) {
1818 isolate()->counters()->soft_deopts_requested()->Increment(); 1872 isolate()->counters()->soft_deopts_requested()->Increment();
1819 if (FLAG_always_opt) return NULL; 1873 if (FLAG_always_opt) return NULL;
1820 } 1874 }
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
2206 2260
2207 HValue* ImplicitReceiverFor(HValue* function, 2261 HValue* ImplicitReceiverFor(HValue* function,
2208 Handle<JSFunction> target); 2262 Handle<JSFunction> target);
2209 2263
2210 int InliningAstSize(Handle<JSFunction> target); 2264 int InliningAstSize(Handle<JSFunction> target);
2211 bool TryInline(Handle<JSFunction> target, 2265 bool TryInline(Handle<JSFunction> target,
2212 int arguments_count, 2266 int arguments_count,
2213 HValue* implicit_return_value, 2267 HValue* implicit_return_value,
2214 BailoutId ast_id, 2268 BailoutId ast_id,
2215 BailoutId return_id, 2269 BailoutId return_id,
2216 InliningKind inlining_kind); 2270 InliningKind inlining_kind,
2271 HSourcePosition position);
2217 2272
2218 bool TryInlineCall(Call* expr); 2273 bool TryInlineCall(Call* expr);
2219 bool TryInlineConstruct(CallNew* expr, HValue* implicit_return_value); 2274 bool TryInlineConstruct(CallNew* expr, HValue* implicit_return_value);
2220 bool TryInlineGetter(Handle<JSFunction> getter, 2275 bool TryInlineGetter(Handle<JSFunction> getter,
2221 Handle<Map> receiver_map, 2276 Handle<Map> receiver_map,
2222 BailoutId ast_id, 2277 BailoutId ast_id,
2223 BailoutId return_id); 2278 BailoutId return_id);
2224 bool TryInlineSetter(Handle<JSFunction> setter, 2279 bool TryInlineSetter(Handle<JSFunction> setter,
2225 Handle<Map> receiver_map, 2280 Handle<Map> receiver_map,
2226 BailoutId id, 2281 BailoutId id,
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
2415 Handle<String> check); 2470 Handle<String> check);
2416 void HandleLiteralCompareNil(CompareOperation* expr, 2471 void HandleLiteralCompareNil(CompareOperation* expr,
2417 Expression* sub_expr, 2472 Expression* sub_expr,
2418 NilValue nil); 2473 NilValue nil);
2419 HControlInstruction* BuildCompareInstruction(Token::Value op, 2474 HControlInstruction* BuildCompareInstruction(Token::Value op,
2420 HValue* left, 2475 HValue* left,
2421 HValue* right, 2476 HValue* right,
2422 Type* left_type, 2477 Type* left_type,
2423 Type* right_type, 2478 Type* right_type,
2424 Type* combined_type, 2479 Type* combined_type,
2425 int left_position, 2480 HSourcePosition left_position,
2426 int right_position, 2481 HSourcePosition right_position,
2427 BailoutId bailout_id); 2482 BailoutId bailout_id);
2428 2483
2429 HInstruction* BuildStringCharCodeAt(HValue* string, 2484 HInstruction* BuildStringCharCodeAt(HValue* string,
2430 HValue* index); 2485 HValue* index);
2431 2486
2432 enum PushBeforeSimulateBehavior { 2487 enum PushBeforeSimulateBehavior {
2433 PUSH_BEFORE_SIMULATE, 2488 PUSH_BEFORE_SIMULATE,
2434 NO_PUSH_BEFORE_SIMULATE 2489 NO_PUSH_BEFORE_SIMULATE
2435 }; 2490 };
2436 HValue* BuildBinaryOperation( 2491 HValue* BuildBinaryOperation(
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
2741 } 2796 }
2742 2797
2743 private: 2798 private:
2744 HGraphBuilder* builder_; 2799 HGraphBuilder* builder_;
2745 }; 2800 };
2746 2801
2747 2802
2748 } } // namespace v8::internal 2803 } } // namespace v8::internal
2749 2804
2750 #endif // V8_HYDROGEN_H_ 2805 #endif // V8_HYDROGEN_H_
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698