Changeset 37324 in webkit for trunk/JavaScriptCore/kjs
- Timestamp:
- Oct 5, 2008, 11:00:58 PM (17 years ago)
- Location:
- trunk/JavaScriptCore/kjs
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/Arguments.cpp
r37268 r37324 65 65 if (!d->callee->marked()) 66 66 d->callee->mark(); 67 68 if (d->activation && !d->activation->marked())69 d->activation->mark();70 67 } 71 68 -
trunk/JavaScriptCore/kjs/Arguments.h
r37268 r37324 33 33 34 34 struct ArgumentsData : Noncopyable { 35 JSActivation* activation;36 37 35 unsigned numParameters; 38 36 ptrdiff_t firstParameterIndex; … … 55 53 public: 56 54 Arguments(ExecState*, Register* callFrame); 57 Arguments(ExecState*, JSActivation*);58 55 virtual ~Arguments(); 59 56 … … 65 62 66 63 void copyRegisters(); 64 bool isTornOff() const { return d->registerArray; } 67 65 void setRegisters(Register* registers) { d->registers = registers; } 68 66 … … 82 80 }; 83 81 84 inline void Arguments::init(ExecState* exec, Register* callFrame) 82 inline Arguments::Arguments(ExecState* exec, Register* callFrame) 83 : JSObject(exec->lexicalGlobalObject()->argumentsStructure()) 84 , d(new ArgumentsData) 85 85 { 86 86 JSFunction* callee; … … 116 116 } 117 117 118 inline Arguments::Arguments(ExecState* exec, Register* callFrame)119 : JSObject(exec->lexicalGlobalObject()->argumentsStructure())120 , d(new ArgumentsData)121 {122 d->activation = 0;123 init(exec, callFrame);124 }125 126 inline Arguments::Arguments(ExecState* exec, JSActivation* activation)127 : JSObject(exec->lexicalGlobalObject()->argumentsStructure())128 , d(new ArgumentsData)129 {130 ASSERT(activation);131 d->activation = activation;132 init(exec, &activation->registerAt(0));133 }134 135 118 inline void Arguments::copyRegisters() 136 119 { 137 ASSERT(!d->activation); 138 ASSERT(!d->registerArray); 120 ASSERT(!isTornOff()); 139 121 140 122 if (!d->numParameters) … … 151 133 152 134 // This JSActivation function is defined here so it can get at Arguments::setRegisters. 153 inline void JSActivation::copyRegisters( JSValue* arguments)135 inline void JSActivation::copyRegisters(Arguments* arguments) 154 136 { 155 137 ASSERT(!d()->registerArray); … … 167 149 Register* registerArray = copyRegisterArray(d()->registers - registerOffset, registerArraySize); 168 150 setRegisters(registerArray + registerOffset, registerArray); 169 if (arguments) { 170 ASSERT(arguments->isObject(&Arguments::info)); 151 if (arguments && !arguments->isTornOff()) 171 152 static_cast<Arguments*>(arguments)->setRegisters(registerArray + registerOffset); 172 }173 153 } 174 154 -
trunk/JavaScriptCore/kjs/JSActivation.cpp
r37285 r37324 156 156 JSActivation* thisObj = static_cast<JSActivation*>(slot.slotBase()); 157 157 158 JSValue* arguments;159 158 if (thisObj->d()->functionBody->usesArguments()) { 160 159 PropertySlot slot; 161 160 thisObj->symbolTableGet(exec->propertyNames().arguments, slot); 162 arguments = slot.getValue(exec, exec->propertyNames().arguments); 163 } else { 164 arguments = thisObj->d()->registers[RegisterFile::OptionalCalleeArguments].getJSValue(); 165 if (!arguments) { 166 arguments = new (exec) Arguments(exec, thisObj); 167 thisObj->d()->registers[RegisterFile::OptionalCalleeArguments] = arguments; 168 } 169 ASSERT(arguments->isObject(&Arguments::info)); 161 return slot.getValue(exec, exec->propertyNames().arguments); 170 162 } 163 164 Arguments* arguments = static_cast<Arguments*>(thisObj->d()->registers[RegisterFile::OptionalCalleeArguments].getJSValue()); 165 if (!arguments) { 166 arguments = new (exec) Arguments(exec, &thisObj->registerAt(0)); 167 arguments->copyRegisters(); 168 thisObj->d()->registers[RegisterFile::OptionalCalleeArguments] = arguments; 169 } 170 ASSERT(arguments->isObject(&Arguments::info)); 171 171 172 172 return arguments; -
trunk/JavaScriptCore/kjs/JSActivation.h
r37285 r37324 60 60 virtual JSObject* toThisObject(ExecState*) const; 61 61 62 void copyRegisters( JSValue* arguments);62 void copyRegisters(Arguments* arguments); 63 63 64 64 virtual const ClassInfo* classInfo() const { return &info; }
Note:
See TracChangeset
for help on using the changeset viewer.