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

Side by Side Diff: src/hydrogen.h

Issue 11659022: Generate the TransitionElementsStub using Crankshaft (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review feedback Created 7 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.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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 HBasicBlock* entry_block() const { return entry_block_; } 256 HBasicBlock* entry_block() const { return entry_block_; }
257 HEnvironment* start_environment() const { return start_environment_; } 257 HEnvironment* start_environment() const { return start_environment_; }
258 258
259 void InitializeInferredTypes(); 259 void InitializeInferredTypes();
260 void InsertTypeConversions(); 260 void InsertTypeConversions();
261 void MergeRemovableSimulates(); 261 void MergeRemovableSimulates();
262 void InsertRepresentationChanges(); 262 void InsertRepresentationChanges();
263 void MarkDeoptimizeOnUndefined(); 263 void MarkDeoptimizeOnUndefined();
264 void ComputeMinusZeroChecks(); 264 void ComputeMinusZeroChecks();
265 void ComputeSafeUint32Operations(); 265 void ComputeSafeUint32Operations();
266 void GlobalValueNumbering();
266 bool ProcessArgumentsObject(); 267 bool ProcessArgumentsObject();
267 void EliminateRedundantPhis(); 268 void EliminateRedundantPhis();
268 void EliminateUnreachablePhis(); 269 void EliminateUnreachablePhis();
269 void Canonicalize(); 270 void Canonicalize();
270 void OrderBlocks(); 271 void OrderBlocks();
271 void AssignDominators(); 272 void AssignDominators();
272 void SetupInformativeDefinitions(); 273 void SetupInformativeDefinitions();
273 void EliminateRedundantBoundsChecks(); 274 void EliminateRedundantBoundsChecks();
274 void DehoistSimpleArrayIndexComputations(); 275 void DehoistSimpleArrayIndexComputations();
275 void DeadCodeElimination(); 276 void DeadCodeElimination();
276 void RestoreActualValues(); 277 void RestoreActualValues();
277 void PropagateDeoptimizingMark(); 278 void PropagateDeoptimizingMark();
278 void EliminateUnusedInstructions(); 279 void EliminateUnusedInstructions();
279 280
280 // Returns false if there are phi-uses of the arguments-object 281 // Returns false if there are phi-uses of the arguments-object
281 // which are not supported by the optimizing compiler. 282 // which are not supported by the optimizing compiler.
282 bool CheckArgumentsPhiUses(); 283 bool CheckArgumentsPhiUses();
283 284
284 // Returns false if there are phi-uses of an uninitialized const 285 // Returns false if there are phi-uses of an uninitialized const
285 // which are not supported by the optimizing compiler. 286 // which are not supported by the optimizing compiler.
286 bool CheckConstPhiUses(); 287 bool CheckConstPhiUses();
287 288
288 void CollectPhis(); 289 void CollectPhis();
289 290
290 void set_undefined_constant(HConstant* constant) { 291 void set_undefined_constant(HConstant* constant) {
291 undefined_constant_.set(constant); 292 undefined_constant_.set(constant);
292 } 293 }
293 HConstant* GetConstantUndefined() const { return undefined_constant_.get(); } 294 HConstant* GetConstantUndefined() const { return undefined_constant_.get(); }
295 HConstant* GetConstant0();
294 HConstant* GetConstant1(); 296 HConstant* GetConstant1();
295 HConstant* GetConstantMinus1(); 297 HConstant* GetConstantMinus1();
296 HConstant* GetConstantTrue(); 298 HConstant* GetConstantTrue();
297 HConstant* GetConstantFalse(); 299 HConstant* GetConstantFalse();
298 HConstant* GetConstantHole(); 300 HConstant* GetConstantHole();
299 301
300 HBasicBlock* CreateBasicBlock(); 302 HBasicBlock* CreateBasicBlock();
301 HArgumentsObject* GetArgumentsObject() const { 303 HArgumentsObject* GetArgumentsObject() const {
302 return arguments_object_.get(); 304 return arguments_object_.get();
303 } 305 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 406
405 Isolate* isolate_; 407 Isolate* isolate_;
406 int next_block_id_; 408 int next_block_id_;
407 HBasicBlock* entry_block_; 409 HBasicBlock* entry_block_;
408 HEnvironment* start_environment_; 410 HEnvironment* start_environment_;
409 ZoneList<HBasicBlock*> blocks_; 411 ZoneList<HBasicBlock*> blocks_;
410 ZoneList<HValue*> values_; 412 ZoneList<HValue*> values_;
411 ZoneList<HPhi*>* phi_list_; 413 ZoneList<HPhi*>* phi_list_;
412 ZoneList<HInstruction*>* uint32_instructions_; 414 ZoneList<HInstruction*>* uint32_instructions_;
413 SetOncePointer<HConstant> undefined_constant_; 415 SetOncePointer<HConstant> undefined_constant_;
416 SetOncePointer<HConstant> constant_0_;
414 SetOncePointer<HConstant> constant_1_; 417 SetOncePointer<HConstant> constant_1_;
415 SetOncePointer<HConstant> constant_minus1_; 418 SetOncePointer<HConstant> constant_minus1_;
416 SetOncePointer<HConstant> constant_true_; 419 SetOncePointer<HConstant> constant_true_;
417 SetOncePointer<HConstant> constant_false_; 420 SetOncePointer<HConstant> constant_false_;
418 SetOncePointer<HConstant> constant_hole_; 421 SetOncePointer<HConstant> constant_hole_;
419 SetOncePointer<HArgumentsObject> arguments_object_; 422 SetOncePointer<HArgumentsObject> arguments_object_;
420 423
421 SetOncePointer<HBasicBlock> osr_loop_entry_; 424 SetOncePointer<HBasicBlock> osr_loop_entry_;
422 SetOncePointer<ZoneList<HUnknownOSRValue*> > osr_values_; 425 SetOncePointer<ZoneList<HUnknownOSRValue*> > osr_values_;
423 426
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 HGraph* CreateGraph(); 872 HGraph* CreateGraph();
870 873
871 // Adding instructions. 874 // Adding instructions.
872 HInstruction* AddInstruction(HInstruction* instr); 875 HInstruction* AddInstruction(HInstruction* instr);
873 void AddSimulate(BailoutId id, 876 void AddSimulate(BailoutId id,
874 RemovableSimulate removable = FIXED_SIMULATE); 877 RemovableSimulate removable = FIXED_SIMULATE);
875 878
876 protected: 879 protected:
877 virtual bool BuildGraph() = 0; 880 virtual bool BuildGraph() = 0;
878 881
882 HBasicBlock* CreateBasicBlock(HEnvironment* env);
883 HBasicBlock* CreateLoopHeaderBlock();
884
879 // Building common constructs 885 // Building common constructs
880 HInstruction* BuildExternalArrayElementAccess( 886 HInstruction* BuildExternalArrayElementAccess(
881 HValue* external_elements, 887 HValue* external_elements,
882 HValue* checked_key, 888 HValue* checked_key,
883 HValue* val, 889 HValue* val,
884 HValue* dependency, 890 HValue* dependency,
885 ElementsKind elements_kind, 891 ElementsKind elements_kind,
886 bool is_store); 892 bool is_store);
887 893
888 HInstruction* BuildFastElementAccess( 894 HInstruction* BuildFastElementAccess(
889 HValue* elements, 895 HValue* elements,
890 HValue* checked_key, 896 HValue* checked_key,
891 HValue* val, 897 HValue* val,
892 HValue* dependency, 898 HValue* dependency,
893 ElementsKind elements_kind, 899 ElementsKind elements_kind,
894 bool is_store); 900 bool is_store);
895 901
896 HInstruction* BuildUncheckedMonomorphicElementAccess( 902 HInstruction* BuildUncheckedMonomorphicElementAccess(
897 HValue* object, 903 HValue* object,
898 HValue* key, 904 HValue* key,
899 HValue* val, 905 HValue* val,
900 HCheckMaps* mapcheck, 906 HCheckMaps* mapcheck,
901 bool is_js_array, 907 bool is_js_array,
902 ElementsKind elements_kind, 908 ElementsKind elements_kind,
903 bool is_store, 909 bool is_store,
904 Representation checked_index_representation = Representation::None()); 910 Representation checked_index_representation = Representation::None());
905 911
912 HInstruction* BuildStoreMap(HValue* object, HValue* map, BailoutId id);
913 HInstruction* BuildStoreMap(HValue* object, Handle<Map> map, BailoutId id);
914
915 class IfBuilder {
916 public:
917 IfBuilder(HGraphBuilder* builder,
918 BailoutId id = BailoutId::StubEntry());
919 ~IfBuilder() {
920 if (!finished_) End();
921 }
922
923 void BeginTrue(HValue* left, HValue* right, Token::Value token);
924 void BeginFalse();
925 void End();
926
927 private:
928 HGraphBuilder* builder_;
929 bool finished_;
930 HBasicBlock* true_block_;
931 HBasicBlock* false_block_;
932 HBasicBlock* merge_block_;
933 BailoutId id_;
934
935 Zone* zone() { return builder_->zone(); }
936 };
937
938 class LoopBuilder {
939 public:
940 enum Direction {
941 kPreIncrement,
942 kPostIncrement,
943 kPreDecrement,
944 kPostDecrement
945 };
946
947 LoopBuilder(HGraphBuilder* builder,
948 HValue* context,
949 Direction direction,
950 BailoutId id = BailoutId::StubEntry());
951 ~LoopBuilder() {
952 ASSERT(finished_);
953 }
954
955 HValue* BeginBody(HValue* initial, HValue* terminating, Token::Value token);
956 void EndBody();
957
958 private:
959 HGraphBuilder* builder_;
960 HValue* context_;
961 HInstruction* increment_;
962 HPhi* phi_;
963 HBasicBlock* header_block_;
964 HBasicBlock* body_block_;
965 HBasicBlock* exit_block_;
966 Direction direction_;
967 BailoutId id_;
968 bool finished_;
969
970 Zone* zone() { return builder_->zone(); }
971 };
972
973 HValue* BuildAllocateElements(HContext* context,
974 ElementsKind kind,
975 HValue* capacity);
976
977 void BuildCopyElements(HContext* context,
978 HValue* from_elements,
979 ElementsKind from_elements_kind,
980 HValue* to_elements,
981 ElementsKind to_elements_kind,
982 HValue* length);
983
906 private: 984 private:
907 HGraphBuilder(); 985 HGraphBuilder();
908 CompilationInfo* info_; 986 CompilationInfo* info_;
909 HGraph* graph_; 987 HGraph* graph_;
910 HBasicBlock* current_block_; 988 HBasicBlock* current_block_;
911 }; 989 };
912 990
913 991
914 class HOptimizedGraphBuilder: public HGraphBuilder, public AstVisitor { 992 class HOptimizedGraphBuilder: public HGraphBuilder, public AstVisitor {
915 public: 993 public:
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 1206
1129 static Representation ToRepresentation(TypeInfo info); 1207 static Representation ToRepresentation(TypeInfo info);
1130 1208
1131 void SetUpScope(Scope* scope); 1209 void SetUpScope(Scope* scope);
1132 virtual void VisitStatements(ZoneList<Statement*>* statements); 1210 virtual void VisitStatements(ZoneList<Statement*>* statements);
1133 1211
1134 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); 1212 #define DECLARE_VISIT(type) virtual void Visit##type(type* node);
1135 AST_NODE_LIST(DECLARE_VISIT) 1213 AST_NODE_LIST(DECLARE_VISIT)
1136 #undef DECLARE_VISIT 1214 #undef DECLARE_VISIT
1137 1215
1138 HBasicBlock* CreateBasicBlock(HEnvironment* env);
1139 HBasicBlock* CreateLoopHeaderBlock();
1140
1141 // Helpers for flow graph construction. 1216 // Helpers for flow graph construction.
1142 enum GlobalPropertyAccess { 1217 enum GlobalPropertyAccess {
1143 kUseCell, 1218 kUseCell,
1144 kUseGeneric 1219 kUseGeneric
1145 }; 1220 };
1146 GlobalPropertyAccess LookupGlobalProperty(Variable* var, 1221 GlobalPropertyAccess LookupGlobalProperty(Variable* var,
1147 LookupResult* lookup, 1222 LookupResult* lookup,
1148 bool is_store); 1223 bool is_store);
1149 1224
1150 void EnsureArgumentsArePushedForAccess(); 1225 void EnsureArgumentsArePushedForAccess();
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 const char* filename_; 1654 const char* filename_;
1580 HeapStringAllocator string_allocator_; 1655 HeapStringAllocator string_allocator_;
1581 StringStream trace_; 1656 StringStream trace_;
1582 int indent_; 1657 int indent_;
1583 }; 1658 };
1584 1659
1585 1660
1586 } } // namespace v8::internal 1661 } } // namespace v8::internal
1587 1662
1588 #endif // V8_HYDROGEN_H_ 1663 #endif // V8_HYDROGEN_H_
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698