| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 12 matching lines...) Expand all Loading... |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_HYDROGEN_H_ | 28 #ifndef V8_HYDROGEN_H_ |
| 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 "ast.h" | 34 #include "ast.h" |
| 34 #include "compiler.h" | 35 #include "compiler.h" |
| 35 #include "hydrogen-instructions.h" | 36 #include "hydrogen-instructions.h" |
| 37 #include "type-info.h" |
| 36 #include "zone.h" | 38 #include "zone.h" |
| 37 | 39 |
| 38 namespace v8 { | 40 namespace v8 { |
| 39 namespace internal { | 41 namespace internal { |
| 40 | 42 |
| 41 // Forward declarations. | 43 // Forward declarations. |
| 42 class BitVector; | 44 class BitVector; |
| 43 class HEnvironment; | 45 class HEnvironment; |
| 44 class HGraph; | 46 class HGraph; |
| 45 class HLoopInformation; | 47 class HLoopInformation; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 void SetJoinId(int id); | 119 void SetJoinId(int id); |
| 118 | 120 |
| 119 void Finish(HControlInstruction* last); | 121 void Finish(HControlInstruction* last); |
| 120 void FinishExit(HControlInstruction* instruction); | 122 void FinishExit(HControlInstruction* instruction); |
| 121 void Goto(HBasicBlock* block, bool include_stack_check = false); | 123 void Goto(HBasicBlock* block, bool include_stack_check = false); |
| 122 | 124 |
| 123 int PredecessorIndexOf(HBasicBlock* predecessor) const; | 125 int PredecessorIndexOf(HBasicBlock* predecessor) const; |
| 124 void AddSimulate(int id) { AddInstruction(CreateSimulate(id)); } | 126 void AddSimulate(int id) { AddInstruction(CreateSimulate(id)); } |
| 125 void AssignCommonDominator(HBasicBlock* other); | 127 void AssignCommonDominator(HBasicBlock* other); |
| 126 | 128 |
| 127 void FinishExitWithDeoptimization() { | 129 void FinishExitWithDeoptimization(HDeoptimize::UseEnvironment has_uses) { |
| 128 FinishExit(CreateDeoptimize()); | 130 FinishExit(CreateDeoptimize(has_uses)); |
| 129 } | 131 } |
| 130 | 132 |
| 131 // Add the inlined function exit sequence, adding an HLeaveInlined | 133 // Add the inlined function exit sequence, adding an HLeaveInlined |
| 132 // instruction and updating the bailout environment. | 134 // instruction and updating the bailout environment. |
| 133 void AddLeaveInlined(HValue* return_value, HBasicBlock* target); | 135 void AddLeaveInlined(HValue* return_value, HBasicBlock* target); |
| 134 | 136 |
| 135 // If a target block is tagged as an inline function return, all | 137 // If a target block is tagged as an inline function return, all |
| 136 // predecessors should contain the inlined exit sequence: | 138 // predecessors should contain the inlined exit sequence: |
| 137 // | 139 // |
| 138 // LeaveInlined | 140 // LeaveInlined |
| 139 // Simulate (caller's environment) | 141 // Simulate (caller's environment) |
| 140 // Goto (target block) | 142 // Goto (target block) |
| 141 bool IsInlineReturnTarget() const { return is_inline_return_target_; } | 143 bool IsInlineReturnTarget() const { return is_inline_return_target_; } |
| 142 void MarkAsInlineReturnTarget() { is_inline_return_target_ = true; } | 144 void MarkAsInlineReturnTarget() { is_inline_return_target_ = true; } |
| 143 | 145 |
| 144 inline Zone* zone(); | 146 inline Zone* zone(); |
| 145 | 147 |
| 146 #ifdef DEBUG | 148 #ifdef DEBUG |
| 147 void Verify(); | 149 void Verify(); |
| 148 #endif | 150 #endif |
| 149 | 151 |
| 150 private: | 152 private: |
| 151 void RegisterPredecessor(HBasicBlock* pred); | 153 void RegisterPredecessor(HBasicBlock* pred); |
| 152 void AddDominatedBlock(HBasicBlock* block); | 154 void AddDominatedBlock(HBasicBlock* block); |
| 153 | 155 |
| 154 HSimulate* CreateSimulate(int id); | 156 HSimulate* CreateSimulate(int id); |
| 155 HDeoptimize* CreateDeoptimize(); | 157 HDeoptimize* CreateDeoptimize(HDeoptimize::UseEnvironment has_uses); |
| 156 | 158 |
| 157 int block_id_; | 159 int block_id_; |
| 158 HGraph* graph_; | 160 HGraph* graph_; |
| 159 ZoneList<HPhi*> phis_; | 161 ZoneList<HPhi*> phis_; |
| 160 HInstruction* first_; | 162 HInstruction* first_; |
| 161 HInstruction* last_; | 163 HInstruction* last_; |
| 162 HControlInstruction* end_; | 164 HControlInstruction* end_; |
| 163 HLoopInformation* loop_information_; | 165 HLoopInformation* loop_information_; |
| 164 ZoneList<HBasicBlock*> predecessors_; | 166 ZoneList<HBasicBlock*> predecessors_; |
| 165 HBasicBlock* dominator_; | 167 HBasicBlock* dominator_; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 Scope* scope, | 316 Scope* scope, |
| 315 Handle<JSFunction> closure); | 317 Handle<JSFunction> closure); |
| 316 | 318 |
| 317 // Simple accessors. | 319 // Simple accessors. |
| 318 Handle<JSFunction> closure() const { return closure_; } | 320 Handle<JSFunction> closure() const { return closure_; } |
| 319 const ZoneList<HValue*>* values() const { return &values_; } | 321 const ZoneList<HValue*>* values() const { return &values_; } |
| 320 const ZoneList<int>* assigned_variables() const { | 322 const ZoneList<int>* assigned_variables() const { |
| 321 return &assigned_variables_; | 323 return &assigned_variables_; |
| 322 } | 324 } |
| 323 int parameter_count() const { return parameter_count_; } | 325 int parameter_count() const { return parameter_count_; } |
| 326 int specials_count() const { return specials_count_; } |
| 324 int local_count() const { return local_count_; } | 327 int local_count() const { return local_count_; } |
| 325 HEnvironment* outer() const { return outer_; } | 328 HEnvironment* outer() const { return outer_; } |
| 326 int pop_count() const { return pop_count_; } | 329 int pop_count() const { return pop_count_; } |
| 327 int push_count() const { return push_count_; } | 330 int push_count() const { return push_count_; } |
| 328 | 331 |
| 329 int ast_id() const { return ast_id_; } | 332 int ast_id() const { return ast_id_; } |
| 330 void set_ast_id(int id) { ast_id_ = id; } | 333 void set_ast_id(int id) { ast_id_ = id; } |
| 331 | 334 |
| 332 int length() const { return values_.length(); } | 335 int length() const { return values_.length(); } |
| 336 bool is_special_index(int i) const { |
| 337 return i >= parameter_count() && i < parameter_count() + specials_count(); |
| 338 } |
| 333 | 339 |
| 334 void Bind(Variable* variable, HValue* value) { | 340 void Bind(Variable* variable, HValue* value) { |
| 335 Bind(IndexFor(variable), value); | 341 Bind(IndexFor(variable), value); |
| 336 } | 342 } |
| 337 | 343 |
| 338 void Bind(int index, HValue* value); | 344 void Bind(int index, HValue* value); |
| 339 | 345 |
| 346 void BindContext(HValue* value) { |
| 347 Bind(parameter_count(), value); |
| 348 } |
| 349 |
| 340 HValue* Lookup(Variable* variable) const { | 350 HValue* Lookup(Variable* variable) const { |
| 341 return Lookup(IndexFor(variable)); | 351 return Lookup(IndexFor(variable)); |
| 342 } | 352 } |
| 343 | 353 |
| 344 HValue* Lookup(int index) const { | 354 HValue* Lookup(int index) const { |
| 345 HValue* result = values_[index]; | 355 HValue* result = values_[index]; |
| 346 ASSERT(result != NULL); | 356 ASSERT(result != NULL); |
| 347 return result; | 357 return result; |
| 348 } | 358 } |
| 349 | 359 |
| 360 HValue* LookupContext() const { |
| 361 // Return first special. |
| 362 return Lookup(parameter_count()); |
| 363 } |
| 364 |
| 350 void Push(HValue* value) { | 365 void Push(HValue* value) { |
| 351 ASSERT(value != NULL); | 366 ASSERT(value != NULL); |
| 352 ++push_count_; | 367 ++push_count_; |
| 353 values_.Add(value); | 368 values_.Add(value); |
| 354 } | 369 } |
| 355 | 370 |
| 356 HValue* Pop() { | 371 HValue* Pop() { |
| 357 ASSERT(!ExpressionStackIsEmpty()); | 372 ASSERT(!ExpressionStackIsEmpty()); |
| 358 if (push_count_ > 0) { | 373 if (push_count_ > 0) { |
| 359 --push_count_; | 374 --push_count_; |
| 360 } else { | 375 } else { |
| 361 ++pop_count_; | 376 ++pop_count_; |
| 362 } | 377 } |
| 363 return values_.RemoveLast(); | 378 return values_.RemoveLast(); |
| 364 } | 379 } |
| 365 | 380 |
| 366 void Drop(int count); | 381 void Drop(int count); |
| 367 | 382 |
| 368 HValue* Top() const { return ExpressionStackAt(0); } | 383 HValue* Top() const { return ExpressionStackAt(0); } |
| 369 | 384 |
| 385 bool ExpressionStackIsEmpty() const; |
| 386 |
| 370 HValue* ExpressionStackAt(int index_from_top) const { | 387 HValue* ExpressionStackAt(int index_from_top) const { |
| 371 int index = length() - index_from_top - 1; | 388 int index = length() - index_from_top - 1; |
| 372 ASSERT(HasExpressionAt(index)); | 389 ASSERT(HasExpressionAt(index)); |
| 373 return values_[index]; | 390 return values_[index]; |
| 374 } | 391 } |
| 375 | 392 |
| 376 void SetExpressionStackAt(int index_from_top, HValue* value); | 393 void SetExpressionStackAt(int index_from_top, HValue* value); |
| 377 | 394 |
| 378 HEnvironment* Copy() const; | 395 HEnvironment* Copy() const; |
| 379 HEnvironment* CopyWithoutHistory() const; | 396 HEnvironment* CopyWithoutHistory() const; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 404 | 421 |
| 405 void PrintTo(StringStream* stream); | 422 void PrintTo(StringStream* stream); |
| 406 void PrintToStd(); | 423 void PrintToStd(); |
| 407 | 424 |
| 408 private: | 425 private: |
| 409 explicit HEnvironment(const HEnvironment* other); | 426 explicit HEnvironment(const HEnvironment* other); |
| 410 | 427 |
| 411 // True if index is included in the expression stack part of the environment. | 428 // True if index is included in the expression stack part of the environment. |
| 412 bool HasExpressionAt(int index) const; | 429 bool HasExpressionAt(int index) const; |
| 413 | 430 |
| 414 bool ExpressionStackIsEmpty() const; | |
| 415 | |
| 416 void Initialize(int parameter_count, int local_count, int stack_height); | 431 void Initialize(int parameter_count, int local_count, int stack_height); |
| 417 void Initialize(const HEnvironment* other); | 432 void Initialize(const HEnvironment* other); |
| 418 | 433 |
| 419 // Map a variable to an environment index. Parameter indices are shifted | 434 // Map a variable to an environment index. Parameter indices are shifted |
| 420 // by 1 (receiver is parameter index -1 but environment index 0). | 435 // by 1 (receiver is parameter index -1 but environment index 0). |
| 421 // Stack-allocated local indices are shifted by the number of parameters. | 436 // Stack-allocated local indices are shifted by the number of parameters. |
| 422 int IndexFor(Variable* variable) const { | 437 int IndexFor(Variable* variable) const { |
| 423 Slot* slot = variable->AsSlot(); | 438 Slot* slot = variable->AsSlot(); |
| 424 ASSERT(slot != NULL && slot->IsStackAllocated()); | 439 ASSERT(slot != NULL && slot->IsStackAllocated()); |
| 425 int shift = (slot->type() == Slot::PARAMETER) ? 1 : parameter_count_; | 440 int shift = (slot->type() == Slot::PARAMETER) |
| 441 ? 1 |
| 442 : parameter_count_ + specials_count_; |
| 426 return slot->index() + shift; | 443 return slot->index() + shift; |
| 427 } | 444 } |
| 428 | 445 |
| 429 Handle<JSFunction> closure_; | 446 Handle<JSFunction> closure_; |
| 430 // Value array [parameters] [locals] [temporaries]. | 447 // Value array [parameters] [specials] [locals] [temporaries]. |
| 431 ZoneList<HValue*> values_; | 448 ZoneList<HValue*> values_; |
| 432 ZoneList<int> assigned_variables_; | 449 ZoneList<int> assigned_variables_; |
| 433 int parameter_count_; | 450 int parameter_count_; |
| 451 int specials_count_; |
| 434 int local_count_; | 452 int local_count_; |
| 435 HEnvironment* outer_; | 453 HEnvironment* outer_; |
| 436 int pop_count_; | 454 int pop_count_; |
| 437 int push_count_; | 455 int push_count_; |
| 438 int ast_id_; | 456 int ast_id_; |
| 439 }; | 457 }; |
| 440 | 458 |
| 441 | 459 |
| 442 class HGraphBuilder; | 460 class HGraphBuilder; |
| 443 | 461 |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 } | 745 } |
| 728 | 746 |
| 729 // Generators for inline runtime functions. | 747 // Generators for inline runtime functions. |
| 730 #define INLINE_FUNCTION_GENERATOR_DECLARATION(Name, argc, ressize) \ | 748 #define INLINE_FUNCTION_GENERATOR_DECLARATION(Name, argc, ressize) \ |
| 731 void Generate##Name(CallRuntime* call); | 749 void Generate##Name(CallRuntime* call); |
| 732 | 750 |
| 733 INLINE_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_DECLARATION) | 751 INLINE_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_DECLARATION) |
| 734 INLINE_RUNTIME_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_DECLARATION) | 752 INLINE_RUNTIME_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_DECLARATION) |
| 735 #undef INLINE_FUNCTION_GENERATOR_DECLARATION | 753 #undef INLINE_FUNCTION_GENERATOR_DECLARATION |
| 736 | 754 |
| 755 void VisitDelete(UnaryOperation* expr); |
| 756 void VisitVoid(UnaryOperation* expr); |
| 757 void VisitTypeof(UnaryOperation* expr); |
| 758 void VisitAdd(UnaryOperation* expr); |
| 759 void VisitSub(UnaryOperation* expr); |
| 760 void VisitBitNot(UnaryOperation* expr); |
| 761 void VisitNot(UnaryOperation* expr); |
| 762 |
| 763 void VisitComma(BinaryOperation* expr); |
| 764 void VisitAndOr(BinaryOperation* expr, bool is_logical_and); |
| 765 void VisitCommon(BinaryOperation* expr); |
| 766 |
| 737 void PreProcessOsrEntry(IterationStatement* statement); | 767 void PreProcessOsrEntry(IterationStatement* statement); |
| 738 // True iff. we are compiling for OSR and the statement is the entry. | 768 // True iff. we are compiling for OSR and the statement is the entry. |
| 739 bool HasOsrEntryAt(IterationStatement* statement); | 769 bool HasOsrEntryAt(IterationStatement* statement); |
| 740 | 770 |
| 741 HBasicBlock* CreateJoin(HBasicBlock* first, | 771 HBasicBlock* CreateJoin(HBasicBlock* first, |
| 742 HBasicBlock* second, | 772 HBasicBlock* second, |
| 743 int join_id); | 773 int join_id); |
| 744 | 774 |
| 745 // Create a back edge in the flow graph. body_exit is the predecessor | 775 // Create a back edge in the flow graph. body_exit is the predecessor |
| 746 // block and loop_entry is the successor block. loop_successor is the | 776 // block and loop_entry is the successor block. loop_successor is the |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 void VisitExpressions(ZoneList<Expression*>* exprs); | 813 void VisitExpressions(ZoneList<Expression*>* exprs); |
| 784 | 814 |
| 785 void AddPhi(HPhi* phi); | 815 void AddPhi(HPhi* phi); |
| 786 | 816 |
| 787 void PushAndAdd(HInstruction* instr); | 817 void PushAndAdd(HInstruction* instr); |
| 788 | 818 |
| 789 // Remove the arguments from the bailout environment and emit instructions | 819 // Remove the arguments from the bailout environment and emit instructions |
| 790 // to push them as outgoing parameters. | 820 // to push them as outgoing parameters. |
| 791 template <int V> HInstruction* PreProcessCall(HCall<V>* call); | 821 template <int V> HInstruction* PreProcessCall(HCall<V>* call); |
| 792 | 822 |
| 793 void AssumeRepresentation(HValue* value, Representation r); | 823 void TraceRepresentation(Token::Value op, |
| 824 TypeInfo info, |
| 825 HValue* value, |
| 826 Representation rep); |
| 827 void AssumeRepresentation(HValue* value, Representation rep); |
| 794 static Representation ToRepresentation(TypeInfo info); | 828 static Representation ToRepresentation(TypeInfo info); |
| 795 | 829 |
| 796 void SetupScope(Scope* scope); | 830 void SetupScope(Scope* scope); |
| 797 virtual void VisitStatements(ZoneList<Statement*>* statements); | 831 virtual void VisitStatements(ZoneList<Statement*>* statements); |
| 798 | 832 |
| 799 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); | 833 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); |
| 800 AST_NODE_LIST(DECLARE_VISIT) | 834 AST_NODE_LIST(DECLARE_VISIT) |
| 801 #undef DECLARE_VISIT | 835 #undef DECLARE_VISIT |
| 802 | 836 |
| 803 HBasicBlock* CreateBasicBlock(HEnvironment* env); | 837 HBasicBlock* CreateBasicBlock(HEnvironment* env); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 void HandlePolymorphicStoreNamedField(Assignment* expr, | 869 void HandlePolymorphicStoreNamedField(Assignment* expr, |
| 836 HValue* object, | 870 HValue* object, |
| 837 HValue* value, | 871 HValue* value, |
| 838 ZoneMapList* types, | 872 ZoneMapList* types, |
| 839 Handle<String> name); | 873 Handle<String> name); |
| 840 void HandlePolymorphicCallNamed(Call* expr, | 874 void HandlePolymorphicCallNamed(Call* expr, |
| 841 HValue* receiver, | 875 HValue* receiver, |
| 842 ZoneMapList* types, | 876 ZoneMapList* types, |
| 843 Handle<String> name); | 877 Handle<String> name); |
| 844 | 878 |
| 879 HCompareSymbolEq* BuildSymbolCompare(HValue* left, |
| 880 HValue* right, |
| 881 Token::Value op); |
| 845 HStringCharCodeAt* BuildStringCharCodeAt(HValue* string, | 882 HStringCharCodeAt* BuildStringCharCodeAt(HValue* string, |
| 846 HValue* index); | 883 HValue* index); |
| 847 HInstruction* BuildBinaryOperation(BinaryOperation* expr, | 884 HInstruction* BuildBinaryOperation(BinaryOperation* expr, |
| 848 HValue* left, | 885 HValue* left, |
| 849 HValue* right); | 886 HValue* right); |
| 850 HInstruction* BuildIncrement(HValue* value, | 887 HInstruction* BuildBinaryOperation(Token::Value op, |
| 851 bool increment, | 888 HValue* left, |
| 889 HValue* right, |
| 890 TypeInfo info); |
| 891 HInstruction* BuildIncrement(bool returns_original_input, |
| 852 CountOperation* expr); | 892 CountOperation* expr); |
| 853 HLoadNamedField* BuildLoadNamedField(HValue* object, | 893 HLoadNamedField* BuildLoadNamedField(HValue* object, |
| 854 Property* expr, | 894 Property* expr, |
| 855 Handle<Map> type, | 895 Handle<Map> type, |
| 856 LookupResult* result, | 896 LookupResult* result, |
| 857 bool smi_and_map_check); | 897 bool smi_and_map_check); |
| 858 HInstruction* BuildLoadNamedGeneric(HValue* object, Property* expr); | 898 HInstruction* BuildLoadNamedGeneric(HValue* object, Property* expr); |
| 859 HInstruction* BuildLoadKeyedFastElement(HValue* object, | 899 HInstruction* BuildLoadKeyedFastElement(HValue* object, |
| 860 HValue* key, | 900 HValue* key, |
| 861 Property* expr); | 901 Property* expr); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 void Kill(int flags); | 1001 void Kill(int flags); |
| 962 | 1002 |
| 963 void Add(HValue* value) { | 1003 void Add(HValue* value) { |
| 964 present_flags_ |= value->flags(); | 1004 present_flags_ |= value->flags(); |
| 965 Insert(value); | 1005 Insert(value); |
| 966 } | 1006 } |
| 967 | 1007 |
| 968 HValue* Lookup(HValue* value) const; | 1008 HValue* Lookup(HValue* value) const; |
| 969 | 1009 |
| 970 HValueMap* Copy(Zone* zone) const { | 1010 HValueMap* Copy(Zone* zone) const { |
| 971 return new(zone) HValueMap(this); | 1011 return new(zone) HValueMap(zone, this); |
| 972 } | 1012 } |
| 973 | 1013 |
| 1014 bool IsEmpty() const { return count_ == 0; } |
| 1015 |
| 974 private: | 1016 private: |
| 975 // A linked list of HValue* values. Stored in arrays. | 1017 // A linked list of HValue* values. Stored in arrays. |
| 976 struct HValueMapListElement { | 1018 struct HValueMapListElement { |
| 977 HValue* value; | 1019 HValue* value; |
| 978 int next; // Index in the array of the next list element. | 1020 int next; // Index in the array of the next list element. |
| 979 }; | 1021 }; |
| 980 static const int kNil = -1; // The end of a linked list | 1022 static const int kNil = -1; // The end of a linked list |
| 981 | 1023 |
| 982 // Must be a power of 2. | 1024 // Must be a power of 2. |
| 983 static const int kInitialSize = 16; | 1025 static const int kInitialSize = 16; |
| 984 | 1026 |
| 985 explicit HValueMap(const HValueMap* other); | 1027 HValueMap(Zone* zone, const HValueMap* other); |
| 986 | 1028 |
| 987 void Resize(int new_size); | 1029 void Resize(int new_size); |
| 988 void ResizeLists(int new_size); | 1030 void ResizeLists(int new_size); |
| 989 void Insert(HValue* value); | 1031 void Insert(HValue* value); |
| 990 uint32_t Bound(uint32_t value) const { return value & (array_size_ - 1); } | 1032 uint32_t Bound(uint32_t value) const { return value & (array_size_ - 1); } |
| 991 | 1033 |
| 992 int array_size_; | 1034 int array_size_; |
| 993 int lists_size_; | 1035 int lists_size_; |
| 994 int count_; // The number of values stored in the HValueMap. | 1036 int count_; // The number of values stored in the HValueMap. |
| 995 int present_flags_; // All flags that are in any value in the HValueMap. | 1037 int present_flags_; // All flags that are in any value in the HValueMap. |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 const char* filename_; | 1199 const char* filename_; |
| 1158 HeapStringAllocator string_allocator_; | 1200 HeapStringAllocator string_allocator_; |
| 1159 StringStream trace_; | 1201 StringStream trace_; |
| 1160 int indent_; | 1202 int indent_; |
| 1161 }; | 1203 }; |
| 1162 | 1204 |
| 1163 | 1205 |
| 1164 } } // namespace v8::internal | 1206 } } // namespace v8::internal |
| 1165 | 1207 |
| 1166 #endif // V8_HYDROGEN_H_ | 1208 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |