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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 HLoopInformation* loop_information() const { return loop_information_; } | 70 HLoopInformation* loop_information() const { return loop_information_; } |
71 const ZoneList<HBasicBlock*>* predecessors() const { return &predecessors_; } | 71 const ZoneList<HBasicBlock*>* predecessors() const { return &predecessors_; } |
72 bool HasPredecessor() const { return predecessors_.length() > 0; } | 72 bool HasPredecessor() const { return predecessors_.length() > 0; } |
73 const ZoneList<HBasicBlock*>* dominated_blocks() const { | 73 const ZoneList<HBasicBlock*>* dominated_blocks() const { |
74 return &dominated_blocks_; | 74 return &dominated_blocks_; |
75 } | 75 } |
76 const ZoneList<int>* deleted_phis() const { | 76 const ZoneList<int>* deleted_phis() const { |
77 return &deleted_phis_; | 77 return &deleted_phis_; |
78 } | 78 } |
79 void RecordDeletedPhi(int merge_index) { | 79 void RecordDeletedPhi(int merge_index) { |
80 deleted_phis_.Add(merge_index); | 80 deleted_phis_.Add(merge_index, zone()); |
81 } | 81 } |
82 HBasicBlock* dominator() const { return dominator_; } | 82 HBasicBlock* dominator() const { return dominator_; } |
83 HEnvironment* last_environment() const { return last_environment_; } | 83 HEnvironment* last_environment() const { return last_environment_; } |
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_; } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 void Advance() { current_++; } | 205 void Advance() { current_++; } |
206 | 206 |
207 private: | 207 private: |
208 const ZoneList<HBasicBlock*>* predecessor_list_; | 208 const ZoneList<HBasicBlock*>* predecessor_list_; |
209 int current_; | 209 int current_; |
210 }; | 210 }; |
211 | 211 |
212 | 212 |
213 class HLoopInformation: public ZoneObject { | 213 class HLoopInformation: public ZoneObject { |
214 public: | 214 public: |
215 explicit HLoopInformation(HBasicBlock* loop_header) | 215 HLoopInformation(HBasicBlock* loop_header, Zone* zone) |
216 : back_edges_(4), | 216 : back_edges_(4, zone), |
217 loop_header_(loop_header), | 217 loop_header_(loop_header), |
218 blocks_(8), | 218 blocks_(8, zone), |
219 stack_check_(NULL) { | 219 stack_check_(NULL) { |
220 blocks_.Add(loop_header); | 220 blocks_.Add(loop_header, zone); |
221 } | 221 } |
222 virtual ~HLoopInformation() {} | 222 virtual ~HLoopInformation() {} |
223 | 223 |
224 const ZoneList<HBasicBlock*>* back_edges() const { return &back_edges_; } | 224 const ZoneList<HBasicBlock*>* back_edges() const { return &back_edges_; } |
225 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } | 225 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } |
226 HBasicBlock* loop_header() const { return loop_header_; } | 226 HBasicBlock* loop_header() const { return loop_header_; } |
227 HBasicBlock* GetLastBackEdge() const; | 227 HBasicBlock* GetLastBackEdge() const; |
228 void RegisterBackEdge(HBasicBlock* block); | 228 void RegisterBackEdge(HBasicBlock* block); |
229 | 229 |
230 HStackCheck* stack_check() const { return stack_check_; } | 230 HStackCheck* stack_check() const { return stack_check_; } |
231 void set_stack_check(HStackCheck* stack_check) { | 231 void set_stack_check(HStackCheck* stack_check) { |
232 stack_check_ = stack_check; | 232 stack_check_ = stack_check; |
233 } | 233 } |
234 | 234 |
235 private: | 235 private: |
236 void AddBlock(HBasicBlock* block); | 236 void AddBlock(HBasicBlock* block); |
237 | 237 |
238 ZoneList<HBasicBlock*> back_edges_; | 238 ZoneList<HBasicBlock*> back_edges_; |
239 HBasicBlock* loop_header_; | 239 HBasicBlock* loop_header_; |
240 ZoneList<HBasicBlock*> blocks_; | 240 ZoneList<HBasicBlock*> blocks_; |
241 HStackCheck* stack_check_; | 241 HStackCheck* stack_check_; |
242 }; | 242 }; |
243 | 243 |
244 class BoundsCheckTable; | 244 class BoundsCheckTable; |
245 class HGraph: public ZoneObject { | 245 class HGraph: public ZoneObject { |
246 public: | 246 public: |
247 explicit HGraph(CompilationInfo* info); | 247 HGraph(CompilationInfo* info, Zone* zone); |
248 | 248 |
249 Isolate* isolate() { return isolate_; } | 249 Isolate* isolate() { return isolate_; } |
250 Zone* zone() { return isolate_->zone(); } | 250 Zone* zone() const { return zone_; } |
251 | 251 |
252 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } | 252 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } |
253 const ZoneList<HPhi*>* phi_list() const { return phi_list_; } | 253 const ZoneList<HPhi*>* phi_list() const { return phi_list_; } |
254 HBasicBlock* entry_block() const { return entry_block_; } | 254 HBasicBlock* entry_block() const { return entry_block_; } |
255 HEnvironment* start_environment() const { return start_environment_; } | 255 HEnvironment* start_environment() const { return start_environment_; } |
256 | 256 |
257 void InitializeInferredTypes(); | 257 void InitializeInferredTypes(); |
258 void InsertTypeConversions(); | 258 void InsertTypeConversions(); |
259 void InsertRepresentationChanges(); | 259 void InsertRepresentationChanges(); |
260 void MarkDeoptimizeOnUndefined(); | 260 void MarkDeoptimizeOnUndefined(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
297 return arguments_object_.get(); | 297 return arguments_object_.get(); |
298 } | 298 } |
299 | 299 |
300 void SetArgumentsObject(HArgumentsObject* object) { | 300 void SetArgumentsObject(HArgumentsObject* object) { |
301 arguments_object_.set(object); | 301 arguments_object_.set(object); |
302 } | 302 } |
303 | 303 |
304 int GetMaximumValueID() const { return values_.length(); } | 304 int GetMaximumValueID() const { return values_.length(); } |
305 int GetNextBlockID() { return next_block_id_++; } | 305 int GetNextBlockID() { return next_block_id_++; } |
306 int GetNextValueID(HValue* value) { | 306 int GetNextValueID(HValue* value) { |
307 values_.Add(value); | 307 values_.Add(value, zone()); |
308 return values_.length() - 1; | 308 return values_.length() - 1; |
309 } | 309 } |
310 HValue* LookupValue(int id) const { | 310 HValue* LookupValue(int id) const { |
311 if (id >= 0 && id < values_.length()) return values_[id]; | 311 if (id >= 0 && id < values_.length()) return values_[id]; |
312 return NULL; | 312 return NULL; |
313 } | 313 } |
314 | 314 |
315 #ifdef DEBUG | 315 #ifdef DEBUG |
316 void Verify(bool do_full_verify) const; | 316 void Verify(bool do_full_verify) const; |
317 #endif | 317 #endif |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
373 SetOncePointer<HConstant> constant_1_; | 373 SetOncePointer<HConstant> constant_1_; |
374 SetOncePointer<HConstant> constant_minus1_; | 374 SetOncePointer<HConstant> constant_minus1_; |
375 SetOncePointer<HConstant> constant_true_; | 375 SetOncePointer<HConstant> constant_true_; |
376 SetOncePointer<HConstant> constant_false_; | 376 SetOncePointer<HConstant> constant_false_; |
377 SetOncePointer<HConstant> constant_hole_; | 377 SetOncePointer<HConstant> constant_hole_; |
378 SetOncePointer<HArgumentsObject> arguments_object_; | 378 SetOncePointer<HArgumentsObject> arguments_object_; |
379 | 379 |
380 SetOncePointer<HBasicBlock> osr_loop_entry_; | 380 SetOncePointer<HBasicBlock> osr_loop_entry_; |
381 SetOncePointer<ZoneList<HUnknownOSRValue*> > osr_values_; | 381 SetOncePointer<ZoneList<HUnknownOSRValue*> > osr_values_; |
382 | 382 |
383 Zone* zone_; | |
384 | |
383 DISALLOW_COPY_AND_ASSIGN(HGraph); | 385 DISALLOW_COPY_AND_ASSIGN(HGraph); |
384 }; | 386 }; |
385 | 387 |
386 | 388 |
387 Zone* HBasicBlock::zone() { return graph_->zone(); } | 389 Zone* HBasicBlock::zone() { return graph_->zone(); } |
388 | 390 |
389 | 391 |
390 // Type of stack frame an environment might refer to. | 392 // Type of stack frame an environment might refer to. |
391 enum FrameType { JS_FUNCTION, JS_CONSTRUCT, ARGUMENTS_ADAPTOR }; | 393 enum FrameType { JS_FUNCTION, JS_CONSTRUCT, ARGUMENTS_ADAPTOR }; |
392 | 394 |
393 | 395 |
394 class HEnvironment: public ZoneObject { | 396 class HEnvironment: public ZoneObject { |
395 public: | 397 public: |
396 HEnvironment(HEnvironment* outer, | 398 HEnvironment(HEnvironment* outer, |
397 Scope* scope, | 399 Scope* scope, |
398 Handle<JSFunction> closure); | 400 Handle<JSFunction> closure, |
401 Zone* zone); | |
399 | 402 |
400 HEnvironment* DiscardInlined(bool drop_extra) { | 403 HEnvironment* DiscardInlined(bool drop_extra) { |
401 HEnvironment* outer = outer_; | 404 HEnvironment* outer = outer_; |
402 while (outer->frame_type() != JS_FUNCTION) outer = outer->outer_; | 405 while (outer->frame_type() != JS_FUNCTION) outer = outer->outer_; |
403 if (drop_extra) outer->Drop(1); | 406 if (drop_extra) outer->Drop(1); |
404 return outer; | 407 return outer; |
405 } | 408 } |
406 | 409 |
407 HEnvironment* arguments_environment() { | 410 HEnvironment* arguments_environment() { |
408 return outer()->frame_type() == ARGUMENTS_ADAPTOR ? outer() : this; | 411 return outer()->frame_type() == ARGUMENTS_ADAPTOR ? outer() : this; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
455 } | 458 } |
456 | 459 |
457 HValue* LookupContext() const { | 460 HValue* LookupContext() const { |
458 // Return first special. | 461 // Return first special. |
459 return Lookup(parameter_count()); | 462 return Lookup(parameter_count()); |
460 } | 463 } |
461 | 464 |
462 void Push(HValue* value) { | 465 void Push(HValue* value) { |
463 ASSERT(value != NULL); | 466 ASSERT(value != NULL); |
464 ++push_count_; | 467 ++push_count_; |
465 values_.Add(value); | 468 values_.Add(value, zone()); |
466 } | 469 } |
467 | 470 |
468 HValue* Pop() { | 471 HValue* Pop() { |
469 ASSERT(!ExpressionStackIsEmpty()); | 472 ASSERT(!ExpressionStackIsEmpty()); |
470 if (push_count_ > 0) { | 473 if (push_count_ > 0) { |
471 --push_count_; | 474 --push_count_; |
472 } else { | 475 } else { |
473 ++pop_count_; | 476 ++pop_count_; |
474 } | 477 } |
475 return values_.RemoveLast(); | 478 return values_.RemoveLast(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
512 } | 515 } |
513 | 516 |
514 void SetValueAt(int index, HValue* value) { | 517 void SetValueAt(int index, HValue* value) { |
515 ASSERT(index < length()); | 518 ASSERT(index < length()); |
516 values_[index] = value; | 519 values_[index] = value; |
517 } | 520 } |
518 | 521 |
519 void PrintTo(StringStream* stream); | 522 void PrintTo(StringStream* stream); |
520 void PrintToStd(); | 523 void PrintToStd(); |
521 | 524 |
525 Zone* zone() const { return zone_; } | |
526 | |
522 private: | 527 private: |
523 explicit HEnvironment(const HEnvironment* other); | 528 HEnvironment(const HEnvironment* other, Zone* zone); |
524 | 529 |
525 HEnvironment(HEnvironment* outer, | 530 HEnvironment(HEnvironment* outer, |
526 Handle<JSFunction> closure, | 531 Handle<JSFunction> closure, |
527 FrameType frame_type, | 532 FrameType frame_type, |
528 int arguments); | 533 int arguments, |
534 Zone* zone); | |
529 | 535 |
530 // Create an artificial stub environment (e.g. for argument adaptor or | 536 // Create an artificial stub environment (e.g. for argument adaptor or |
531 // constructor stub). | 537 // constructor stub). |
532 HEnvironment* CreateStubEnvironment(HEnvironment* outer, | 538 HEnvironment* CreateStubEnvironment(HEnvironment* outer, |
533 Handle<JSFunction> target, | 539 Handle<JSFunction> target, |
534 FrameType frame_type, | 540 FrameType frame_type, |
535 int arguments) const; | 541 int arguments) const; |
536 | 542 |
537 // True if index is included in the expression stack part of the environment. | 543 // True if index is included in the expression stack part of the environment. |
538 bool HasExpressionAt(int index) const; | 544 bool HasExpressionAt(int index) const; |
(...skipping 17 matching lines...) Expand all Loading... | |
556 ZoneList<HValue*> values_; | 562 ZoneList<HValue*> values_; |
557 ZoneList<int> assigned_variables_; | 563 ZoneList<int> assigned_variables_; |
558 FrameType frame_type_; | 564 FrameType frame_type_; |
559 int parameter_count_; | 565 int parameter_count_; |
560 int specials_count_; | 566 int specials_count_; |
561 int local_count_; | 567 int local_count_; |
562 HEnvironment* outer_; | 568 HEnvironment* outer_; |
563 int pop_count_; | 569 int pop_count_; |
564 int push_count_; | 570 int push_count_; |
565 int ast_id_; | 571 int ast_id_; |
572 Zone* zone_; | |
566 }; | 573 }; |
567 | 574 |
568 | 575 |
569 class HGraphBuilder; | 576 class HGraphBuilder; |
570 | 577 |
571 enum ArgumentsAllowedFlag { | 578 enum ArgumentsAllowedFlag { |
572 ARGUMENTS_NOT_ALLOWED, | 579 ARGUMENTS_NOT_ALLOWED, |
573 ARGUMENTS_ALLOWED | 580 ARGUMENTS_ALLOWED |
574 }; | 581 }; |
575 | 582 |
(...skipping 24 matching lines...) Expand all Loading... | |
600 | 607 |
601 void set_for_typeof(bool for_typeof) { for_typeof_ = for_typeof; } | 608 void set_for_typeof(bool for_typeof) { for_typeof_ = for_typeof; } |
602 bool is_for_typeof() { return for_typeof_; } | 609 bool is_for_typeof() { return for_typeof_; } |
603 | 610 |
604 protected: | 611 protected: |
605 AstContext(HGraphBuilder* owner, Expression::Context kind); | 612 AstContext(HGraphBuilder* owner, Expression::Context kind); |
606 virtual ~AstContext(); | 613 virtual ~AstContext(); |
607 | 614 |
608 HGraphBuilder* owner() const { return owner_; } | 615 HGraphBuilder* owner() const { return owner_; } |
609 | 616 |
610 inline Zone* zone(); | 617 inline Zone* zone() const; |
danno
2012/06/05 13:42:35
Why the const here and not on other version of zon
sanjoy
2012/06/05 14:21:39
Fixed. Changed all the zone() methods (except the
| |
611 | 618 |
612 // We want to be able to assert, in a context-specific way, that the stack | 619 // We want to be able to assert, in a context-specific way, that the stack |
613 // height makes sense when the context is filled. | 620 // height makes sense when the context is filled. |
614 #ifdef DEBUG | 621 #ifdef DEBUG |
615 int original_length_; | 622 int original_length_; |
616 #endif | 623 #endif |
617 | 624 |
618 private: | 625 private: |
619 HGraphBuilder* owner_; | 626 HGraphBuilder* owner_; |
620 Expression::Context kind_; | 627 Expression::Context kind_; |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
814 | 821 |
815 // Search the break stack for a break or continue target. | 822 // Search the break stack for a break or continue target. |
816 HBasicBlock* Get(BreakableStatement* stmt, BreakType type, int* drop_extra); | 823 HBasicBlock* Get(BreakableStatement* stmt, BreakType type, int* drop_extra); |
817 | 824 |
818 private: | 825 private: |
819 BreakAndContinueInfo* info_; | 826 BreakAndContinueInfo* info_; |
820 HGraphBuilder* owner_; | 827 HGraphBuilder* owner_; |
821 BreakAndContinueScope* next_; | 828 BreakAndContinueScope* next_; |
822 }; | 829 }; |
823 | 830 |
824 HGraphBuilder(CompilationInfo* info, TypeFeedbackOracle* oracle); | 831 HGraphBuilder(CompilationInfo* info, TypeFeedbackOracle* oracle, Zone* zone); |
825 | 832 |
826 HGraph* CreateGraph(); | 833 HGraph* CreateGraph(); |
827 | 834 |
828 // Simple accessors. | 835 // Simple accessors. |
829 HGraph* graph() const { return graph_; } | 836 HGraph* graph() const { return graph_; } |
830 BreakAndContinueScope* break_scope() const { return break_scope_; } | 837 BreakAndContinueScope* break_scope() const { return break_scope_; } |
831 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; } | 838 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; } |
832 | 839 |
833 HBasicBlock* current_block() const { return current_block_; } | 840 HBasicBlock* current_block() const { return current_block_; } |
834 void set_current_block(HBasicBlock* block) { current_block_ = block; } | 841 void set_current_block(HBasicBlock* block) { current_block_ = block; } |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1137 HValue* key, | 1144 HValue* key, |
1138 HValue* value); | 1145 HValue* value); |
1139 | 1146 |
1140 HValue* BuildContextChainWalk(Variable* var); | 1147 HValue* BuildContextChainWalk(Variable* var); |
1141 | 1148 |
1142 void AddCheckConstantFunction(Call* expr, | 1149 void AddCheckConstantFunction(Call* expr, |
1143 HValue* receiver, | 1150 HValue* receiver, |
1144 Handle<Map> receiver_map, | 1151 Handle<Map> receiver_map, |
1145 bool smi_and_map_check); | 1152 bool smi_and_map_check); |
1146 | 1153 |
1147 Zone* zone() { return zone_; } | 1154 Zone* zone() const { return zone_; } |
danno
2012/06/05 13:42:35
Why the const here and not on other version of zon
| |
1148 | 1155 |
1149 // The translation state of the currently-being-translated function. | 1156 // The translation state of the currently-being-translated function. |
1150 FunctionState* function_state_; | 1157 FunctionState* function_state_; |
1151 | 1158 |
1152 // The base of the function state stack. | 1159 // The base of the function state stack. |
1153 FunctionState initial_function_state_; | 1160 FunctionState initial_function_state_; |
1154 | 1161 |
1155 // Expression context of the currently visited subexpression. NULL when | 1162 // Expression context of the currently visited subexpression. NULL when |
1156 // visiting statements. | 1163 // visiting statements. |
1157 AstContext* ast_context_; | 1164 AstContext* ast_context_; |
(...skipping 11 matching lines...) Expand all Loading... | |
1169 | 1176 |
1170 bool inline_bailout_; | 1177 bool inline_bailout_; |
1171 | 1178 |
1172 friend class FunctionState; // Pushes and pops the state stack. | 1179 friend class FunctionState; // Pushes and pops the state stack. |
1173 friend class AstContext; // Pushes and pops the AST context stack. | 1180 friend class AstContext; // Pushes and pops the AST context stack. |
1174 | 1181 |
1175 DISALLOW_COPY_AND_ASSIGN(HGraphBuilder); | 1182 DISALLOW_COPY_AND_ASSIGN(HGraphBuilder); |
1176 }; | 1183 }; |
1177 | 1184 |
1178 | 1185 |
1179 Zone* AstContext::zone() { return owner_->zone(); } | 1186 Zone* AstContext::zone() const { return owner_->zone(); } |
danno
2012/06/05 13:42:35
Why the const here and not on other version of zon
| |
1180 | 1187 |
1181 | 1188 |
1182 class HValueMap: public ZoneObject { | 1189 class HValueMap: public ZoneObject { |
1183 public: | 1190 public: |
1184 HValueMap() | 1191 explicit HValueMap(Zone* zone) |
1185 : array_size_(0), | 1192 : array_size_(0), |
1186 lists_size_(0), | 1193 lists_size_(0), |
1187 count_(0), | 1194 count_(0), |
1188 present_flags_(0), | 1195 present_flags_(0), |
1189 array_(NULL), | 1196 array_(NULL), |
1190 lists_(NULL), | 1197 lists_(NULL), |
1191 free_list_head_(kNil) { | 1198 free_list_head_(kNil) { |
1192 ResizeLists(kInitialSize); | 1199 ResizeLists(kInitialSize, zone); |
1193 Resize(kInitialSize); | 1200 Resize(kInitialSize, zone); |
1194 } | 1201 } |
1195 | 1202 |
1196 void Kill(GVNFlagSet flags); | 1203 void Kill(GVNFlagSet flags); |
1197 | 1204 |
1198 void Add(HValue* value) { | 1205 void Add(HValue* value, Zone* zone) { |
1199 present_flags_.Add(value->gvn_flags()); | 1206 present_flags_.Add(value->gvn_flags()); |
1200 Insert(value); | 1207 Insert(value, zone); |
1201 } | 1208 } |
1202 | 1209 |
1203 HValue* Lookup(HValue* value) const; | 1210 HValue* Lookup(HValue* value) const; |
1204 | 1211 |
1205 HValueMap* Copy(Zone* zone) const { | 1212 HValueMap* Copy(Zone* zone) const { |
1206 return new(zone) HValueMap(zone, this); | 1213 return new(zone) HValueMap(zone, this); |
1207 } | 1214 } |
1208 | 1215 |
1209 bool IsEmpty() const { return count_ == 0; } | 1216 bool IsEmpty() const { return count_ == 0; } |
1210 | 1217 |
1211 private: | 1218 private: |
1212 // A linked list of HValue* values. Stored in arrays. | 1219 // A linked list of HValue* values. Stored in arrays. |
1213 struct HValueMapListElement { | 1220 struct HValueMapListElement { |
1214 HValue* value; | 1221 HValue* value; |
1215 int next; // Index in the array of the next list element. | 1222 int next; // Index in the array of the next list element. |
1216 }; | 1223 }; |
1217 static const int kNil = -1; // The end of a linked list | 1224 static const int kNil = -1; // The end of a linked list |
1218 | 1225 |
1219 // Must be a power of 2. | 1226 // Must be a power of 2. |
1220 static const int kInitialSize = 16; | 1227 static const int kInitialSize = 16; |
1221 | 1228 |
1222 HValueMap(Zone* zone, const HValueMap* other); | 1229 HValueMap(Zone* zone, const HValueMap* other); |
1223 | 1230 |
1224 void Resize(int new_size); | 1231 void Resize(int new_size, Zone* zone); |
1225 void ResizeLists(int new_size); | 1232 void ResizeLists(int new_size, Zone* zone); |
1226 void Insert(HValue* value); | 1233 void Insert(HValue* value, Zone* zone); |
1227 uint32_t Bound(uint32_t value) const { return value & (array_size_ - 1); } | 1234 uint32_t Bound(uint32_t value) const { return value & (array_size_ - 1); } |
1228 | 1235 |
1229 int array_size_; | 1236 int array_size_; |
1230 int lists_size_; | 1237 int lists_size_; |
1231 int count_; // The number of values stored in the HValueMap. | 1238 int count_; // The number of values stored in the HValueMap. |
1232 GVNFlagSet present_flags_; // All flags that are in any value in the | 1239 GVNFlagSet present_flags_; // All flags that are in any value in the |
1233 // HValueMap. | 1240 // HValueMap. |
1234 HValueMapListElement* array_; // Primary store - contains the first value | 1241 HValueMapListElement* array_; // Primary store - contains the first value |
1235 // with a given hash. Colliding elements are stored in linked lists. | 1242 // with a given hash. Colliding elements are stored in linked lists. |
1236 HValueMapListElement* lists_; // The linked lists containing hash collisions. | 1243 HValueMapListElement* lists_; // The linked lists containing hash collisions. |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1369 private: | 1376 private: |
1370 HTracer* tracer_; | 1377 HTracer* tracer_; |
1371 const char* name_; | 1378 const char* name_; |
1372 }; | 1379 }; |
1373 | 1380 |
1374 explicit HTracer(const char* filename) | 1381 explicit HTracer(const char* filename) |
1375 : filename_(filename), trace_(&string_allocator_), indent_(0) { | 1382 : filename_(filename), trace_(&string_allocator_), indent_(0) { |
1376 WriteChars(filename, "", 0, false); | 1383 WriteChars(filename, "", 0, false); |
1377 } | 1384 } |
1378 | 1385 |
1379 void TraceLiveRange(LiveRange* range, const char* type); | 1386 void TraceLiveRange(LiveRange* range, const char* type, Zone* zone); |
1380 void Trace(const char* name, HGraph* graph, LChunk* chunk); | 1387 void Trace(const char* name, HGraph* graph, LChunk* chunk); |
1381 void FlushToFile(); | 1388 void FlushToFile(); |
1382 | 1389 |
1383 void PrintEmptyProperty(const char* name) { | 1390 void PrintEmptyProperty(const char* name) { |
1384 PrintIndent(); | 1391 PrintIndent(); |
1385 trace_.Add("%s\n", name); | 1392 trace_.Add("%s\n", name); |
1386 } | 1393 } |
1387 | 1394 |
1388 void PrintStringProperty(const char* name, const char* value) { | 1395 void PrintStringProperty(const char* name, const char* value) { |
1389 PrintIndent(); | 1396 PrintIndent(); |
(...skipping 24 matching lines...) Expand all Loading... | |
1414 const char* filename_; | 1421 const char* filename_; |
1415 HeapStringAllocator string_allocator_; | 1422 HeapStringAllocator string_allocator_; |
1416 StringStream trace_; | 1423 StringStream trace_; |
1417 int indent_; | 1424 int indent_; |
1418 }; | 1425 }; |
1419 | 1426 |
1420 | 1427 |
1421 } } // namespace v8::internal | 1428 } } // namespace v8::internal |
1422 | 1429 |
1423 #endif // V8_HYDROGEN_H_ | 1430 #endif // V8_HYDROGEN_H_ |
OLD | NEW |