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 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1353 // Indicates whether a property should be set or (re)defined. Setting of a | 1353 // Indicates whether a property should be set or (re)defined. Setting of a |
1354 // property causes attributes to remain unchanged, writability to be checked | 1354 // property causes attributes to remain unchanged, writability to be checked |
1355 // and callbacks to be called. Defining of a property causes attributes to | 1355 // and callbacks to be called. Defining of a property causes attributes to |
1356 // be updated and callbacks to be overridden. | 1356 // be updated and callbacks to be overridden. |
1357 enum SetPropertyMode { | 1357 enum SetPropertyMode { |
1358 SET_PROPERTY, | 1358 SET_PROPERTY, |
1359 DEFINE_PROPERTY | 1359 DEFINE_PROPERTY |
1360 }; | 1360 }; |
1361 | 1361 |
1362 | 1362 |
1363 // Indicator for one component of an AccessorPair. | |
1364 enum AccessorComponent { | |
1365 ACCESSOR_GETTER, | |
1366 ACCESSOR_SETTER | |
1367 }; | |
1368 | |
1369 | |
1363 // JSReceiver includes types on which properties can be defined, i.e., | 1370 // JSReceiver includes types on which properties can be defined, i.e., |
1364 // JSObject and JSProxy. | 1371 // JSObject and JSProxy. |
1365 class JSReceiver: public HeapObject { | 1372 class JSReceiver: public HeapObject { |
1366 public: | 1373 public: |
1367 enum DeleteMode { | 1374 enum DeleteMode { |
1368 NORMAL_DELETION, | 1375 NORMAL_DELETION, |
1369 STRICT_DELETION, | 1376 STRICT_DELETION, |
1370 FORCE_DELETION | 1377 FORCE_DELETION |
1371 }; | 1378 }; |
1372 | 1379 |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1605 PropertyAttributes GetPropertyAttributeWithInterceptor(JSObject* receiver, | 1612 PropertyAttributes GetPropertyAttributeWithInterceptor(JSObject* receiver, |
1606 String* name, | 1613 String* name, |
1607 bool continue_search); | 1614 bool continue_search); |
1608 PropertyAttributes GetPropertyAttributeWithFailedAccessCheck( | 1615 PropertyAttributes GetPropertyAttributeWithFailedAccessCheck( |
1609 Object* receiver, | 1616 Object* receiver, |
1610 LookupResult* result, | 1617 LookupResult* result, |
1611 String* name, | 1618 String* name, |
1612 bool continue_search); | 1619 bool continue_search); |
1613 | 1620 |
1614 MUST_USE_RESULT MaybeObject* DefineAccessor(String* name, | 1621 MUST_USE_RESULT MaybeObject* DefineAccessor(String* name, |
1615 bool is_getter, | 1622 AccessorComponent component, |
1616 Object* fun, | 1623 Object* fun, |
1617 PropertyAttributes attributes); | 1624 PropertyAttributes attributes); |
1618 Object* LookupAccessor(String* name, bool is_getter); | 1625 Object* LookupAccessor(String* name, AccessorComponent component); |
1619 | 1626 |
1620 MUST_USE_RESULT MaybeObject* DefineAccessor(AccessorInfo* info); | 1627 MUST_USE_RESULT MaybeObject* DefineAccessor(AccessorInfo* info); |
1621 | 1628 |
1622 // Used from Object::GetProperty(). | 1629 // Used from Object::GetProperty(). |
1623 MUST_USE_RESULT MaybeObject* GetPropertyWithFailedAccessCheck( | 1630 MUST_USE_RESULT MaybeObject* GetPropertyWithFailedAccessCheck( |
1624 Object* receiver, | 1631 Object* receiver, |
1625 LookupResult* result, | 1632 LookupResult* result, |
1626 String* name, | 1633 String* name, |
1627 PropertyAttributes* attributes); | 1634 PropertyAttributes* attributes); |
1628 MUST_USE_RESULT MaybeObject* GetPropertyWithInterceptor( | 1635 MUST_USE_RESULT MaybeObject* GetPropertyWithInterceptor( |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2159 MUST_USE_RESULT MaybeObject* SetElementCallback( | 2166 MUST_USE_RESULT MaybeObject* SetElementCallback( |
2160 uint32_t index, | 2167 uint32_t index, |
2161 Object* structure, | 2168 Object* structure, |
2162 PropertyAttributes attributes); | 2169 PropertyAttributes attributes); |
2163 MUST_USE_RESULT MaybeObject* SetPropertyCallback( | 2170 MUST_USE_RESULT MaybeObject* SetPropertyCallback( |
2164 String* name, | 2171 String* name, |
2165 Object* structure, | 2172 Object* structure, |
2166 PropertyAttributes attributes); | 2173 PropertyAttributes attributes); |
2167 MUST_USE_RESULT MaybeObject* DefineElementAccessor( | 2174 MUST_USE_RESULT MaybeObject* DefineElementAccessor( |
2168 uint32_t index, | 2175 uint32_t index, |
2169 bool is_getter, | 2176 AccessorComponent component, |
2170 Object* fun, | 2177 Object* fun, |
2171 PropertyAttributes attributes); | 2178 PropertyAttributes attributes); |
2172 MUST_USE_RESULT MaybeObject* DefinePropertyAccessor( | 2179 MUST_USE_RESULT MaybeObject* DefinePropertyAccessor( |
2173 String* name, | 2180 String* name, |
2174 bool is_getter, | 2181 AccessorComponent component, |
2175 Object* fun, | 2182 Object* fun, |
2176 PropertyAttributes attributes); | 2183 PropertyAttributes attributes); |
2177 void LookupInDescriptor(String* name, LookupResult* result); | 2184 void LookupInDescriptor(String* name, LookupResult* result); |
2178 | 2185 |
2179 // Returns the hidden properties backing store object, currently | 2186 // Returns the hidden properties backing store object, currently |
2180 // a StringDictionary, stored on this object. | 2187 // a StringDictionary, stored on this object. |
2181 // If no hidden properties object has been put on this object, | 2188 // If no hidden properties object has been put on this object, |
2182 // return undefined, unless create_if_absent is true, in which case | 2189 // return undefined, unless create_if_absent is true, in which case |
2183 // a new dictionary is created, added to this object, and returned. | 2190 // a new dictionary is created, added to this object, and returned. |
2184 MUST_USE_RESULT MaybeObject* GetHiddenPropertiesDictionary( | 2191 MUST_USE_RESULT MaybeObject* GetHiddenPropertiesDictionary( |
(...skipping 5735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7920 // * a pointer to a map: a transition used to ensure map sharing | 7927 // * a pointer to a map: a transition used to ensure map sharing |
7921 class AccessorPair: public Struct { | 7928 class AccessorPair: public Struct { |
7922 public: | 7929 public: |
7923 DECL_ACCESSORS(getter, Object) | 7930 DECL_ACCESSORS(getter, Object) |
7924 DECL_ACCESSORS(setter, Object) | 7931 DECL_ACCESSORS(setter, Object) |
7925 | 7932 |
7926 static inline AccessorPair* cast(Object* obj); | 7933 static inline AccessorPair* cast(Object* obj); |
7927 | 7934 |
7928 MUST_USE_RESULT MaybeObject* CopyWithoutTransitions(); | 7935 MUST_USE_RESULT MaybeObject* CopyWithoutTransitions(); |
7929 | 7936 |
7930 // TODO(svenpanne) Evil temporary helper, will vanish soon... | 7937 Object* get(AccessorComponent component) { |
Michael Starzinger
2012/03/05 11:56:30
If you plan on extending AccessorComponent later (
Sven Panne
2012/03/05 12:08:51
Given C++'s lovely implicit conversions, I think t
| |
7931 void set(bool modify_getter, Object* value) { | 7938 return (component == ACCESSOR_GETTER) ? getter() : setter(); |
7932 if (modify_getter) { | 7939 } |
7940 | |
7941 void set(AccessorComponent component, Object* value) { | |
7942 if (component == ACCESSOR_GETTER) { | |
7933 set_getter(value); | 7943 set_getter(value); |
7934 } else { | 7944 } else { |
7935 set_setter(value); | 7945 set_setter(value); |
7936 } | 7946 } |
7937 } | 7947 } |
7938 | 7948 |
7939 bool ContainsAccessor() { | 7949 bool ContainsAccessor() { |
7940 return IsJSAccessor(getter()) || IsJSAccessor(setter()); | 7950 return IsJSAccessor(getter()) || IsJSAccessor(setter()); |
7941 } | 7951 } |
7942 | 7952 |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8453 } else { | 8463 } else { |
8454 value &= ~(1 << bit_position); | 8464 value &= ~(1 << bit_position); |
8455 } | 8465 } |
8456 return value; | 8466 return value; |
8457 } | 8467 } |
8458 }; | 8468 }; |
8459 | 8469 |
8460 } } // namespace v8::internal | 8470 } } // namespace v8::internal |
8461 | 8471 |
8462 #endif // V8_OBJECTS_H_ | 8472 #endif // V8_OBJECTS_H_ |
OLD | NEW |