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

Side by Side Diff: src/hydrogen.h

Issue 149413010: A64: Synchronize with r16024. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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
« no previous file with comments | « src/heap.cc ('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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 Isolate* isolate() const { return isolate_; } 309 Isolate* isolate() const { return isolate_; }
310 Zone* zone() const { return zone_; } 310 Zone* zone() const { return zone_; }
311 CompilationInfo* info() const { return info_; } 311 CompilationInfo* info() const { return info_; }
312 312
313 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } 313 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; }
314 const ZoneList<HPhi*>* phi_list() const { return phi_list_; } 314 const ZoneList<HPhi*>* phi_list() const { return phi_list_; }
315 HBasicBlock* entry_block() const { return entry_block_; } 315 HBasicBlock* entry_block() const { return entry_block_; }
316 HEnvironment* start_environment() const { return start_environment_; } 316 HEnvironment* start_environment() const { return start_environment_; }
317 317
318 void FinalizeUniqueValueIds(); 318 void FinalizeUniqueValueIds();
319 void MarkDeoptimizeOnUndefined();
320 bool ProcessArgumentsObject(); 319 bool ProcessArgumentsObject();
321 void OrderBlocks(); 320 void OrderBlocks();
322 void AssignDominators(); 321 void AssignDominators();
323 void SetupInformativeDefinitions(); 322 void SetupInformativeDefinitions();
324 void RestoreActualValues(); 323 void RestoreActualValues();
325 324
326 // Returns false if there are phi-uses of the arguments-object 325 // Returns false if there are phi-uses of the arguments-object
327 // which are not supported by the optimizing compiler. 326 // which are not supported by the optimizing compiler.
328 bool CheckArgumentsPhiUses(); 327 bool CheckArgumentsPhiUses();
329 328
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 int GetNextBlockID() { return next_block_id_++; } 360 int GetNextBlockID() { return next_block_id_++; }
362 int GetNextValueID(HValue* value) { 361 int GetNextValueID(HValue* value) {
363 values_.Add(value, zone()); 362 values_.Add(value, zone());
364 return values_.length() - 1; 363 return values_.length() - 1;
365 } 364 }
366 HValue* LookupValue(int id) const { 365 HValue* LookupValue(int id) const {
367 if (id >= 0 && id < values_.length()) return values_[id]; 366 if (id >= 0 && id < values_.length()) return values_[id];
368 return NULL; 367 return NULL;
369 } 368 }
370 369
371 bool Optimize(SmartArrayPointer<char>* bailout_reason); 370 bool Optimize(BailoutReason* bailout_reason);
372 371
373 #ifdef DEBUG 372 #ifdef DEBUG
374 void Verify(bool do_full_verify) const; 373 void Verify(bool do_full_verify) const;
375 #endif 374 #endif
376 375
377 bool has_osr() { 376 bool has_osr() {
378 return osr_ != NULL; 377 return osr_ != NULL;
379 } 378 }
380 379
381 void set_osr(HOsrBuilder* osr) { 380 void set_osr(HOsrBuilder* osr) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 private: 456 private:
458 HConstant* GetConstant(SetOncePointer<HConstant>* pointer, 457 HConstant* GetConstant(SetOncePointer<HConstant>* pointer,
459 int32_t integer_value); 458 int32_t integer_value);
460 459
461 template<class Phase> 460 template<class Phase>
462 void Run() { 461 void Run() {
463 Phase phase(this); 462 Phase phase(this);
464 phase.Run(); 463 phase.Run();
465 } 464 }
466 465
467 void RecursivelyMarkPhiDeoptimizeOnUndefined(HPhi* phi);
468 void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor); 466 void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor);
469 void SetupInformativeDefinitionsInBlock(HBasicBlock* block); 467 void SetupInformativeDefinitionsInBlock(HBasicBlock* block);
470 void SetupInformativeDefinitionsRecursively(HBasicBlock* block); 468 void SetupInformativeDefinitionsRecursively(HBasicBlock* block);
471 void EliminateRedundantBoundsChecksUsingInductionVariables(); 469 void EliminateRedundantBoundsChecksUsingInductionVariables();
472 470
473 Isolate* isolate_; 471 Isolate* isolate_;
474 int next_block_id_; 472 int next_block_id_;
475 HBasicBlock* entry_block_; 473 HBasicBlock* entry_block_;
476 HEnvironment* start_environment_; 474 HEnvironment* start_environment_;
477 ZoneList<HBasicBlock*> blocks_; 475 ZoneList<HBasicBlock*> blocks_;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 HValue* Lookup(Variable* variable) const { 576 HValue* Lookup(Variable* variable) const {
579 return Lookup(IndexFor(variable)); 577 return Lookup(IndexFor(variable));
580 } 578 }
581 579
582 HValue* Lookup(int index) const { 580 HValue* Lookup(int index) const {
583 HValue* result = values_[index]; 581 HValue* result = values_[index];
584 ASSERT(result != NULL); 582 ASSERT(result != NULL);
585 return result; 583 return result;
586 } 584 }
587 585
588 HValue* LookupContext() const { 586 HValue* context() const {
589 // Return first special. 587 // Return first special.
590 return Lookup(parameter_count()); 588 return Lookup(parameter_count());
591 } 589 }
592 590
593 void Push(HValue* value) { 591 void Push(HValue* value) {
594 ASSERT(value != NULL); 592 ASSERT(value != NULL);
595 ++push_count_; 593 ++push_count_;
596 values_.Add(value, zone()); 594 values_.Add(value, zone());
597 } 595 }
598 596
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 HGraph* graph() const { return graph_; } 983 HGraph* graph() const { return graph_; }
986 Isolate* isolate() const { return graph_->isolate(); } 984 Isolate* isolate() const { return graph_->isolate(); }
987 CompilationInfo* top_info() { return info_; } 985 CompilationInfo* top_info() { return info_; }
988 986
989 HGraph* CreateGraph(); 987 HGraph* CreateGraph();
990 988
991 // Bailout environment manipulation. 989 // Bailout environment manipulation.
992 void Push(HValue* value) { environment()->Push(value); } 990 void Push(HValue* value) { environment()->Push(value); }
993 HValue* Pop() { return environment()->Pop(); } 991 HValue* Pop() { return environment()->Pop(); }
994 992
993 virtual HValue* context() = 0;
994
995 // Adding instructions. 995 // Adding instructions.
996 HInstruction* AddInstruction(HInstruction* instr); 996 HInstruction* AddInstruction(HInstruction* instr);
997 997
998 template<class I> 998 template<class I>
999 I* Add() { return static_cast<I*>(AddInstruction(new(zone()) I())); } 999 HInstruction* NewUncasted() { return I::New(zone(), context()); }
1000
1001 template<class I>
1002 I* New() { return I::cast(NewUncasted<I>()); }
1003
1004 template<class I>
1005 HInstruction* AddUncasted() { return AddInstruction(NewUncasted<I>());}
1006
1007 template<class I>
1008 I* Add() { return I::cast(AddUncasted<I>());}
1009
1010 template<class I, class P1>
1011 HInstruction* NewUncasted(P1 p1) {
1012 return I::New(zone(), context(), p1);
1013 }
1014
1015 template<class I, class P1>
1016 I* New(P1 p1) { return I::cast(NewUncasted<I>(p1)); }
1017
1018 template<class I, class P1>
1019 HInstruction* AddUncasted(P1 p1) {
1020 HInstruction* result = AddInstruction(NewUncasted<I>(p1));
1021 // Specializations must have their parameters properly casted
1022 // to avoid landing here.
1023 ASSERT(!result->IsReturn() && !result->IsSimulate() &&
1024 !result->IsDeoptimize());
1025 return result;
1026 }
1000 1027
1001 template<class I, class P1> 1028 template<class I, class P1>
1002 I* Add(P1 p1) { 1029 I* Add(P1 p1) {
1003 return static_cast<I*>(AddInstruction(new(zone()) I(p1))); 1030 return I::cast(AddUncasted<I>(p1));
1031 }
1032
1033 template<class I, class P1, class P2>
1034 HInstruction* NewUncasted(P1 p1, P2 p2) {
1035 return I::New(zone(), context(), p1, p2);
1036 }
1037
1038 template<class I, class P1, class P2>
1039 I* New(P1 p1, P2 p2) {
1040 return I::cast(NewUncasted<I>(p1, p2));
1041 }
1042
1043 template<class I, class P1, class P2>
1044 HInstruction* AddUncasted(P1 p1, P2 p2) {
1045 HInstruction* result = AddInstruction(NewUncasted<I>(p1, p2));
1046 // Specializations must have their parameters properly casted
1047 // to avoid landing here.
1048 ASSERT(!result->IsSimulate());
1049 return result;
1004 } 1050 }
1005 1051
1006 template<class I, class P1, class P2> 1052 template<class I, class P1, class P2>
1007 I* Add(P1 p1, P2 p2) { 1053 I* Add(P1 p1, P2 p2) {
1008 return static_cast<I*>(AddInstruction(new(zone()) I(p1, p2))); 1054 return static_cast<I*>(AddUncasted<I>(p1, p2));
1055 }
1056
1057 template<class I, class P1, class P2, class P3>
1058 HInstruction* NewUncasted(P1 p1, P2 p2, P3 p3) {
1059 return I::New(zone(), context(), p1, p2, p3);
1060 }
1061
1062 template<class I, class P1, class P2, class P3>
1063 I* New(P1 p1, P2 p2, P3 p3) {
1064 return I::cast(NewUncasted<I>(p1, p2, p3));
1065 }
1066
1067 template<class I, class P1, class P2, class P3>
1068 HInstruction* AddUncasted(P1 p1, P2 p2, P3 p3) {
1069 return AddInstruction(NewUncasted<I>(p1, p2, p3));
1009 } 1070 }
1010 1071
1011 template<class I, class P1, class P2, class P3> 1072 template<class I, class P1, class P2, class P3>
1012 I* Add(P1 p1, P2 p2, P3 p3) { 1073 I* Add(P1 p1, P2 p2, P3 p3) {
1013 return static_cast<I*>(AddInstruction(new(zone()) I(p1, p2, p3))); 1074 return I::cast(AddUncasted<I>(p1, p2, p3));
1075 }
1076
1077 template<class I, class P1, class P2, class P3, class P4>
1078 HInstruction* NewUncasted(P1 p1, P2 p2, P3 p3, P4 p4) {
1079 return I::New(zone(), context(), p1, p2, p3, p4);
1080 }
1081
1082 template<class I, class P1, class P2, class P3, class P4>
1083 I* New(P1 p1, P2 p2, P3 p3, P4 p4) {
1084 return I::cast(NewUncasted<I>(p1, p2, p3, p4));
1085 }
1086
1087 template<class I, class P1, class P2, class P3, class P4>
1088 HInstruction* AddUncasted(P1 p1, P2 p2, P3 p3, P4 p4) {
1089 return AddInstruction(NewUncasted<I>(p1, p2, p3, p4));
1014 } 1090 }
1015 1091
1016 template<class I, class P1, class P2, class P3, class P4> 1092 template<class I, class P1, class P2, class P3, class P4>
1017 I* Add(P1 p1, P2 p2, P3 p3, P4 p4) { 1093 I* Add(P1 p1, P2 p2, P3 p3, P4 p4) {
1018 return static_cast<I*>(AddInstruction(new(zone()) I(p1, p2, p3, p4))); 1094 return I::cast(AddUncasted<I>(p1, p2, p3, p4));
1095 }
1096
1097 template<class I, class P1, class P2, class P3, class P4, class P5>
1098 HInstruction* NewUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) {
1099 return I::New(zone(), context(), p1, p2, p3, p4, p5);
1100 }
1101
1102 template<class I, class P1, class P2, class P3, class P4, class P5>
1103 I* New(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) {
1104 return I::cast(NewUncasted<I>(p1, p2, p3, p4, p5));
1105 }
1106
1107 template<class I, class P1, class P2, class P3, class P4, class P5>
1108 HInstruction* AddUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) {
1109 return AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5));
1019 } 1110 }
1020 1111
1021 template<class I, class P1, class P2, class P3, class P4, class P5> 1112 template<class I, class P1, class P2, class P3, class P4, class P5>
1022 I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) { 1113 I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) {
1023 return static_cast<I*>(AddInstruction(new(zone()) I(p1, p2, p3, p4, p5))); 1114 return I::cast(AddUncasted<I>(p1, p2, p3, p4, p5));
1115 }
1116
1117 template<class I, class P1, class P2, class P3, class P4, class P5, class P6>
1118 HInstruction* NewUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) {
1119 return I::New(zone(), context(), p1, p2, p3, p4, p5, p6);
1120 }
1121
1122 template<class I, class P1, class P2, class P3, class P4, class P5, class P6>
1123 I* New(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) {
1124 return I::cast(NewUncasted<I>(p1, p2, p3, p4, p5, p6));
1125 }
1126
1127 template<class I, class P1, class P2, class P3, class P4, class P5, class P6>
1128 HInstruction* AddUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) {
1129 return AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6));
1024 } 1130 }
1025 1131
1026 template<class I, class P1, class P2, class P3, class P4, class P5, class P6> 1132 template<class I, class P1, class P2, class P3, class P4, class P5, class P6>
1027 I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) { 1133 I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) {
1028 return static_cast<I*>(AddInstruction( 1134 return I::cast(AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6)));
1029 new(zone()) I(p1, p2, p3, p4, p5, p6))); 1135 }
1136
1137 template<class I, class P1, class P2, class P3, class P4,
1138 class P5, class P6, class P7>
1139 HInstruction* NewUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) {
1140 return I::New(zone(), context(), p1, p2, p3, p4, p5, p6, p7);
1141 }
1142
1143 template<class I, class P1, class P2, class P3, class P4,
1144 class P5, class P6, class P7>
1145 I* New(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) {
1146 return I::cast(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7));
1147 }
1148
1149 template<class I, class P1, class P2, class P3,
1150 class P4, class P5, class P6, class P7>
1151 HInstruction* AddUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) {
1152 return AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7));
1030 } 1153 }
1031 1154
1032 template<class I, class P1, class P2, class P3, 1155 template<class I, class P1, class P2, class P3,
1033 class P4, class P5, class P6, class P7> 1156 class P4, class P5, class P6, class P7>
1034 I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) { 1157 I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) {
1035 return static_cast<I*>(AddInstruction( 1158 return I::cast(AddInstruction(NewUncasted<I>(p1, p2, p3, p4,
1036 new(zone()) I(p1, p2, p3, p4, p5, p6, p7))); 1159 p5, p6, p7)));
1160 }
1161
1162 template<class I, class P1, class P2, class P3, class P4,
1163 class P5, class P6, class P7, class P8>
1164 HInstruction* NewUncasted(P1 p1, P2 p2, P3 p3, P4 p4,
1165 P5 p5, P6 p6, P7 p7, P8 p8) {
1166 return I::New(zone(), context(), p1, p2, p3, p4, p5, p6, p7, p8);
1167 }
1168
1169 template<class I, class P1, class P2, class P3, class P4,
1170 class P5, class P6, class P7, class P8>
1171 I* New(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) {
1172 return I::cast(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7, p8));
1173 }
1174
1175 template<class I, class P1, class P2, class P3, class P4,
1176 class P5, class P6, class P7, class P8>
1177 HInstruction* AddUncasted(P1 p1, P2 p2, P3 p3, P4 p4,
1178 P5 p5, P6 p6, P7 p7, P8 p8) {
1179 return AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7, p8));
1037 } 1180 }
1038 1181
1039 template<class I, class P1, class P2, class P3, class P4, 1182 template<class I, class P1, class P2, class P3, class P4,
1040 class P5, class P6, class P7, class P8> 1183 class P5, class P6, class P7, class P8>
1041 I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) { 1184 I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) {
1042 return static_cast<I*>(AddInstruction( 1185 return I::cast(
1043 new(zone()) I(p1, p2, p3, p4, p5, p6, p7, p8))); 1186 AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7, p8)));
1044 } 1187 }
1188
1189 void AddSimulate(BailoutId id,
1190 RemovableSimulate removable = FIXED_SIMULATE);
1045 1191
1046 void IncrementInNoSideEffectsScope() { 1192 void IncrementInNoSideEffectsScope() {
1047 no_side_effects_scope_count_++; 1193 no_side_effects_scope_count_++;
1048 } 1194 }
1049 1195
1050 void DecrementInNoSideEffectsScope() { 1196 void DecrementInNoSideEffectsScope() {
1051 no_side_effects_scope_count_--; 1197 no_side_effects_scope_count_--;
1052 } 1198 }
1053 1199
1054 protected: 1200 protected:
(...skipping 29 matching lines...) Expand all
1084 HValue* object, 1230 HValue* object,
1085 HValue* key, 1231 HValue* key,
1086 HValue* val, 1232 HValue* val,
1087 HCheckMaps* mapcheck, 1233 HCheckMaps* mapcheck,
1088 bool is_js_array, 1234 bool is_js_array,
1089 ElementsKind elements_kind, 1235 ElementsKind elements_kind,
1090 bool is_store, 1236 bool is_store,
1091 LoadKeyedHoleMode load_mode, 1237 LoadKeyedHoleMode load_mode,
1092 KeyedAccessStoreMode store_mode); 1238 KeyedAccessStoreMode store_mode);
1093 1239
1094 HLoadNamedField* AddLoad(
1095 HValue *object,
1096 HObjectAccess access,
1097 HValue *typecheck = NULL);
1098
1099 HLoadNamedField* BuildLoadNamedField(
1100 HValue* object,
1101 HObjectAccess access,
1102 Representation representation);
1103
1104 HInstruction* AddExternalArrayElementAccess( 1240 HInstruction* AddExternalArrayElementAccess(
1105 HValue* external_elements, 1241 HValue* external_elements,
1106 HValue* checked_key, 1242 HValue* checked_key,
1107 HValue* val, 1243 HValue* val,
1108 HValue* dependency, 1244 HValue* dependency,
1109 ElementsKind elements_kind, 1245 ElementsKind elements_kind,
1110 bool is_store); 1246 bool is_store);
1111 1247
1112 HInstruction* AddFastElementAccess( 1248 HInstruction* AddFastElementAccess(
1113 HValue* elements, 1249 HValue* elements,
1114 HValue* checked_key, 1250 HValue* checked_key,
1115 HValue* val, 1251 HValue* val,
1116 HValue* dependency, 1252 HValue* dependency,
1117 ElementsKind elements_kind, 1253 ElementsKind elements_kind,
1118 bool is_store, 1254 bool is_store,
1119 LoadKeyedHoleMode load_mode, 1255 LoadKeyedHoleMode load_mode,
1120 KeyedAccessStoreMode store_mode); 1256 KeyedAccessStoreMode store_mode);
1121 1257
1122 HLoadNamedField* BuildLoadNamedField(HValue* object, HObjectAccess access); 1258 HLoadNamedField* BuildLoadNamedField(
1123 HStoreNamedField* AddStore(HValue *object, HObjectAccess access, HValue *val); 1259 HValue* object,
1260 HObjectAccess access,
1261 HValue* typecheck = NULL);
1262 HInstruction* BuildLoadStringLength(HValue* object, HValue* typecheck = NULL);
1124 HStoreNamedField* AddStoreMapConstant(HValue *object, Handle<Map>); 1263 HStoreNamedField* AddStoreMapConstant(HValue *object, Handle<Map>);
1125 HLoadNamedField* AddLoadElements(HValue *object, HValue *typecheck = NULL); 1264 HLoadNamedField* AddLoadElements(HValue *object, HValue *typecheck = NULL);
1126 HLoadNamedField* AddLoadFixedArrayLength(HValue *object); 1265 HLoadNamedField* AddLoadFixedArrayLength(HValue *object);
1127 1266
1128 HValue* AddLoadJSBuiltin(Builtins::JavaScript builtin, HValue* context); 1267 HValue* AddLoadJSBuiltin(Builtins::JavaScript builtin);
1129 1268
1130 HValue* TruncateToNumber(HValue* value, Handle<Type>* expected); 1269 HValue* TruncateToNumber(HValue* value, Handle<Type>* expected);
1131 1270
1132 void PushAndAdd(HInstruction* instr); 1271 void PushAndAdd(HInstruction* instr);
1133 1272
1134 void FinishExitWithHardDeoptimization(HBasicBlock* continuation); 1273 void FinishExitWithHardDeoptimization(HBasicBlock* continuation);
1135 1274
1275 void AddIncrementCounter(StatsCounter* counter,
1276 HValue* context);
1277
1136 class IfBuilder { 1278 class IfBuilder {
1137 public: 1279 public:
1138 explicit IfBuilder(HGraphBuilder* builder, 1280 explicit IfBuilder(HGraphBuilder* builder,
1139 int position = RelocInfo::kNoPosition); 1281 int position = RelocInfo::kNoPosition);
1140 IfBuilder(HGraphBuilder* builder, 1282 IfBuilder(HGraphBuilder* builder,
1141 HIfContinuation* continuation); 1283 HIfContinuation* continuation);
1142 1284
1143 ~IfBuilder() { 1285 ~IfBuilder() {
1144 if (!finished_) End(); 1286 if (!finished_) End();
1145 } 1287 }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 builder_->IncrementInNoSideEffectsScope(); 1448 builder_->IncrementInNoSideEffectsScope();
1307 } 1449 }
1308 ~NoObservableSideEffectsScope() { 1450 ~NoObservableSideEffectsScope() {
1309 builder_->DecrementInNoSideEffectsScope(); 1451 builder_->DecrementInNoSideEffectsScope();
1310 } 1452 }
1311 1453
1312 private: 1454 private:
1313 HGraphBuilder* builder_; 1455 HGraphBuilder* builder_;
1314 }; 1456 };
1315 1457
1316 HValue* BuildNewElementsCapacity(HValue* context, 1458 HValue* BuildNewElementsCapacity(HValue* old_capacity);
1317 HValue* old_capacity);
1318 1459
1319 void BuildNewSpaceArrayCheck(HValue* length, 1460 void BuildNewSpaceArrayCheck(HValue* length,
1320 ElementsKind kind); 1461 ElementsKind kind);
1321 1462
1322 class JSArrayBuilder { 1463 class JSArrayBuilder {
1323 public: 1464 public:
1324 JSArrayBuilder(HGraphBuilder* builder, 1465 JSArrayBuilder(HGraphBuilder* builder,
1325 ElementsKind kind, 1466 ElementsKind kind,
1326 HValue* allocation_site_payload, 1467 HValue* allocation_site_payload,
1327 HValue* constructor_function, 1468 HValue* constructor_function,
(...skipping 13 matching lines...) Expand all
1341 int elements_size() const { 1482 int elements_size() const {
1342 return IsFastDoubleElementsKind(kind_) ? kDoubleSize : kPointerSize; 1483 return IsFastDoubleElementsKind(kind_) ? kDoubleSize : kPointerSize;
1343 } 1484 }
1344 HGraphBuilder* builder() { return builder_; } 1485 HGraphBuilder* builder() { return builder_; }
1345 HGraph* graph() { return builder_->graph(); } 1486 HGraph* graph() { return builder_->graph(); }
1346 int initial_capacity() { 1487 int initial_capacity() {
1347 STATIC_ASSERT(JSArray::kPreallocatedArrayElements > 0); 1488 STATIC_ASSERT(JSArray::kPreallocatedArrayElements > 0);
1348 return JSArray::kPreallocatedArrayElements; 1489 return JSArray::kPreallocatedArrayElements;
1349 } 1490 }
1350 1491
1351 HValue* EmitMapCode(HValue* context); 1492 HValue* EmitMapCode();
1352 HValue* EmitInternalMapCode(); 1493 HValue* EmitInternalMapCode();
1353 HValue* EstablishEmptyArrayAllocationSize(); 1494 HValue* EstablishEmptyArrayAllocationSize();
1354 HValue* EstablishAllocationSize(HValue* length_node); 1495 HValue* EstablishAllocationSize(HValue* length_node);
1355 HValue* AllocateArray(HValue* size_in_bytes, HValue* capacity, 1496 HValue* AllocateArray(HValue* size_in_bytes, HValue* capacity,
1356 HValue* length_field, bool fill_with_hole); 1497 HValue* length_field, bool fill_with_hole);
1357 1498
1358 HGraphBuilder* builder_; 1499 HGraphBuilder* builder_;
1359 ElementsKind kind_; 1500 ElementsKind kind_;
1360 AllocationSiteMode mode_; 1501 AllocationSiteMode mode_;
1361 HValue* allocation_site_payload_; 1502 HValue* allocation_site_payload_;
1362 HValue* constructor_function_; 1503 HValue* constructor_function_;
1363 HInnerAllocatedObject* elements_location_; 1504 HInnerAllocatedObject* elements_location_;
1364 }; 1505 };
1365 1506
1366 HValue* BuildAllocateElements(HValue* context, 1507 HValue* BuildAllocateElements(ElementsKind kind,
1367 ElementsKind kind,
1368 HValue* capacity); 1508 HValue* capacity);
1369 1509
1370 void BuildInitializeElementsHeader(HValue* elements, 1510 void BuildInitializeElementsHeader(HValue* elements,
1371 ElementsKind kind, 1511 ElementsKind kind,
1372 HValue* capacity); 1512 HValue* capacity);
1373 1513
1374 HValue* BuildAllocateElementsAndInitializeElementsHeader(HValue* context, 1514 HValue* BuildAllocateElementsAndInitializeElementsHeader(ElementsKind kind,
1375 ElementsKind kind,
1376 HValue* capacity); 1515 HValue* capacity);
1377 1516
1378 // array must have been allocated with enough room for 1517 // array must have been allocated with enough room for
1379 // 1) the JSArray, 2) a AllocationMemento if mode requires it, 1518 // 1) the JSArray, 2) a AllocationMemento if mode requires it,
1380 // 3) a FixedArray or FixedDoubleArray. 1519 // 3) a FixedArray or FixedDoubleArray.
1381 // A pointer to the Fixed(Double)Array is returned. 1520 // A pointer to the Fixed(Double)Array is returned.
1382 HInnerAllocatedObject* BuildJSArrayHeader(HValue* array, 1521 HInnerAllocatedObject* BuildJSArrayHeader(HValue* array,
1383 HValue* array_map, 1522 HValue* array_map,
1384 AllocationSiteMode mode, 1523 AllocationSiteMode mode,
1385 ElementsKind elements_kind, 1524 ElementsKind elements_kind,
1386 HValue* allocation_site_payload, 1525 HValue* allocation_site_payload,
1387 HValue* length_field); 1526 HValue* length_field);
1388 1527
1389 HValue* BuildGrowElementsCapacity(HValue* object, 1528 HValue* BuildGrowElementsCapacity(HValue* object,
1390 HValue* elements, 1529 HValue* elements,
1391 ElementsKind kind, 1530 ElementsKind kind,
1392 ElementsKind new_kind, 1531 ElementsKind new_kind,
1393 HValue* length, 1532 HValue* length,
1394 HValue* new_capacity); 1533 HValue* new_capacity);
1395 1534
1396 void BuildFillElementsWithHole(HValue* context, 1535 void BuildFillElementsWithHole(HValue* elements,
1397 HValue* elements,
1398 ElementsKind elements_kind, 1536 ElementsKind elements_kind,
1399 HValue* from, 1537 HValue* from,
1400 HValue* to); 1538 HValue* to);
1401 1539
1402 void BuildCopyElements(HValue* context, 1540 void BuildCopyElements(HValue* from_elements,
1403 HValue* from_elements,
1404 ElementsKind from_elements_kind, 1541 ElementsKind from_elements_kind,
1405 HValue* to_elements, 1542 HValue* to_elements,
1406 ElementsKind to_elements_kind, 1543 ElementsKind to_elements_kind,
1407 HValue* length, 1544 HValue* length,
1408 HValue* capacity); 1545 HValue* capacity);
1409 1546
1410 HValue* BuildCloneShallowArray(HContext* context, 1547 HValue* BuildCloneShallowArray(HValue* boilerplate,
1411 HValue* boilerplate,
1412 HValue* allocation_site, 1548 HValue* allocation_site,
1413 AllocationSiteMode mode, 1549 AllocationSiteMode mode,
1414 ElementsKind kind, 1550 ElementsKind kind,
1415 int length); 1551 int length);
1416 1552
1417 HInstruction* BuildUnaryMathOp( 1553 HInstruction* BuildUnaryMathOp(
1418 HValue* value, Handle<Type> type, Token::Value token); 1554 HValue* value, Handle<Type> type, Token::Value token);
1419 1555
1420 void BuildCompareNil( 1556 void BuildCompareNil(
1421 HValue* value, 1557 HValue* value,
1422 Handle<Type> type, 1558 Handle<Type> type,
1423 int position, 1559 int position,
1424 HIfContinuation* continuation); 1560 HIfContinuation* continuation);
1425 1561
1426 HValue* BuildCreateAllocationMemento(HValue* previous_object, 1562 HValue* BuildCreateAllocationMemento(HValue* previous_object,
1427 int previous_object_size, 1563 int previous_object_size,
1428 HValue* payload); 1564 HValue* payload);
1429 1565
1430 HInstruction* BuildGetNativeContext(HValue* context); 1566 HInstruction* BuildGetNativeContext();
1431 HInstruction* BuildGetArrayFunction(HValue* context); 1567 HInstruction* BuildGetArrayFunction();
1432 1568
1433 private: 1569 private:
1434 HGraphBuilder(); 1570 HGraphBuilder();
1435 1571
1436 void PadEnvironmentForContinuation(HBasicBlock* from, 1572 void PadEnvironmentForContinuation(HBasicBlock* from,
1437 HBasicBlock* continuation); 1573 HBasicBlock* continuation);
1438 1574
1439 CompilationInfo* info_; 1575 CompilationInfo* info_;
1440 HGraph* graph_; 1576 HGraph* graph_;
1441 HBasicBlock* current_block_; 1577 HBasicBlock* current_block_;
1442 int no_side_effects_scope_count_; 1578 int no_side_effects_scope_count_;
1443 }; 1579 };
1444 1580
1445 1581
1446 template<> 1582 template<>
1447 inline HDeoptimize* HGraphBuilder::Add(Deoptimizer::BailoutType type) { 1583 inline HInstruction* HGraphBuilder::AddUncasted<HDeoptimize>(
1584 Deoptimizer::BailoutType type) {
1448 if (type == Deoptimizer::SOFT) { 1585 if (type == Deoptimizer::SOFT) {
1449 isolate()->counters()->soft_deopts_requested()->Increment(); 1586 isolate()->counters()->soft_deopts_requested()->Increment();
1450 if (FLAG_always_opt) return NULL; 1587 if (FLAG_always_opt) return NULL;
1451 } 1588 }
1452 if (current_block()->IsDeoptimizing()) return NULL; 1589 if (current_block()->IsDeoptimizing()) return NULL;
1453 HDeoptimize* instr = new(zone()) HDeoptimize(type); 1590 HDeoptimize* instr = New<HDeoptimize>(type);
1454 AddInstruction(instr); 1591 AddInstruction(instr);
1455 if (type == Deoptimizer::SOFT) { 1592 if (type == Deoptimizer::SOFT) {
1456 isolate()->counters()->soft_deopts_inserted()->Increment(); 1593 isolate()->counters()->soft_deopts_inserted()->Increment();
1457 graph()->set_has_soft_deoptimize(true); 1594 graph()->set_has_soft_deoptimize(true);
1458 } 1595 }
1459 current_block()->MarkAsDeoptimizing(); 1596 current_block()->MarkAsDeoptimizing();
1460 return instr; 1597 return instr;
1461 } 1598 }
1462 1599
1463 1600
1464 template<> 1601 template<>
1465 inline HSimulate* HGraphBuilder::Add(BailoutId id, 1602 inline HDeoptimize* HGraphBuilder::Add<HDeoptimize>(
1466 RemovableSimulate removable) { 1603 Deoptimizer::BailoutType type) {
1604 return static_cast<HDeoptimize*>(AddUncasted<HDeoptimize>(type));
1605 }
1606
1607
1608 template<>
1609 inline HInstruction* HGraphBuilder::AddUncasted<HSimulate>(
1610 BailoutId id,
1611 RemovableSimulate removable) {
1467 HSimulate* instr = current_block()->CreateSimulate(id, removable); 1612 HSimulate* instr = current_block()->CreateSimulate(id, removable);
1468 AddInstruction(instr); 1613 AddInstruction(instr);
1469 return instr; 1614 return instr;
1470 } 1615 }
1471 1616
1472 1617
1473 template<> 1618 template<>
1474 inline HSimulate* HGraphBuilder::Add(BailoutId id) { 1619 inline HInstruction* HGraphBuilder::NewUncasted<HLoadNamedField>(
1475 return Add<HSimulate>(id, FIXED_SIMULATE); 1620 HValue* object, HObjectAccess access) {
1621 return NewUncasted<HLoadNamedField>(object, access,
1622 static_cast<HValue*>(NULL));
1476 } 1623 }
1477 1624
1478 1625
1479 template<> 1626 template<>
1480 inline HReturn* HGraphBuilder::Add(HValue* value) { 1627 inline HInstruction* HGraphBuilder::AddUncasted<HLoadNamedField>(
1481 HValue* context = environment()->LookupContext(); 1628 HValue* object, HObjectAccess access) {
1629 return AddUncasted<HLoadNamedField>(object, access,
1630 static_cast<HValue*>(NULL));
1631 }
1632
1633
1634 template<>
1635 inline HInstruction* HGraphBuilder::AddUncasted<HSimulate>(BailoutId id) {
1636 return AddUncasted<HSimulate>(id, FIXED_SIMULATE);
1637 }
1638
1639
1640 template<>
1641 inline HInstruction* HGraphBuilder::AddUncasted<HReturn>(HValue* value) {
1482 int num_parameters = graph()->info()->num_parameters(); 1642 int num_parameters = graph()->info()->num_parameters();
1483 HValue* params = Add<HConstant>(num_parameters); 1643 HValue* params = AddUncasted<HConstant>(num_parameters);
1484 HReturn* return_instruction = new(graph()->zone()) 1644 HReturn* return_instruction = New<HReturn>(value, params);
1485 HReturn(value, context, params);
1486 current_block()->FinishExit(return_instruction); 1645 current_block()->FinishExit(return_instruction);
1487 return return_instruction; 1646 return return_instruction;
1488 } 1647 }
1489 1648
1490 1649
1491 template<> 1650 template<>
1492 inline HReturn* HGraphBuilder::Add(HConstant* p1) { 1651 inline HInstruction* HGraphBuilder::AddUncasted<HReturn>(HConstant* value) {
1493 return Add<HReturn>(static_cast<HValue*>(p1)); 1652 return AddUncasted<HReturn>(static_cast<HValue*>(value));
1494 } 1653 }
1495 1654
1496 1655
1656 template<>
1657 inline HInstruction* HGraphBuilder::NewUncasted<HContext>() {
1658 return HContext::New(zone());
1659 }
1660
1661
1497 class HOptimizedGraphBuilder: public HGraphBuilder, public AstVisitor { 1662 class HOptimizedGraphBuilder: public HGraphBuilder, public AstVisitor {
1498 public: 1663 public:
1499 // A class encapsulating (lazily-allocated) break and continue blocks for 1664 // A class encapsulating (lazily-allocated) break and continue blocks for
1500 // a breakable statement. Separated from BreakAndContinueScope so that it 1665 // a breakable statement. Separated from BreakAndContinueScope so that it
1501 // can have a separate lifetime. 1666 // can have a separate lifetime.
1502 class BreakAndContinueInfo BASE_EMBEDDED { 1667 class BreakAndContinueInfo BASE_EMBEDDED {
1503 public: 1668 public:
1504 explicit BreakAndContinueInfo(BreakableStatement* target, 1669 explicit BreakAndContinueInfo(BreakableStatement* target,
1505 int drop_extra = 0) 1670 int drop_extra = 0)
1506 : target_(target), 1671 : target_(target),
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1552 explicit HOptimizedGraphBuilder(CompilationInfo* info); 1717 explicit HOptimizedGraphBuilder(CompilationInfo* info);
1553 1718
1554 virtual bool BuildGraph(); 1719 virtual bool BuildGraph();
1555 1720
1556 // Simple accessors. 1721 // Simple accessors.
1557 BreakAndContinueScope* break_scope() const { return break_scope_; } 1722 BreakAndContinueScope* break_scope() const { return break_scope_; }
1558 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; } 1723 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; }
1559 1724
1560 bool inline_bailout() { return inline_bailout_; } 1725 bool inline_bailout() { return inline_bailout_; }
1561 1726
1562 void Bailout(const char* reason); 1727 HValue* context() { return environment()->context(); }
1728
1729 void Bailout(BailoutReason reason);
1563 1730
1564 HBasicBlock* CreateJoin(HBasicBlock* first, 1731 HBasicBlock* CreateJoin(HBasicBlock* first,
1565 HBasicBlock* second, 1732 HBasicBlock* second,
1566 BailoutId join_id); 1733 BailoutId join_id);
1567 1734
1568 FunctionState* function_state() const { return function_state_; } 1735 FunctionState* function_state() const { return function_state_; }
1569 1736
1570 void VisitDeclarations(ZoneList<Declaration*>* declarations); 1737 void VisitDeclarations(ZoneList<Declaration*>* declarations);
1571 1738
1572 void* operator new(size_t size, Zone* zone) { 1739 void* operator new(size_t size, Zone* zone) {
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1827 HValue* receiver, 1994 HValue* receiver,
1828 SmallMapList* types, 1995 SmallMapList* types,
1829 Handle<String> name); 1996 Handle<String> name);
1830 void HandleLiteralCompareTypeof(CompareOperation* expr, 1997 void HandleLiteralCompareTypeof(CompareOperation* expr,
1831 Expression* sub_expr, 1998 Expression* sub_expr,
1832 Handle<String> check); 1999 Handle<String> check);
1833 void HandleLiteralCompareNil(CompareOperation* expr, 2000 void HandleLiteralCompareNil(CompareOperation* expr,
1834 Expression* sub_expr, 2001 Expression* sub_expr,
1835 NilValue nil); 2002 NilValue nil);
1836 2003
1837 HInstruction* BuildStringCharCodeAt(HValue* context, 2004 HInstruction* BuildStringCharCodeAt(HValue* string,
1838 HValue* string,
1839 HValue* index); 2005 HValue* index);
1840 HInstruction* BuildBinaryOperation(BinaryOperation* expr, 2006 HInstruction* BuildBinaryOperation(BinaryOperation* expr,
1841 HValue* left, 2007 HValue* left,
1842 HValue* right); 2008 HValue* right);
1843 HInstruction* BuildIncrement(bool returns_original_input, 2009 HInstruction* BuildIncrement(bool returns_original_input,
1844 CountOperation* expr); 2010 CountOperation* expr);
1845 HInstruction* BuildLoadKeyedGeneric(HValue* object, 2011 HInstruction* BuildLoadKeyedGeneric(HValue* object,
1846 HValue* key); 2012 HValue* key);
1847 2013
1848 HInstruction* TryBuildConsolidatedElementLoad(HValue* object, 2014 HInstruction* TryBuildConsolidatedElementLoad(HValue* object,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1884 Handle<Map> map, 2050 Handle<Map> map,
1885 Handle<JSFunction> getter, 2051 Handle<JSFunction> getter,
1886 Handle<JSObject> holder); 2052 Handle<JSObject> holder);
1887 HInstruction* BuildLoadNamedMonomorphic(HValue* object, 2053 HInstruction* BuildLoadNamedMonomorphic(HValue* object,
1888 Handle<String> name, 2054 Handle<String> name,
1889 Property* expr, 2055 Property* expr,
1890 Handle<Map> map); 2056 Handle<Map> map);
1891 2057
1892 void AddCheckMap(HValue* object, Handle<Map> map); 2058 void AddCheckMap(HValue* object, Handle<Map> map);
1893 2059
1894 void AddCheckMapsWithTransitions(HValue* object,
1895 Handle<Map> map);
1896
1897 void BuildStoreNamed(Expression* expression, 2060 void BuildStoreNamed(Expression* expression,
1898 BailoutId id, 2061 BailoutId id,
1899 int position, 2062 int position,
1900 BailoutId assignment_id, 2063 BailoutId assignment_id,
1901 Property* prop, 2064 Property* prop,
1902 HValue* object, 2065 HValue* object,
1903 HValue* store_value, 2066 HValue* store_value,
1904 HValue* result_value); 2067 HValue* result_value);
1905 2068
1906 HInstruction* BuildStoreNamedField(HValue* object, 2069 HInstruction* BuildStoreNamedField(HValue* object,
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
2163 EmbeddedVector<char, 64> filename_; 2326 EmbeddedVector<char, 64> filename_;
2164 HeapStringAllocator string_allocator_; 2327 HeapStringAllocator string_allocator_;
2165 StringStream trace_; 2328 StringStream trace_;
2166 int indent_; 2329 int indent_;
2167 }; 2330 };
2168 2331
2169 2332
2170 } } // namespace v8::internal 2333 } } // namespace v8::internal
2171 2334
2172 #endif // V8_HYDROGEN_H_ 2335 #endif // V8_HYDROGEN_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698