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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // - SeqInternalizedString | 113 // - SeqInternalizedString |
114 // - SeqOneByteInternalizedString | 114 // - SeqOneByteInternalizedString |
115 // - SeqTwoByteInternalizedString | 115 // - SeqTwoByteInternalizedString |
116 // - ConsInternalizedString | 116 // - ConsInternalizedString |
117 // - ExternalInternalizedString | 117 // - ExternalInternalizedString |
118 // - ExternalAsciiInternalizedString | 118 // - ExternalAsciiInternalizedString |
119 // - ExternalTwoByteInternalizedString | 119 // - ExternalTwoByteInternalizedString |
120 // - Symbol | 120 // - Symbol |
121 // - HeapNumber | 121 // - HeapNumber |
122 // - Cell | 122 // - Cell |
123 // - JSGlobalPropertyCell | 123 // - PropertyCell |
124 // - Code | 124 // - Code |
125 // - Map | 125 // - Map |
126 // - Oddball | 126 // - Oddball |
127 // - Foreign | 127 // - Foreign |
128 // - SharedFunctionInfo | 128 // - SharedFunctionInfo |
129 // - Struct | 129 // - Struct |
130 // - Box | 130 // - Box |
131 // - DeclaredAccessorDescriptor | 131 // - DeclaredAccessorDescriptor |
132 // - AccessorInfo | 132 // - AccessorInfo |
133 // - DeclaredAccessorInfo | 133 // - DeclaredAccessorInfo |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 V(PolymorphicCodeCacheHashTable) \ | 1010 V(PolymorphicCodeCacheHashTable) \ |
1011 V(MapCache) \ | 1011 V(MapCache) \ |
1012 V(Primitive) \ | 1012 V(Primitive) \ |
1013 V(GlobalObject) \ | 1013 V(GlobalObject) \ |
1014 V(JSGlobalObject) \ | 1014 V(JSGlobalObject) \ |
1015 V(JSBuiltinsObject) \ | 1015 V(JSBuiltinsObject) \ |
1016 V(JSGlobalProxy) \ | 1016 V(JSGlobalProxy) \ |
1017 V(UndetectableObject) \ | 1017 V(UndetectableObject) \ |
1018 V(AccessCheckNeeded) \ | 1018 V(AccessCheckNeeded) \ |
1019 V(Cell) \ | 1019 V(Cell) \ |
1020 V(JSGlobalPropertyCell) \ | 1020 V(PropertyCell) \ |
1021 V(ObjectHashTable) \ | 1021 V(ObjectHashTable) \ |
1022 | 1022 |
1023 | 1023 |
1024 // Object is the abstract superclass for all classes in the | 1024 // Object is the abstract superclass for all classes in the |
1025 // object hierarchy. | 1025 // object hierarchy. |
1026 // Object does not use any virtual functions to avoid the | 1026 // Object does not use any virtual functions to avoid the |
1027 // allocation of the C++ vtable. | 1027 // allocation of the C++ vtable. |
1028 // Since Smi and Failure are subclasses of Object no | 1028 // Since Smi and Failure are subclasses of Object no |
1029 // data members can be present in Object. | 1029 // data members can be present in Object. |
1030 class Object : public MaybeObject { | 1030 class Object : public MaybeObject { |
(...skipping 3347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4378 static inline DeoptimizationOutputData* cast(Object* obj); | 4378 static inline DeoptimizationOutputData* cast(Object* obj); |
4379 | 4379 |
4380 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER) | 4380 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER) |
4381 void DeoptimizationOutputDataPrint(FILE* out); | 4381 void DeoptimizationOutputDataPrint(FILE* out); |
4382 #endif | 4382 #endif |
4383 }; | 4383 }; |
4384 | 4384 |
4385 | 4385 |
4386 // Forward declaration. | 4386 // Forward declaration. |
4387 class Cell; | 4387 class Cell; |
4388 class JSGlobalPropertyCell; | 4388 class PropertyCell; |
4389 | 4389 |
4390 // TypeFeedbackCells is a fixed array used to hold the association between | 4390 // TypeFeedbackCells is a fixed array used to hold the association between |
4391 // cache cells and AST ids for code generated by the full compiler. | 4391 // cache cells and AST ids for code generated by the full compiler. |
4392 // The format of the these objects is | 4392 // The format of the these objects is |
4393 // [i * 2]: Global property cell of ith cache cell. | 4393 // [i * 2]: Global property cell of ith cache cell. |
4394 // [i * 2 + 1]: Ast ID for ith cache cell. | 4394 // [i * 2 + 1]: Ast ID for ith cache cell. |
4395 class TypeFeedbackCells: public FixedArray { | 4395 class TypeFeedbackCells: public FixedArray { |
4396 public: | 4396 public: |
4397 int CellCount() { return length() / 2; } | 4397 int CellCount() { return length() / 2; } |
4398 static int LengthOfFixedArray(int cell_count) { return cell_count * 2; } | 4398 static int LengthOfFixedArray(int cell_count) { return cell_count * 2; } |
(...skipping 2415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6814 // [native context]: the natives corresponding to this global object. | 6814 // [native context]: the natives corresponding to this global object. |
6815 DECL_ACCESSORS(native_context, Context) | 6815 DECL_ACCESSORS(native_context, Context) |
6816 | 6816 |
6817 // [global context]: the most recent (i.e. innermost) global context. | 6817 // [global context]: the most recent (i.e. innermost) global context. |
6818 DECL_ACCESSORS(global_context, Context) | 6818 DECL_ACCESSORS(global_context, Context) |
6819 | 6819 |
6820 // [global receiver]: the global receiver object of the context | 6820 // [global receiver]: the global receiver object of the context |
6821 DECL_ACCESSORS(global_receiver, JSObject) | 6821 DECL_ACCESSORS(global_receiver, JSObject) |
6822 | 6822 |
6823 // Retrieve the property cell used to store a property. | 6823 // Retrieve the property cell used to store a property. |
6824 JSGlobalPropertyCell* GetPropertyCell(LookupResult* result); | 6824 PropertyCell* GetPropertyCell(LookupResult* result); |
6825 | 6825 |
6826 // This is like GetProperty, but is used when you know the lookup won't fail | 6826 // This is like GetProperty, but is used when you know the lookup won't fail |
6827 // by throwing an exception. This is for the debug and builtins global | 6827 // by throwing an exception. This is for the debug and builtins global |
6828 // objects, where it is known which properties can be expected to be present | 6828 // objects, where it is known which properties can be expected to be present |
6829 // on the object. | 6829 // on the object. |
6830 Object* GetPropertyNoExceptionThrown(Name* key) { | 6830 Object* GetPropertyNoExceptionThrown(Name* key) { |
6831 Object* answer = GetProperty(key)->ToObjectUnchecked(); | 6831 Object* answer = GetProperty(key)->ToObjectUnchecked(); |
6832 return answer; | 6832 return answer; |
6833 } | 6833 } |
6834 | 6834 |
6835 // Ensure that the global object has a cell for the given property name. | 6835 // Ensure that the global object has a cell for the given property name. |
6836 static Handle<JSGlobalPropertyCell> EnsurePropertyCell( | 6836 static Handle<PropertyCell> EnsurePropertyCell( |
6837 Handle<GlobalObject> global, | 6837 Handle<GlobalObject> global, |
6838 Handle<Name> name); | 6838 Handle<Name> name); |
6839 // TODO(kmillikin): This function can be eliminated once the stub cache is | 6839 // TODO(kmillikin): This function can be eliminated once the stub cache is |
6840 // fully handlified (and the static helper can be written directly). | 6840 // fully handlified (and the static helper can be written directly). |
6841 MUST_USE_RESULT MaybeObject* EnsurePropertyCell(Name* name); | 6841 MUST_USE_RESULT MaybeObject* EnsurePropertyCell(Name* name); |
6842 | 6842 |
6843 // Casting. | 6843 // Casting. |
6844 static inline GlobalObject* cast(Object* obj); | 6844 static inline GlobalObject* cast(Object* obj); |
6845 | 6845 |
6846 // Layout description. | 6846 // Layout description. |
(...skipping 1716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8563 class Cell: public HeapObject { | 8563 class Cell: public HeapObject { |
8564 public: | 8564 public: |
8565 // [value]: value of the global property. | 8565 // [value]: value of the global property. |
8566 DECL_ACCESSORS(value, Object) | 8566 DECL_ACCESSORS(value, Object) |
8567 | 8567 |
8568 // Casting. | 8568 // Casting. |
8569 static inline Cell* cast(Object* obj); | 8569 static inline Cell* cast(Object* obj); |
8570 | 8570 |
8571 static inline Cell* FromValueAddress(Address value) { | 8571 static inline Cell* FromValueAddress(Address value) { |
8572 Object* result = FromAddress(value - kValueOffset); | 8572 Object* result = FromAddress(value - kValueOffset); |
8573 ASSERT(result->IsCell() || result->IsJSGlobalPropertyCell()); | 8573 ASSERT(result->IsCell() || result->IsPropertyCell()); |
8574 return static_cast<Cell*>(result); | 8574 return static_cast<Cell*>(result); |
8575 } | 8575 } |
8576 | 8576 |
8577 inline Address ValueAddress() { | 8577 inline Address ValueAddress() { |
8578 return address() + kValueOffset; | 8578 return address() + kValueOffset; |
8579 } | 8579 } |
8580 | 8580 |
8581 // Dispatched behavior. | 8581 // Dispatched behavior. |
8582 DECLARE_PRINTER(Cell) | 8582 DECLARE_PRINTER(Cell) |
8583 DECLARE_VERIFIER(Cell) | 8583 DECLARE_VERIFIER(Cell) |
8584 | 8584 |
8585 // Layout description. | 8585 // Layout description. |
8586 static const int kValueOffset = HeapObject::kHeaderSize; | 8586 static const int kValueOffset = HeapObject::kHeaderSize; |
8587 static const int kSize = kValueOffset + kPointerSize; | 8587 static const int kSize = kValueOffset + kPointerSize; |
8588 | 8588 |
8589 typedef FixedBodyDescriptor<kValueOffset, | 8589 typedef FixedBodyDescriptor<kValueOffset, |
8590 kValueOffset + kPointerSize, | 8590 kValueOffset + kPointerSize, |
8591 kSize> BodyDescriptor; | 8591 kSize> BodyDescriptor; |
8592 | 8592 |
8593 private: | 8593 private: |
8594 DISALLOW_IMPLICIT_CONSTRUCTORS(Cell); | 8594 DISALLOW_IMPLICIT_CONSTRUCTORS(Cell); |
8595 }; | 8595 }; |
8596 | 8596 |
8597 | 8597 |
8598 class JSGlobalPropertyCell: public Cell { | 8598 class PropertyCell: public Cell { |
8599 public: | 8599 public: |
8600 Type* type(); | 8600 Type* type(); |
8601 void set_type(Type* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 8601 void set_type(Type* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
8602 | 8602 |
8603 // Casting. | 8603 // Casting. |
8604 static inline JSGlobalPropertyCell* cast(Object* obj); | 8604 static inline PropertyCell* cast(Object* obj); |
8605 | 8605 |
8606 inline Address TypeAddress() { | 8606 inline Address TypeAddress() { |
8607 return address() + kTypeOffset; | 8607 return address() + kTypeOffset; |
8608 } | 8608 } |
8609 | 8609 |
8610 // Dispatched behavior. | 8610 // Dispatched behavior. |
8611 DECLARE_PRINTER(JSGlobalPropertyCell) | 8611 DECLARE_PRINTER(PropertyCell) |
8612 DECLARE_VERIFIER(JSGlobalPropertyCell) | 8612 DECLARE_VERIFIER(PropertyCell) |
8613 | 8613 |
8614 // Layout description. | 8614 // Layout description. |
8615 static const int kTypeOffset = kValueOffset + kPointerSize; | 8615 static const int kTypeOffset = kValueOffset + kPointerSize; |
8616 static const int kSize = kTypeOffset + kPointerSize; | 8616 static const int kSize = kTypeOffset + kPointerSize; |
8617 | 8617 |
8618 typedef FixedBodyDescriptor< | 8618 typedef FixedBodyDescriptor< |
8619 kValueOffset, | 8619 kValueOffset, |
8620 kTypeOffset + kPointerSize, | 8620 kTypeOffset + kPointerSize, |
8621 JSGlobalPropertyCell::kSize> BodyDescriptor; | 8621 PropertyCell::kSize> BodyDescriptor; |
8622 | 8622 |
8623 private: | 8623 private: |
8624 DECL_ACCESSORS(type_raw, Object) | 8624 DECL_ACCESSORS(type_raw, Object) |
8625 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalPropertyCell); | 8625 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell); |
8626 }; | 8626 }; |
8627 | 8627 |
8628 | 8628 |
8629 // The JSProxy describes EcmaScript Harmony proxies | 8629 // The JSProxy describes EcmaScript Harmony proxies |
8630 class JSProxy: public JSReceiver { | 8630 class JSProxy: public JSReceiver { |
8631 public: | 8631 public: |
8632 // [handler]: The handler property. | 8632 // [handler]: The handler property. |
8633 DECL_ACCESSORS(handler, Object) | 8633 DECL_ACCESSORS(handler, Object) |
8634 | 8634 |
8635 // [hash]: The hash code property (undefined if not initialized yet). | 8635 // [hash]: The hash code property (undefined if not initialized yet). |
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9717 } else { | 9717 } else { |
9718 value &= ~(1 << bit_position); | 9718 value &= ~(1 << bit_position); |
9719 } | 9719 } |
9720 return value; | 9720 return value; |
9721 } | 9721 } |
9722 }; | 9722 }; |
9723 | 9723 |
9724 } } // namespace v8::internal | 9724 } } // namespace v8::internal |
9725 | 9725 |
9726 #endif // V8_OBJECTS_H_ | 9726 #endif // V8_OBJECTS_H_ |
OLD | NEW |