Chromium Code Reviews| Index: src/objects.h |
| diff --git a/src/objects.h b/src/objects.h |
| index 3ec9428ab255d48da40b5537a8961cc559186906..395ea486589eecf09cd984b8ad69ec861abd2579 100644 |
| --- a/src/objects.h |
| +++ b/src/objects.h |
| @@ -710,6 +710,7 @@ class FixedArrayBase; |
| class ObjectVisitor; |
| class StringStream; |
| class Failure; |
| +class AccessorPair; |
|
Michael Starzinger
2012/05/02 13:30:14
Can we alpha-sort this?
Sven Panne
2012/05/03 09:39:02
Done.
|
| struct ValueInfo : public Malloced { |
| ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { } |
| @@ -1642,6 +1643,25 @@ class JSObject: public JSReceiver { |
| Object* getter, |
| Object* setter, |
| PropertyAttributes attributes); |
| + // Try to define a single accessor paying attention to map transitions. |
| + // Returns a JavaScript null if this was not possible and we have to use the |
| + // slow case. Note that we can fail due to allocations, too. |
| + MUST_USE_RESULT MaybeObject* DefineFastAccessor( |
| + String* name, |
| + AccessorComponent component, |
| + Object* accessor, |
| + PropertyAttributes attributes); |
| + MUST_USE_RESULT MaybeObject* CreateFreshAccessor( |
| + String* name, |
| + AccessorComponent component, |
| + Object* accessor, |
| + PropertyAttributes attributes); |
| + MUST_USE_RESULT MaybeObject* NewCallbackTrans( |
| + String* name, |
| + AccessorComponent component, |
| + Object* accessor, |
| + PropertyAttributes attributes, |
| + AccessorPair* accessors2); |
| Object* LookupAccessor(String* name, AccessorComponent component); |
| MUST_USE_RESULT MaybeObject* DefineAccessor(AccessorInfo* info); |
| @@ -8108,6 +8128,18 @@ class AccessorPair: public Struct { |
| MUST_USE_RESULT MaybeObject* CopyWithoutTransitions(); |
| + Object* get(AccessorComponent component) { |
| + return component == ACCESSOR_GETTER ? getter() : setter(); |
| + } |
| + |
| + void set(AccessorComponent component, Object* value) { |
| + if (component == ACCESSOR_GETTER) { |
| + set_getter(value); |
| + } else { |
| + set_setter(value); |
| + } |
| + } |
| + |
| // Note: Returns undefined instead in case of a hole. |
| Object* GetComponent(AccessorComponent component); |