Ignore:
Timestamp:
Aug 6, 2005, 11:17:49 PM (20 years ago)
Author:
mjs
Message:

JavaScriptCore:

Reviewed by Darin.

Change over to the new PropertySlot mechanism for property
lookup. This allows the elimination of hasOwnProperty
methods. Also did some of the performance tuning enabled by this
(but not yet all the possible improvements for function calls,
assignment, ++, and so forth). And also much code cleanup.

Net result is about a 2% speedup on the JS iBench.

Also redid Geoff's fix for the chrashing applet by avoiding a NULL
prototype in the bindings code and using the default of Null()
instead.

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • bindings/objc/objc_runtime.h:
  • bindings/objc/objc_runtime.mm: (ObjcFallbackObjectImp::ObjcFallbackObjectImp): (ObjcFallbackObjectImp::getOwnPropertySlot):
  • bindings/runtime_array.cpp: (RuntimeArrayImp::lengthGetter): (RuntimeArrayImp::indexGetter): (RuntimeArrayImp::getOwnPropertySlot):
  • bindings/runtime_array.h:
  • bindings/runtime_method.cpp: (RuntimeMethodImp::lengthGetter): (RuntimeMethodImp::getOwnPropertySlot):
  • bindings/runtime_method.h:
  • bindings/runtime_object.cpp: (RuntimeObjectImp::RuntimeObjectImp): (RuntimeObjectImp::fallbackObjectGetter): (RuntimeObjectImp::fieldGetter): (RuntimeObjectImp::methodGetter): (RuntimeObjectImp::getOwnPropertySlot):
  • bindings/runtime_object.h:
  • bindings/runtime_root.h:
  • kjs/array_instance.h:
  • kjs/array_object.cpp: (ArrayInstanceImp::lengthGetter): (ArrayInstanceImp::getOwnPropertySlot): (ArrayPrototypeImp::getOwnPropertySlot):
  • kjs/array_object.h:
  • kjs/date_object.cpp: (DatePrototypeImp::getOwnPropertySlot):
  • kjs/date_object.h:
  • kjs/function.cpp: (KJS::FunctionImp::argumentsGetter): (KJS::FunctionImp::lengthGetter): (KJS::FunctionImp::getOwnPropertySlot): (KJS::FunctionImp::put): (KJS::FunctionImp::deleteProperty): (KJS::ArgumentsImp::mappedIndexGetter): (KJS::ArgumentsImp::getOwnPropertySlot): (KJS::ActivationImp::argumentsGetter): (KJS::ActivationImp::getArgumentsGetter): (KJS::ActivationImp::getOwnPropertySlot): (KJS::ActivationImp::deleteProperty):
  • kjs/function.h:
  • kjs/internal.cpp: (InterpreterImp::InterpreterImp): (InterpreterImp::initGlobalObject): (InterpreterImp::~InterpreterImp): (InterpreterImp::evaluate):
  • kjs/internal.h: (KJS::InterpreterImp::globalExec):
  • kjs/interpreter.cpp: (Interpreter::Interpreter): (Interpreter::createLanguageInstanceForValue):
  • kjs/interpreter.h: (KJS::Interpreter::argumentsIdentifier): (KJS::Interpreter::specialPrototypeIdentifier):
  • kjs/lookup.h: (KJS::staticFunctionGetter): (KJS::staticValueGetter): (KJS::getStaticPropertySlot): (KJS::getStaticFunctionSlot): (KJS::getStaticValueSlot):
  • kjs/math_object.cpp: (MathObjectImp::getOwnPropertySlot):
  • kjs/math_object.h:
  • kjs/nodes.cpp: (ResolveNode::evaluate): (ResolveNode::evaluateReference): (AccessorNode1::evaluate): (AccessorNode2::evaluate):
  • kjs/number_object.cpp: (NumberObjectImp::getOwnPropertySlot):
  • kjs/number_object.h:
  • kjs/object.cpp: (KJS::ObjectImp::get): (KJS::ObjectImp::getProperty): (KJS::ObjectImp::getPropertySlot): (KJS::ObjectImp::getOwnPropertySlot): (KJS::ObjectImp::put): (KJS::ObjectImp::hasProperty): (KJS::ObjectImp::hasOwnProperty):
  • kjs/object.h: (KJS::ObjectImp::getDirectLocation): (KJS::ObjectImp::getPropertySlot): (KJS::ObjectImp::getOwnPropertySlot):
  • kjs/object_wrapper.h: Added. (KJS::): (KJS::Object::Object): (KJS::Object::operator ObjectImp *):
  • kjs/property_map.cpp: (KJS::PropertyMap::getLocation):
  • kjs/property_map.h:
  • kjs/property_slot.cpp: Added. (KJS::PropertySlot::undefinedGetter):
  • kjs/property_slot.h: Added. (KJS::PropertySlot::isSet): (KJS::PropertySlot::getValue): (KJS::PropertySlot::setValueSlot): (KJS::PropertySlot::setStaticEntry): (KJS::PropertySlot::setCustom): (KJS::PropertySlot::setCustomIndex): (KJS::PropertySlot::setUndefined): (KJS::PropertySlot::slotBase): (KJS::PropertySlot::staticEntry): (KJS::PropertySlot::index): (KJS::PropertySlot::):
  • kjs/protect.h:
  • kjs/protected_object.h: Added. (KJS::ProtectedObject::ProtectedObject): (KJS::ProtectedObject::~ProtectedObject): (KJS::ProtectedObject::operator=): (KJS::ProtectedReference::ProtectedReference): (KJS::ProtectedReference::~ProtectedReference): (KJS::ProtectedReference::operator=):
  • kjs/reference.h:
  • kjs/reference_list.cpp:
  • kjs/regexp_object.cpp: (RegExpObjectImp::backrefGetter): (RegExpObjectImp::getOwnPropertySlot):
  • kjs/regexp_object.h:
  • kjs/string_object.cpp: (StringInstanceImp::lengthGetter): (StringInstanceImp::indexGetter): (StringInstanceImp::getOwnPropertySlot): (StringPrototypeImp::getOwnPropertySlot):
  • kjs/string_object.h:

WebCore:

Reviewed by Darin.

Change over to the new PropertySlot mechanism for property
lookup. This allows the elimination of hasOwnProperty methods. I
also did a bunch of code cleanup and regularization of the various
property lookup methods.

Test cases added: Added a test case for a bug I found along the way.

  • layout-tests/fast/js/string-index-overflow.html:
  • layout-tests/fast/js/string-index-overflow-expected.txt:
  • khtml/ecma/kjs_binding.cpp: (KJS::ScriptInterpreter::createLanguageInstanceForValue):
  • khtml/ecma/kjs_binding.h:
  • khtml/ecma/kjs_css.cpp: (KJS::DOMCSSStyleDeclaration::indexGetter): (KJS::DOMCSSStyleDeclaration::cssPropertyGetter): (KJS::DOMCSSStyleDeclaration::getOwnPropertySlot): (KJS::DOMCSSStyleDeclaration::getValueProperty): (KJS::DOMStyleSheet::getOwnPropertySlot): (KJS::DOMStyleSheetList::getValueProperty): (KJS::DOMStyleSheetList::indexGetter): (KJS::DOMStyleSheetList::nameGetter): (KJS::DOMStyleSheetList::getOwnPropertySlot): (KJS::DOMMediaList::getValueProperty): (KJS::DOMMediaList::indexGetter): (KJS::DOMMediaList::getOwnPropertySlot): (KJS::DOMCSSStyleSheet::getValueProperty): (KJS::DOMCSSStyleSheet::getOwnPropertySlot): (KJS::DOMCSSRuleList::getValueProperty): (KJS::DOMCSSRuleList::indexGetter): (KJS::DOMCSSRuleList::getOwnPropertySlot): (KJS::DOMCSSRule::getOwnPropertySlot): (KJS::CSSRuleConstructor::getOwnPropertySlot): (KJS::DOMCSSValue::getValueProperty): (KJS::DOMCSSValue::getOwnPropertySlot): (KJS::CSSValueConstructor::getOwnPropertySlot): (KJS::DOMCSSPrimitiveValue::getValueProperty): (KJS::DOMCSSPrimitiveValue::getOwnPropertySlot): (KJS::CSSPrimitiveValueConstructor::getOwnPropertySlot): (KJS::DOMCSSValueList::getValueProperty): (KJS::DOMCSSValueList::indexGetter): (KJS::DOMCSSValueList::getOwnPropertySlot): (KJS::DOMRGBColor::getOwnPropertySlot): (KJS::DOMRect::getOwnPropertySlot): (KJS::DOMCounter::getOwnPropertySlot):
  • khtml/ecma/kjs_css.h: (KJS::DOMCSSStyleDeclaration::): (KJS::DOMCSSStyleSheet::): (KJS::DOMCSSRule::): (KJS::DOMCSSValueList::):
  • khtml/ecma/kjs_dom.cpp: (KJS::DOMNode::getOwnPropertySlot): (KJS::): (KJS::DOMNodeList::getValueProperty): (KJS::DOMNodeList::indexGetter): (KJS::DOMNodeList::nameGetter): (KJS::DOMNodeList::getOwnPropertySlot): (KJS::DOMNodeList::call): (KJS::DOMAttr::getOwnPropertySlot): (KJS::DOMDocument::getOwnPropertySlot): (KJS::DOMElement::getValueProperty): (KJS::DOMElement::attributeGetter): (KJS::DOMElement::getOwnPropertySlot): (KJS::DOMDocumentType::getOwnPropertySlot): (KJS::DOMNamedNodeMap::lengthGetter): (KJS::DOMNamedNodeMap::indexGetter): (KJS::DOMNamedNodeMap::getOwnPropertySlot): (KJS::DOMProcessingInstruction::getOwnPropertySlot): (KJS::DOMNotation::getOwnPropertySlot): (KJS::DOMEntity::getOwnPropertySlot): (KJS::NodeConstructor::getOwnPropertySlot): (KJS::DOMExceptionConstructor::getOwnPropertySlot): (KJS::DOMNamedNodesCollection::lengthGetter): (KJS::DOMNamedNodesCollection::indexGetter): (KJS::DOMNamedNodesCollection::getOwnPropertySlot): (KJS::DOMCharacterData::getOwnPropertySlot):
  • khtml/ecma/kjs_dom.h:
  • khtml/ecma/kjs_events.cpp: (KJS::EventConstructor::getOwnPropertySlot): (KJS::DOMEvent::getOwnPropertySlot): (KJS::EventExceptionConstructor::getOwnPropertySlot): (KJS::DOMUIEvent::getOwnPropertySlot): (KJS::DOMMouseEvent::getOwnPropertySlot): (KJS::DOMKeyboardEvent::getOwnPropertySlot): (KJS::MutationEventConstructor::getOwnPropertySlot): (KJS::DOMMutationEvent::getOwnPropertySlot): (KJS::DOMWheelEvent::getOwnPropertySlot): (KJS::Clipboard::getOwnPropertySlot):
  • khtml/ecma/kjs_events.h:
  • khtml/ecma/kjs_html.cpp: (KJS::HTMLDocument::namedItemGetter): (KJS::HTMLDocument::getValueProperty): (KJS::HTMLDocument::getOwnPropertySlot): (KJS::HTMLElement::formIndexGetter): (KJS::HTMLElement::formNameGetter): (KJS::HTMLElement::selectIndexGetter): (KJS::HTMLElement::framesetNameGetter): (KJS::HTMLElement::frameWindowPropertyGetter): (KJS::HTMLElement::runtimeObjectGetter): (KJS::HTMLElement::runtimeObjectPropertyGetter): (KJS::HTMLElement::getOwnPropertySlot): (KJS::HTMLCollection::lengthGetter): (KJS::HTMLCollection::indexGetter): (KJS::HTMLCollection::nameGetter): (KJS::HTMLCollection::getOwnPropertySlot): (KJS::HTMLSelectCollection::selectedIndexGetter): (KJS::HTMLSelectCollection::getOwnPropertySlot): (KJS::Image::getOwnPropertySlot): (KJS::Context2D::getOwnPropertySlot): (KJS::Gradient::getOwnPropertySlot): (KJS::ImagePattern::getOwnPropertySlot):
  • khtml/ecma/kjs_html.h: (KJS::HTMLCollection::toBoolean):
  • khtml/ecma/kjs_navigator.cpp: (KJS::Plugins::): (KJS::MimeTypes::): (KJS::Plugin::): (KJS::MimeType::): (KJS::): (KJS::Navigator::getOwnPropertySlot): (KJS::Plugins::getValueProperty): (KJS::Plugins::indexGetter): (KJS::Plugins::nameGetter): (KJS::Plugins::getOwnPropertySlot): (KJS::MimeTypes::getValueProperty): (KJS::MimeTypes::indexGetter): (KJS::MimeTypes::nameGetter): (KJS::MimeTypes::getOwnPropertySlot): (KJS::Plugin::getValueProperty): (KJS::Plugin::indexGetter): (KJS::Plugin::nameGetter): (KJS::Plugin::getOwnPropertySlot): (KJS::MimeType::getValueProperty): (KJS::MimeType::getOwnPropertySlot):
  • khtml/ecma/kjs_navigator.h:
  • khtml/ecma/kjs_range.cpp: (KJS::DOMRange::getOwnPropertySlot): (KJS::RangeConstructor::getOwnPropertySlot):
  • khtml/ecma/kjs_range.h:
  • khtml/ecma/kjs_traversal.cpp: (KJS::DOMNodeIterator::getOwnPropertySlot): (KJS::NodeFilterConstructor::getOwnPropertySlot): (KJS::DOMTreeWalker::getOwnPropertySlot):
  • khtml/ecma/kjs_traversal.h:
  • khtml/ecma/kjs_views.cpp: (KJS::DOMAbstractView::~DOMAbstractView): (KJS::DOMAbstractView::getValueProperty): (KJS::DOMAbstractView::getOwnPropertySlot):
  • khtml/ecma/kjs_views.h:
  • khtml/ecma/kjs_window.cpp: (KJS::FrameArray::): (KJS::FrameArray::classInfo): (KJS::Screen::getOwnPropertySlot): (KJS::Window::getValueProperty): (KJS::Window::childFrameGetter): (KJS::Window::namedFrameGetter): (KJS::Window::indexGetter): (KJS::Window::namedItemGetter): (KJS::Window::getOwnPropertySlot): (KJS::): (KJS::FrameArray::getValueProperty): (KJS::FrameArray::indexGetter): (KJS::FrameArray::nameGetter): (KJS::FrameArray::getOwnPropertySlot): (KJS::Location::getValueProperty): (KJS::Location::getOwnPropertySlot): (KJS::Selection::getValueProperty): (KJS::Selection::getOwnPropertySlot): (KJS::BarInfo::getValueProperty): (KJS::BarInfo::getOwnPropertySlot): (KJS::History::getOwnPropertySlot):
  • khtml/ecma/kjs_window.h:
  • khtml/ecma/xmlhttprequest.cpp: (KJS::XMLHttpRequest::getOwnPropertySlot):
  • khtml/ecma/xmlhttprequest.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/internal.cpp

    r9929 r10076  
    498498
    499499InterpreterImp::InterpreterImp(Interpreter *interp, const Object &glob)
    500     : _context(0)
     500  : globExec(interp, 0)
     501  , _context(0)
    501502{
    502503  // add this interpreter to the global chain
     
    518519
    519520  global = glob;
    520   globExec = new ExecState(m_interpreter,0);
    521521  dbg = 0;
    522522  m_compatMode = Interpreter::NativeMode;
     
    550550  // Contructor prototype objects (Object.prototype, Array.prototype etc)
    551551
    552   FunctionPrototypeImp *funcProto = new FunctionPrototypeImp(globExec);
     552  FunctionPrototypeImp *funcProto = new FunctionPrototypeImp(&globExec);
    553553  b_FunctionPrototype = Object(funcProto);
    554   ObjectPrototypeImp *objProto = new ObjectPrototypeImp(globExec,funcProto);
     554  ObjectPrototypeImp *objProto = new ObjectPrototypeImp(&globExec, funcProto);
    555555  b_ObjectPrototype = Object(objProto);
    556556  funcProto->setPrototype(b_ObjectPrototype);
    557557
    558   ArrayPrototypeImp *arrayProto = new ArrayPrototypeImp(globExec,objProto);
     558  ArrayPrototypeImp *arrayProto = new ArrayPrototypeImp(&globExec, objProto);
    559559  b_ArrayPrototype = Object(arrayProto);
    560   StringPrototypeImp *stringProto = new StringPrototypeImp(globExec,objProto);
     560  StringPrototypeImp *stringProto = new StringPrototypeImp(&globExec, objProto);
    561561  b_StringPrototype = Object(stringProto);
    562   BooleanPrototypeImp *booleanProto = new BooleanPrototypeImp(globExec,objProto,funcProto);
     562  BooleanPrototypeImp *booleanProto = new BooleanPrototypeImp(&globExec, objProto, funcProto);
    563563  b_BooleanPrototype = Object(booleanProto);
    564   NumberPrototypeImp *numberProto = new NumberPrototypeImp(globExec,objProto,funcProto);
     564  NumberPrototypeImp *numberProto = new NumberPrototypeImp(&globExec, objProto, funcProto);
    565565  b_NumberPrototype = Object(numberProto);
    566   DatePrototypeImp *dateProto = new DatePrototypeImp(globExec,objProto);
     566  DatePrototypeImp *dateProto = new DatePrototypeImp(&globExec, objProto);
    567567  b_DatePrototype = Object(dateProto);
    568   RegExpPrototypeImp *regexpProto = new RegExpPrototypeImp(globExec,objProto,funcProto);
     568  RegExpPrototypeImp *regexpProto = new RegExpPrototypeImp(&globExec, objProto, funcProto);
    569569  b_RegExpPrototype = Object(regexpProto);
    570   ErrorPrototypeImp *errorProto = new ErrorPrototypeImp(globExec,objProto,funcProto);
     570  ErrorPrototypeImp *errorProto = new ErrorPrototypeImp(&globExec, objProto, funcProto);
    571571  b_ErrorPrototype = Object(errorProto);
    572572
     
    574574
    575575  // Constructors (Object, Array, etc.)
    576   b_Object = Object(new ObjectObjectImp(globExec, objProto, funcProto));
    577   b_Function = Object(new FunctionObjectImp(globExec, funcProto));
    578   b_Array = Object(new ArrayObjectImp(globExec, funcProto, arrayProto));
    579   b_String = Object(new StringObjectImp(globExec, funcProto, stringProto));
    580   b_Boolean = Object(new BooleanObjectImp(globExec, funcProto, booleanProto));
    581   b_Number = Object(new NumberObjectImp(globExec, funcProto, numberProto));
    582   b_Date = Object(new DateObjectImp(globExec, funcProto, dateProto));
    583   b_RegExp = Object(new RegExpObjectImp(globExec, funcProto, regexpProto));
    584   b_Error = Object(new ErrorObjectImp(globExec, funcProto, errorProto));
     576  b_Object = Object(new ObjectObjectImp(&globExec, objProto, funcProto));
     577  b_Function = Object(new FunctionObjectImp(&globExec, funcProto));
     578  b_Array = Object(new ArrayObjectImp(&globExec, funcProto, arrayProto));
     579  b_String = Object(new StringObjectImp(&globExec, funcProto, stringProto));
     580  b_Boolean = Object(new BooleanObjectImp(&globExec, funcProto, booleanProto));
     581  b_Number = Object(new NumberObjectImp(&globExec, funcProto, numberProto));
     582  b_Date = Object(new DateObjectImp(&globExec, funcProto, dateProto));
     583  b_RegExp = Object(new RegExpObjectImp(&globExec, funcProto, regexpProto));
     584  b_Error = Object(new ErrorObjectImp(&globExec, funcProto, errorProto));
    585585
    586586  // Error object prototypes
    587   b_evalErrorPrototype = Object(new NativeErrorPrototypeImp(globExec,errorProto,EvalError,
    588                                                             "EvalError","EvalError"));
    589   b_rangeErrorPrototype = Object(new NativeErrorPrototypeImp(globExec,errorProto,RangeError,
    590                                                             "RangeError","RangeError"));
    591   b_referenceErrorPrototype = Object(new NativeErrorPrototypeImp(globExec,errorProto,ReferenceError,
    592                                                             "ReferenceError","ReferenceError"));
    593   b_syntaxErrorPrototype = Object(new NativeErrorPrototypeImp(globExec,errorProto,SyntaxError,
    594                                                             "SyntaxError","SyntaxError"));
    595   b_typeErrorPrototype = Object(new NativeErrorPrototypeImp(globExec,errorProto,TypeError,
    596                                                             "TypeError","TypeError"));
    597   b_uriErrorPrototype = Object(new NativeErrorPrototypeImp(globExec,errorProto,URIError,
    598                                                             "URIError","URIError"));
     587  b_evalErrorPrototype = Object(new NativeErrorPrototypeImp(&globExec, errorProto, EvalError,
     588                                                            "EvalError", "EvalError"));
     589  b_rangeErrorPrototype = Object(new NativeErrorPrototypeImp(&globExec, errorProto, RangeError,
     590                                                            "RangeError", "RangeError"));
     591  b_referenceErrorPrototype = Object(new NativeErrorPrototypeImp(&globExec, errorProto, ReferenceError,
     592                                                            "ReferenceError", "ReferenceError"));
     593  b_syntaxErrorPrototype = Object(new NativeErrorPrototypeImp(&globExec, errorProto, SyntaxError,
     594                                                            "SyntaxError", "SyntaxError"));
     595  b_typeErrorPrototype = Object(new NativeErrorPrototypeImp(&globExec, errorProto, TypeError,
     596                                                            "TypeError", "TypeError"));
     597  b_uriErrorPrototype = Object(new NativeErrorPrototypeImp(&globExec, errorProto, URIError,
     598                                                            "URIError", "URIError"));
    599599
    600600  // Error objects
    601   b_evalError = Object(new NativeErrorImp(globExec,funcProto,b_evalErrorPrototype));
    602   b_rangeError = Object(new NativeErrorImp(globExec,funcProto,b_rangeErrorPrototype));
    603   b_referenceError = Object(new NativeErrorImp(globExec,funcProto,b_referenceErrorPrototype));
    604   b_syntaxError = Object(new NativeErrorImp(globExec,funcProto,b_syntaxErrorPrototype));
    605   b_typeError = Object(new NativeErrorImp(globExec,funcProto,b_typeErrorPrototype));
    606   b_uriError = Object(new NativeErrorImp(globExec,funcProto,b_uriErrorPrototype));
     601  b_evalError = Object(new NativeErrorImp(&globExec, funcProto, b_evalErrorPrototype));
     602  b_rangeError = Object(new NativeErrorImp(&globExec, funcProto, b_rangeErrorPrototype));
     603  b_referenceError = Object(new NativeErrorImp(&globExec, funcProto, b_referenceErrorPrototype));
     604  b_syntaxError = Object(new NativeErrorImp(&globExec, funcProto, b_syntaxErrorPrototype));
     605  b_typeError = Object(new NativeErrorImp(&globExec, funcProto, b_typeErrorPrototype));
     606  b_uriError = Object(new NativeErrorImp(&globExec, funcProto, b_uriErrorPrototype));
    607607
    608608  // ECMA 15.3.4.1
    609   funcProto->put(globExec,"constructor", b_Function, DontEnum);
    610 
    611   global.put(globExec,"Object", b_Object, DontEnum);
    612   global.put(globExec,"Function", b_Function, DontEnum);
    613   global.put(globExec,"Array", b_Array, DontEnum);
    614   global.put(globExec,"Boolean", b_Boolean, DontEnum);
    615   global.put(globExec,"String", b_String, DontEnum);
    616   global.put(globExec,"Number", b_Number, DontEnum);
    617   global.put(globExec,"Date", b_Date, DontEnum);
    618   global.put(globExec,"RegExp", b_RegExp, DontEnum);
    619   global.put(globExec,"Error", b_Error, DontEnum);
     609  funcProto->put(&globExec, "constructor", b_Function, DontEnum);
     610
     611  global.put(&globExec, "Object", b_Object, DontEnum);
     612  global.put(&globExec, "Function", b_Function, DontEnum);
     613  global.put(&globExec, "Array", b_Array, DontEnum);
     614  global.put(&globExec, "Boolean", b_Boolean, DontEnum);
     615  global.put(&globExec, "String", b_String, DontEnum);
     616  global.put(&globExec, "Number", b_Number, DontEnum);
     617  global.put(&globExec, "Date", b_Date, DontEnum);
     618  global.put(&globExec, "RegExp", b_RegExp, DontEnum);
     619  global.put(&globExec, "Error", b_Error, DontEnum);
    620620  // Using Internal for those to have something != 0
    621621  // (see kjs_window). Maybe DontEnum would be ok too ?
    622   global.put(globExec,"EvalError",b_evalError, Internal);
    623   global.put(globExec,"RangeError",b_rangeError, Internal);
    624   global.put(globExec,"ReferenceError",b_referenceError, Internal);
    625   global.put(globExec,"SyntaxError",b_syntaxError, Internal);
    626   global.put(globExec,"TypeError",b_typeError, Internal);
    627   global.put(globExec,"URIError",b_uriError, Internal);
     622  global.put(&globExec, "EvalError",b_evalError, Internal);
     623  global.put(&globExec, "RangeError",b_rangeError, Internal);
     624  global.put(&globExec, "ReferenceError",b_referenceError, Internal);
     625  global.put(&globExec, "SyntaxError",b_syntaxError, Internal);
     626  global.put(&globExec, "TypeError",b_typeError, Internal);
     627  global.put(&globExec, "URIError",b_uriError, Internal);
    628628
    629629  // Set the "constructor" property of all builtin constructors
    630   objProto->put(globExec, "constructor", b_Object, DontEnum | DontDelete | ReadOnly);
    631   funcProto->put(globExec, "constructor", b_Function, DontEnum | DontDelete | ReadOnly);
    632   arrayProto->put(globExec, "constructor", b_Array, DontEnum | DontDelete | ReadOnly);
    633   booleanProto->put(globExec, "constructor", b_Boolean, DontEnum | DontDelete | ReadOnly);
    634   stringProto->put(globExec, "constructor", b_String, DontEnum | DontDelete | ReadOnly);
    635   numberProto->put(globExec, "constructor", b_Number, DontEnum | DontDelete | ReadOnly);
    636   dateProto->put(globExec, "constructor", b_Date, DontEnum | DontDelete | ReadOnly);
    637   regexpProto->put(globExec, "constructor", b_RegExp, DontEnum | DontDelete | ReadOnly);
    638   errorProto->put(globExec, "constructor", b_Error, DontEnum | DontDelete | ReadOnly);
    639   b_evalErrorPrototype.put(globExec, "constructor", b_evalError, DontEnum | DontDelete | ReadOnly);
    640   b_rangeErrorPrototype.put(globExec, "constructor", b_rangeError, DontEnum | DontDelete | ReadOnly);
    641   b_referenceErrorPrototype.put(globExec, "constructor", b_referenceError, DontEnum | DontDelete | ReadOnly);
    642   b_syntaxErrorPrototype.put(globExec, "constructor", b_syntaxError, DontEnum | DontDelete | ReadOnly);
    643   b_typeErrorPrototype.put(globExec, "constructor", b_typeError, DontEnum | DontDelete | ReadOnly);
    644   b_uriErrorPrototype.put(globExec, "constructor", b_uriError, DontEnum | DontDelete | ReadOnly);
     630  objProto->put(&globExec, "constructor", b_Object, DontEnum | DontDelete | ReadOnly);
     631  funcProto->put(&globExec, "constructor", b_Function, DontEnum | DontDelete | ReadOnly);
     632  arrayProto->put(&globExec, "constructor", b_Array, DontEnum | DontDelete | ReadOnly);
     633  booleanProto->put(&globExec, "constructor", b_Boolean, DontEnum | DontDelete | ReadOnly);
     634  stringProto->put(&globExec, "constructor", b_String, DontEnum | DontDelete | ReadOnly);
     635  numberProto->put(&globExec, "constructor", b_Number, DontEnum | DontDelete | ReadOnly);
     636  dateProto->put(&globExec, "constructor", b_Date, DontEnum | DontDelete | ReadOnly);
     637  regexpProto->put(&globExec, "constructor", b_RegExp, DontEnum | DontDelete | ReadOnly);
     638  errorProto->put(&globExec, "constructor", b_Error, DontEnum | DontDelete | ReadOnly);
     639  b_evalErrorPrototype.put(&globExec, "constructor", b_evalError, DontEnum | DontDelete | ReadOnly);
     640  b_rangeErrorPrototype.put(&globExec, "constructor", b_rangeError, DontEnum | DontDelete | ReadOnly);
     641  b_referenceErrorPrototype.put(&globExec, "constructor", b_referenceError, DontEnum | DontDelete | ReadOnly);
     642  b_syntaxErrorPrototype.put(&globExec, "constructor", b_syntaxError, DontEnum | DontDelete | ReadOnly);
     643  b_typeErrorPrototype.put(&globExec, "constructor", b_typeError, DontEnum | DontDelete | ReadOnly);
     644  b_uriErrorPrototype.put(&globExec, "constructor", b_uriError, DontEnum | DontDelete | ReadOnly);
    645645
    646646  // built-in values
    647   global.put(globExec, "NaN",        Number(NaN), DontEnum|DontDelete);
    648   global.put(globExec, "Infinity",   Number(Inf), DontEnum|DontDelete);
    649   global.put(globExec, "undefined",  Undefined(), DontEnum|DontDelete);
     647  global.put(&globExec, "NaN",        Number(NaN), DontEnum|DontDelete);
     648  global.put(&globExec, "Infinity",   Number(Inf), DontEnum|DontDelete);
     649  global.put(&globExec, "undefined",  Undefined(), DontEnum|DontDelete);
    650650
    651651  // built-in functions
    652   global.put(globExec,"eval",       Object(new GlobalFuncImp(globExec,funcProto,GlobalFuncImp::Eval,      1)), DontEnum);
    653   global.put(globExec,"parseInt",   Object(new GlobalFuncImp(globExec,funcProto,GlobalFuncImp::ParseInt,  2)), DontEnum);
    654   global.put(globExec,"parseFloat", Object(new GlobalFuncImp(globExec,funcProto,GlobalFuncImp::ParseFloat, 1)), DontEnum);
    655   global.put(globExec,"isNaN",      Object(new GlobalFuncImp(globExec,funcProto,GlobalFuncImp::IsNaN,      1)), DontEnum);
    656   global.put(globExec,"isFinite",   Object(new GlobalFuncImp(globExec,funcProto,GlobalFuncImp::IsFinite,  1)), DontEnum);
    657   global.put(globExec,"escape",     Object(new GlobalFuncImp(globExec,funcProto,GlobalFuncImp::Escape,    1)), DontEnum);
    658   global.put(globExec,"unescape",   Object(new GlobalFuncImp(globExec,funcProto,GlobalFuncImp::UnEscape,  1)), DontEnum);
    659   global.put(globExec,"decodeURI",  Object(new GlobalFuncImp(globExec,funcProto,GlobalFuncImp::DecodeURI, 1)), DontEnum);
    660   global.put(globExec,"decodeURIComponent", Object(new GlobalFuncImp(globExec,funcProto,GlobalFuncImp::DecodeURIComponent, 1)), DontEnum);
    661   global.put(globExec,"encodeURI",  Object(new GlobalFuncImp(globExec,funcProto,GlobalFuncImp::EncodeURI, 1)), DontEnum);
    662   global.put(globExec,"encodeURIComponent", Object(new GlobalFuncImp(globExec,funcProto,GlobalFuncImp::EncodeURIComponent, 1)), DontEnum);
     652  global.put(&globExec, "eval",       Object(new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::Eval, 1)), DontEnum);
     653  global.put(&globExec, "parseInt",   Object(new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::ParseInt, 2)), DontEnum);
     654  global.put(&globExec, "parseFloat", Object(new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::ParseFloat, 1)), DontEnum);
     655  global.put(&globExec, "isNaN",      Object(new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::IsNaN, 1)), DontEnum);
     656  global.put(&globExec, "isFinite",   Object(new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::IsFinite, 1)), DontEnum);
     657  global.put(&globExec, "escape",     Object(new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::Escape, 1)), DontEnum);
     658  global.put(&globExec, "unescape",   Object(new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::UnEscape, 1)), DontEnum);
     659  global.put(&globExec, "decodeURI",  Object(new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::DecodeURI, 1)), DontEnum);
     660  global.put(&globExec, "decodeURIComponent", Object(new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::DecodeURIComponent, 1)), DontEnum);
     661  global.put(&globExec, "encodeURI",  Object(new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::EncodeURI, 1)), DontEnum);
     662  global.put(&globExec, "encodeURIComponent", Object(new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::EncodeURIComponent, 1)), DontEnum);
    663663#ifndef NDEBUG
    664   global.put(globExec,"kjsprint",   Object(new GlobalFuncImp(globExec,funcProto,GlobalFuncImp::KJSPrint,  1)), DontEnum);
     664  global.put(&globExec, "kjsprint",   Object(new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::KJSPrint, 1)), DontEnum);
    665665#endif
    666666
    667667  // built-in objects
    668   global.put(globExec,"Math", Object(new MathObjectImp(globExec,objProto)), DontEnum);
     668  global.put(&globExec, "Math", Object(new MathObjectImp(&globExec, objProto)), DontEnum);
    669669}
    670670
     
    673673  if (dbg)
    674674    dbg->detach(m_interpreter);
    675   delete globExec;
    676   globExec = 0L;
    677675  clear();
    678676}
     
    746744  if (recursion >= 20) {
    747745#if APPLE_CHANGES
    748     Completion result = Completion(Throw,Error::create(globExec,GeneralError,"Recursion too deep"));
     746    Completion result = Completion(Throw, Error::create(&globExec, GeneralError, "Recursion too deep"));
    749747    unlockInterpreter();
    750748    return result;
    751749#else
    752     return Completion(Throw,Error::create(globExec,GeneralError,"Recursion too deep"));
     750    return Completion(Throw,Error::create(&globExec, GeneralError, "Recursion too deep"));
    753751#endif
    754752  }
     
    762760  // notify debugger that source has been parsed
    763761  if (dbg) {
    764     bool cont = dbg->sourceParsed(globExec,sid,sourceURL,code,errLine);
     762    bool cont = dbg->sourceParsed(&globExec, sid, sourceURL, code, errLine);
    765763    if (!cont)
    766764#if APPLE_CHANGES
     
    776774  // no program node means a syntax error occurred
    777775  if (!progNode) {
    778     Object err = Error::create(globExec,SyntaxError,errMsg.ascii(),errLine, -1, &sourceURL);
    779     err.put(globExec,"sid",Number(sid));
     776    Object err = Error::create(&globExec, SyntaxError, errMsg.ascii(), errLine, -1, &sourceURL);
     777    err.put(&globExec, "sid", Number(sid));
    780778#if APPLE_CHANGES
    781779    unlockInterpreter();
     
    784782  }
    785783
    786   globExec->clearException();
     784  globExec.clearException();
    787785
    788786  recursion++;
     
    797795      thisObj = globalObject();
    798796    else {
    799       thisObj = thisV.toObject(globExec);
     797      thisObj = thisV.toObject(&globExec);
    800798    }
    801799  }
    802800
    803801  Completion res;
    804   if (globExec->hadException()) {
     802  if (globExec.hadException()) {
    805803    // the thisArg.toObject() conversion above might have thrown an exception - if so,
    806804    // propagate it back
    807     res = Completion(Throw,globExec->exception());
     805    res = Completion(Throw, globExec.exception());
    808806  }
    809807  else {
Note: See TracChangeset for help on using the changeset viewer.