Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/objects.h

Issue 9716035: Make setting of accessors even more atomic. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Incorporated review comments. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/api.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after
1620 bool continue_search); 1620 bool continue_search);
1621 PropertyAttributes GetPropertyAttributeWithInterceptor(JSObject* receiver, 1621 PropertyAttributes GetPropertyAttributeWithInterceptor(JSObject* receiver,
1622 String* name, 1622 String* name,
1623 bool continue_search); 1623 bool continue_search);
1624 PropertyAttributes GetPropertyAttributeWithFailedAccessCheck( 1624 PropertyAttributes GetPropertyAttributeWithFailedAccessCheck(
1625 Object* receiver, 1625 Object* receiver,
1626 LookupResult* result, 1626 LookupResult* result,
1627 String* name, 1627 String* name,
1628 bool continue_search); 1628 bool continue_search);
1629 1629
1630 static void DefineAccessor(Handle<JSObject> object,
1631 Handle<String> name,
1632 Handle<Object> getter,
1633 Handle<Object> setter,
1634 PropertyAttributes attributes);
1630 MUST_USE_RESULT MaybeObject* DefineAccessor(String* name, 1635 MUST_USE_RESULT MaybeObject* DefineAccessor(String* name,
1631 AccessorComponent component, 1636 Object* getter,
1632 Object* fun, 1637 Object* setter,
1633 PropertyAttributes attributes); 1638 PropertyAttributes attributes);
1634 Object* LookupAccessor(String* name, AccessorComponent component); 1639 Object* LookupAccessor(String* name, AccessorComponent component);
1635 1640
1636 MUST_USE_RESULT MaybeObject* DefineAccessor(AccessorInfo* info); 1641 MUST_USE_RESULT MaybeObject* DefineAccessor(AccessorInfo* info);
1637 1642
1638 // Used from Object::GetProperty(). 1643 // Used from Object::GetProperty().
1639 MUST_USE_RESULT MaybeObject* GetPropertyWithFailedAccessCheck( 1644 MUST_USE_RESULT MaybeObject* GetPropertyWithFailedAccessCheck(
1640 Object* receiver, 1645 Object* receiver,
1641 LookupResult* result, 1646 LookupResult* result,
1642 String* name, 1647 String* name,
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
2171 MUST_USE_RESULT MaybeObject* SetElementCallback( 2176 MUST_USE_RESULT MaybeObject* SetElementCallback(
2172 uint32_t index, 2177 uint32_t index,
2173 Object* structure, 2178 Object* structure,
2174 PropertyAttributes attributes); 2179 PropertyAttributes attributes);
2175 MUST_USE_RESULT MaybeObject* SetPropertyCallback( 2180 MUST_USE_RESULT MaybeObject* SetPropertyCallback(
2176 String* name, 2181 String* name,
2177 Object* structure, 2182 Object* structure,
2178 PropertyAttributes attributes); 2183 PropertyAttributes attributes);
2179 MUST_USE_RESULT MaybeObject* DefineElementAccessor( 2184 MUST_USE_RESULT MaybeObject* DefineElementAccessor(
2180 uint32_t index, 2185 uint32_t index,
2181 AccessorComponent component, 2186 Object* getter,
2182 Object* fun, 2187 Object* setter,
2183 PropertyAttributes attributes); 2188 PropertyAttributes attributes);
2184 MUST_USE_RESULT MaybeObject* DefinePropertyAccessor( 2189 MUST_USE_RESULT MaybeObject* DefinePropertyAccessor(
2185 String* name, 2190 String* name,
2186 AccessorComponent component, 2191 Object* getter,
2187 Object* fun, 2192 Object* setter,
2188 PropertyAttributes attributes); 2193 PropertyAttributes attributes);
2189 void LookupInDescriptor(String* name, LookupResult* result); 2194 void LookupInDescriptor(String* name, LookupResult* result);
2190 2195
2191 // Returns the hidden properties backing store object, currently 2196 // Returns the hidden properties backing store object, currently
2192 // a StringDictionary, stored on this object. 2197 // a StringDictionary, stored on this object.
2193 // If no hidden properties object has been put on this object, 2198 // If no hidden properties object has been put on this object,
2194 // return undefined, unless create_if_absent is true, in which case 2199 // return undefined, unless create_if_absent is true, in which case
2195 // a new dictionary is created, added to this object, and returned. 2200 // a new dictionary is created, added to this object, and returned.
2196 MUST_USE_RESULT MaybeObject* GetHiddenPropertiesDictionary( 2201 MUST_USE_RESULT MaybeObject* GetHiddenPropertiesDictionary(
2197 bool create_if_absent); 2202 bool create_if_absent);
(...skipping 5840 matching lines...) Expand 10 before | Expand all | Expand 10 after
8038 // * a pointer to a map: a transition used to ensure map sharing 8043 // * a pointer to a map: a transition used to ensure map sharing
8039 class AccessorPair: public Struct { 8044 class AccessorPair: public Struct {
8040 public: 8045 public:
8041 DECL_ACCESSORS(getter, Object) 8046 DECL_ACCESSORS(getter, Object)
8042 DECL_ACCESSORS(setter, Object) 8047 DECL_ACCESSORS(setter, Object)
8043 8048
8044 static inline AccessorPair* cast(Object* obj); 8049 static inline AccessorPair* cast(Object* obj);
8045 8050
8046 MUST_USE_RESULT MaybeObject* CopyWithoutTransitions(); 8051 MUST_USE_RESULT MaybeObject* CopyWithoutTransitions();
8047 8052
8048 Object* get(AccessorComponent component) { 8053 // Note: Returns undefined instead in case of a hole.
8049 ASSERT(component == ACCESSOR_GETTER || component == ACCESSOR_SETTER); 8054 Object* GetComponent(AccessorComponent component);
8050 return (component == ACCESSOR_GETTER) ? getter() : setter(); 8055
8056 // Set both components, skipping arguments which are a JavaScript null.
8057 void SetComponents(Object* getter, Object* setter) {
8058 if (!getter->IsNull()) set_getter(getter);
8059 if (!setter->IsNull()) set_setter(setter);
8051 } 8060 }
8052 8061
8053 void set(AccessorComponent component, Object* value) {
8054 ASSERT(component == ACCESSOR_GETTER || component == ACCESSOR_SETTER);
8055 if (component == ACCESSOR_GETTER) {
8056 set_getter(value);
8057 } else {
8058 set_setter(value);
8059 }
8060 }
8061
8062 // Same as get, but returns undefined instead of the hole.
8063 Object* SafeGet(AccessorComponent component);
8064
8065 bool ContainsAccessor() { 8062 bool ContainsAccessor() {
8066 return IsJSAccessor(getter()) || IsJSAccessor(setter()); 8063 return IsJSAccessor(getter()) || IsJSAccessor(setter());
8067 } 8064 }
8068 8065
8069 #ifdef OBJECT_PRINT 8066 #ifdef OBJECT_PRINT
8070 void AccessorPairPrint(FILE* out = stdout); 8067 void AccessorPairPrint(FILE* out = stdout);
8071 #endif 8068 #endif
8072 #ifdef DEBUG 8069 #ifdef DEBUG
8073 void AccessorPairVerify(); 8070 void AccessorPairVerify();
8074 #endif 8071 #endif
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
8579 } else { 8576 } else {
8580 value &= ~(1 << bit_position); 8577 value &= ~(1 << bit_position);
8581 } 8578 }
8582 return value; 8579 return value;
8583 } 8580 }
8584 }; 8581 };
8585 8582
8586 } } // namespace v8::internal 8583 } } // namespace v8::internal
8587 8584
8588 #endif // V8_OBJECTS_H_ 8585 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698