2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
3 * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
22 #ifndef JSGlobalObject_h
23 #define JSGlobalObject_h
25 #include "ArrayAllocationProfile.h"
27 #include "JSClassRef.h"
29 #include "JSSegmentedVariableObject.h"
30 #include "JSWeakObjectMapRefInternal.h"
31 #include "NumberPrototype.h"
32 #include "SpecialPointer.h"
33 #include "StringPrototype.h"
34 #include "StructureChain.h"
35 #include "StructureRareDataInlines.h"
36 #include "Watchpoint.h"
37 #include <JavaScriptCore/JSBase.h>
38 #include <wtf/HashSet.h>
39 #include <wtf/OwnPtr.h>
40 #include <wtf/RandomNumber.h>
43 struct OpaqueJSClassContextData
;
48 class BooleanPrototype
;
51 class ErrorConstructor
;
55 class FunctionCodeBlock
;
56 class FunctionExecutable
;
57 class FunctionPrototype
;
59 class GlobalCodeBlock
;
61 class LLIntOffsetsExtractor
;
62 class NativeErrorConstructor
;
63 class ProgramCodeBlock
;
64 class ProgramExecutable
;
65 class RegExpConstructor
;
66 class RegExpPrototype
;
68 struct ActivationStackNode
;
71 typedef Vector
<ExecState
*, 16> ExecStateStack
;
73 struct GlobalObjectMethodTable
{
74 typedef bool (*AllowsAccessFromFunctionPtr
)(const JSGlobalObject
*, ExecState
*);
75 AllowsAccessFromFunctionPtr allowsAccessFrom
;
77 typedef bool (*SupportsProfilingFunctionPtr
)(const JSGlobalObject
*);
78 SupportsProfilingFunctionPtr supportsProfiling
;
80 typedef bool (*SupportsRichSourceInfoFunctionPtr
)(const JSGlobalObject
*);
81 SupportsRichSourceInfoFunctionPtr supportsRichSourceInfo
;
83 typedef bool (*ShouldInterruptScriptFunctionPtr
)(const JSGlobalObject
*);
84 ShouldInterruptScriptFunctionPtr shouldInterruptScript
;
86 typedef bool (*JavaScriptExperimentsEnabledFunctionPtr
)(const JSGlobalObject
*);
87 JavaScriptExperimentsEnabledFunctionPtr javaScriptExperimentsEnabled
;
90 // NOTE: This needs to be the last entry in the struct. We have initialization code
91 // that relies on that! See <rdar://12329156>.
92 typedef bool (*ShouldInterruptScriptBeforeTimeoutPtr
)(const JSGlobalObject
*);
93 ShouldInterruptScriptBeforeTimeoutPtr shouldInterruptScriptBeforeTimeout
;
97 class JSGlobalObject
: public JSSegmentedVariableObject
{
99 typedef HashSet
<RefPtr
<OpaqueJSWeakObjectMap
> > WeakMapSet
;
100 typedef HashMap
<OpaqueJSClass
*, OwnPtr
<OpaqueJSClassContextData
> > OpaqueJSClassDataMap
;
102 struct JSGlobalObjectRareData
{
103 JSGlobalObjectRareData()
109 unsigned profileGroup
;
111 OpaqueJSClassDataMap opaqueJSClassData
;
116 Register m_globalCallFrame
[JSStack::CallFrameHeaderSize
];
118 WriteBarrier
<JSObject
> m_globalThis
;
120 WriteBarrier
<RegExpConstructor
> m_regExpConstructor
;
121 WriteBarrier
<ErrorConstructor
> m_errorConstructor
;
122 WriteBarrier
<NativeErrorConstructor
> m_evalErrorConstructor
;
123 WriteBarrier
<NativeErrorConstructor
> m_rangeErrorConstructor
;
124 WriteBarrier
<NativeErrorConstructor
> m_referenceErrorConstructor
;
125 WriteBarrier
<NativeErrorConstructor
> m_syntaxErrorConstructor
;
126 WriteBarrier
<NativeErrorConstructor
> m_typeErrorConstructor
;
127 WriteBarrier
<NativeErrorConstructor
> m_URIErrorConstructor
;
129 WriteBarrier
<JSFunction
> m_evalFunction
;
130 WriteBarrier
<JSFunction
> m_callFunction
;
131 WriteBarrier
<JSFunction
> m_applyFunction
;
132 WriteBarrier
<GetterSetter
> m_throwTypeErrorGetterSetter
;
134 WriteBarrier
<ObjectPrototype
> m_objectPrototype
;
135 WriteBarrier
<FunctionPrototype
> m_functionPrototype
;
136 WriteBarrier
<ArrayPrototype
> m_arrayPrototype
;
137 WriteBarrier
<BooleanPrototype
> m_booleanPrototype
;
138 WriteBarrier
<StringPrototype
> m_stringPrototype
;
139 WriteBarrier
<NumberPrototype
> m_numberPrototype
;
140 WriteBarrier
<DatePrototype
> m_datePrototype
;
141 WriteBarrier
<RegExpPrototype
> m_regExpPrototype
;
142 WriteBarrier
<ErrorPrototype
> m_errorPrototype
;
144 WriteBarrier
<Structure
> m_withScopeStructure
;
145 WriteBarrier
<Structure
> m_strictEvalActivationStructure
;
146 WriteBarrier
<Structure
> m_activationStructure
;
147 WriteBarrier
<Structure
> m_nameScopeStructure
;
148 WriteBarrier
<Structure
> m_argumentsStructure
;
150 // Lists the actual structures used for having these particular indexing shapes.
151 WriteBarrier
<Structure
> m_originalArrayStructureForIndexingShape
[NumberOfIndexingShapes
];
152 // Lists the structures we should use during allocation for these particular indexing shapes.
153 WriteBarrier
<Structure
> m_arrayStructureForIndexingShapeDuringAllocation
[NumberOfIndexingShapes
];
155 WriteBarrier
<Structure
> m_booleanObjectStructure
;
156 WriteBarrier
<Structure
> m_callbackConstructorStructure
;
157 WriteBarrier
<Structure
> m_callbackFunctionStructure
;
158 WriteBarrier
<Structure
> m_callbackObjectStructure
;
159 #if JSC_OBJC_API_ENABLED
160 WriteBarrier
<Structure
> m_objcCallbackFunctionStructure
;
161 WriteBarrier
<Structure
> m_objcWrapperObjectStructure
;
163 WriteBarrier
<Structure
> m_dateStructure
;
164 WriteBarrier
<Structure
> m_nullPrototypeObjectStructure
;
165 WriteBarrier
<Structure
> m_errorStructure
;
166 WriteBarrier
<Structure
> m_functionStructure
;
167 WriteBarrier
<Structure
> m_boundFunctionStructure
;
168 WriteBarrier
<Structure
> m_namedFunctionStructure
;
169 PropertyOffset m_functionNameOffset
;
170 WriteBarrier
<Structure
> m_numberObjectStructure
;
171 WriteBarrier
<Structure
> m_privateNameStructure
;
172 WriteBarrier
<Structure
> m_regExpMatchesArrayStructure
;
173 WriteBarrier
<Structure
> m_regExpStructure
;
174 WriteBarrier
<Structure
> m_stringObjectStructure
;
175 WriteBarrier
<Structure
> m_internalFunctionStructure
;
177 void* m_specialPointers
[Special::TableSize
]; // Special pointers used by the LLInt and JIT.
179 Debugger
* m_debugger
;
181 RefPtr
<WatchpointSet
> m_masqueradesAsUndefinedWatchpoint
;
182 RefPtr
<WatchpointSet
> m_havingABadTimeWatchpoint
;
184 OwnPtr
<JSGlobalObjectRareData
> m_rareData
;
186 WeakRandom m_weakRandom
;
189 String m_evalDisabledErrorMessage
;
190 bool m_experimentsEnabled
;
192 static JS_EXPORTDATA
const GlobalObjectMethodTable s_globalObjectMethodTable
;
193 const GlobalObjectMethodTable
* m_globalObjectMethodTable
;
195 void createRareDataIfNeeded()
199 m_rareData
= adoptPtr(new JSGlobalObjectRareData
);
203 typedef JSSegmentedVariableObject Base
;
205 static JSGlobalObject
* create(VM
& vm
, Structure
* structure
)
207 JSGlobalObject
* globalObject
= new (NotNull
, allocateCell
<JSGlobalObject
>(vm
.heap
)) JSGlobalObject(vm
, structure
);
208 globalObject
->finishCreation(vm
);
209 vm
.heap
.addFinalizer(globalObject
, destroy
);
213 static JS_EXPORTDATA
const ClassInfo s_info
;
215 bool hasDebugger() const { return m_debugger
; }
216 bool hasProfiler() const { return globalObjectMethodTable()->supportsProfiling(this); }
219 JS_EXPORT_PRIVATE
explicit JSGlobalObject(VM
&, Structure
*, const GlobalObjectMethodTable
* = 0);
221 void finishCreation(VM
& vm
)
223 Base::finishCreation(vm
);
224 structure()->setGlobalObject(vm
, this);
225 m_experimentsEnabled
= m_globalObjectMethodTable
->javaScriptExperimentsEnabled(this);
229 void finishCreation(VM
& vm
, JSObject
* thisValue
)
231 Base::finishCreation(vm
);
232 structure()->setGlobalObject(vm
, this);
233 m_experimentsEnabled
= m_globalObjectMethodTable
->javaScriptExperimentsEnabled(this);
238 JS_EXPORT_PRIVATE
~JSGlobalObject();
239 JS_EXPORT_PRIVATE
static void destroy(JSCell
*);
240 // We don't need a destructor because we use a finalizer instead.
241 static const bool needsDestruction
= false;
243 JS_EXPORT_PRIVATE
static void visitChildren(JSCell
*, SlotVisitor
&);
245 JS_EXPORT_PRIVATE
static bool getOwnPropertySlot(JSCell
*, ExecState
*, PropertyName
, PropertySlot
&);
246 JS_EXPORT_PRIVATE
static bool getOwnPropertyDescriptor(JSObject
*, ExecState
*, PropertyName
, PropertyDescriptor
&);
247 bool hasOwnPropertyForWrite(ExecState
*, PropertyName
);
248 JS_EXPORT_PRIVATE
static void put(JSCell
*, ExecState
*, PropertyName
, JSValue
, PutPropertySlot
&);
250 JS_EXPORT_PRIVATE
static void putDirectVirtual(JSObject
*, ExecState
*, PropertyName
, JSValue
, unsigned attributes
);
252 JS_EXPORT_PRIVATE
static void defineGetter(JSObject
*, ExecState
*, PropertyName
, JSObject
* getterFunc
, unsigned attributes
);
253 JS_EXPORT_PRIVATE
static void defineSetter(JSObject
*, ExecState
*, PropertyName
, JSObject
* setterFunc
, unsigned attributes
);
254 JS_EXPORT_PRIVATE
static bool defineOwnProperty(JSObject
*, ExecState
*, PropertyName
, PropertyDescriptor
&, bool shouldThrow
);
256 // We use this in the code generator as we perform symbol table
257 // lookups prior to initializing the properties
258 bool symbolTableHasProperty(PropertyName
);
260 // The following accessors return pristine values, even if a script
261 // replaces the global object's associated property.
263 RegExpConstructor
* regExpConstructor() const { return m_regExpConstructor
.get(); }
265 ErrorConstructor
* errorConstructor() const { return m_errorConstructor
.get(); }
266 NativeErrorConstructor
* evalErrorConstructor() const { return m_evalErrorConstructor
.get(); }
267 NativeErrorConstructor
* rangeErrorConstructor() const { return m_rangeErrorConstructor
.get(); }
268 NativeErrorConstructor
* referenceErrorConstructor() const { return m_referenceErrorConstructor
.get(); }
269 NativeErrorConstructor
* syntaxErrorConstructor() const { return m_syntaxErrorConstructor
.get(); }
270 NativeErrorConstructor
* typeErrorConstructor() const { return m_typeErrorConstructor
.get(); }
271 NativeErrorConstructor
* URIErrorConstructor() const { return m_URIErrorConstructor
.get(); }
273 JSFunction
* evalFunction() const { return m_evalFunction
.get(); }
274 JSFunction
* callFunction() const { return m_callFunction
.get(); }
275 JSFunction
* applyFunction() const { return m_applyFunction
.get(); }
276 GetterSetter
* throwTypeErrorGetterSetter(ExecState
* exec
)
278 if (!m_throwTypeErrorGetterSetter
)
279 createThrowTypeError(exec
);
280 return m_throwTypeErrorGetterSetter
.get();
283 ObjectPrototype
* objectPrototype() const { return m_objectPrototype
.get(); }
284 FunctionPrototype
* functionPrototype() const { return m_functionPrototype
.get(); }
285 ArrayPrototype
* arrayPrototype() const { return m_arrayPrototype
.get(); }
286 BooleanPrototype
* booleanPrototype() const { return m_booleanPrototype
.get(); }
287 StringPrototype
* stringPrototype() const { return m_stringPrototype
.get(); }
288 NumberPrototype
* numberPrototype() const { return m_numberPrototype
.get(); }
289 DatePrototype
* datePrototype() const { return m_datePrototype
.get(); }
290 RegExpPrototype
* regExpPrototype() const { return m_regExpPrototype
.get(); }
291 ErrorPrototype
* errorPrototype() const { return m_errorPrototype
.get(); }
293 Structure
* withScopeStructure() const { return m_withScopeStructure
.get(); }
294 Structure
* strictEvalActivationStructure() const { return m_strictEvalActivationStructure
.get(); }
295 Structure
* activationStructure() const { return m_activationStructure
.get(); }
296 Structure
* nameScopeStructure() const { return m_nameScopeStructure
.get(); }
297 Structure
* argumentsStructure() const { return m_argumentsStructure
.get(); }
298 Structure
* originalArrayStructureForIndexingType(IndexingType indexingType
) const
300 ASSERT(indexingType
& IsArray
);
301 return m_originalArrayStructureForIndexingShape
[(indexingType
& IndexingShapeMask
) >> IndexingShapeShift
].get();
303 Structure
* arrayStructureForIndexingTypeDuringAllocation(IndexingType indexingType
) const
305 ASSERT(indexingType
& IsArray
);
306 return m_arrayStructureForIndexingShapeDuringAllocation
[(indexingType
& IndexingShapeMask
) >> IndexingShapeShift
].get();
308 Structure
* arrayStructureForProfileDuringAllocation(ArrayAllocationProfile
* profile
) const
310 return arrayStructureForIndexingTypeDuringAllocation(ArrayAllocationProfile::selectIndexingTypeFor(profile
));
313 bool isOriginalArrayStructure(Structure
* structure
)
315 return originalArrayStructureForIndexingType(structure
->indexingType() | IsArray
) == structure
;
318 Structure
* booleanObjectStructure() const { return m_booleanObjectStructure
.get(); }
319 Structure
* callbackConstructorStructure() const { return m_callbackConstructorStructure
.get(); }
320 Structure
* callbackFunctionStructure() const { return m_callbackFunctionStructure
.get(); }
321 Structure
* callbackObjectStructure() const { return m_callbackObjectStructure
.get(); }
322 #if JSC_OBJC_API_ENABLED
323 Structure
* objcCallbackFunctionStructure() const { return m_objcCallbackFunctionStructure
.get(); }
324 Structure
* objcWrapperObjectStructure() const { return m_objcWrapperObjectStructure
.get(); }
326 Structure
* dateStructure() const { return m_dateStructure
.get(); }
327 Structure
* nullPrototypeObjectStructure() const { return m_nullPrototypeObjectStructure
.get(); }
328 Structure
* errorStructure() const { return m_errorStructure
.get(); }
329 Structure
* functionStructure() const { return m_functionStructure
.get(); }
330 Structure
* boundFunctionStructure() const { return m_boundFunctionStructure
.get(); }
331 Structure
* namedFunctionStructure() const { return m_namedFunctionStructure
.get(); }
332 PropertyOffset
functionNameOffset() const { return m_functionNameOffset
; }
333 Structure
* numberObjectStructure() const { return m_numberObjectStructure
.get(); }
334 Structure
* privateNameStructure() const { return m_privateNameStructure
.get(); }
335 Structure
* internalFunctionStructure() const { return m_internalFunctionStructure
.get(); }
336 Structure
* regExpMatchesArrayStructure() const { return m_regExpMatchesArrayStructure
.get(); }
337 Structure
* regExpStructure() const { return m_regExpStructure
.get(); }
338 Structure
* stringObjectStructure() const { return m_stringObjectStructure
.get(); }
340 void* actualPointerFor(Special::Pointer pointer
)
342 ASSERT(pointer
< Special::TableSize
);
343 return m_specialPointers
[pointer
];
346 WatchpointSet
* masqueradesAsUndefinedWatchpoint() { return m_masqueradesAsUndefinedWatchpoint
.get(); }
347 WatchpointSet
* havingABadTimeWatchpoint() { return m_havingABadTimeWatchpoint
.get(); }
349 bool isHavingABadTime() const
351 return m_havingABadTimeWatchpoint
->hasBeenInvalidated();
354 void haveABadTime(VM
&);
356 bool arrayPrototypeChainIsSane();
358 void setProfileGroup(unsigned value
) { createRareDataIfNeeded(); m_rareData
->profileGroup
= value
; }
359 unsigned profileGroup() const
363 return m_rareData
->profileGroup
;
366 Debugger
* debugger() const { return m_debugger
; }
367 void setDebugger(Debugger
* debugger
) { m_debugger
= debugger
; }
369 const GlobalObjectMethodTable
* globalObjectMethodTable() const { return m_globalObjectMethodTable
; }
371 static bool allowsAccessFrom(const JSGlobalObject
*, ExecState
*) { return true; }
372 static bool supportsProfiling(const JSGlobalObject
*) { return false; }
373 static bool supportsRichSourceInfo(const JSGlobalObject
*) { return true; }
375 JS_EXPORT_PRIVATE ExecState
* globalExec();
378 static bool shouldInterruptScriptBeforeTimeout(const JSGlobalObject
*) { return false; }
380 static bool shouldInterruptScript(const JSGlobalObject
*) { return true; }
381 static bool javaScriptExperimentsEnabled(const JSGlobalObject
*) { return false; }
383 bool isDynamicScope(bool& requiresDynamicChecks
) const;
385 bool evalEnabled() const { return m_evalEnabled
; }
386 const String
& evalDisabledErrorMessage() const { return m_evalDisabledErrorMessage
; }
387 void setEvalEnabled(bool enabled
, const String
& errorMessage
= String())
389 m_evalEnabled
= enabled
;
390 m_evalDisabledErrorMessage
= errorMessage
;
393 void resetPrototype(VM
&, JSValue prototype
);
395 VM
& vm() const { return *Heap::heap(this)->vm(); }
396 JSObject
* globalThis() const;
398 static Structure
* createStructure(VM
& vm
, JSValue prototype
)
400 return Structure::create(vm
, 0, prototype
, TypeInfo(GlobalObjectType
, StructureFlags
), &s_info
);
403 void registerWeakMap(OpaqueJSWeakObjectMap
* map
)
405 createRareDataIfNeeded();
406 m_rareData
->weakMaps
.add(map
);
409 void unregisterWeakMap(OpaqueJSWeakObjectMap
* map
)
412 m_rareData
->weakMaps
.remove(map
);
415 OpaqueJSClassDataMap
& opaqueJSClassData()
417 createRareDataIfNeeded();
418 return m_rareData
->opaqueJSClassData
;
421 double weakRandomNumber() { return m_weakRandom
.get(); }
422 unsigned weakRandomInteger() { return m_weakRandom
.getUint32(); }
424 UnlinkedProgramCodeBlock
* createProgramCodeBlock(CallFrame
*, ProgramExecutable
*, JSObject
** exception
);
425 UnlinkedEvalCodeBlock
* createEvalCodeBlock(CodeCache
*, CallFrame
*, JSScope
*, EvalExecutable
*, JSObject
** exception
);
429 static const unsigned StructureFlags
= OverridesGetOwnPropertySlot
| OverridesVisitChildren
| OverridesGetPropertyNames
| Base::StructureFlags
;
431 struct GlobalPropertyInfo
{
432 GlobalPropertyInfo(const Identifier
& i
, JSValue v
, unsigned a
)
439 const Identifier identifier
;
443 JS_EXPORT_PRIVATE
void addStaticGlobals(GlobalPropertyInfo
*, int count
);
445 JS_EXPORT_PRIVATE
static JSC::JSObject
* toThisObject(JSC::JSCell
*, JSC::ExecState
*);
447 JS_EXPORT_PRIVATE
void setGlobalThis(VM
&, JSObject
* globalThis
);
450 friend class LLIntOffsetsExtractor
;
452 // FIXME: Fold reset into init.
453 JS_EXPORT_PRIVATE
void init(JSObject
* thisValue
);
454 void reset(JSValue prototype
);
456 void createThrowTypeError(ExecState
*);
458 JS_EXPORT_PRIVATE
static void clearRareData(JSCell
*);
461 JSGlobalObject
* asGlobalObject(JSValue
);
463 inline JSGlobalObject
* asGlobalObject(JSValue value
)
465 ASSERT(asObject(value
)->isGlobalObject());
466 return jsCast
<JSGlobalObject
*>(asObject(value
));
469 inline bool JSGlobalObject::hasOwnPropertyForWrite(ExecState
* exec
, PropertyName propertyName
)
472 if (Base::getOwnPropertySlot(this, exec
, propertyName
, slot
))
474 bool slotIsWriteable
;
475 return symbolTableGet(this, propertyName
, slot
, slotIsWriteable
);
478 inline bool JSGlobalObject::symbolTableHasProperty(PropertyName propertyName
)
480 SymbolTableEntry entry
= symbolTable()->inlineGet(propertyName
.publicName());
481 return !entry
.isNull();
484 inline JSGlobalObject
* ExecState::dynamicGlobalObject()
486 if (this == lexicalGlobalObject()->globalExec())
487 return lexicalGlobalObject();
489 // For any ExecState that's not a globalExec, the
490 // dynamic global object must be set since code is running
491 ASSERT(vm().dynamicGlobalObject
);
492 return vm().dynamicGlobalObject
;
495 inline JSArray
* constructEmptyArray(ExecState
* exec
, ArrayAllocationProfile
* profile
, JSGlobalObject
* globalObject
, unsigned initialLength
= 0)
497 return ArrayAllocationProfile::updateLastAllocationFor(profile
, JSArray::create(exec
->vm(), initialLength
>= MIN_SPARSE_ARRAY_INDEX
? globalObject
->arrayStructureForIndexingTypeDuringAllocation(ArrayWithArrayStorage
) : globalObject
->arrayStructureForProfileDuringAllocation(profile
), initialLength
));
500 inline JSArray
* constructEmptyArray(ExecState
* exec
, ArrayAllocationProfile
* profile
, unsigned initialLength
= 0)
502 return constructEmptyArray(exec
, profile
, exec
->lexicalGlobalObject(), initialLength
);
505 inline JSArray
* constructArray(ExecState
* exec
, ArrayAllocationProfile
* profile
, JSGlobalObject
* globalObject
, const ArgList
& values
)
507 return ArrayAllocationProfile::updateLastAllocationFor(profile
, constructArray(exec
, globalObject
->arrayStructureForProfileDuringAllocation(profile
), values
));
510 inline JSArray
* constructArray(ExecState
* exec
, ArrayAllocationProfile
* profile
, const ArgList
& values
)
512 return constructArray(exec
, profile
, exec
->lexicalGlobalObject(), values
);
515 inline JSArray
* constructArray(ExecState
* exec
, ArrayAllocationProfile
* profile
, JSGlobalObject
* globalObject
, const JSValue
* values
, unsigned length
)
517 return ArrayAllocationProfile::updateLastAllocationFor(profile
, constructArray(exec
, globalObject
->arrayStructureForProfileDuringAllocation(profile
), values
, length
));
520 inline JSArray
* constructArray(ExecState
* exec
, ArrayAllocationProfile
* profile
, const JSValue
* values
, unsigned length
)
522 return constructArray(exec
, profile
, exec
->lexicalGlobalObject(), values
, length
);
525 class DynamicGlobalObjectScope
{
526 WTF_MAKE_NONCOPYABLE(DynamicGlobalObjectScope
);
528 JS_EXPORT_PRIVATE
DynamicGlobalObjectScope(VM
&, JSGlobalObject
*);
530 ~DynamicGlobalObjectScope()
532 m_dynamicGlobalObjectSlot
= m_savedDynamicGlobalObject
;
536 JSGlobalObject
*& m_dynamicGlobalObjectSlot
;
537 JSGlobalObject
* m_savedDynamicGlobalObject
;
540 inline bool JSGlobalObject::isDynamicScope(bool&) const
545 inline JSObject
* JSScope::globalThis()
547 return globalObject()->globalThis();
550 inline JSObject
* JSGlobalObject::globalThis() const
552 return m_globalThis
.get();
557 #endif // JSGlobalObject_h