| 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 bool CheckConstPhiUses(); | 297 bool CheckConstPhiUses(); |
| 298 | 298 |
| 299 void CollectPhis(); | 299 void CollectPhis(); |
| 300 | 300 |
| 301 void set_undefined_constant(HConstant* constant) { | 301 void set_undefined_constant(HConstant* constant) { |
| 302 undefined_constant_.set(constant); | 302 undefined_constant_.set(constant); |
| 303 } | 303 } |
| 304 HConstant* GetConstantUndefined() const { return undefined_constant_.get(); } | 304 HConstant* GetConstantUndefined() const { return undefined_constant_.get(); } |
| 305 HConstant* GetConstant0(); | 305 HConstant* GetConstant0(); |
| 306 HConstant* GetConstant1(); | 306 HConstant* GetConstant1(); |
| 307 HConstant* GetConstantSmi0(); |
| 308 HConstant* GetConstantSmi1(); |
| 307 HConstant* GetConstantMinus1(); | 309 HConstant* GetConstantMinus1(); |
| 308 HConstant* GetConstantTrue(); | 310 HConstant* GetConstantTrue(); |
| 309 HConstant* GetConstantFalse(); | 311 HConstant* GetConstantFalse(); |
| 310 HConstant* GetConstantHole(); | 312 HConstant* GetConstantHole(); |
| 313 HConstant* GetConstantNull(); |
| 311 HConstant* GetInvalidContext(); | 314 HConstant* GetInvalidContext(); |
| 312 | 315 |
| 313 HBasicBlock* CreateBasicBlock(); | 316 HBasicBlock* CreateBasicBlock(); |
| 314 HArgumentsObject* GetArgumentsObject() const { | 317 HArgumentsObject* GetArgumentsObject() const { |
| 315 return arguments_object_.get(); | 318 return arguments_object_.get(); |
| 316 } | 319 } |
| 317 | 320 |
| 318 void SetArgumentsObject(HArgumentsObject* object) { | 321 void SetArgumentsObject(HArgumentsObject* object) { |
| 319 arguments_object_.set(object); | 322 arguments_object_.set(object); |
| 320 } | 323 } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 void RecordUint32Instruction(HInstruction* instr) { | 391 void RecordUint32Instruction(HInstruction* instr) { |
| 389 if (uint32_instructions_ == NULL) { | 392 if (uint32_instructions_ == NULL) { |
| 390 uint32_instructions_ = new(zone()) ZoneList<HInstruction*>(4, zone()); | 393 uint32_instructions_ = new(zone()) ZoneList<HInstruction*>(4, zone()); |
| 391 } | 394 } |
| 392 uint32_instructions_->Add(instr, zone()); | 395 uint32_instructions_->Add(instr, zone()); |
| 393 } | 396 } |
| 394 | 397 |
| 395 private: | 398 private: |
| 396 HConstant* GetConstantInt32(SetOncePointer<HConstant>* pointer, | 399 HConstant* GetConstantInt32(SetOncePointer<HConstant>* pointer, |
| 397 int32_t integer_value); | 400 int32_t integer_value); |
| 401 HConstant* GetConstantSmi(SetOncePointer<HConstant>* pointer, |
| 402 int32_t integer_value); |
| 398 | 403 |
| 399 void MarkAsDeoptimizingRecursively(HBasicBlock* block); | 404 void MarkAsDeoptimizingRecursively(HBasicBlock* block); |
| 400 void NullifyUnreachableInstructions(); | 405 void NullifyUnreachableInstructions(); |
| 401 void InsertTypeConversions(HInstruction* instr); | 406 void InsertTypeConversions(HInstruction* instr); |
| 402 void PropagateMinusZeroChecks(HValue* value, BitVector* visited); | 407 void PropagateMinusZeroChecks(HValue* value, BitVector* visited); |
| 403 void RecursivelyMarkPhiDeoptimizeOnUndefined(HPhi* phi); | 408 void RecursivelyMarkPhiDeoptimizeOnUndefined(HPhi* phi); |
| 404 void InsertRepresentationChangeForUse(HValue* value, | 409 void InsertRepresentationChangeForUse(HValue* value, |
| 405 HValue* use_value, | 410 HValue* use_value, |
| 406 int use_index, | 411 int use_index, |
| 407 Representation to); | 412 Representation to); |
| 408 void InsertRepresentationChangesForValue(HValue* value); | 413 void InsertRepresentationChangesForValue(HValue* value); |
| 409 void InferTypes(ZoneList<HValue*>* worklist); | 414 void InferTypes(ZoneList<HValue*>* worklist); |
| 410 void InitializeInferredTypes(int from_inclusive, int to_inclusive); | 415 void InitializeInferredTypes(int from_inclusive, int to_inclusive); |
| 411 void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor); | 416 void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor); |
| 412 void SetupInformativeDefinitionsInBlock(HBasicBlock* block); | 417 void SetupInformativeDefinitionsInBlock(HBasicBlock* block); |
| 413 void SetupInformativeDefinitionsRecursively(HBasicBlock* block); | 418 void SetupInformativeDefinitionsRecursively(HBasicBlock* block); |
| 414 void EliminateRedundantBoundsChecks(HBasicBlock* bb, BoundsCheckTable* table); | 419 void EliminateRedundantBoundsChecks(HBasicBlock* bb, BoundsCheckTable* table); |
| 415 | 420 |
| 416 Isolate* isolate_; | 421 Isolate* isolate_; |
| 417 int next_block_id_; | 422 int next_block_id_; |
| 418 HBasicBlock* entry_block_; | 423 HBasicBlock* entry_block_; |
| 419 HEnvironment* start_environment_; | 424 HEnvironment* start_environment_; |
| 420 ZoneList<HBasicBlock*> blocks_; | 425 ZoneList<HBasicBlock*> blocks_; |
| 421 ZoneList<HValue*> values_; | 426 ZoneList<HValue*> values_; |
| 422 ZoneList<HPhi*>* phi_list_; | 427 ZoneList<HPhi*>* phi_list_; |
| 423 ZoneList<HInstruction*>* uint32_instructions_; | 428 ZoneList<HInstruction*>* uint32_instructions_; |
| 424 SetOncePointer<HConstant> undefined_constant_; | 429 SetOncePointer<HConstant> undefined_constant_; |
| 425 SetOncePointer<HConstant> constant_0_; | 430 SetOncePointer<HConstant> constant_0_; |
| 426 SetOncePointer<HConstant> constant_1_; | 431 SetOncePointer<HConstant> constant_1_; |
| 432 SetOncePointer<HConstant> constant_smi_0_; |
| 433 SetOncePointer<HConstant> constant_smi_1_; |
| 427 SetOncePointer<HConstant> constant_minus1_; | 434 SetOncePointer<HConstant> constant_minus1_; |
| 428 SetOncePointer<HConstant> constant_true_; | 435 SetOncePointer<HConstant> constant_true_; |
| 429 SetOncePointer<HConstant> constant_false_; | 436 SetOncePointer<HConstant> constant_false_; |
| 430 SetOncePointer<HConstant> constant_the_hole_; | 437 SetOncePointer<HConstant> constant_the_hole_; |
| 438 SetOncePointer<HConstant> constant_null_; |
| 431 SetOncePointer<HConstant> constant_invalid_context_; | 439 SetOncePointer<HConstant> constant_invalid_context_; |
| 432 SetOncePointer<HArgumentsObject> arguments_object_; | 440 SetOncePointer<HArgumentsObject> arguments_object_; |
| 433 | 441 |
| 434 SetOncePointer<HBasicBlock> osr_loop_entry_; | 442 SetOncePointer<HBasicBlock> osr_loop_entry_; |
| 435 SetOncePointer<ZoneList<HUnknownOSRValue*> > osr_values_; | 443 SetOncePointer<ZoneList<HUnknownOSRValue*> > osr_values_; |
| 436 | 444 |
| 437 CompilationInfo* info_; | 445 CompilationInfo* info_; |
| 438 Zone* zone_; | 446 Zone* zone_; |
| 439 | 447 |
| 440 bool is_recursive_; | 448 bool is_recursive_; |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 | 891 |
| 884 class HIfContinuation { | 892 class HIfContinuation { |
| 885 public: | 893 public: |
| 886 HIfContinuation() { continuation_captured_ = false; } | 894 HIfContinuation() { continuation_captured_ = false; } |
| 887 ~HIfContinuation() { ASSERT(!continuation_captured_); } | 895 ~HIfContinuation() { ASSERT(!continuation_captured_); } |
| 888 | 896 |
| 889 void Capture(HBasicBlock* true_branch, | 897 void Capture(HBasicBlock* true_branch, |
| 890 HBasicBlock* false_branch, | 898 HBasicBlock* false_branch, |
| 891 int position) { | 899 int position) { |
| 892 ASSERT(!continuation_captured_); | 900 ASSERT(!continuation_captured_); |
| 893 ASSERT(true_branch != NULL || false_branch != NULL); | |
| 894 true_branch_ = true_branch; | 901 true_branch_ = true_branch; |
| 895 false_branch_ = false_branch; | 902 false_branch_ = false_branch; |
| 896 position_ = position; | 903 position_ = position; |
| 897 continuation_captured_ = true; | 904 continuation_captured_ = true; |
| 898 } | 905 } |
| 899 | 906 |
| 900 void Continue(HBasicBlock** true_branch, | 907 void Continue(HBasicBlock** true_branch, |
| 901 HBasicBlock** false_branch, | 908 HBasicBlock** false_branch, |
| 902 int* position) { | 909 int* position) { |
| 903 ASSERT(continuation_captured_); | 910 ASSERT(continuation_captured_); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 class CheckBuilder { | 1023 class CheckBuilder { |
| 1017 public: | 1024 public: |
| 1018 explicit CheckBuilder(HGraphBuilder* builder); | 1025 explicit CheckBuilder(HGraphBuilder* builder); |
| 1019 ~CheckBuilder() { | 1026 ~CheckBuilder() { |
| 1020 if (!finished_) End(); | 1027 if (!finished_) End(); |
| 1021 } | 1028 } |
| 1022 | 1029 |
| 1023 HValue* CheckNotUndefined(HValue* value); | 1030 HValue* CheckNotUndefined(HValue* value); |
| 1024 HValue* CheckIntegerCompare(HValue* left, HValue* right, Token::Value op); | 1031 HValue* CheckIntegerCompare(HValue* left, HValue* right, Token::Value op); |
| 1025 HValue* CheckIntegerEq(HValue* left, HValue* right); | 1032 HValue* CheckIntegerEq(HValue* left, HValue* right); |
| 1033 |
| 1026 void End(); | 1034 void End(); |
| 1027 | 1035 |
| 1028 private: | 1036 private: |
| 1029 Zone* zone() { return builder_->zone(); } | 1037 Zone* zone() { return builder_->zone(); } |
| 1030 | 1038 |
| 1031 HGraphBuilder* builder_; | 1039 HGraphBuilder* builder_; |
| 1032 bool finished_; | 1040 bool finished_; |
| 1033 HBasicBlock* failure_block_; | 1041 HBasicBlock* failure_block_; |
| 1034 HBasicBlock* merge_block_; | 1042 HBasicBlock* merge_block_; |
| 1035 }; | 1043 }; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1122 void Or(); | 1130 void Or(); |
| 1123 void And(); | 1131 void And(); |
| 1124 | 1132 |
| 1125 void CaptureContinuation(HIfContinuation* continuation); | 1133 void CaptureContinuation(HIfContinuation* continuation); |
| 1126 | 1134 |
| 1127 void Then(); | 1135 void Then(); |
| 1128 void Else(); | 1136 void Else(); |
| 1129 void End(); | 1137 void End(); |
| 1130 | 1138 |
| 1131 void Deopt(); | 1139 void Deopt(); |
| 1140 void Return(HValue* value); |
| 1132 | 1141 |
| 1133 private: | 1142 private: |
| 1134 void AddCompare(HControlInstruction* compare); | 1143 void AddCompare(HControlInstruction* compare); |
| 1135 | 1144 |
| 1136 Zone* zone() { return builder_->zone(); } | 1145 Zone* zone() { return builder_->zone(); } |
| 1137 | 1146 |
| 1138 HGraphBuilder* builder_; | 1147 HGraphBuilder* builder_; |
| 1139 int position_; | 1148 int position_; |
| 1140 bool finished_ : 1; | 1149 bool finished_ : 1; |
| 1141 bool did_then_ : 1; | 1150 bool did_then_ : 1; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 ElementsKind to_elements_kind, | 1248 ElementsKind to_elements_kind, |
| 1240 HValue* length, | 1249 HValue* length, |
| 1241 HValue* capacity); | 1250 HValue* capacity); |
| 1242 | 1251 |
| 1243 HValue* BuildCloneShallowArray(HContext* context, | 1252 HValue* BuildCloneShallowArray(HContext* context, |
| 1244 HValue* boilerplate, | 1253 HValue* boilerplate, |
| 1245 AllocationSiteMode mode, | 1254 AllocationSiteMode mode, |
| 1246 ElementsKind kind, | 1255 ElementsKind kind, |
| 1247 int length); | 1256 int length); |
| 1248 | 1257 |
| 1258 void BuildCompareNil( |
| 1259 HValue* value, |
| 1260 EqualityKind kind, |
| 1261 CompareNilICStub::Types types, |
| 1262 Handle<Map> map, |
| 1263 int position, |
| 1264 HIfContinuation* continuation); |
| 1265 |
| 1249 private: | 1266 private: |
| 1250 HGraphBuilder(); | 1267 HGraphBuilder(); |
| 1251 CompilationInfo* info_; | 1268 CompilationInfo* info_; |
| 1252 HGraph* graph_; | 1269 HGraph* graph_; |
| 1253 HBasicBlock* current_block_; | 1270 HBasicBlock* current_block_; |
| 1254 int no_side_effects_scope_count_; | 1271 int no_side_effects_scope_count_; |
| 1255 }; | 1272 }; |
| 1256 | 1273 |
| 1257 | 1274 |
| 1258 class HOptimizedGraphBuilder: public HGraphBuilder, public AstVisitor { | 1275 class HOptimizedGraphBuilder: public HGraphBuilder, public AstVisitor { |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1936 EmbeddedVector<char, 64> filename_; | 1953 EmbeddedVector<char, 64> filename_; |
| 1937 HeapStringAllocator string_allocator_; | 1954 HeapStringAllocator string_allocator_; |
| 1938 StringStream trace_; | 1955 StringStream trace_; |
| 1939 int indent_; | 1956 int indent_; |
| 1940 }; | 1957 }; |
| 1941 | 1958 |
| 1942 | 1959 |
| 1943 } } // namespace v8::internal | 1960 } } // namespace v8::internal |
| 1944 | 1961 |
| 1945 #endif // V8_HYDROGEN_H_ | 1962 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |