Changeset 11527 in webkit for trunk/JavaScriptCore/kjs/function.cpp
- Timestamp:
- Dec 10, 2005, 6:06:17 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/function.cpp
r11525 r11527 59 59 FunctionImp::FunctionImp(ExecState *exec, const Identifier &n) 60 60 : InternalFunctionImp( 61 static_cast<FunctionPrototype Imp*>(exec->lexicalInterpreter()->builtinFunctionPrototype())61 static_cast<FunctionPrototype*>(exec->lexicalInterpreter()->builtinFunctionPrototype()) 62 62 ), param(0L), ident(n) 63 63 { … … 74 74 } 75 75 76 ValueImp *FunctionImp::callAsFunction(ExecState *exec, ObjectImp*thisObj, const List &args)77 { 78 ObjectImp*globalObj = exec->dynamicInterpreter()->globalObject();76 JSValue *FunctionImp::callAsFunction(ExecState *exec, JSObject *thisObj, const List &args) 77 { 78 JSObject *globalObj = exec->dynamicInterpreter()->globalObject(); 79 79 80 80 // enter a new execution context … … 171 171 void FunctionImp::processParameters(ExecState *exec, const List &args) 172 172 { 173 ObjectImp*variable = exec->context().imp()->variableObject();173 JSObject *variable = exec->context().imp()->variableObject(); 174 174 175 175 #ifdef KJS_VERBOSE … … 207 207 } 208 208 209 ValueImp*FunctionImp::argumentsGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)209 JSValue *FunctionImp::argumentsGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot) 210 210 { 211 211 FunctionImp *thisObj = static_cast<FunctionImp *>(slot.slotBase()); … … 220 220 } 221 221 222 ValueImp*FunctionImp::lengthGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)222 JSValue *FunctionImp::lengthGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot) 223 223 { 224 224 FunctionImp *thisObj = static_cast<FunctionImp *>(slot.slotBase()); … … 249 249 } 250 250 251 void FunctionImp::put(ExecState *exec, const Identifier &propertyName, ValueImp*value, int attr)251 void FunctionImp::put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr) 252 252 { 253 253 if (propertyName == exec->dynamicInterpreter()->argumentsIdentifier() || propertyName == lengthPropertyName) … … 313 313 314 314 // ECMA 13.2.2 [[Construct]] 315 ObjectImp*DeclaredFunctionImp::construct(ExecState *exec, const List &args)316 { 317 ObjectImp*proto;318 ValueImp*p = get(exec,prototypePropertyName);315 JSObject *DeclaredFunctionImp::construct(ExecState *exec, const List &args) 316 { 317 JSObject *proto; 318 JSValue *p = get(exec,prototypePropertyName); 319 319 if (p->isObject()) 320 proto = static_cast< ObjectImp*>(p);320 proto = static_cast<JSObject*>(p); 321 321 else 322 322 proto = exec->lexicalInterpreter()->builtinObjectPrototype(); 323 323 324 ObjectImp *obj(new ObjectImp(proto));325 326 ValueImp*res = call(exec,obj,args);324 JSObject *obj(new JSObject(proto)); 325 326 JSValue *res = call(exec,obj,args); 327 327 328 328 if (res->isObject()) 329 return static_cast< ObjectImp*>(res);329 return static_cast<JSObject *>(res); 330 330 else 331 331 return obj; … … 414 414 } 415 415 416 // ------------------------------ Arguments Imp---------------------------------417 418 const ClassInfo Arguments Imp::info = {"Arguments", 0, 0, 0};416 // ------------------------------ Arguments --------------------------------- 417 418 const ClassInfo Arguments::info = {"Arguments", 0, 0, 0}; 419 419 420 420 // ECMA 10.1.8 421 Arguments Imp::ArgumentsImp(ExecState *exec, FunctionImp *func, const List &args, ActivationImp *act)422 : ObjectImp(exec->lexicalInterpreter()->builtinObjectPrototype()),421 Arguments::Arguments(ExecState *exec, FunctionImp *func, const List &args, ActivationImp *act) 422 : JSObject(exec->lexicalInterpreter()->builtinObjectPrototype()), 423 423 _activationObject(act), 424 424 indexToNameMap(func, args) … … 431 431 for (; iterator != args.end(); i++, iterator++) { 432 432 if (!indexToNameMap.isMapped(Identifier::from(i))) { 433 ObjectImp::put(exec, Identifier::from(i), *iterator, DontEnum);434 } 435 } 436 } 437 438 void Arguments Imp::mark()439 { 440 ObjectImp::mark();433 JSObject::put(exec, Identifier::from(i), *iterator, DontEnum); 434 } 435 } 436 } 437 438 void Arguments::mark() 439 { 440 JSObject::mark(); 441 441 if (_activationObject && !_activationObject->marked()) 442 442 _activationObject->mark(); 443 443 } 444 444 445 ValueImp *ArgumentsImp::mappedIndexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)446 { 447 Arguments Imp *thisObj = static_cast<ArgumentsImp*>(slot.slotBase());445 JSValue *Arguments::mappedIndexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot) 446 { 447 Arguments *thisObj = static_cast<Arguments *>(slot.slotBase()); 448 448 return thisObj->_activationObject->get(exec, thisObj->indexToNameMap[propertyName]); 449 449 } 450 450 451 bool Arguments Imp::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)451 bool Arguments::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot) 452 452 { 453 453 if (indexToNameMap.isMapped(propertyName)) { … … 456 456 } 457 457 458 return ObjectImp::getOwnPropertySlot(exec, propertyName, slot);459 } 460 461 void Arguments Imp::put(ExecState *exec, const Identifier &propertyName, ValueImp*value, int attr)458 return JSObject::getOwnPropertySlot(exec, propertyName, slot); 459 } 460 461 void Arguments::put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr) 462 462 { 463 463 if (indexToNameMap.isMapped(propertyName)) { 464 464 _activationObject->put(exec, indexToNameMap[propertyName], value, attr); 465 465 } else { 466 ObjectImp::put(exec, propertyName, value, attr);467 } 468 } 469 470 bool Arguments Imp::deleteProperty(ExecState *exec, const Identifier &propertyName)466 JSObject::put(exec, propertyName, value, attr); 467 } 468 } 469 470 bool Arguments::deleteProperty(ExecState *exec, const Identifier &propertyName) 471 471 { 472 472 if (indexToNameMap.isMapped(propertyName)) { … … 474 474 return true; 475 475 } else { 476 return ObjectImp::deleteProperty(exec, propertyName);476 return JSObject::deleteProperty(exec, propertyName); 477 477 } 478 478 } … … 490 490 } 491 491 492 ValueImp*ActivationImp::argumentsGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)492 JSValue *ActivationImp::argumentsGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot) 493 493 { 494 494 ActivationImp *thisObj = static_cast<ActivationImp *>(slot.slotBase()); … … 509 509 { 510 510 // do this first so property map arguments property wins over the below 511 if ( ObjectImp::getOwnPropertySlot(exec, propertyName, slot))511 if (JSObject::getOwnPropertySlot(exec, propertyName, slot)) 512 512 return true; 513 513 … … 524 524 if (propertyName == exec->dynamicInterpreter()->argumentsIdentifier()) 525 525 return false; 526 return ObjectImp::deleteProperty(exec, propertyName);526 return JSObject::deleteProperty(exec, propertyName); 527 527 } 528 528 … … 534 534 if (_argumentsObject && !_argumentsObject->marked()) 535 535 _argumentsObject->mark(); 536 ObjectImp::mark();536 JSObject::mark(); 537 537 } 538 538 539 539 void ActivationImp::createArgumentsObject(ExecState *exec) const 540 540 { 541 _argumentsObject = new Arguments Imp(exec, _function, _arguments, const_cast<ActivationImp *>(this));541 _argumentsObject = new Arguments(exec, _function, _arguments, const_cast<ActivationImp *>(this)); 542 542 } 543 543 … … 545 545 546 546 547 GlobalFuncImp::GlobalFuncImp(ExecState *exec, FunctionPrototype Imp*funcProto, int i, int len)547 GlobalFuncImp::GlobalFuncImp(ExecState *exec, FunctionPrototype *funcProto, int i, int len) 548 548 : InternalFunctionImp(funcProto), id(i) 549 549 { … … 561 561 } 562 562 563 static ValueImp*encode(ExecState *exec, const List &args, const char *do_not_escape)563 static JSValue *encode(ExecState *exec, const List &args, const char *do_not_escape) 564 564 { 565 565 UString r = "", s, str = args[0]->toString(exec); … … 579 579 } 580 580 581 static ValueImp*decode(ExecState *exec, const List &args, const char *do_not_unescape, bool strict)581 static JSValue *decode(ExecState *exec, const List &args, const char *do_not_unescape, bool strict) 582 582 { 583 583 UString s = "", str = args[0]->toString(exec); … … 748 748 } 749 749 750 ValueImp *GlobalFuncImp::callAsFunction(ExecState *exec, ObjectImp*/*thisObj*/, const List &args)751 { 752 ValueImp*res = jsUndefined();750 JSValue *GlobalFuncImp::callAsFunction(ExecState *exec, JSObject */*thisObj*/, const List &args) 751 { 752 JSValue *res = jsUndefined(); 753 753 754 754 static const char do_not_escape[] = … … 773 773 switch (id) { 774 774 case Eval: { // eval() 775 ValueImp*x = args[0];775 JSValue *x = args[0]; 776 776 if (!x->isString()) 777 777 return x; … … 797 797 798 798 // enter a new execution context 799 ObjectImp *thisVal = static_cast<ObjectImp*>(exec->context().thisValue());799 JSObject *thisVal = static_cast<JSObject *>(exec->context().thisValue()); 800 800 ContextImp ctx(exec->dynamicInterpreter()->globalObject(), 801 801 exec->dynamicInterpreter()->imp(),
Note:
See TracChangeset
for help on using the changeset viewer.