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 4669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4680 // [marked_for_deoptimization]: For kind OPTIMIZED_FUNCTION tells whether | 4680 // [marked_for_deoptimization]: For kind OPTIMIZED_FUNCTION tells whether |
4681 // the code is going to be deoptimized because of dead embedded maps. | 4681 // the code is going to be deoptimized because of dead embedded maps. |
4682 inline bool marked_for_deoptimization(); | 4682 inline bool marked_for_deoptimization(); |
4683 inline void set_marked_for_deoptimization(bool flag); | 4683 inline void set_marked_for_deoptimization(bool flag); |
4684 | 4684 |
4685 bool allowed_in_shared_map_code_cache(); | 4685 bool allowed_in_shared_map_code_cache(); |
4686 | 4686 |
4687 // Get the safepoint entry for the given pc. | 4687 // Get the safepoint entry for the given pc. |
4688 SafepointEntry GetSafepointEntry(Address pc); | 4688 SafepointEntry GetSafepointEntry(Address pc); |
4689 | 4689 |
| 4690 // Find an object in a stub with a specified map |
| 4691 Object* FindNthObject(int n, Map* match_map); |
| 4692 void ReplaceNthObject(int n, Map* match_map, Object* replace_with); |
| 4693 |
4690 // Find the first map in an IC stub. | 4694 // Find the first map in an IC stub. |
4691 Map* FindFirstMap(); | 4695 Map* FindFirstMap(); |
4692 void FindAllMaps(MapHandleList* maps); | 4696 void FindAllMaps(MapHandleList* maps); |
4693 void ReplaceFirstMap(Map* replace); | 4697 void ReplaceFirstMap(Map* replace); |
4694 | 4698 |
4695 // Find the first code in an IC stub. | 4699 // Find the first code in an IC stub. |
4696 Code* FindFirstCode(); | 4700 Code* FindFirstCode(); |
4697 void FindAllCode(CodeHandleList* code_list, int length); | 4701 void FindAllCode(CodeHandleList* code_list, int length); |
4698 | 4702 |
4699 // Find the first name in an IC stub. | 4703 // Find the first name in an IC stub. |
4700 Name* FindFirstName(); | 4704 Name* FindFirstName(); |
4701 | 4705 |
| 4706 void ReplaceNthCell(int n, Cell* replace_with); |
| 4707 |
4702 class ExtraICStateStrictMode: public BitField<StrictModeFlag, 0, 1> {}; | 4708 class ExtraICStateStrictMode: public BitField<StrictModeFlag, 0, 1> {}; |
4703 class ExtraICStateKeyedAccessStoreMode: | 4709 class ExtraICStateKeyedAccessStoreMode: |
4704 public BitField<KeyedAccessStoreMode, 1, 4> {}; // NOLINT | 4710 public BitField<KeyedAccessStoreMode, 1, 4> {}; // NOLINT |
4705 | 4711 |
4706 class ExtraICStateStubHolder: public BitField<StubHolder, 0, 1> {}; | 4712 class ExtraICStateStubHolder: public BitField<StubHolder, 0, 1> {}; |
4707 | 4713 |
4708 static inline StrictModeFlag GetStrictMode(ExtraICState extra_ic_state) { | 4714 static inline StrictModeFlag GetStrictMode(ExtraICState extra_ic_state) { |
4709 return ExtraICStateStrictMode::decode(extra_ic_state); | 4715 return ExtraICStateStrictMode::decode(extra_ic_state); |
4710 } | 4716 } |
4711 | 4717 |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5022 // deoptimized when the transition is replaced by a new version. | 5028 // deoptimized when the transition is replaced by a new version. |
5023 kTransitionGroup, | 5029 kTransitionGroup, |
5024 // Group of code that omit run-time prototype checks for prototypes | 5030 // Group of code that omit run-time prototype checks for prototypes |
5025 // described by this map. The group is deoptimized whenever an object | 5031 // described by this map. The group is deoptimized whenever an object |
5026 // described by this map changes shape (and transitions to a new map), | 5032 // described by this map changes shape (and transitions to a new map), |
5027 // possibly invalidating the assumptions embedded in the code. | 5033 // possibly invalidating the assumptions embedded in the code. |
5028 kPrototypeCheckGroup, | 5034 kPrototypeCheckGroup, |
5029 // Group of code that depends on elements not being added to objects with | 5035 // Group of code that depends on elements not being added to objects with |
5030 // this map. | 5036 // this map. |
5031 kElementsCantBeAddedGroup, | 5037 kElementsCantBeAddedGroup, |
5032 kGroupCount = kElementsCantBeAddedGroup + 1 | 5038 // Group of code that depends on global property values in property cells |
| 5039 // not being changed. |
| 5040 kPropertyCellChangedGroup, |
| 5041 kGroupCount = kPropertyCellChangedGroup + 1 |
5033 }; | 5042 }; |
5034 | 5043 |
5035 // Array for holding the index of the first code object of each group. | 5044 // Array for holding the index of the first code object of each group. |
5036 // The last element stores the total number of code objects. | 5045 // The last element stores the total number of code objects. |
5037 class GroupStartIndexes { | 5046 class GroupStartIndexes { |
5038 public: | 5047 public: |
5039 explicit GroupStartIndexes(DependentCode* entries); | 5048 explicit GroupStartIndexes(DependentCode* entries); |
5040 void Recompute(DependentCode* entries); | 5049 void Recompute(DependentCode* entries); |
5041 int at(int i) { return start_indexes_[i]; } | 5050 int at(int i) { return start_indexes_[i]; } |
5042 int number_of_entries() { return start_indexes_[kGroupCount]; } | 5051 int number_of_entries() { return start_indexes_[kGroupCount]; } |
(...skipping 21 matching lines...) Expand all Loading... |
5064 inline bool is_code_at(int i); | 5073 inline bool is_code_at(int i); |
5065 inline Code* code_at(int i); | 5074 inline Code* code_at(int i); |
5066 inline CompilationInfo* compilation_info_at(int i); | 5075 inline CompilationInfo* compilation_info_at(int i); |
5067 inline void set_object_at(int i, Object* object); | 5076 inline void set_object_at(int i, Object* object); |
5068 inline Object** slot_at(int i); | 5077 inline Object** slot_at(int i); |
5069 inline Object* object_at(int i); | 5078 inline Object* object_at(int i); |
5070 inline void clear_at(int i); | 5079 inline void clear_at(int i); |
5071 inline void copy(int from, int to); | 5080 inline void copy(int from, int to); |
5072 static inline DependentCode* cast(Object* object); | 5081 static inline DependentCode* cast(Object* object); |
5073 | 5082 |
| 5083 static DependentCode* ForObject(Handle<HeapObject> object, |
| 5084 DependencyGroup group); |
| 5085 |
5074 private: | 5086 private: |
5075 // Make a room at the end of the given group by moving out the first | 5087 // Make a room at the end of the given group by moving out the first |
5076 // code objects of the subsequent groups. | 5088 // code objects of the subsequent groups. |
5077 inline void ExtendGroup(DependencyGroup group); | 5089 inline void ExtendGroup(DependencyGroup group); |
5078 static const int kCodesStartIndex = kGroupCount; | 5090 static const int kCodesStartIndex = kGroupCount; |
5079 }; | 5091 }; |
5080 | 5092 |
5081 | 5093 |
5082 // All heap objects have a Map that describes their structure. | 5094 // All heap objects have a Map that describes their structure. |
5083 // A Map contains information about: | 5095 // A Map contains information about: |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5561 } | 5573 } |
5562 | 5574 |
5563 // Fires when the layout of an object with a leaf map changes. | 5575 // Fires when the layout of an object with a leaf map changes. |
5564 // This includes adding transitions to the leaf map or changing | 5576 // This includes adding transitions to the leaf map or changing |
5565 // the descriptor array. | 5577 // the descriptor array. |
5566 inline void NotifyLeafMapLayoutChange(); | 5578 inline void NotifyLeafMapLayoutChange(); |
5567 | 5579 |
5568 inline bool CanOmitPrototypeChecks(); | 5580 inline bool CanOmitPrototypeChecks(); |
5569 | 5581 |
5570 void AddDependentCompilationInfo(DependentCode::DependencyGroup group, | 5582 void AddDependentCompilationInfo(DependentCode::DependencyGroup group, |
5571 CompilationInfo* info); | 5583 CompilationInfo* info); |
5572 | 5584 |
5573 void AddDependentCode(DependentCode::DependencyGroup group, | 5585 void AddDependentCode(DependentCode::DependencyGroup group, |
5574 Handle<Code> code); | 5586 Handle<Code> code); |
5575 | 5587 |
5576 bool IsMapInArrayPrototypeChain(); | 5588 bool IsMapInArrayPrototypeChain(); |
5577 | 5589 |
5578 // Dispatched behavior. | 5590 // Dispatched behavior. |
5579 DECLARE_PRINTER(Map) | 5591 DECLARE_PRINTER(Map) |
5580 DECLARE_VERIFIER(Map) | 5592 DECLARE_VERIFIER(Map) |
5581 | 5593 |
(...skipping 2982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8564 kValueOffset + kPointerSize, | 8576 kValueOffset + kPointerSize, |
8565 kSize> BodyDescriptor; | 8577 kSize> BodyDescriptor; |
8566 | 8578 |
8567 private: | 8579 private: |
8568 DISALLOW_IMPLICIT_CONSTRUCTORS(Cell); | 8580 DISALLOW_IMPLICIT_CONSTRUCTORS(Cell); |
8569 }; | 8581 }; |
8570 | 8582 |
8571 | 8583 |
8572 class PropertyCell: public Cell { | 8584 class PropertyCell: public Cell { |
8573 public: | 8585 public: |
| 8586 // [type]: type of the global property. |
8574 Type* type(); | 8587 Type* type(); |
8575 void set_type(Type* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 8588 void set_type(Type* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
8576 | 8589 |
| 8590 // [dependent_code]: dependent code that depends on the type of the global |
| 8591 // property. |
| 8592 DECL_ACCESSORS(dependent_code, DependentCode) |
| 8593 |
| 8594 // Sets the value of the cell and updates the type field to be the union |
| 8595 // of the cell's current type and the value's type. |
| 8596 void set_value_infer_type(Object* value, |
| 8597 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
| 8598 |
8577 // Casting. | 8599 // Casting. |
8578 static inline PropertyCell* cast(Object* obj); | 8600 static inline PropertyCell* cast(Object* obj); |
8579 | 8601 |
8580 inline Address TypeAddress() { | 8602 inline Address TypeAddress() { |
8581 return address() + kTypeOffset; | 8603 return address() + kTypeOffset; |
8582 } | 8604 } |
8583 | 8605 |
8584 // Dispatched behavior. | 8606 // Dispatched behavior. |
8585 DECLARE_PRINTER(PropertyCell) | 8607 DECLARE_PRINTER(PropertyCell) |
8586 DECLARE_VERIFIER(PropertyCell) | 8608 DECLARE_VERIFIER(PropertyCell) |
8587 | 8609 |
8588 // Layout description. | 8610 // Layout description. |
8589 static const int kTypeOffset = kValueOffset + kPointerSize; | 8611 static const int kTypeOffset = kValueOffset + kPointerSize; |
8590 static const int kSize = kTypeOffset + kPointerSize; | 8612 static const int kDependentCodeOffset = kTypeOffset + kPointerSize; |
| 8613 static const int kSize = kDependentCodeOffset + kPointerSize; |
8591 | 8614 |
8592 typedef FixedBodyDescriptor< | 8615 static const int kPointerFieldsBeginOffset = kValueOffset; |
8593 kValueOffset, | 8616 static const int kPointerFieldsEndOffset = kDependentCodeOffset; |
8594 kTypeOffset + kPointerSize, | 8617 |
8595 PropertyCell::kSize> BodyDescriptor; | 8618 typedef FixedBodyDescriptor<kValueOffset, |
| 8619 kSize, |
| 8620 kSize> BodyDescriptor; |
| 8621 |
| 8622 void AddDependentCompilationInfo(CompilationInfo* info); |
| 8623 |
| 8624 void AddDependentCode(Handle<Code> code); |
| 8625 |
| 8626 Type* UnionType(Object* value); |
8596 | 8627 |
8597 private: | 8628 private: |
8598 DECL_ACCESSORS(type_raw, Object) | 8629 DECL_ACCESSORS(type_raw, Object) |
8599 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell); | 8630 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell); |
8600 }; | 8631 }; |
8601 | 8632 |
8602 | 8633 |
8603 // The JSProxy describes EcmaScript Harmony proxies | 8634 // The JSProxy describes EcmaScript Harmony proxies |
8604 class JSProxy: public JSReceiver { | 8635 class JSProxy: public JSReceiver { |
8605 public: | 8636 public: |
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9727 } else { | 9758 } else { |
9728 value &= ~(1 << bit_position); | 9759 value &= ~(1 << bit_position); |
9729 } | 9760 } |
9730 return value; | 9761 return value; |
9731 } | 9762 } |
9732 }; | 9763 }; |
9733 | 9764 |
9734 } } // namespace v8::internal | 9765 } } // namespace v8::internal |
9735 | 9766 |
9736 #endif // V8_OBJECTS_H_ | 9767 #endif // V8_OBJECTS_H_ |
OLD | NEW |