Chromium Code Reviews| Index: src/objects.h |
| diff --git a/src/objects.h b/src/objects.h |
| index 482b7944644361cd50f0728cc064b5a6dcd0e5fa..7d1457f50e24523ab6f111e8baaa0952ae66c7bd 100644 |
| --- a/src/objects.h |
| +++ b/src/objects.h |
| @@ -1360,6 +1360,13 @@ enum SetPropertyMode { |
| }; |
| +// Indicator for one component of an AccessorPair. |
| +enum AccessorComponent { |
| + ACCESSOR_GETTER, |
| + ACCESSOR_SETTER |
| +}; |
| + |
| + |
| // JSReceiver includes types on which properties can be defined, i.e., |
| // JSObject and JSProxy. |
| class JSReceiver: public HeapObject { |
| @@ -1612,10 +1619,10 @@ class JSObject: public JSReceiver { |
| bool continue_search); |
| MUST_USE_RESULT MaybeObject* DefineAccessor(String* name, |
| - bool is_getter, |
| + AccessorComponent component, |
| Object* fun, |
| PropertyAttributes attributes); |
| - Object* LookupAccessor(String* name, bool is_getter); |
| + Object* LookupAccessor(String* name, AccessorComponent component); |
| MUST_USE_RESULT MaybeObject* DefineAccessor(AccessorInfo* info); |
| @@ -2166,12 +2173,12 @@ class JSObject: public JSReceiver { |
| PropertyAttributes attributes); |
| MUST_USE_RESULT MaybeObject* DefineElementAccessor( |
| uint32_t index, |
| - bool is_getter, |
| + AccessorComponent component, |
| Object* fun, |
| PropertyAttributes attributes); |
| MUST_USE_RESULT MaybeObject* DefinePropertyAccessor( |
| String* name, |
| - bool is_getter, |
| + AccessorComponent component, |
| Object* fun, |
| PropertyAttributes attributes); |
| void LookupInDescriptor(String* name, LookupResult* result); |
| @@ -7927,9 +7934,12 @@ class AccessorPair: public Struct { |
| MUST_USE_RESULT MaybeObject* CopyWithoutTransitions(); |
| - // TODO(svenpanne) Evil temporary helper, will vanish soon... |
| - void set(bool modify_getter, Object* value) { |
| - if (modify_getter) { |
| + 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
|
| + return (component == ACCESSOR_GETTER) ? getter() : setter(); |
| + } |
| + |
| + void set(AccessorComponent component, Object* value) { |
| + if (component == ACCESSOR_GETTER) { |
| set_getter(value); |
| } else { |
| set_setter(value); |