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