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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/api.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index c7093a817bfc46bb939701f7a63497de22a1261d..aa02624f38600781813c69e9a51548e6937d4d52 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -1627,9 +1627,14 @@ class JSObject: public JSReceiver {
String* name,
bool continue_search);
+ static void DefineAccessor(Handle<JSObject> object,
+ Handle<String> name,
+ Handle<Object> getter,
+ Handle<Object> setter,
+ PropertyAttributes attributes);
MUST_USE_RESULT MaybeObject* DefineAccessor(String* name,
- AccessorComponent component,
- Object* fun,
+ Object* getter,
+ Object* setter,
PropertyAttributes attributes);
Object* LookupAccessor(String* name, AccessorComponent component);
@@ -2178,13 +2183,13 @@ class JSObject: public JSReceiver {
PropertyAttributes attributes);
MUST_USE_RESULT MaybeObject* DefineElementAccessor(
uint32_t index,
- AccessorComponent component,
- Object* fun,
+ Object* getter,
+ Object* setter,
PropertyAttributes attributes);
MUST_USE_RESULT MaybeObject* DefinePropertyAccessor(
String* name,
- AccessorComponent component,
- Object* fun,
+ Object* getter,
+ Object* setter,
PropertyAttributes attributes);
void LookupInDescriptor(String* name, LookupResult* result);
@@ -8045,23 +8050,15 @@ class AccessorPair: public Struct {
MUST_USE_RESULT MaybeObject* CopyWithoutTransitions();
- Object* get(AccessorComponent component) {
- ASSERT(component == ACCESSOR_GETTER || component == ACCESSOR_SETTER);
- return (component == ACCESSOR_GETTER) ? getter() : setter();
- }
+ // Note: Returns undefined instead in case of a hole.
+ Object* GetComponent(AccessorComponent component);
- void set(AccessorComponent component, Object* value) {
- ASSERT(component == ACCESSOR_GETTER || component == ACCESSOR_SETTER);
- if (component == ACCESSOR_GETTER) {
- set_getter(value);
- } else {
- set_setter(value);
- }
+ // Set both components, skipping arguments which are a JavaScript null.
+ void SetComponents(Object* getter, Object* setter) {
+ if (!getter->IsNull()) set_getter(getter);
+ if (!setter->IsNull()) set_setter(setter);
}
- // Same as get, but returns undefined instead of the hole.
- Object* SafeGet(AccessorComponent component);
-
bool ContainsAccessor() {
return IsJSAccessor(getter()) || IsJSAccessor(setter());
}
« 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