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 5012 matching lines...) Loading... |
5023 // deoptimized when the transition is replaced by a new version. | 5023 // deoptimized when the transition is replaced by a new version. |
5024 kTransitionGroup, | 5024 kTransitionGroup, |
5025 // Group of code that omit run-time prototype checks for prototypes | 5025 // Group of code that omit run-time prototype checks for prototypes |
5026 // described by this map. The group is deoptimized whenever an object | 5026 // described by this map. The group is deoptimized whenever an object |
5027 // described by this map changes shape (and transitions to a new map), | 5027 // described by this map changes shape (and transitions to a new map), |
5028 // possibly invalidating the assumptions embedded in the code. | 5028 // possibly invalidating the assumptions embedded in the code. |
5029 kPrototypeCheckGroup, | 5029 kPrototypeCheckGroup, |
5030 // Group of code that depends on elements not being added to objects with | 5030 // Group of code that depends on elements not being added to objects with |
5031 // this map. | 5031 // this map. |
5032 kElementsCantBeAddedGroup, | 5032 kElementsCantBeAddedGroup, |
5033 kGroupCount = kElementsCantBeAddedGroup + 1 | 5033 // Group of code that depends on global property values in property cells |
| 5034 // not being changed. |
| 5035 kPropertyCellChangedGroup, |
| 5036 kGroupCount = kPropertyCellChangedGroup + 1 |
5034 }; | 5037 }; |
5035 | 5038 |
5036 // Array for holding the index of the first code object of each group. | 5039 // Array for holding the index of the first code object of each group. |
5037 // The last element stores the total number of code objects. | 5040 // The last element stores the total number of code objects. |
5038 class GroupStartIndexes { | 5041 class GroupStartIndexes { |
5039 public: | 5042 public: |
5040 explicit GroupStartIndexes(DependentCode* entries); | 5043 explicit GroupStartIndexes(DependentCode* entries); |
5041 void Recompute(DependentCode* entries); | 5044 void Recompute(DependentCode* entries); |
5042 int at(int i) { return start_indexes_[i]; } | 5045 int at(int i) { return start_indexes_[i]; } |
5043 int number_of_entries() { return start_indexes_[kGroupCount]; } | 5046 int number_of_entries() { return start_indexes_[kGroupCount]; } |
(...skipping 21 matching lines...) Loading... |
5065 inline bool is_code_at(int i); | 5068 inline bool is_code_at(int i); |
5066 inline Code* code_at(int i); | 5069 inline Code* code_at(int i); |
5067 inline CompilationInfo* compilation_info_at(int i); | 5070 inline CompilationInfo* compilation_info_at(int i); |
5068 inline void set_object_at(int i, Object* object); | 5071 inline void set_object_at(int i, Object* object); |
5069 inline Object** slot_at(int i); | 5072 inline Object** slot_at(int i); |
5070 inline Object* object_at(int i); | 5073 inline Object* object_at(int i); |
5071 inline void clear_at(int i); | 5074 inline void clear_at(int i); |
5072 inline void copy(int from, int to); | 5075 inline void copy(int from, int to); |
5073 static inline DependentCode* cast(Object* object); | 5076 static inline DependentCode* cast(Object* object); |
5074 | 5077 |
| 5078 static DependentCode* ForObject(Handle<HeapObject> object, |
| 5079 DependencyGroup group); |
| 5080 |
5075 private: | 5081 private: |
5076 // Make a room at the end of the given group by moving out the first | 5082 // Make a room at the end of the given group by moving out the first |
5077 // code objects of the subsequent groups. | 5083 // code objects of the subsequent groups. |
5078 inline void ExtendGroup(DependencyGroup group); | 5084 inline void ExtendGroup(DependencyGroup group); |
5079 static const int kCodesStartIndex = kGroupCount; | 5085 static const int kCodesStartIndex = kGroupCount; |
5080 }; | 5086 }; |
5081 | 5087 |
5082 | 5088 |
5083 // All heap objects have a Map that describes their structure. | 5089 // All heap objects have a Map that describes their structure. |
5084 // A Map contains information about: | 5090 // A Map contains information about: |
(...skipping 477 matching lines...) Loading... |
5562 } | 5568 } |
5563 | 5569 |
5564 // Fires when the layout of an object with a leaf map changes. | 5570 // Fires when the layout of an object with a leaf map changes. |
5565 // This includes adding transitions to the leaf map or changing | 5571 // This includes adding transitions to the leaf map or changing |
5566 // the descriptor array. | 5572 // the descriptor array. |
5567 inline void NotifyLeafMapLayoutChange(); | 5573 inline void NotifyLeafMapLayoutChange(); |
5568 | 5574 |
5569 inline bool CanOmitPrototypeChecks(); | 5575 inline bool CanOmitPrototypeChecks(); |
5570 | 5576 |
5571 void AddDependentCompilationInfo(DependentCode::DependencyGroup group, | 5577 void AddDependentCompilationInfo(DependentCode::DependencyGroup group, |
5572 CompilationInfo* info); | 5578 CompilationInfo* info); |
5573 | 5579 |
5574 void AddDependentCode(DependentCode::DependencyGroup group, | 5580 void AddDependentCode(DependentCode::DependencyGroup group, |
5575 Handle<Code> code); | 5581 Handle<Code> code); |
5576 | 5582 |
5577 bool IsMapInArrayPrototypeChain(); | 5583 bool IsMapInArrayPrototypeChain(); |
5578 | 5584 |
5579 // Dispatched behavior. | 5585 // Dispatched behavior. |
5580 DECLARE_PRINTER(Map) | 5586 DECLARE_PRINTER(Map) |
5581 DECLARE_VERIFIER(Map) | 5587 DECLARE_VERIFIER(Map) |
5582 | 5588 |
(...skipping 2982 matching lines...) Loading... |
8565 kValueOffset + kPointerSize, | 8571 kValueOffset + kPointerSize, |
8566 kSize> BodyDescriptor; | 8572 kSize> BodyDescriptor; |
8567 | 8573 |
8568 private: | 8574 private: |
8569 DISALLOW_IMPLICIT_CONSTRUCTORS(Cell); | 8575 DISALLOW_IMPLICIT_CONSTRUCTORS(Cell); |
8570 }; | 8576 }; |
8571 | 8577 |
8572 | 8578 |
8573 class PropertyCell: public Cell { | 8579 class PropertyCell: public Cell { |
8574 public: | 8580 public: |
| 8581 // [type]: type of the global property. |
8575 Type* type(); | 8582 Type* type(); |
8576 void set_type(Type* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 8583 void set_type(Type* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
8577 | 8584 |
| 8585 // [dependent_code]: dependent code that depends on the type of the global |
| 8586 // property. |
| 8587 DECL_ACCESSORS(dependent_code, DependentCode) |
| 8588 |
8578 // Casting. | 8589 // Casting. |
8579 static inline PropertyCell* cast(Object* obj); | 8590 static inline PropertyCell* cast(Object* obj); |
8580 | 8591 |
8581 inline Address TypeAddress() { | 8592 inline Address TypeAddress() { |
8582 return address() + kTypeOffset; | 8593 return address() + kTypeOffset; |
8583 } | 8594 } |
8584 | 8595 |
8585 // Dispatched behavior. | 8596 // Dispatched behavior. |
8586 DECLARE_PRINTER(PropertyCell) | 8597 DECLARE_PRINTER(PropertyCell) |
8587 DECLARE_VERIFIER(PropertyCell) | 8598 DECLARE_VERIFIER(PropertyCell) |
8588 | 8599 |
8589 // Layout description. | 8600 // Layout description. |
8590 static const int kTypeOffset = kValueOffset + kPointerSize; | 8601 static const int kTypeOffset = kValueOffset + kPointerSize; |
8591 static const int kSize = kTypeOffset + kPointerSize; | 8602 static const int kDependentCodeOffset = kTypeOffset + kPointerSize; |
| 8603 static const int kSize = kDependentCodeOffset + kPointerSize; |
8592 | 8604 |
8593 typedef FixedBodyDescriptor< | 8605 static const int kPointerFieldsBeginOffset = kValueOffset; |
8594 kValueOffset, | 8606 static const int kPointerFieldsEndOffset = kDependentCodeOffset; |
8595 kTypeOffset + kPointerSize, | 8607 |
8596 PropertyCell::kSize> BodyDescriptor; | 8608 typedef FixedBodyDescriptor<kValueOffset, |
| 8609 kSize, |
| 8610 kSize> BodyDescriptor; |
| 8611 |
| 8612 void AddDependentCompilationInfo(CompilationInfo* info); |
| 8613 |
| 8614 void AddDependentCode(Handle<Code> code); |
8597 | 8615 |
8598 private: | 8616 private: |
8599 DECL_ACCESSORS(type_raw, Object) | 8617 DECL_ACCESSORS(type_raw, Object) |
8600 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell); | 8618 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell); |
8601 }; | 8619 }; |
8602 | 8620 |
8603 | 8621 |
8604 // The JSProxy describes EcmaScript Harmony proxies | 8622 // The JSProxy describes EcmaScript Harmony proxies |
8605 class JSProxy: public JSReceiver { | 8623 class JSProxy: public JSReceiver { |
8606 public: | 8624 public: |
(...skipping 1121 matching lines...) Loading... |
9728 } else { | 9746 } else { |
9729 value &= ~(1 << bit_position); | 9747 value &= ~(1 << bit_position); |
9730 } | 9748 } |
9731 return value; | 9749 return value; |
9732 } | 9750 } |
9733 }; | 9751 }; |
9734 | 9752 |
9735 } } // namespace v8::internal | 9753 } } // namespace v8::internal |
9736 | 9754 |
9737 #endif // V8_OBJECTS_H_ | 9755 #endif // V8_OBJECTS_H_ |
OLD | NEW |