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 1868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1879 MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributes( | 1879 MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributes( |
1880 Name* key, | 1880 Name* key, |
1881 Object* value, | 1881 Object* value, |
1882 PropertyAttributes attributes, | 1882 PropertyAttributes attributes, |
1883 ValueType value_type = OPTIMAL_REPRESENTATION); | 1883 ValueType value_type = OPTIMAL_REPRESENTATION); |
1884 | 1884 |
1885 // Retrieve a value in a normalized object given a lookup result. | 1885 // Retrieve a value in a normalized object given a lookup result. |
1886 // Handles the special representation of JS global objects. | 1886 // Handles the special representation of JS global objects. |
1887 Object* GetNormalizedProperty(LookupResult* result); | 1887 Object* GetNormalizedProperty(LookupResult* result); |
1888 | 1888 |
| 1889 // Sets the property value in a normalized object given (key, value). |
| 1890 // Handles the special representation of JS global objects. |
| 1891 static Handle<Object> SetNormalizedProperty(Handle<JSObject> object, |
| 1892 LookupResult* result, |
| 1893 Handle<Object> value); |
| 1894 |
1889 // Sets the property value in a normalized object given a lookup result. | 1895 // Sets the property value in a normalized object given a lookup result. |
1890 // Handles the special representation of JS global objects. | 1896 // Handles the special representation of JS global objects. |
1891 Object* SetNormalizedProperty(LookupResult* result, Object* value); | 1897 MUST_USE_RESULT MaybeObject* SetNormalizedProperty(LookupResult* result, |
| 1898 Object* value); |
1892 | 1899 |
1893 // Sets the property value in a normalized object given (key, value, details). | 1900 // Sets the property value in a normalized object given (key, value, details). |
1894 // Handles the special representation of JS global objects. | 1901 // Handles the special representation of JS global objects. |
1895 static Handle<Object> SetNormalizedProperty(Handle<JSObject> object, | 1902 static Handle<Object> SetNormalizedProperty(Handle<JSObject> object, |
1896 Handle<Name> key, | 1903 Handle<Name> key, |
1897 Handle<Object> value, | 1904 Handle<Object> value, |
1898 PropertyDetails details); | 1905 PropertyDetails details); |
1899 | 1906 |
1900 MUST_USE_RESULT MaybeObject* SetNormalizedProperty(Name* name, | 1907 MUST_USE_RESULT MaybeObject* SetNormalizedProperty(Name* name, |
1901 Object* value, | 1908 Object* value, |
(...skipping 6674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8576 class PropertyCell: public Cell { | 8583 class PropertyCell: public Cell { |
8577 public: | 8584 public: |
8578 // [type]: type of the global property. | 8585 // [type]: type of the global property. |
8579 Type* type(); | 8586 Type* type(); |
8580 void set_type(Type* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 8587 void set_type(Type* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
8581 | 8588 |
8582 // [dependent_code]: dependent code that depends on the type of the global | 8589 // [dependent_code]: dependent code that depends on the type of the global |
8583 // property. | 8590 // property. |
8584 DECL_ACCESSORS(dependent_code, DependentCode) | 8591 DECL_ACCESSORS(dependent_code, DependentCode) |
8585 | 8592 |
| 8593 // Sets the value of the cell and updates the type field to be the union |
| 8594 // of the cell's current type and the value's type. If the change causes |
| 8595 // a change of the type of the cell's contents, code dependent on the cell |
| 8596 // will be deoptimized. |
| 8597 MUST_USE_RESULT MaybeObject* SetValueInferType( |
| 8598 Object* value, |
| 8599 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
| 8600 |
8586 // Casting. | 8601 // Casting. |
8587 static inline PropertyCell* cast(Object* obj); | 8602 static inline PropertyCell* cast(Object* obj); |
8588 | 8603 |
8589 inline Address TypeAddress() { | 8604 inline Address TypeAddress() { |
8590 return address() + kTypeOffset; | 8605 return address() + kTypeOffset; |
8591 } | 8606 } |
8592 | 8607 |
8593 // Dispatched behavior. | 8608 // Dispatched behavior. |
8594 DECLARE_PRINTER(PropertyCell) | 8609 DECLARE_PRINTER(PropertyCell) |
8595 DECLARE_VERIFIER(PropertyCell) | 8610 DECLARE_VERIFIER(PropertyCell) |
8596 | 8611 |
8597 // Layout description. | 8612 // Layout description. |
8598 static const int kTypeOffset = kValueOffset + kPointerSize; | 8613 static const int kTypeOffset = kValueOffset + kPointerSize; |
8599 static const int kDependentCodeOffset = kTypeOffset + kPointerSize; | 8614 static const int kDependentCodeOffset = kTypeOffset + kPointerSize; |
8600 static const int kSize = kDependentCodeOffset + kPointerSize; | 8615 static const int kSize = kDependentCodeOffset + kPointerSize; |
8601 | 8616 |
8602 static const int kPointerFieldsBeginOffset = kValueOffset; | 8617 static const int kPointerFieldsBeginOffset = kValueOffset; |
8603 static const int kPointerFieldsEndOffset = kDependentCodeOffset; | 8618 static const int kPointerFieldsEndOffset = kDependentCodeOffset; |
8604 | 8619 |
8605 typedef FixedBodyDescriptor<kValueOffset, | 8620 typedef FixedBodyDescriptor<kValueOffset, |
8606 kSize, | 8621 kSize, |
8607 kSize> BodyDescriptor; | 8622 kSize> BodyDescriptor; |
8608 | 8623 |
8609 void AddDependentCompilationInfo(CompilationInfo* info); | 8624 void AddDependentCompilationInfo(CompilationInfo* info); |
8610 | 8625 |
8611 void AddDependentCode(Handle<Code> code); | 8626 void AddDependentCode(Handle<Code> code); |
8612 | 8627 |
| 8628 static Type* UpdateType(Handle<PropertyCell> cell, |
| 8629 Handle<Object> value); |
| 8630 |
8613 private: | 8631 private: |
8614 DECL_ACCESSORS(type_raw, Object) | 8632 DECL_ACCESSORS(type_raw, Object) |
8615 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell); | 8633 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell); |
8616 }; | 8634 }; |
8617 | 8635 |
8618 | 8636 |
8619 // The JSProxy describes EcmaScript Harmony proxies | 8637 // The JSProxy describes EcmaScript Harmony proxies |
8620 class JSProxy: public JSReceiver { | 8638 class JSProxy: public JSReceiver { |
8621 public: | 8639 public: |
8622 // [handler]: The handler property. | 8640 // [handler]: The handler property. |
(...skipping 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9743 } else { | 9761 } else { |
9744 value &= ~(1 << bit_position); | 9762 value &= ~(1 << bit_position); |
9745 } | 9763 } |
9746 return value; | 9764 return value; |
9747 } | 9765 } |
9748 }; | 9766 }; |
9749 | 9767 |
9750 } } // namespace v8::internal | 9768 } } // namespace v8::internal |
9751 | 9769 |
9752 #endif // V8_OBJECTS_H_ | 9770 #endif // V8_OBJECTS_H_ |
OLD | NEW |