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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 bool CheckConstPhiUses(); | 291 bool CheckConstPhiUses(); |
292 | 292 |
293 void CollectPhis(); | 293 void CollectPhis(); |
294 | 294 |
295 void set_undefined_constant(HConstant* constant) { | 295 void set_undefined_constant(HConstant* constant) { |
296 undefined_constant_.set(constant); | 296 undefined_constant_.set(constant); |
297 } | 297 } |
298 HConstant* GetConstantUndefined() const { return undefined_constant_.get(); } | 298 HConstant* GetConstantUndefined() const { return undefined_constant_.get(); } |
299 HConstant* GetConstant0(); | 299 HConstant* GetConstant0(); |
300 HConstant* GetConstant1(); | 300 HConstant* GetConstant1(); |
| 301 HConstant* GetConstant2(); |
301 HConstant* GetConstantMinus1(); | 302 HConstant* GetConstantMinus1(); |
302 HConstant* GetConstantTrue(); | 303 HConstant* GetConstantTrue(); |
303 HConstant* GetConstantFalse(); | 304 HConstant* GetConstantFalse(); |
304 HConstant* GetConstantHole(); | 305 HConstant* GetConstantHole(); |
305 | 306 |
306 HBasicBlock* CreateBasicBlock(); | 307 HBasicBlock* CreateBasicBlock(); |
307 HArgumentsObject* GetArgumentsObject() const { | 308 HArgumentsObject* GetArgumentsObject() const { |
308 return arguments_object_.get(); | 309 return arguments_object_.get(); |
309 } | 310 } |
310 | 311 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 int next_block_id_; | 413 int next_block_id_; |
413 HBasicBlock* entry_block_; | 414 HBasicBlock* entry_block_; |
414 HEnvironment* start_environment_; | 415 HEnvironment* start_environment_; |
415 ZoneList<HBasicBlock*> blocks_; | 416 ZoneList<HBasicBlock*> blocks_; |
416 ZoneList<HValue*> values_; | 417 ZoneList<HValue*> values_; |
417 ZoneList<HPhi*>* phi_list_; | 418 ZoneList<HPhi*>* phi_list_; |
418 ZoneList<HInstruction*>* uint32_instructions_; | 419 ZoneList<HInstruction*>* uint32_instructions_; |
419 SetOncePointer<HConstant> undefined_constant_; | 420 SetOncePointer<HConstant> undefined_constant_; |
420 SetOncePointer<HConstant> constant_0_; | 421 SetOncePointer<HConstant> constant_0_; |
421 SetOncePointer<HConstant> constant_1_; | 422 SetOncePointer<HConstant> constant_1_; |
| 423 SetOncePointer<HConstant> constant_2_; |
422 SetOncePointer<HConstant> constant_minus1_; | 424 SetOncePointer<HConstant> constant_minus1_; |
423 SetOncePointer<HConstant> constant_true_; | 425 SetOncePointer<HConstant> constant_true_; |
424 SetOncePointer<HConstant> constant_false_; | 426 SetOncePointer<HConstant> constant_false_; |
425 SetOncePointer<HConstant> constant_hole_; | 427 SetOncePointer<HConstant> constant_hole_; |
426 SetOncePointer<HArgumentsObject> arguments_object_; | 428 SetOncePointer<HArgumentsObject> arguments_object_; |
427 | 429 |
428 SetOncePointer<HBasicBlock> osr_loop_entry_; | 430 SetOncePointer<HBasicBlock> osr_loop_entry_; |
429 SetOncePointer<ZoneList<HUnknownOSRValue*> > osr_values_; | 431 SetOncePointer<ZoneList<HUnknownOSRValue*> > osr_values_; |
430 | 432 |
431 CompilationInfo* info_; | 433 CompilationInfo* info_; |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 HValue* length, | 887 HValue* length, |
886 BoundsCheckKeyMode key_mode = DONT_ALLOW_SMI_KEY, | 888 BoundsCheckKeyMode key_mode = DONT_ALLOW_SMI_KEY, |
887 Representation r = Representation::None()); | 889 Representation r = Representation::None()); |
888 | 890 |
889 protected: | 891 protected: |
890 virtual bool BuildGraph() = 0; | 892 virtual bool BuildGraph() = 0; |
891 | 893 |
892 HBasicBlock* CreateBasicBlock(HEnvironment* env); | 894 HBasicBlock* CreateBasicBlock(HEnvironment* env); |
893 HBasicBlock* CreateLoopHeaderBlock(); | 895 HBasicBlock* CreateLoopHeaderBlock(); |
894 | 896 |
| 897 void AddSoftDeoptimize(); |
| 898 |
895 // Building common constructs | 899 // Building common constructs |
896 HInstruction* BuildExternalArrayElementAccess( | 900 HInstruction* BuildExternalArrayElementAccess( |
897 HValue* external_elements, | 901 HValue* external_elements, |
898 HValue* checked_key, | 902 HValue* checked_key, |
899 HValue* val, | 903 HValue* val, |
900 HValue* dependency, | 904 HValue* dependency, |
901 ElementsKind elements_kind, | 905 ElementsKind elements_kind, |
902 bool is_store); | 906 bool is_store); |
903 | 907 |
904 HInstruction* BuildFastElementAccess( | 908 HInstruction* BuildFastElementAccess( |
905 HValue* elements, | 909 HValue* elements, |
906 HValue* checked_key, | 910 HValue* checked_key, |
907 HValue* val, | 911 HValue* val, |
908 HValue* dependency, | 912 HValue* dependency, |
909 ElementsKind elements_kind, | 913 ElementsKind elements_kind, |
910 bool is_store); | 914 bool is_store, |
| 915 KeyedAccessStoreMode store_mode); |
| 916 |
| 917 HValue* BuildCheckForCapacityGrow(HValue* object, |
| 918 HValue* elements, |
| 919 ElementsKind kind, |
| 920 HValue* length, |
| 921 HValue* key, |
| 922 bool is_js_array); |
| 923 |
| 924 HValue* BuildCopyElementsOnWrite(HValue* object, |
| 925 HValue* elements, |
| 926 ElementsKind kind, |
| 927 HValue* length); |
911 | 928 |
912 HInstruction* BuildUncheckedMonomorphicElementAccess( | 929 HInstruction* BuildUncheckedMonomorphicElementAccess( |
913 HValue* object, | 930 HValue* object, |
914 HValue* key, | 931 HValue* key, |
915 HValue* val, | 932 HValue* val, |
916 HCheckMaps* mapcheck, | 933 HCheckMaps* mapcheck, |
917 bool is_js_array, | 934 bool is_js_array, |
918 ElementsKind elements_kind, | 935 ElementsKind elements_kind, |
919 bool is_store, | 936 bool is_store, |
| 937 KeyedAccessStoreMode store_mode, |
920 Representation checked_index_representation = Representation::None()); | 938 Representation checked_index_representation = Representation::None()); |
921 | 939 |
922 HInstruction* BuildStoreMap(HValue* object, HValue* map, BailoutId id); | 940 HInstruction* BuildStoreMap(HValue* object, HValue* map, BailoutId id); |
923 HInstruction* BuildStoreMap(HValue* object, Handle<Map> map, BailoutId id); | 941 HInstruction* BuildStoreMap(HValue* object, Handle<Map> map, BailoutId id); |
924 | 942 |
925 class CheckBuilder { | 943 class CheckBuilder { |
926 public: | 944 public: |
927 CheckBuilder(HGraphBuilder* builder, BailoutId id); | 945 CheckBuilder(HGraphBuilder* builder, BailoutId id); |
928 ~CheckBuilder() { | 946 ~CheckBuilder() { |
929 if (!finished_) End(); | 947 if (!finished_) End(); |
(...skipping 13 matching lines...) Expand all Loading... |
943 BailoutId id_; | 961 BailoutId id_; |
944 }; | 962 }; |
945 | 963 |
946 class IfBuilder { | 964 class IfBuilder { |
947 public: | 965 public: |
948 IfBuilder(HGraphBuilder* builder, BailoutId id); | 966 IfBuilder(HGraphBuilder* builder, BailoutId id); |
949 ~IfBuilder() { | 967 ~IfBuilder() { |
950 if (!finished_) End(); | 968 if (!finished_) End(); |
951 } | 969 } |
952 | 970 |
953 HInstruction* BeginTrue( | 971 HInstruction* BeginIf( |
954 HValue* left, | 972 HValue* left, |
955 HValue* right, | 973 HValue* right, |
956 Token::Value token, | 974 Token::Value token, |
957 Representation input_representation = Representation::Integer32()); | 975 Representation input_representation = Representation::Integer32()); |
958 void BeginFalse(); | 976 HInstruction* BeginIfObjectsEqual( |
| 977 HValue* left, |
| 978 HValue* right); |
| 979 void BeginElse(); |
959 void End(); | 980 void End(); |
960 | 981 |
961 private: | 982 private: |
962 Zone* zone() { return builder_->zone(); } | 983 Zone* zone() { return builder_->zone(); } |
963 | 984 |
964 HGraphBuilder* builder_; | 985 HGraphBuilder* builder_; |
965 bool finished_; | 986 bool finished_; |
966 HBasicBlock* first_true_block_; | 987 HBasicBlock* first_true_block_; |
967 HBasicBlock* last_true_block_; | 988 HBasicBlock* last_true_block_; |
968 HBasicBlock* first_false_block_; | 989 HBasicBlock* first_false_block_; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 HInstruction* increment_; | 1023 HInstruction* increment_; |
1003 HPhi* phi_; | 1024 HPhi* phi_; |
1004 HBasicBlock* header_block_; | 1025 HBasicBlock* header_block_; |
1005 HBasicBlock* body_block_; | 1026 HBasicBlock* body_block_; |
1006 HBasicBlock* exit_block_; | 1027 HBasicBlock* exit_block_; |
1007 Direction direction_; | 1028 Direction direction_; |
1008 BailoutId id_; | 1029 BailoutId id_; |
1009 bool finished_; | 1030 bool finished_; |
1010 }; | 1031 }; |
1011 | 1032 |
1012 HValue* BuildAllocateElements(HContext* context, | 1033 HValue* BuildNewElementsCapacity(HValue* context, |
| 1034 HValue* old_capacity); |
| 1035 |
| 1036 void BuildNewSpaceArrayCheck(HValue* length, |
| 1037 ElementsKind kind); |
| 1038 |
| 1039 HValue* BuildAllocateElements(HValue* context, |
1013 ElementsKind kind, | 1040 ElementsKind kind, |
1014 HValue* capacity); | 1041 HValue* capacity, |
| 1042 BailoutId ast_id); |
1015 | 1043 |
1016 void BuildCopyElements(HContext* context, | 1044 HValue* BuildGrowElementsCapacity(HValue* object, |
| 1045 HValue* elements, |
| 1046 ElementsKind kind, |
| 1047 HValue* length, |
| 1048 HValue* new_capacity, |
| 1049 BailoutId ast_id); |
| 1050 |
| 1051 void BuildFillElementsWithHole(HValue* context, |
| 1052 HValue* elements, |
| 1053 ElementsKind elements_kind, |
| 1054 HValue* from, |
| 1055 HValue* to, |
| 1056 BailoutId ast_id); |
| 1057 |
| 1058 void BuildCopyElements(HValue* context, |
1017 HValue* from_elements, | 1059 HValue* from_elements, |
1018 ElementsKind from_elements_kind, | 1060 ElementsKind from_elements_kind, |
1019 HValue* to_elements, | 1061 HValue* to_elements, |
1020 ElementsKind to_elements_kind, | 1062 ElementsKind to_elements_kind, |
1021 HValue* length); | 1063 HValue* length, |
| 1064 HValue* capacity, |
| 1065 BailoutId ast_id); |
1022 | 1066 |
1023 private: | 1067 private: |
1024 HGraphBuilder(); | 1068 HGraphBuilder(); |
1025 CompilationInfo* info_; | 1069 CompilationInfo* info_; |
1026 HGraph* graph_; | 1070 HGraph* graph_; |
1027 HBasicBlock* current_block_; | 1071 HBasicBlock* current_block_; |
1028 }; | 1072 }; |
1029 | 1073 |
1030 | 1074 |
1031 class HOptimizedGraphBuilder: public HGraphBuilder, public AstVisitor { | 1075 class HOptimizedGraphBuilder: public HGraphBuilder, public AstVisitor { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1088 HOptimizedGraphBuilder(CompilationInfo* info, TypeFeedbackOracle* oracle); | 1132 HOptimizedGraphBuilder(CompilationInfo* info, TypeFeedbackOracle* oracle); |
1089 | 1133 |
1090 virtual bool BuildGraph(); | 1134 virtual bool BuildGraph(); |
1091 | 1135 |
1092 // Simple accessors. | 1136 // Simple accessors. |
1093 BreakAndContinueScope* break_scope() const { return break_scope_; } | 1137 BreakAndContinueScope* break_scope() const { return break_scope_; } |
1094 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; } | 1138 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; } |
1095 | 1139 |
1096 bool inline_bailout() { return inline_bailout_; } | 1140 bool inline_bailout() { return inline_bailout_; } |
1097 | 1141 |
1098 void AddSoftDeoptimize(); | |
1099 | |
1100 // Bailout environment manipulation. | 1142 // Bailout environment manipulation. |
1101 void Push(HValue* value) { environment()->Push(value); } | 1143 void Push(HValue* value) { environment()->Push(value); } |
1102 HValue* Pop() { return environment()->Pop(); } | 1144 HValue* Pop() { return environment()->Pop(); } |
1103 | 1145 |
1104 void Bailout(const char* reason); | 1146 void Bailout(const char* reason); |
1105 | 1147 |
1106 HBasicBlock* CreateJoin(HBasicBlock* first, | 1148 HBasicBlock* CreateJoin(HBasicBlock* first, |
1107 HBasicBlock* second, | 1149 HBasicBlock* second, |
1108 BailoutId join_id); | 1150 BailoutId join_id); |
1109 | 1151 |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 HInstruction* TryBuildConsolidatedElementLoad(HValue* object, | 1381 HInstruction* TryBuildConsolidatedElementLoad(HValue* object, |
1340 HValue* key, | 1382 HValue* key, |
1341 HValue* val, | 1383 HValue* val, |
1342 SmallMapList* maps); | 1384 SmallMapList* maps); |
1343 | 1385 |
1344 HInstruction* BuildMonomorphicElementAccess(HValue* object, | 1386 HInstruction* BuildMonomorphicElementAccess(HValue* object, |
1345 HValue* key, | 1387 HValue* key, |
1346 HValue* val, | 1388 HValue* val, |
1347 HValue* dependency, | 1389 HValue* dependency, |
1348 Handle<Map> map, | 1390 Handle<Map> map, |
1349 bool is_store); | 1391 bool is_store, |
| 1392 KeyedAccessStoreMode store_mode); |
1350 | 1393 |
1351 HValue* HandlePolymorphicElementAccess(HValue* object, | 1394 HValue* HandlePolymorphicElementAccess(HValue* object, |
1352 HValue* key, | 1395 HValue* key, |
1353 HValue* val, | 1396 HValue* val, |
1354 Expression* prop, | 1397 Expression* prop, |
1355 BailoutId ast_id, | 1398 BailoutId ast_id, |
1356 int position, | 1399 int position, |
1357 bool is_store, | 1400 bool is_store, |
| 1401 KeyedAccessStoreMode store_mode, |
1358 bool* has_side_effects); | 1402 bool* has_side_effects); |
1359 | 1403 |
1360 HValue* HandleKeyedElementAccess(HValue* obj, | 1404 HValue* HandleKeyedElementAccess(HValue* obj, |
1361 HValue* key, | 1405 HValue* key, |
1362 HValue* val, | 1406 HValue* val, |
1363 Expression* expr, | 1407 Expression* expr, |
1364 BailoutId ast_id, | 1408 BailoutId ast_id, |
1365 int position, | 1409 int position, |
1366 bool is_store, | 1410 bool is_store, |
1367 bool* has_side_effects); | 1411 bool* has_side_effects); |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1677 EmbeddedVector<char, 64> filename_; | 1721 EmbeddedVector<char, 64> filename_; |
1678 HeapStringAllocator string_allocator_; | 1722 HeapStringAllocator string_allocator_; |
1679 StringStream trace_; | 1723 StringStream trace_; |
1680 int indent_; | 1724 int indent_; |
1681 }; | 1725 }; |
1682 | 1726 |
1683 | 1727 |
1684 } } // namespace v8::internal | 1728 } } // namespace v8::internal |
1685 | 1729 |
1686 #endif // V8_HYDROGEN_H_ | 1730 #endif // V8_HYDROGEN_H_ |
OLD | NEW |