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

Side by Side Diff: src/hydrogen.h

Issue 12385014: Hydrogen stubs for array constructors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: With all ports done Created 7 years, 8 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
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 18 matching lines...) Expand all
29 #define V8_HYDROGEN_H_ 29 #define V8_HYDROGEN_H_
30 30
31 #include "v8.h" 31 #include "v8.h"
32 32
33 #include "allocation.h" 33 #include "allocation.h"
34 #include "ast.h" 34 #include "ast.h"
35 #include "compiler.h" 35 #include "compiler.h"
36 #include "hydrogen-instructions.h" 36 #include "hydrogen-instructions.h"
37 #include "type-info.h" 37 #include "type-info.h"
38 #include "zone.h" 38 #include "zone.h"
39 #include "scopes.h"
39 40
40 namespace v8 { 41 namespace v8 {
41 namespace internal { 42 namespace internal {
42 43
43 // Forward declarations. 44 // Forward declarations.
44 class BitVector; 45 class BitVector;
45 class FunctionState; 46 class FunctionState;
46 class HEnvironment; 47 class HEnvironment;
47 class HGraph; 48 class HGraph;
48 class HLoopInformation; 49 class HLoopInformation;
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 void set_current_block(HBasicBlock* block) { current_block_ = block; } 876 void set_current_block(HBasicBlock* block) { current_block_ = block; }
876 HEnvironment* environment() const { 877 HEnvironment* environment() const {
877 return current_block()->last_environment(); 878 return current_block()->last_environment();
878 } 879 }
879 Zone* zone() const { return info_->zone(); } 880 Zone* zone() const { return info_->zone(); }
880 HGraph* graph() const { return graph_; } 881 HGraph* graph() const { return graph_; }
881 Isolate* isolate() const { return graph_->isolate(); } 882 Isolate* isolate() const { return graph_->isolate(); }
882 883
883 HGraph* CreateGraph(); 884 HGraph* CreateGraph();
884 885
886 // Bailout environment manipulation.
887 void Push(HValue* value) { environment()->Push(value); }
888 HValue* Pop() { return environment()->Pop(); }
889
885 // Adding instructions. 890 // Adding instructions.
886 HInstruction* AddInstruction(HInstruction* instr); 891 HInstruction* AddInstruction(HInstruction* instr);
887 void AddSimulate(BailoutId id, 892 void AddSimulate(BailoutId id,
888 RemovableSimulate removable = FIXED_SIMULATE); 893 RemovableSimulate removable = FIXED_SIMULATE);
889 HBoundsCheck* AddBoundsCheck( 894 HBoundsCheck* AddBoundsCheck(
890 HValue* index, 895 HValue* index,
891 HValue* length, 896 HValue* length,
892 BoundsCheckKeyMode key_mode = DONT_ALLOW_SMI_KEY, 897 BoundsCheckKeyMode key_mode = DONT_ALLOW_SMI_KEY,
893 Representation r = Representation::None()); 898 Representation r = Representation::None());
894 899
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 private: 1061 private:
1057 HGraphBuilder* builder_; 1062 HGraphBuilder* builder_;
1058 }; 1063 };
1059 1064
1060 HValue* BuildNewElementsCapacity(HValue* context, 1065 HValue* BuildNewElementsCapacity(HValue* context,
1061 HValue* old_capacity); 1066 HValue* old_capacity);
1062 1067
1063 void BuildNewSpaceArrayCheck(HValue* length, 1068 void BuildNewSpaceArrayCheck(HValue* length,
1064 ElementsKind kind); 1069 ElementsKind kind);
1065 1070
1071 class JSArrayBuilder {
1072 public:
1073 JSArrayBuilder(HGraphBuilder* builder,
1074 ElementsKind kind,
1075 HValue* allocation_site_payload,
1076 AllocationSiteMode mode);
1077
1078 HValue* AllocateEmptyArray();
1079 HValue* AllocateArray(HValue* capacity, HValue* length_field,
1080 bool fill_with_hole);
1081 HValue* GetElementsLocation() { return elements_location_; }
1082
1083 private:
1084 Zone* zone() const { return builder_->zone(); }
1085 int elements_size() const {
1086 return IsFastDoubleElementsKind(kind_) ? kDoubleSize : kPointerSize;
1087 }
1088 HInstruction* AddInstruction(HInstruction* instr) {
1089 return builder_->AddInstruction(instr);
1090 }
1091 HGraphBuilder* builder() { return builder_; }
1092 HGraph* graph() { return builder_->graph(); }
1093 int initial_capacity() {
1094 STATIC_ASSERT(JSArray::kPreallocatedArrayElements > 0);
1095 return JSArray::kPreallocatedArrayElements;
1096 }
1097
1098 HValue* EmitMapCode(HValue* context);
1099 HValue* EstablishEmptyArrayAllocationSize();
1100 HValue* EstablishAllocationSize(HValue* length_node);
1101 HValue* AllocateArray(HValue* size_in_bytes, HValue* capacity,
1102 HValue* length_field, bool fill_with_hole);
1103
1104 HGraphBuilder* builder_;
1105 ElementsKind kind_;
1106 AllocationSiteMode mode_;
1107 HValue* allocation_site_payload_;
1108 HInnerAllocatedObject* elements_location_;
1109 };
1110
1066 HValue* BuildAllocateElements(HValue* context, 1111 HValue* BuildAllocateElements(HValue* context,
1067 ElementsKind kind, 1112 ElementsKind kind,
1068 HValue* capacity); 1113 HValue* capacity);
1069 1114
1070 void BuildInitializeElements(HValue* elements, 1115 void BuildInitializeElements(HValue* elements,
1071 ElementsKind kind, 1116 ElementsKind kind,
1072 HValue* capacity); 1117 HValue* capacity);
1073 1118
1074 HValue* BuildAllocateAndInitializeElements(HValue* context, 1119 HValue* BuildAllocateAndInitializeElements(HValue* context,
1075 ElementsKind kind, 1120 ElementsKind kind,
1076 HValue* capacity); 1121 HValue* capacity);
1077 1122
1123 // array must have been allocated with enough room for
1124 // 1) the JSArray, 2) a AllocationSiteInfo if mode requires it,
1125 // 3) a FixedArray or FixedDoubleArray.
1126 // A pointer to the Fixed(Double)Array is returned.
1127 HInnerAllocatedObject* BuildJSArrayHeader(HValue* array,
1128 HValue* array_map,
1129 AllocationSiteMode mode,
1130 HValue* allocation_site_payload,
1131 HValue* length_field);
1132
1078 HValue* BuildGrowElementsCapacity(HValue* object, 1133 HValue* BuildGrowElementsCapacity(HValue* object,
1079 HValue* elements, 1134 HValue* elements,
1080 ElementsKind kind, 1135 ElementsKind kind,
1081 HValue* length, 1136 HValue* length,
1082 HValue* new_capacity); 1137 HValue* new_capacity);
1083 1138
1084 void BuildFillElementsWithHole(HValue* context, 1139 void BuildFillElementsWithHole(HValue* context,
1085 HValue* elements, 1140 HValue* elements,
1086 ElementsKind elements_kind, 1141 ElementsKind elements_kind,
1087 HValue* from, 1142 HValue* from,
1088 HValue* to); 1143 HValue* to);
1089 1144
1090 void BuildCopyElements(HValue* context, 1145 void BuildCopyElements(HValue* context,
1091 HValue* from_elements, 1146 HValue* from_elements,
1092 ElementsKind from_elements_kind, 1147 ElementsKind from_elements_kind,
1093 HValue* to_elements, 1148 HValue* to_elements,
1094 ElementsKind to_elements_kind, 1149 ElementsKind to_elements_kind,
1095 HValue* length, 1150 HValue* length,
1096 HValue* capacity); 1151 HValue* capacity);
1097 1152
1098 HValue* BuildCloneShallowArray(HContext* context, 1153 HValue* BuildCloneShallowArray(HContext* context,
1099 HValue* boilerplate, 1154 HValue* boilerplate,
1100 AllocationSiteMode mode, 1155 AllocationSiteMode mode,
1101 ElementsKind kind, 1156 ElementsKind kind,
1102 int length); 1157 int length);
1103 1158
1159 HValue* BuildCreateAllocationSiteInfo(HValue* previous_object,
1160 int previous_object_size,
1161 HValue* payload);
1162
1104 private: 1163 private:
1105 HGraphBuilder(); 1164 HGraphBuilder();
1106 CompilationInfo* info_; 1165 CompilationInfo* info_;
1107 HGraph* graph_; 1166 HGraph* graph_;
1108 HBasicBlock* current_block_; 1167 HBasicBlock* current_block_;
1109 int no_side_effects_scope_count_; 1168 int no_side_effects_scope_count_;
1110 }; 1169 };
1111 1170
1112 1171
1113 class HOptimizedGraphBuilder: public HGraphBuilder, public AstVisitor { 1172 class HOptimizedGraphBuilder: public HGraphBuilder, public AstVisitor {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 virtual bool BuildGraph(); 1231 virtual bool BuildGraph();
1173 1232
1174 // Simple accessors. 1233 // Simple accessors.
1175 BreakAndContinueScope* break_scope() const { return break_scope_; } 1234 BreakAndContinueScope* break_scope() const { return break_scope_; }
1176 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; } 1235 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; }
1177 1236
1178 bool inline_bailout() { return inline_bailout_; } 1237 bool inline_bailout() { return inline_bailout_; }
1179 1238
1180 void AddSoftDeoptimize(); 1239 void AddSoftDeoptimize();
1181 1240
1182 // Bailout environment manipulation.
1183 void Push(HValue* value) { environment()->Push(value); }
1184 HValue* Pop() { return environment()->Pop(); }
1185
1186 void Bailout(const char* reason); 1241 void Bailout(const char* reason);
1187 1242
1188 HBasicBlock* CreateJoin(HBasicBlock* first, 1243 HBasicBlock* CreateJoin(HBasicBlock* first,
1189 HBasicBlock* second, 1244 HBasicBlock* second,
1190 BailoutId join_id); 1245 BailoutId join_id);
1191 1246
1192 TypeFeedbackOracle* oracle() const { return function_state()->oracle(); } 1247 TypeFeedbackOracle* oracle() const { return function_state()->oracle(); }
1193 1248
1194 FunctionState* function_state() const { return function_state_; } 1249 FunctionState* function_state() const { return function_state_; }
1195 1250
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
1792 EmbeddedVector<char, 64> filename_; 1847 EmbeddedVector<char, 64> filename_;
1793 HeapStringAllocator string_allocator_; 1848 HeapStringAllocator string_allocator_;
1794 StringStream trace_; 1849 StringStream trace_;
1795 int indent_; 1850 int indent_;
1796 }; 1851 };
1797 1852
1798 1853
1799 } } // namespace v8::internal 1854 } } // namespace v8::internal
1800 1855
1801 #endif // V8_HYDROGEN_H_ 1856 #endif // V8_HYDROGEN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698