From a89b2ebb8e192c5e8cea21079bda2ee2c0c7dddd Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 25 May 2012 15:09:11 +0200 Subject: Imported WebKit commit eb5c1b8fe4d4b1b90b5137433fc58a91da0e6878 (http://svn.webkit.org/repository/webkit/trunk@118516) --- Source/JavaScriptCore/runtime/Arguments.cpp | 30 ++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'Source/JavaScriptCore/runtime/Arguments.cpp') diff --git a/Source/JavaScriptCore/runtime/Arguments.cpp b/Source/JavaScriptCore/runtime/Arguments.cpp index 1fd05fd9e..4628cec8d 100644 --- a/Source/JavaScriptCore/runtime/Arguments.cpp +++ b/Source/JavaScriptCore/runtime/Arguments.cpp @@ -358,6 +358,9 @@ void Arguments::tearOff(CallFrame* callFrame) if (!d->numArguments) return; + // Must be called for the same call frame from which it was created. + ASSERT(bitwise_cast*>(callFrame) == d->registers); + d->registerArray = adoptArrayPtr(new WriteBarrier[d->numArguments]); d->registers = d->registerArray.get() + CallFrame::offsetFor(d->numArguments + 1); @@ -367,7 +370,28 @@ void Arguments::tearOff(CallFrame* callFrame) return; } - InlineCallFrame* inlineCallFrame = callFrame->inlineCallFrame(); + tearOffForInlineCallFrame( + callFrame->globalData(), callFrame->registers(), callFrame->inlineCallFrame()); +} + +void Arguments::tearOff(CallFrame* callFrame, InlineCallFrame* inlineCallFrame) +{ + if (isTornOff()) + return; + + if (!d->numArguments) + return; + + d->registerArray = adoptArrayPtr(new WriteBarrier[d->numArguments]); + d->registers = d->registerArray.get() + CallFrame::offsetFor(d->numArguments + 1); + + tearOffForInlineCallFrame( + callFrame->globalData(), callFrame->registers() + inlineCallFrame->stackOffset, + inlineCallFrame); +} + +void Arguments::tearOffForInlineCallFrame(JSGlobalData& globalData, Register* registers, InlineCallFrame* inlineCallFrame) +{ for (size_t i = 0; i < d->numArguments; ++i) { ValueRecovery& recovery = inlineCallFrame->arguments[i + 1]; // In the future we'll support displaced recoveries (indicating that the @@ -376,7 +400,7 @@ void Arguments::tearOff(CallFrame* callFrame) // it's much less likely that we'll support in-register recoveries since // this code does not (easily) have access to registers. JSValue value; - Register* location = &callFrame->registers()[CallFrame::argumentOffset(i)]; + Register* location = ®isters[CallFrame::argumentOffset(i)]; switch (recovery.technique()) { case AlreadyInRegisterFile: value = location->jsValue(); @@ -404,7 +428,7 @@ void Arguments::tearOff(CallFrame* callFrame) ASSERT_NOT_REACHED(); break; } - argument(i).set(callFrame->globalData(), this, value); + argument(i).set(globalData, this, value); } } -- cgit v1.2.1