| OLD | NEW |
| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 int argument_count() const { return argument_count_; } | 84 int argument_count() const { return argument_count_; } |
| 85 void set_argument_count(int count) { argument_count_ = count; } | 85 void set_argument_count(int count) { argument_count_ = count; } |
| 86 int first_instruction_index() const { return first_instruction_index_; } | 86 int first_instruction_index() const { return first_instruction_index_; } |
| 87 void set_first_instruction_index(int index) { | 87 void set_first_instruction_index(int index) { |
| 88 first_instruction_index_ = index; | 88 first_instruction_index_ = index; |
| 89 } | 89 } |
| 90 int last_instruction_index() const { return last_instruction_index_; } | 90 int last_instruction_index() const { return last_instruction_index_; } |
| 91 void set_last_instruction_index(int index) { | 91 void set_last_instruction_index(int index) { |
| 92 last_instruction_index_ = index; | 92 last_instruction_index_ = index; |
| 93 } | 93 } |
| 94 bool is_osr_entry() { return is_osr_entry_; } |
| 95 void set_osr_entry() { is_osr_entry_ = true; } |
| 94 | 96 |
| 95 void AttachLoopInformation(); | 97 void AttachLoopInformation(); |
| 96 void DetachLoopInformation(); | 98 void DetachLoopInformation(); |
| 97 bool IsLoopHeader() const { return loop_information() != NULL; } | 99 bool IsLoopHeader() const { return loop_information() != NULL; } |
| 98 bool IsStartBlock() const { return block_id() == 0; } | 100 bool IsStartBlock() const { return block_id() == 0; } |
| 99 void PostProcessLoopHeader(IterationStatement* stmt); | 101 void PostProcessLoopHeader(IterationStatement* stmt); |
| 100 | 102 |
| 101 bool IsFinished() const { return end_ != NULL; } | 103 bool IsFinished() const { return end_ != NULL; } |
| 102 void AddPhi(HPhi* phi); | 104 void AddPhi(HPhi* phi); |
| 103 void RemovePhi(HPhi* phi); | 105 void RemovePhi(HPhi* phi); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 // Outgoing parameter count at block exit, set during lithium translation. | 188 // Outgoing parameter count at block exit, set during lithium translation. |
| 187 int argument_count_; | 189 int argument_count_; |
| 188 // Instruction indices into the lithium code stream. | 190 // Instruction indices into the lithium code stream. |
| 189 int first_instruction_index_; | 191 int first_instruction_index_; |
| 190 int last_instruction_index_; | 192 int last_instruction_index_; |
| 191 ZoneList<int> deleted_phis_; | 193 ZoneList<int> deleted_phis_; |
| 192 HBasicBlock* parent_loop_header_; | 194 HBasicBlock* parent_loop_header_; |
| 193 bool is_inline_return_target_; | 195 bool is_inline_return_target_; |
| 194 bool is_deoptimizing_; | 196 bool is_deoptimizing_; |
| 195 bool dominates_loop_successors_; | 197 bool dominates_loop_successors_; |
| 198 bool is_osr_entry_; |
| 196 }; | 199 }; |
| 197 | 200 |
| 198 | 201 |
| 199 class HPredecessorIterator BASE_EMBEDDED { | 202 class HPredecessorIterator BASE_EMBEDDED { |
| 200 public: | 203 public: |
| 201 explicit HPredecessorIterator(HBasicBlock* block) | 204 explicit HPredecessorIterator(HBasicBlock* block) |
| 202 : predecessor_list_(block->predecessors()), current_(0) { } | 205 : predecessor_list_(block->predecessors()), current_(0) { } |
| 203 | 206 |
| 204 bool Done() { return current_ >= predecessor_list_->length(); } | 207 bool Done() { return current_ >= predecessor_list_->length(); } |
| 205 HBasicBlock* Current() { return predecessor_list_->at(current_); } | 208 HBasicBlock* Current() { return predecessor_list_->at(current_); } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 235 | 238 |
| 236 private: | 239 private: |
| 237 void AddBlock(HBasicBlock* block); | 240 void AddBlock(HBasicBlock* block); |
| 238 | 241 |
| 239 ZoneList<HBasicBlock*> back_edges_; | 242 ZoneList<HBasicBlock*> back_edges_; |
| 240 HBasicBlock* loop_header_; | 243 HBasicBlock* loop_header_; |
| 241 ZoneList<HBasicBlock*> blocks_; | 244 ZoneList<HBasicBlock*> blocks_; |
| 242 HStackCheck* stack_check_; | 245 HStackCheck* stack_check_; |
| 243 }; | 246 }; |
| 244 | 247 |
| 248 |
| 245 class BoundsCheckTable; | 249 class BoundsCheckTable; |
| 246 class HGraph: public ZoneObject { | 250 class HGraph: public ZoneObject { |
| 247 public: | 251 public: |
| 248 explicit HGraph(CompilationInfo* info); | 252 explicit HGraph(CompilationInfo* info); |
| 249 | 253 |
| 250 Isolate* isolate() { return isolate_; } | 254 Isolate* isolate() { return isolate_; } |
| 251 Zone* zone() const { return zone_; } | 255 Zone* zone() const { return zone_; } |
| 252 CompilationInfo* info() const { return info_; } | 256 CompilationInfo* info() const { return info_; } |
| 253 | 257 |
| 254 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } | 258 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 return is_recursive_; | 367 return is_recursive_; |
| 364 } | 368 } |
| 365 | 369 |
| 366 void RecordUint32Instruction(HInstruction* instr) { | 370 void RecordUint32Instruction(HInstruction* instr) { |
| 367 if (uint32_instructions_ == NULL) { | 371 if (uint32_instructions_ == NULL) { |
| 368 uint32_instructions_ = new(zone()) ZoneList<HInstruction*>(4, zone()); | 372 uint32_instructions_ = new(zone()) ZoneList<HInstruction*>(4, zone()); |
| 369 } | 373 } |
| 370 uint32_instructions_->Add(instr, zone()); | 374 uint32_instructions_->Add(instr, zone()); |
| 371 } | 375 } |
| 372 | 376 |
| 377 HArrayInstruction* RecordArrayInstruction(HArrayInstruction* instr) { |
| 378 if (array_instructions_ == NULL) { |
| 379 array_instructions_ = new(zone()) ZoneList<HArrayInstruction*>(4, zone()); |
| 380 } |
| 381 array_instructions_->Add(instr, zone()); |
| 382 return instr; |
| 383 } |
| 384 |
| 385 ZoneList<HArrayInstruction*>* array_instructions() { |
| 386 return array_instructions_; |
| 387 } |
| 388 |
| 373 private: | 389 private: |
| 374 HConstant* GetConstant(SetOncePointer<HConstant>* pointer, | 390 HConstant* GetConstant(SetOncePointer<HConstant>* pointer, |
| 375 Handle<Object> value); | 391 Handle<Object> value); |
| 376 HConstant* GetConstantInt32(SetOncePointer<HConstant>* pointer, | 392 HConstant* GetConstantInt32(SetOncePointer<HConstant>* pointer, |
| 377 int32_t integer_value); | 393 int32_t integer_value); |
| 378 | 394 |
| 379 void MarkAsDeoptimizingRecursively(HBasicBlock* block); | 395 void MarkAsDeoptimizingRecursively(HBasicBlock* block); |
| 396 void InsertElementsTransitions(); |
| 380 void InsertTypeConversions(HInstruction* instr); | 397 void InsertTypeConversions(HInstruction* instr); |
| 381 void PropagateMinusZeroChecks(HValue* value, BitVector* visited); | 398 void PropagateMinusZeroChecks(HValue* value, BitVector* visited); |
| 382 void RecursivelyMarkPhiDeoptimizeOnUndefined(HPhi* phi); | 399 void RecursivelyMarkPhiDeoptimizeOnUndefined(HPhi* phi); |
| 383 void InsertRepresentationChangeForUse(HValue* value, | 400 void InsertRepresentationChangeForUse(HValue* value, |
| 384 HValue* use_value, | 401 HValue* use_value, |
| 385 int use_index, | 402 int use_index, |
| 386 Representation to); | 403 Representation to); |
| 387 void InsertRepresentationChangesForValue(HValue* value); | 404 void InsertRepresentationChangesForValue(HValue* value); |
| 388 void InferTypes(ZoneList<HValue*>* worklist); | 405 void InferTypes(ZoneList<HValue*>* worklist); |
| 389 void InitializeInferredTypes(int from_inclusive, int to_inclusive); | 406 void InitializeInferredTypes(int from_inclusive, int to_inclusive); |
| 390 void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor); | 407 void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor); |
| 391 void EliminateRedundantBoundsChecks(HBasicBlock* bb, BoundsCheckTable* table); | 408 void EliminateRedundantBoundsChecks(HBasicBlock* bb, BoundsCheckTable* table); |
| 392 | 409 |
| 393 Isolate* isolate_; | 410 Isolate* isolate_; |
| 394 int next_block_id_; | 411 int next_block_id_; |
| 395 HBasicBlock* entry_block_; | 412 HBasicBlock* entry_block_; |
| 396 HEnvironment* start_environment_; | 413 HEnvironment* start_environment_; |
| 397 ZoneList<HBasicBlock*> blocks_; | 414 ZoneList<HBasicBlock*> blocks_; |
| 398 ZoneList<HValue*> values_; | 415 ZoneList<HValue*> values_; |
| 399 ZoneList<HPhi*>* phi_list_; | 416 ZoneList<HPhi*>* phi_list_; |
| 400 ZoneList<HInstruction*>* uint32_instructions_; | 417 ZoneList<HInstruction*>* uint32_instructions_; |
| 418 ZoneList<HArrayInstruction*>* array_instructions_; |
| 401 SetOncePointer<HConstant> undefined_constant_; | 419 SetOncePointer<HConstant> undefined_constant_; |
| 402 SetOncePointer<HConstant> constant_1_; | 420 SetOncePointer<HConstant> constant_1_; |
| 403 SetOncePointer<HConstant> constant_minus1_; | 421 SetOncePointer<HConstant> constant_minus1_; |
| 404 SetOncePointer<HConstant> constant_true_; | 422 SetOncePointer<HConstant> constant_true_; |
| 405 SetOncePointer<HConstant> constant_false_; | 423 SetOncePointer<HConstant> constant_false_; |
| 406 SetOncePointer<HConstant> constant_hole_; | 424 SetOncePointer<HConstant> constant_hole_; |
| 407 SetOncePointer<HArgumentsObject> arguments_object_; | 425 SetOncePointer<HArgumentsObject> arguments_object_; |
| 408 | 426 |
| 409 SetOncePointer<HBasicBlock> osr_loop_entry_; | 427 SetOncePointer<HBasicBlock> osr_loop_entry_; |
| 410 SetOncePointer<ZoneList<HUnknownOSRValue*> > osr_values_; | 428 SetOncePointer<ZoneList<HUnknownOSRValue*> > osr_values_; |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 NilValue nil); | 1150 NilValue nil); |
| 1133 | 1151 |
| 1134 HStringCharCodeAt* BuildStringCharCodeAt(HValue* context, | 1152 HStringCharCodeAt* BuildStringCharCodeAt(HValue* context, |
| 1135 HValue* string, | 1153 HValue* string, |
| 1136 HValue* index); | 1154 HValue* index); |
| 1137 HInstruction* BuildBinaryOperation(BinaryOperation* expr, | 1155 HInstruction* BuildBinaryOperation(BinaryOperation* expr, |
| 1138 HValue* left, | 1156 HValue* left, |
| 1139 HValue* right); | 1157 HValue* right); |
| 1140 HInstruction* BuildIncrement(bool returns_original_input, | 1158 HInstruction* BuildIncrement(bool returns_original_input, |
| 1141 CountOperation* expr); | 1159 CountOperation* expr); |
| 1142 HInstruction* BuildFastElementAccess(HValue* elements, | 1160 HArrayInstruction* BuildFastElementAccess(HValue* elements, |
| 1143 HValue* checked_key, | 1161 HValue* checked_key, |
| 1144 HValue* val, | 1162 HValue* val, |
| 1145 HValue* dependency, | 1163 HValue* dependency, |
| 1146 ElementsKind elements_kind, | 1164 ElementsKind elements_kind, |
| 1147 bool is_store); | 1165 bool is_store); |
| 1148 | 1166 |
| 1149 HInstruction* TryBuildConsolidatedElementLoad(HValue* object, | 1167 HArrayInstruction* TryBuildConsolidatedElementLoad(HValue* object, |
| 1150 HValue* key, | 1168 HValue* key, |
| 1151 HValue* val, | 1169 HValue* val, |
| 1152 SmallMapList* maps); | 1170 SmallMapList* maps); |
| 1153 | 1171 |
| 1154 HInstruction* BuildUncheckedMonomorphicElementAccess(HValue* object, | 1172 HArrayInstruction* BuildUncheckedMonomorphicElementAccess(HValue* object, |
| 1155 HValue* key, | 1173 HValue* key, |
| 1156 HValue* val, | 1174 HValue* val, |
| 1157 HCheckMaps* mapcheck, | 1175 HCheckMaps* mapcheck, |
| 1158 Handle<Map> map, | 1176 Handle<Map> map, |
| 1159 bool is_store); | 1177 bool is_store); |
| 1160 | 1178 |
| 1161 HInstruction* BuildMonomorphicElementAccess(HValue* object, | 1179 HArrayInstruction* BuildMonomorphicElementAccess(HValue* object, |
| 1162 HValue* key, | 1180 HValue* key, |
| 1163 HValue* val, | 1181 HValue* val, |
| 1164 HValue* dependency, | 1182 HValue* dependency, |
| 1165 Handle<Map> map, | 1183 Handle<Map> map, |
| 1166 bool is_store); | 1184 bool is_store); |
| 1167 | 1185 |
| 1168 HValue* HandlePolymorphicElementAccess(HValue* object, | 1186 HValue* HandlePolymorphicElementAccess(HValue* object, |
| 1169 HValue* key, | 1187 HValue* key, |
| 1170 HValue* val, | 1188 HValue* val, |
| 1171 Expression* prop, | 1189 Expression* prop, |
| 1172 BailoutId ast_id, | 1190 BailoutId ast_id, |
| 1173 int position, | 1191 int position, |
| 1174 bool is_store, | 1192 bool is_store, |
| 1175 bool* has_side_effects); | 1193 bool* has_side_effects); |
| 1176 | 1194 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1191 Property* expr); | 1209 Property* expr); |
| 1192 HInstruction* BuildCallGetter(HValue* object, | 1210 HInstruction* BuildCallGetter(HValue* object, |
| 1193 Handle<Map> map, | 1211 Handle<Map> map, |
| 1194 Handle<JSFunction> getter, | 1212 Handle<JSFunction> getter, |
| 1195 Handle<JSObject> holder); | 1213 Handle<JSObject> holder); |
| 1196 HInstruction* BuildLoadNamedMonomorphic(HValue* object, | 1214 HInstruction* BuildLoadNamedMonomorphic(HValue* object, |
| 1197 Handle<String> name, | 1215 Handle<String> name, |
| 1198 Property* expr, | 1216 Property* expr, |
| 1199 Handle<Map> map); | 1217 Handle<Map> map); |
| 1200 HInstruction* BuildLoadKeyedGeneric(HValue* object, HValue* key); | 1218 HInstruction* BuildLoadKeyedGeneric(HValue* object, HValue* key); |
| 1201 HInstruction* BuildExternalArrayElementAccess( | 1219 HArrayInstruction* BuildExternalArrayElementAccess( |
| 1202 HValue* external_elements, | 1220 HValue* external_elements, |
| 1203 HValue* checked_key, | 1221 HValue* checked_key, |
| 1204 HValue* val, | 1222 HValue* val, |
| 1205 HValue* dependency, | 1223 HValue* dependency, |
| 1206 ElementsKind elements_kind, | 1224 ElementsKind elements_kind, |
| 1207 bool is_store); | 1225 bool is_store); |
| 1208 | 1226 |
| 1209 void AddCheckMapsWithTransitions(HValue* object, | 1227 void AddCheckMapsWithTransitions(HValue* object, |
| 1210 Handle<Map> map); | 1228 Handle<Map> map); |
| 1211 | 1229 |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1527 const char* filename_; | 1545 const char* filename_; |
| 1528 HeapStringAllocator string_allocator_; | 1546 HeapStringAllocator string_allocator_; |
| 1529 StringStream trace_; | 1547 StringStream trace_; |
| 1530 int indent_; | 1548 int indent_; |
| 1531 }; | 1549 }; |
| 1532 | 1550 |
| 1533 | 1551 |
| 1534 } } // namespace v8::internal | 1552 } } // namespace v8::internal |
| 1535 | 1553 |
| 1536 #endif // V8_HYDROGEN_H_ | 1554 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |