| Index: src/objects.h
|
| ===================================================================
|
| --- src/objects.h (revision 539)
|
| +++ src/objects.h (working copy)
|
| @@ -48,6 +48,7 @@
|
| // - GlobalObject
|
| // - JSGlobalObject
|
| // - JSBuiltinsObject
|
| +// _ JSGlobalProxy
|
| // - JSValue
|
| // - Script
|
| // - Array
|
| @@ -263,6 +264,7 @@
|
| V(JS_OBJECT_TYPE) \
|
| V(JS_GLOBAL_OBJECT_TYPE) \
|
| V(JS_BUILTINS_OBJECT_TYPE) \
|
| + V(JS_GLOBAL_PROXY_TYPE) \
|
| V(JS_ARRAY_TYPE) \
|
| V(JS_REGEXP_TYPE) \
|
| \
|
| @@ -518,6 +520,7 @@
|
| JS_OBJECT_TYPE,
|
| JS_GLOBAL_OBJECT_TYPE,
|
| JS_BUILTINS_OBJECT_TYPE,
|
| + JS_GLOBAL_PROXY_TYPE,
|
| JS_ARRAY_TYPE,
|
| JS_REGEXP_TYPE,
|
|
|
| @@ -627,6 +630,7 @@
|
| inline bool IsGlobalObject();
|
| inline bool IsJSGlobalObject();
|
| inline bool IsJSBuiltinsObject();
|
| + inline bool IsJSGlobalProxy();
|
| inline bool IsUndetectableObject();
|
| inline bool IsAccessCheckNeeded();
|
|
|
| @@ -1114,7 +1118,7 @@
|
| // [elements]: The elements (properties with names that are integers).
|
| // elements is a FixedArray in the fast case, and a Dictionary in the slow
|
| // case.
|
| - DECL_ACCESSORS(elements, HeapObject) // Get and set fast elements.
|
| + DECL_ACCESSORS(elements, FixedArray) // Get and set fast elements.
|
| inline void initialize_elements();
|
| inline bool HasFastElements();
|
| inline Dictionary* element_dictionary(); // Gets slow elements.
|
| @@ -2338,12 +2342,12 @@
|
|
|
| // Tells whether the instance needs security checks when accessing its
|
| // properties.
|
| - inline void set_needs_access_check() {
|
| - set_bit_field(bit_field() | (1 << kNeedsAccessCheck));
|
| + inline void set_is_access_check_needed() {
|
| + set_bit_field(bit_field() | (1 << kIsAccessCheckNeeded));
|
| }
|
|
|
| - inline bool needs_access_check() {
|
| - return ((1 << kNeedsAccessCheck) & bit_field()) != 0;
|
| + inline bool is_access_check_needed() {
|
| + return ((1 << kIsAccessCheckNeeded) & bit_field()) != 0;
|
| }
|
|
|
| // [prototype]: implicit prototype object.
|
| @@ -2435,7 +2439,7 @@
|
| static const int kHasIndexedInterceptor = 4;
|
| static const int kIsUndetectable = 5;
|
| static const int kHasInstanceCallHandler = 6;
|
| - static const int kNeedsAccessCheck = 7;
|
| + static const int kIsAccessCheckNeeded = 7;
|
| private:
|
| DISALLOW_IMPLICIT_CONSTRUCTORS(Map);
|
| };
|
| @@ -2739,6 +2743,39 @@
|
| };
|
|
|
|
|
| +// JSGlobalProxy's prototype must be a JSGlobalObject or null,
|
| +// and the prototype is hidden. JSGlobalProxy always delegates
|
| +// property accesses to its prototype if the prototype is not null.
|
| +//
|
| +// A JSGlobalProxy can be reinitialized which will preserve its identity.
|
| +//
|
| +// Accessing a JSGlobalProxy requires security check.
|
| +
|
| +class JSGlobalProxy : public JSObject {
|
| + public:
|
| + // [context]: the owner global context of this proxy object.
|
| + // It is null value if this object is not used by any context.
|
| + DECL_ACCESSORS(context, Object)
|
| +
|
| + // Casting.
|
| + static inline JSGlobalProxy* cast(Object* obj);
|
| +
|
| + // Dispatched behavior.
|
| +#ifdef DEBUG
|
| + void JSGlobalProxyPrint();
|
| + void JSGlobalProxyVerify();
|
| +#endif
|
| +
|
| + // Layout description.
|
| + static const int kContextOffset = JSObject::kHeaderSize;
|
| + static const int kSize = kContextOffset + kPointerSize;
|
| +
|
| + private:
|
| +
|
| + DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalProxy);
|
| +};
|
| +
|
| +
|
| // Forward declaration.
|
| class JSBuiltinsObject;
|
|
|
| @@ -2752,10 +2789,14 @@
|
| // [global context]: the global context corresponding to this global objet.
|
| DECL_ACCESSORS(global_context, Context)
|
|
|
| + // [global receiver]: the global receiver object of the context
|
| + DECL_ACCESSORS(global_receiver, JSObject)
|
| +
|
| // Layout description.
|
| static const int kBuiltinsOffset = JSObject::kHeaderSize;
|
| static const int kGlobalContextOffset = kBuiltinsOffset + kPointerSize;
|
| - static const int kHeaderSize = kGlobalContextOffset + kPointerSize;
|
| + static const int kGlobalReceiverOffset = kGlobalContextOffset + kPointerSize;
|
| + static const int kHeaderSize = kGlobalReceiverOffset + kPointerSize;
|
|
|
| private:
|
| friend class AGCCVersionRequiresThisClassToHaveAFriendSoHereItIs;
|
| @@ -2767,10 +2808,6 @@
|
| // JavaScript global object.
|
| class JSGlobalObject: public GlobalObject {
|
| public:
|
| - // [security token]: the object being used for security check when accessing
|
| - // global properties.
|
| - DECL_ACCESSORS(security_token, Object)
|
| -
|
| // Casting.
|
| static inline JSGlobalObject* cast(Object* obj);
|
|
|
| @@ -2781,8 +2818,7 @@
|
| #endif
|
|
|
| // Layout description.
|
| - static const int kSecurityTokenOffset = GlobalObject::kHeaderSize;
|
| - static const int kSize = kSecurityTokenOffset + kPointerSize;
|
| + static const int kSize = GlobalObject::kHeaderSize;
|
|
|
| private:
|
| DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalObject);
|
| @@ -3067,7 +3103,7 @@
|
| static const int kMaxArrayIndexSize = 10;
|
|
|
| // Max ascii char code.
|
| - static const int kMaxAsciiCharCode = 127;
|
| + static const int kMaxAsciiCharCode = unibrow::Utf8::kMaxOneByteChar;
|
|
|
| // Mask constant for checking if a string has a computed hash code
|
| // and if it is an array index. The least significant bit indicates
|
|
|