source: webkit/trunk/JavaScriptCore/kjs/JSGlobalObject.cpp@ 34372

Last change on this file since 34372 was 33980, checked in by [email protected], 17 years ago

2008-05-21 Geoffrey Garen <[email protected]>

Reviewed by Mark Rowe.

Fix layout test failure in fast/dom/getter-on-window-object2 introduced in r33961.

  • JavaScriptCore.exp:
  • kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::defineGetter): (KJS::JSGlobalObject::defineSetter):
  • kjs/JSGlobalObject.h:
  • Property svn:eol-style set to native
File size: 20.9 KB
Line 
1/*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Cameron Zwarich ([email protected])
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
15 * its contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30#include "config.h"
31#include "JSGlobalObject.h"
32
33#include "CodeBlock.h"
34#include "array_object.h"
35#include "bool_object.h"
36#include "date_object.h"
37#include "debugger.h"
38#include "error_object.h"
39#include "function_object.h"
40#include "math_object.h"
41#include "number_object.h"
42#include "object_object.h"
43#include "regexp_object.h"
44#include "scope_chain_mark.h"
45#include "string_object.h"
46
47#if USE(MULTIPLE_THREADS)
48#include <wtf/ThreadSpecific.h>
49using namespace WTF;
50#endif
51
52#if HAVE(SYS_TIME_H)
53#include <sys/time.h>
54#endif
55
56#if PLATFORM(WIN_OS)
57#include <windows.h>
58#endif
59
60#if PLATFORM(QT)
61#include <QDateTime>
62#endif
63
64namespace KJS {
65
66extern const HashTable arrayTable;
67extern const HashTable dateTable;
68extern const HashTable mathTable;
69extern const HashTable numberTable;
70extern const HashTable RegExpImpTable;
71extern const HashTable RegExpObjectImpTable;
72extern const HashTable stringTable;
73
74// Default number of ticks before a timeout check should be done.
75static const int initialTickCountThreshold = 255;
76
77// Preferred number of milliseconds between each timeout check
78static const int preferredScriptCheckTimeInterval = 1000;
79
80static inline void markIfNeeded(JSValue* v)
81{
82 if (v && !v->marked())
83 v->mark();
84}
85
86// Returns the current time in milliseconds
87// It doesn't matter what "current time" is here, just as long as
88// it's possible to measure the time difference correctly.
89static inline unsigned getCurrentTime()
90{
91#if HAVE(SYS_TIME_H)
92 struct timeval tv;
93 gettimeofday(&tv, 0);
94 return tv.tv_sec * 1000 + tv.tv_usec / 1000;
95#elif PLATFORM(QT)
96 QDateTime t = QDateTime::currentDateTime();
97 return t.toTime_t() * 1000 + t.time().msec();
98#elif PLATFORM(WIN_OS)
99 return timeGetTime();
100#else
101#error Platform does not have getCurrentTime function
102#endif
103}
104
105JSGlobalObject* JSGlobalObject::s_head = 0;
106
107JSGlobalObject::~JSGlobalObject()
108{
109 ASSERT(JSLock::currentThreadIsHoldingLock());
110
111 if (d()->debugger)
112 d()->debugger->detach(this);
113
114 d()->next->d()->prev = d()->prev;
115 d()->prev->d()->next = d()->next;
116 s_head = d()->next;
117 if (s_head == this)
118 s_head = 0;
119
120 HashSet<ProgramCodeBlock*>::const_iterator end = codeBlocks().end();
121 for (HashSet<ProgramCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it)
122 (*it)->globalObject = 0;
123
124 delete d();
125}
126
127struct ThreadClassInfoHashTables {
128 ThreadClassInfoHashTables()
129 : arrayTable(KJS::arrayTable)
130 , dateTable(KJS::dateTable)
131 , mathTable(KJS::mathTable)
132 , numberTable(KJS::numberTable)
133 , RegExpImpTable(KJS::RegExpImpTable)
134 , RegExpObjectImpTable(KJS::RegExpObjectImpTable)
135 , stringTable(KJS::stringTable)
136 {
137 }
138
139 ~ThreadClassInfoHashTables()
140 {
141#if USE(MULTIPLE_THREADS)
142 delete[] arrayTable.table;
143 delete[] dateTable.table;
144 delete[] mathTable.table;
145 delete[] numberTable.table;
146 delete[] RegExpImpTable.table;
147 delete[] RegExpObjectImpTable.table;
148 delete[] stringTable.table;
149#endif
150 }
151
152#if USE(MULTIPLE_THREADS)
153 HashTable arrayTable;
154 HashTable dateTable;
155 HashTable mathTable;
156 HashTable numberTable;
157 HashTable RegExpImpTable;
158 HashTable RegExpObjectImpTable;
159 HashTable stringTable;
160#else
161 const HashTable& arrayTable;
162 const HashTable& dateTable;
163 const HashTable& mathTable;
164 const HashTable& numberTable;
165 const HashTable& RegExpImpTable;
166 const HashTable& RegExpObjectImpTable;
167 const HashTable& stringTable;
168#endif
169};
170
171ThreadClassInfoHashTables* JSGlobalObject::threadClassInfoHashTables()
172{
173#if USE(MULTIPLE_THREADS)
174 static ThreadSpecific<ThreadClassInfoHashTables> sharedInstance;
175 return sharedInstance;
176#else
177 static ThreadClassInfoHashTables sharedInstance;
178 return &sharedInstance;
179#endif
180}
181
182void JSGlobalObject::init(JSObject* thisValue)
183{
184 ASSERT(JSLock::currentThreadIsHoldingLock());
185
186 if (s_head) {
187 d()->prev = s_head;
188 d()->next = s_head->d()->next;
189 s_head->d()->next->d()->prev = this;
190 s_head->d()->next = this;
191 } else
192 s_head = d()->next = d()->prev = this;
193
194 resetTimeoutCheck();
195 d()->timeoutTime = 0;
196 d()->timeoutCheckCount = 0;
197
198 d()->recursion = 0;
199 d()->debugger = 0;
200
201 d()->perThreadData.arrayTable = &threadClassInfoHashTables()->arrayTable;
202 d()->perThreadData.dateTable = &threadClassInfoHashTables()->dateTable;
203 d()->perThreadData.mathTable = &threadClassInfoHashTables()->mathTable;
204 d()->perThreadData.numberTable = &threadClassInfoHashTables()->numberTable;
205 d()->perThreadData.RegExpImpTable = &threadClassInfoHashTables()->RegExpImpTable;
206 d()->perThreadData.RegExpObjectImpTable = &threadClassInfoHashTables()->RegExpObjectImpTable;
207 d()->perThreadData.stringTable = &threadClassInfoHashTables()->stringTable;
208 d()->perThreadData.propertyNames = CommonIdentifiers::shared();
209
210 d()->globalExec.set(new ExecState(this, thisValue, d()->globalScopeChain.node()));
211
212 d()->pageGroupIdentifier = 0;
213
214 reset(prototype());
215}
216
217void JSGlobalObject::put(ExecState* exec, const Identifier& propertyName, JSValue* value)
218{
219 if (symbolTablePut(propertyName, value))
220 return;
221 return JSVariableObject::put(exec, propertyName, value);
222}
223
224void JSGlobalObject::putWithAttributes(ExecState* exec, const Identifier& propertyName, JSValue* value, unsigned attributes)
225{
226 if (symbolTablePutWithAttributes(propertyName, value, attributes))
227 return;
228
229 JSValue* valueBefore = getDirect(propertyName);
230 JSVariableObject::put(exec, propertyName, value);
231 if (!valueBefore) {
232 if (JSValue* valueAfter = getDirect(propertyName))
233 putDirect(propertyName, valueAfter, attributes);
234 }
235}
236
237void JSGlobalObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunc)
238{
239 PropertySlot slot;
240 if (!symbolTableGet(propertyName, slot))
241 JSVariableObject::defineGetter(exec, propertyName, getterFunc);
242}
243
244void JSGlobalObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunc)
245{
246 PropertySlot slot;
247 if (!symbolTableGet(propertyName, slot))
248 JSVariableObject::defineSetter(exec, propertyName, setterFunc);
249}
250
251static inline JSObject* lastInPrototypeChain(JSObject* object)
252{
253 JSObject* o = object;
254 while (o->prototype()->isObject())
255 o = static_cast<JSObject*>(o->prototype());
256 return o;
257}
258
259void JSGlobalObject::reset(JSValue* prototype)
260{
261 // Clear before inititalizing, to avoid calling mark() on stale pointers --
262 // which would be wasteful -- or uninitialized pointers -- which would be
263 // dangerous. (The allocations below may cause a GC.)
264
265 _prop.clear();
266 registerFileStack().current()->clear();
267 registerFileStack().current()->addGlobalSlots(1);
268 symbolTable().clear();
269
270 // Prototypes
271 d()->functionPrototype = 0;
272 d()->objectPrototype = 0;
273
274 d()->arrayPrototype = 0;
275 d()->stringPrototype = 0;
276 d()->booleanPrototype = 0;
277 d()->numberPrototype = 0;
278 d()->datePrototype = 0;
279 d()->regExpPrototype = 0;
280 d()->errorPrototype = 0;
281
282 d()->evalErrorPrototype = 0;
283 d()->rangeErrorPrototype = 0;
284 d()->referenceErrorPrototype = 0;
285 d()->syntaxErrorPrototype = 0;
286 d()->typeErrorPrototype = 0;
287 d()->URIErrorPrototype = 0;
288
289 // Constructors
290 d()->objectConstructor = 0;
291 d()->functionConstructor = 0;
292 d()->arrayConstructor = 0;
293 d()->stringConstructor = 0;
294 d()->booleanConstructor = 0;
295 d()->numberConstructor = 0;
296 d()->dateConstructor = 0;
297 d()->regExpConstructor = 0;
298 d()->errorConstructor = 0;
299
300 d()->evalErrorConstructor = 0;
301 d()->rangeErrorConstructor = 0;
302 d()->referenceErrorConstructor = 0;
303 d()->syntaxErrorConstructor = 0;
304 d()->typeErrorConstructor = 0;
305 d()->URIErrorConstructor = 0;
306
307 d()->evalFunction = 0;
308
309 ExecState* exec = d()->globalExec.get();
310
311 // Prototypes
312 d()->functionPrototype = new FunctionPrototype(exec);
313 d()->objectPrototype = new ObjectPrototype(exec, d()->functionPrototype);
314 d()->functionPrototype->setPrototype(d()->objectPrototype);
315
316 d()->arrayPrototype = new ArrayPrototype(exec, d()->objectPrototype);
317 d()->stringPrototype = new StringPrototype(exec, d()->objectPrototype);
318 d()->booleanPrototype = new BooleanPrototype(exec, d()->objectPrototype, d()->functionPrototype);
319 d()->numberPrototype = new NumberPrototype(exec, d()->objectPrototype, d()->functionPrototype);
320 d()->datePrototype = new DatePrototype(exec, d()->objectPrototype);
321 d()->regExpPrototype = new RegExpPrototype(exec, d()->objectPrototype, d()->functionPrototype);
322 d()->errorPrototype = new ErrorPrototype(exec, d()->objectPrototype, d()->functionPrototype);
323
324 d()->evalErrorPrototype = new NativeErrorPrototype(exec, d()->errorPrototype, "EvalError", "EvalError");
325 d()->rangeErrorPrototype = new NativeErrorPrototype(exec, d()->errorPrototype, "RangeError", "RangeError");
326 d()->referenceErrorPrototype = new NativeErrorPrototype(exec, d()->errorPrototype, "ReferenceError", "ReferenceError");
327 d()->syntaxErrorPrototype = new NativeErrorPrototype(exec, d()->errorPrototype, "SyntaxError", "SyntaxError");
328 d()->typeErrorPrototype = new NativeErrorPrototype(exec, d()->errorPrototype, "TypeError", "TypeError");
329 d()->URIErrorPrototype = new NativeErrorPrototype(exec, d()->errorPrototype, "URIError", "URIError");
330
331 // Constructors
332 d()->objectConstructor = new ObjectObjectImp(exec, d()->objectPrototype, d()->functionPrototype);
333 d()->functionConstructor = new FunctionObjectImp(exec, d()->functionPrototype);
334 d()->arrayConstructor = new ArrayObjectImp(exec, d()->functionPrototype, d()->arrayPrototype);
335 d()->stringConstructor = new StringObjectImp(exec, d()->functionPrototype, d()->stringPrototype);
336 d()->booleanConstructor = new BooleanObjectImp(exec, d()->functionPrototype, d()->booleanPrototype);
337 d()->numberConstructor = new NumberObjectImp(exec, d()->functionPrototype, d()->numberPrototype);
338 d()->dateConstructor = new DateObjectImp(exec, d()->functionPrototype, d()->datePrototype);
339 d()->regExpConstructor = new RegExpObjectImp(exec, d()->functionPrototype, d()->regExpPrototype);
340 d()->errorConstructor = new ErrorObjectImp(exec, d()->functionPrototype, d()->errorPrototype);
341
342 d()->evalErrorConstructor = new NativeErrorImp(exec, d()->functionPrototype, d()->evalErrorPrototype);
343 d()->rangeErrorConstructor = new NativeErrorImp(exec, d()->functionPrototype, d()->rangeErrorPrototype);
344 d()->referenceErrorConstructor = new NativeErrorImp(exec, d()->functionPrototype, d()->referenceErrorPrototype);
345 d()->syntaxErrorConstructor = new NativeErrorImp(exec, d()->functionPrototype, d()->syntaxErrorPrototype);
346 d()->typeErrorConstructor = new NativeErrorImp(exec, d()->functionPrototype, d()->typeErrorPrototype);
347 d()->URIErrorConstructor = new NativeErrorImp(exec, d()->functionPrototype, d()->URIErrorPrototype);
348
349 d()->functionPrototype->putDirect(exec->propertyNames().constructor, d()->functionConstructor, DontEnum);
350
351 d()->objectPrototype->putDirect(exec->propertyNames().constructor, d()->objectConstructor, DontEnum);
352 d()->functionPrototype->putDirect(exec->propertyNames().constructor, d()->functionConstructor, DontEnum);
353 d()->arrayPrototype->putDirect(exec->propertyNames().constructor, d()->arrayConstructor, DontEnum);
354 d()->booleanPrototype->putDirect(exec->propertyNames().constructor, d()->booleanConstructor, DontEnum);
355 d()->stringPrototype->putDirect(exec->propertyNames().constructor, d()->stringConstructor, DontEnum);
356 d()->numberPrototype->putDirect(exec->propertyNames().constructor, d()->numberConstructor, DontEnum);
357 d()->datePrototype->putDirect(exec->propertyNames().constructor, d()->dateConstructor, DontEnum);
358 d()->regExpPrototype->putDirect(exec->propertyNames().constructor, d()->regExpConstructor, DontEnum);
359 d()->errorPrototype->putDirect(exec->propertyNames().constructor, d()->errorConstructor, DontEnum);
360 d()->evalErrorPrototype->putDirect(exec->propertyNames().constructor, d()->evalErrorConstructor, DontEnum);
361 d()->rangeErrorPrototype->putDirect(exec->propertyNames().constructor, d()->rangeErrorConstructor, DontEnum);
362 d()->referenceErrorPrototype->putDirect(exec->propertyNames().constructor, d()->referenceErrorConstructor, DontEnum);
363 d()->syntaxErrorPrototype->putDirect(exec->propertyNames().constructor, d()->syntaxErrorConstructor, DontEnum);
364 d()->typeErrorPrototype->putDirect(exec->propertyNames().constructor, d()->typeErrorConstructor, DontEnum);
365 d()->URIErrorPrototype->putDirect(exec->propertyNames().constructor, d()->URIErrorConstructor, DontEnum);
366
367 // Set global constructors
368
369 // FIXME: These properties could be handled by a static hash table.
370
371 putDirect("Object", d()->objectConstructor, DontEnum);
372 putDirect("Function", d()->functionConstructor, DontEnum);
373 putDirect("Array", d()->arrayConstructor, DontEnum);
374 putDirect("Boolean", d()->booleanConstructor, DontEnum);
375 putDirect("String", d()->stringConstructor, DontEnum);
376 putDirect("Number", d()->numberConstructor, DontEnum);
377 putDirect("Date", d()->dateConstructor, DontEnum);
378 putDirect("RegExp", d()->regExpConstructor, DontEnum);
379 putDirect("Error", d()->errorConstructor, DontEnum);
380 putDirect("EvalError", d()->evalErrorConstructor);
381 putDirect("RangeError", d()->rangeErrorConstructor);
382 putDirect("ReferenceError", d()->referenceErrorConstructor);
383 putDirect("SyntaxError", d()->syntaxErrorConstructor);
384 putDirect("TypeError", d()->typeErrorConstructor);
385 putDirect("URIError", d()->URIErrorConstructor);
386
387 // Set global values.
388 GlobalPropertyInfo staticGlobals[] = {
389 GlobalPropertyInfo("Math", new MathObjectImp(exec, d()->objectPrototype), DontEnum | DontDelete),
390 GlobalPropertyInfo("NaN", jsNaN(), DontEnum | DontDelete),
391 GlobalPropertyInfo("Infinity", jsNumber(Inf), DontEnum | DontDelete),
392 GlobalPropertyInfo("undefined", jsUndefined(), DontEnum | DontDelete)
393 };
394
395 addStaticGlobals(staticGlobals, sizeof(staticGlobals) / sizeof(GlobalPropertyInfo));
396
397 // Set global functions.
398
399 d()->evalFunction = new PrototypeReflexiveFunction(exec, d()->functionPrototype, 1, exec->propertyNames().eval, globalFuncEval, this);
400 putDirectFunction(d()->evalFunction, DontEnum);
401 putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 2, "parseInt", globalFuncParseInt), DontEnum);
402 putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, "parseFloat", globalFuncParseFloat), DontEnum);
403 putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, "isNaN", globalFuncIsNaN), DontEnum);
404 putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, "isFinite", globalFuncIsFinite), DontEnum);
405 putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, "escape", globalFuncEscape), DontEnum);
406 putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, "unescape", globalFuncUnescape), DontEnum);
407 putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, "decodeURI", globalFuncDecodeURI), DontEnum);
408 putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, "decodeURIComponent", globalFuncDecodeURIComponent), DontEnum);
409 putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, "encodeURI", globalFuncEncodeURI), DontEnum);
410 putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, "encodeURIComponent", globalFuncEncodeURIComponent), DontEnum);
411#ifndef NDEBUG
412 putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, "kjsprint", globalFuncKJSPrint), DontEnum);
413#endif
414
415 // Set prototype, and also insert the object prototype at the end of the chain.
416
417 setPrototype(prototype);
418 lastInPrototypeChain(this)->setPrototype(d()->objectPrototype);
419}
420
421void JSGlobalObject::startTimeoutCheck()
422{
423 if (!d()->timeoutCheckCount)
424 resetTimeoutCheck();
425
426 ++d()->timeoutCheckCount;
427}
428
429void JSGlobalObject::stopTimeoutCheck()
430{
431 --d()->timeoutCheckCount;
432}
433
434void JSGlobalObject::resetTimeoutCheck()
435{
436 d()->tickCount = 0;
437 d()->ticksUntilNextTimeoutCheck = initialTickCountThreshold;
438 d()->timeAtLastCheckTimeout = 0;
439 d()->timeExecuting = 0;
440}
441
442bool JSGlobalObject::checkTimeout()
443{
444 d()->tickCount = 0;
445
446 unsigned currentTime = getCurrentTime();
447
448 if (!d()->timeAtLastCheckTimeout) {
449 // Suspicious amount of looping in a script -- start timing it
450 d()->timeAtLastCheckTimeout = currentTime;
451 return false;
452 }
453
454 unsigned timeDiff = currentTime - d()->timeAtLastCheckTimeout;
455
456 if (timeDiff == 0)
457 timeDiff = 1;
458
459 d()->timeExecuting += timeDiff;
460 d()->timeAtLastCheckTimeout = currentTime;
461
462 // Adjust the tick threshold so we get the next checkTimeout call in the interval specified in
463 // preferredScriptCheckTimeInterval
464 d()->ticksUntilNextTimeoutCheck = (unsigned)((float)preferredScriptCheckTimeInterval / timeDiff) * d()->ticksUntilNextTimeoutCheck;
465
466 // If the new threshold is 0 reset it to the default threshold. This can happen if the timeDiff is higher than the
467 // preferred script check time interval.
468 if (d()->ticksUntilNextTimeoutCheck == 0)
469 d()->ticksUntilNextTimeoutCheck = initialTickCountThreshold;
470
471 if (d()->timeoutTime && d()->timeExecuting > d()->timeoutTime) {
472 if (shouldInterruptScript())
473 return true;
474
475 resetTimeoutCheck();
476 }
477
478 return false;
479}
480
481void JSGlobalObject::mark()
482{
483 JSVariableObject::mark();
484
485 HashSet<ProgramCodeBlock*>::const_iterator end = codeBlocks().end();
486 for (HashSet<ProgramCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it)
487 (*it)->mark();
488
489 registerFileStack().mark();
490
491 markIfNeeded(d()->globalExec->exception());
492
493 markIfNeeded(d()->objectConstructor);
494 markIfNeeded(d()->functionConstructor);
495 markIfNeeded(d()->arrayConstructor);
496 markIfNeeded(d()->booleanConstructor);
497 markIfNeeded(d()->stringConstructor);
498 markIfNeeded(d()->numberConstructor);
499 markIfNeeded(d()->dateConstructor);
500 markIfNeeded(d()->regExpConstructor);
501 markIfNeeded(d()->errorConstructor);
502 markIfNeeded(d()->evalErrorConstructor);
503 markIfNeeded(d()->rangeErrorConstructor);
504 markIfNeeded(d()->referenceErrorConstructor);
505 markIfNeeded(d()->syntaxErrorConstructor);
506 markIfNeeded(d()->typeErrorConstructor);
507 markIfNeeded(d()->URIErrorConstructor);
508
509 markIfNeeded(d()->evalFunction);
510
511 markIfNeeded(d()->objectPrototype);
512 markIfNeeded(d()->functionPrototype);
513 markIfNeeded(d()->arrayPrototype);
514 markIfNeeded(d()->booleanPrototype);
515 markIfNeeded(d()->stringPrototype);
516 markIfNeeded(d()->numberPrototype);
517 markIfNeeded(d()->datePrototype);
518 markIfNeeded(d()->regExpPrototype);
519 markIfNeeded(d()->errorPrototype);
520 markIfNeeded(d()->evalErrorPrototype);
521 markIfNeeded(d()->rangeErrorPrototype);
522 markIfNeeded(d()->referenceErrorPrototype);
523 markIfNeeded(d()->syntaxErrorPrototype);
524 markIfNeeded(d()->typeErrorPrototype);
525 markIfNeeded(d()->URIErrorPrototype);
526}
527
528JSGlobalObject* JSGlobalObject::toGlobalObject(ExecState*) const
529{
530 return const_cast<JSGlobalObject*>(this);
531}
532
533ExecState* JSGlobalObject::globalExec()
534{
535 return d()->globalExec.get();
536}
537
538bool JSGlobalObject::isDynamicScope() const
539{
540 return true;
541}
542
543
544} // namespace KJS
Note: See TracBrowser for help on using the repository browser.