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 1914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1925 bool continue_search); | 1925 bool continue_search); |
1926 PropertyAttributes GetElementAttributeWithReceiver(JSReceiver* receiver, | 1926 PropertyAttributes GetElementAttributeWithReceiver(JSReceiver* receiver, |
1927 uint32_t index, | 1927 uint32_t index, |
1928 bool continue_search); | 1928 bool continue_search); |
1929 | 1929 |
1930 static void DefineAccessor(Handle<JSObject> object, | 1930 static void DefineAccessor(Handle<JSObject> object, |
1931 Handle<Name> name, | 1931 Handle<Name> name, |
1932 Handle<Object> getter, | 1932 Handle<Object> getter, |
1933 Handle<Object> setter, | 1933 Handle<Object> setter, |
1934 PropertyAttributes attributes); | 1934 PropertyAttributes attributes); |
1935 // Can cause GC. | 1935 |
1936 MUST_USE_RESULT MaybeObject* DefineAccessor(Name* name, | |
1937 Object* getter, | |
1938 Object* setter, | |
1939 PropertyAttributes attributes); | |
1940 // Try to define a single accessor paying attention to map transitions. | |
1941 // Returns a JavaScript null if this was not possible and we have to use the | |
1942 // slow case. Note that we can fail due to allocations, too. | |
1943 MUST_USE_RESULT MaybeObject* DefineFastAccessor( | |
1944 Name* name, | |
1945 AccessorComponent component, | |
1946 Object* accessor, | |
1947 PropertyAttributes attributes); | |
1948 Object* LookupAccessor(Name* name, AccessorComponent component); | 1936 Object* LookupAccessor(Name* name, AccessorComponent component); |
1949 | 1937 |
1950 MUST_USE_RESULT MaybeObject* DefineAccessor(AccessorInfo* info); | 1938 MUST_USE_RESULT MaybeObject* DefineAccessor(AccessorInfo* info); |
1951 | 1939 |
1952 // Used from Object::GetProperty(). | 1940 // Used from Object::GetProperty(). |
1953 MUST_USE_RESULT MaybeObject* GetPropertyWithFailedAccessCheck( | 1941 MUST_USE_RESULT MaybeObject* GetPropertyWithFailedAccessCheck( |
1954 Object* receiver, | 1942 Object* receiver, |
1955 LookupResult* result, | 1943 LookupResult* result, |
1956 Name* name, | 1944 Name* name, |
1957 PropertyAttributes* attributes); | 1945 PropertyAttributes* attributes); |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2508 | 2496 |
2509 bool CanSetCallback(Name* name); | 2497 bool CanSetCallback(Name* name); |
2510 MUST_USE_RESULT MaybeObject* SetElementCallback( | 2498 MUST_USE_RESULT MaybeObject* SetElementCallback( |
2511 uint32_t index, | 2499 uint32_t index, |
2512 Object* structure, | 2500 Object* structure, |
2513 PropertyAttributes attributes); | 2501 PropertyAttributes attributes); |
2514 MUST_USE_RESULT MaybeObject* SetPropertyCallback( | 2502 MUST_USE_RESULT MaybeObject* SetPropertyCallback( |
2515 Name* name, | 2503 Name* name, |
2516 Object* structure, | 2504 Object* structure, |
2517 PropertyAttributes attributes); | 2505 PropertyAttributes attributes); |
2518 MUST_USE_RESULT MaybeObject* DefineElementAccessor( | 2506 static void DefineElementAccessor(Handle<JSObject> object, |
2519 uint32_t index, | 2507 uint32_t index, |
2520 Object* getter, | 2508 Handle<Object> getter, |
2521 Object* setter, | 2509 Handle<Object> setter, |
2522 PropertyAttributes attributes); | 2510 PropertyAttributes attributes); |
2523 MUST_USE_RESULT MaybeObject* CreateAccessorPairFor(Name* name); | 2511 static Handle<AccessorPair> CreateAccessorPairFor(Handle<JSObject> object, |
2524 MUST_USE_RESULT MaybeObject* DefinePropertyAccessor( | 2512 Handle<Name> name); |
2525 Name* name, | 2513 static void DefinePropertyAccessor(Handle<JSObject> object, |
2526 Object* getter, | 2514 Handle<Name> name, |
2527 Object* setter, | 2515 Handle<Object> getter, |
2528 PropertyAttributes attributes); | 2516 Handle<Object> setter, |
| 2517 PropertyAttributes attributes); |
2529 | 2518 |
| 2519 // Try to define a single accessor paying attention to map transitions. |
| 2520 // Returns a JavaScript null if this was not possible and we have to use the |
| 2521 // slow case. |
| 2522 static Handle<Object> DefineFastAccessor(Handle<JSObject> object, |
| 2523 Handle<Name> name, |
| 2524 AccessorComponent component, |
| 2525 Handle<Object> accessor, |
| 2526 PropertyAttributes attributes); |
2530 | 2527 |
2531 enum InitializeHiddenProperties { | 2528 enum InitializeHiddenProperties { |
2532 CREATE_NEW_IF_ABSENT, | 2529 CREATE_NEW_IF_ABSENT, |
2533 ONLY_RETURN_INLINE_VALUE | 2530 ONLY_RETURN_INLINE_VALUE |
2534 }; | 2531 }; |
2535 | 2532 |
2536 // If create_if_absent is true, return the hash table backing store | 2533 // If create_if_absent is true, return the hash table backing store |
2537 // for hidden properties. If there is no backing store, allocate one. | 2534 // for hidden properties. If there is no backing store, allocate one. |
2538 // If create_if_absent is false, return the hash table backing store | 2535 // If create_if_absent is false, return the hash table backing store |
2539 // or the inline stored identity hash, whatever is found. | 2536 // or the inline stored identity hash, whatever is found. |
(...skipping 6711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9251 // * undefined: considered an accessor by the spec, too, strangely enough | 9248 // * undefined: considered an accessor by the spec, too, strangely enough |
9252 // * the hole: an accessor which has not been set | 9249 // * the hole: an accessor which has not been set |
9253 // * a pointer to a map: a transition used to ensure map sharing | 9250 // * a pointer to a map: a transition used to ensure map sharing |
9254 class AccessorPair: public Struct { | 9251 class AccessorPair: public Struct { |
9255 public: | 9252 public: |
9256 DECL_ACCESSORS(getter, Object) | 9253 DECL_ACCESSORS(getter, Object) |
9257 DECL_ACCESSORS(setter, Object) | 9254 DECL_ACCESSORS(setter, Object) |
9258 | 9255 |
9259 static inline AccessorPair* cast(Object* obj); | 9256 static inline AccessorPair* cast(Object* obj); |
9260 | 9257 |
9261 MUST_USE_RESULT MaybeObject* Copy(); | 9258 static Handle<AccessorPair> Copy(Handle<AccessorPair> pair); |
9262 | 9259 |
9263 Object* get(AccessorComponent component) { | 9260 Object* get(AccessorComponent component) { |
9264 return component == ACCESSOR_GETTER ? getter() : setter(); | 9261 return component == ACCESSOR_GETTER ? getter() : setter(); |
9265 } | 9262 } |
9266 | 9263 |
9267 void set(AccessorComponent component, Object* value) { | 9264 void set(AccessorComponent component, Object* value) { |
9268 if (component == ACCESSOR_GETTER) { | 9265 if (component == ACCESSOR_GETTER) { |
9269 set_getter(value); | 9266 set_getter(value); |
9270 } else { | 9267 } else { |
9271 set_setter(value); | 9268 set_setter(value); |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9748 } else { | 9745 } else { |
9749 value &= ~(1 << bit_position); | 9746 value &= ~(1 << bit_position); |
9750 } | 9747 } |
9751 return value; | 9748 return value; |
9752 } | 9749 } |
9753 }; | 9750 }; |
9754 | 9751 |
9755 } } // namespace v8::internal | 9752 } } // namespace v8::internal |
9756 | 9753 |
9757 #endif // V8_OBJECTS_H_ | 9754 #endif // V8_OBJECTS_H_ |
OLD | NEW |