| OLD | NEW |
| 1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 3121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3132 const char** names_; | 3132 const char** names_; |
| 3133 }; | 3133 }; |
| 3134 | 3134 |
| 3135 | 3135 |
| 3136 /** | 3136 /** |
| 3137 * A sandboxed execution context with its own set of built-in objects | 3137 * A sandboxed execution context with its own set of built-in objects |
| 3138 * and functions. | 3138 * and functions. |
| 3139 */ | 3139 */ |
| 3140 class V8EXPORT Context { | 3140 class V8EXPORT Context { |
| 3141 public: | 3141 public: |
| 3142 /** Returns the global object of the context. */ | 3142 /** |
| 3143 * Returns the global proxy object or global object itself for |
| 3144 * detached contexts. |
| 3145 * |
| 3146 * Global proxy object is a thin wrapper whose prototype points to |
| 3147 * actual context's global object with the properties like Object, etc. |
| 3148 * This is done that way for security reasons (for more details see |
| 3149 * https://wiki.mozilla.org/Gecko:SplitWindow). |
| 3150 * |
| 3151 * Please note that changes to global proxy object prototype most probably |
| 3152 * would break VM---v8 expects only global object as a prototype of |
| 3153 * global proxy object. |
| 3154 * |
| 3155 * If DetachGlobal() has been invoked, Global() would return actual global |
| 3156 * object until global is reattached with ReattachGlobal(). |
| 3157 */ |
| 3143 Local<Object> Global(); | 3158 Local<Object> Global(); |
| 3144 | 3159 |
| 3145 /** | 3160 /** |
| 3146 * Detaches the global object from its context before | 3161 * Detaches the global object from its context before |
| 3147 * the global object can be reused to create a new context. | 3162 * the global object can be reused to create a new context. |
| 3148 */ | 3163 */ |
| 3149 void DetachGlobal(); | 3164 void DetachGlobal(); |
| 3150 | 3165 |
| 3151 /** | 3166 /** |
| 3152 * Reattaches a global object to a context. This can be used to | 3167 * Reattaches a global object to a context. This can be used to |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3523 static const int kHeapObjectMapOffset = 0; | 3538 static const int kHeapObjectMapOffset = 0; |
| 3524 static const int kMapInstanceTypeOffset = 1 * kApiPointerSize + kApiIntSize; | 3539 static const int kMapInstanceTypeOffset = 1 * kApiPointerSize + kApiIntSize; |
| 3525 static const int kStringResourceOffset = | 3540 static const int kStringResourceOffset = |
| 3526 InternalConstants<kApiPointerSize>::kStringResourceOffset; | 3541 InternalConstants<kApiPointerSize>::kStringResourceOffset; |
| 3527 | 3542 |
| 3528 static const int kProxyProxyOffset = kApiPointerSize; | 3543 static const int kProxyProxyOffset = kApiPointerSize; |
| 3529 static const int kJSObjectHeaderSize = 3 * kApiPointerSize; | 3544 static const int kJSObjectHeaderSize = 3 * kApiPointerSize; |
| 3530 static const int kFullStringRepresentationMask = 0x07; | 3545 static const int kFullStringRepresentationMask = 0x07; |
| 3531 static const int kExternalTwoByteRepresentationTag = 0x02; | 3546 static const int kExternalTwoByteRepresentationTag = 0x02; |
| 3532 | 3547 |
| 3533 static const int kJSObjectType = 0x9f; | 3548 static const int kJSObjectType = 0xa0; |
| 3534 static const int kFirstNonstringType = 0x80; | 3549 static const int kFirstNonstringType = 0x80; |
| 3535 static const int kProxyType = 0x85; | 3550 static const int kProxyType = 0x85; |
| 3536 | 3551 |
| 3537 static inline bool HasHeapObjectTag(internal::Object* value) { | 3552 static inline bool HasHeapObjectTag(internal::Object* value) { |
| 3538 return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) == | 3553 return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) == |
| 3539 kHeapObjectTag); | 3554 kHeapObjectTag); |
| 3540 } | 3555 } |
| 3541 | 3556 |
| 3542 static inline bool HasSmiTag(internal::Object* value) { | 3557 static inline bool HasSmiTag(internal::Object* value) { |
| 3543 return ((reinterpret_cast<intptr_t>(value) & kSmiTagMask) == kSmiTag); | 3558 return ((reinterpret_cast<intptr_t>(value) & kSmiTagMask) == kSmiTag); |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3933 | 3948 |
| 3934 | 3949 |
| 3935 } // namespace v8 | 3950 } // namespace v8 |
| 3936 | 3951 |
| 3937 | 3952 |
| 3938 #undef V8EXPORT | 3953 #undef V8EXPORT |
| 3939 #undef TYPE_CHECK | 3954 #undef TYPE_CHECK |
| 3940 | 3955 |
| 3941 | 3956 |
| 3942 #endif // V8_H_ | 3957 #endif // V8_H_ |
| OLD | NEW |