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