summaryrefslogtreecommitdiffstats
path: root/Source/JavaScriptCore/interpreter/Interpreter.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-18 13:36:51 +0100
committerSteve Block <steveblock@google.com>2011-05-24 15:38:28 +0100
commit2fc2651226baac27029e38c9d6ef883fa32084db (patch)
treee396d4bf89dcce6ed02071be66212495b1df1dec /Source/JavaScriptCore/interpreter/Interpreter.cpp
parentb3725cedeb43722b3b175aaeff70552e562d2c94 (diff)
downloadexternal_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.zip
external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.gz
external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.bz2
Merge WebKit at r78450: Initial merge by git.
Change-Id: I6d3e5f1f868ec266a0aafdef66182ddc3f265dc1
Diffstat (limited to 'Source/JavaScriptCore/interpreter/Interpreter.cpp')
-rw-r--r--Source/JavaScriptCore/interpreter/Interpreter.cpp54
1 files changed, 28 insertions, 26 deletions
diff --git a/Source/JavaScriptCore/interpreter/Interpreter.cpp b/Source/JavaScriptCore/interpreter/Interpreter.cpp
index 392e8b8..c2612ac 100644
--- a/Source/JavaScriptCore/interpreter/Interpreter.cpp
+++ b/Source/JavaScriptCore/interpreter/Interpreter.cpp
@@ -103,11 +103,11 @@ NEVER_INLINE bool Interpreter::resolve(CallFrame* callFrame, Instruction* vPC, J
CodeBlock* codeBlock = callFrame->codeBlock();
Identifier& ident = codeBlock->identifier(property);
do {
- JSObject* o = *iter;
+ JSObject* o = iter->get();
PropertySlot slot(o);
if (o->getPropertySlot(callFrame, ident, slot)) {
JSValue result = slot.getValue(callFrame, ident);
- exceptionValue = callFrame->globalData().exception;
+ exceptionValue = callFrame->globalData().exception.get();
if (exceptionValue)
return false;
callFrame->uncheckedR(dst) = JSValue(result);
@@ -142,11 +142,11 @@ NEVER_INLINE bool Interpreter::resolveSkip(CallFrame* callFrame, Instruction* vP
}
Identifier& ident = codeBlock->identifier(property);
do {
- JSObject* o = *iter;
+ JSObject* o = iter->get();
PropertySlot slot(o);
if (o->getPropertySlot(callFrame, ident, slot)) {
JSValue result = slot.getValue(callFrame, ident);
- exceptionValue = callFrame->globalData().exception;
+ exceptionValue = callFrame->globalData().exception.get();
if (exceptionValue)
return false;
ASSERT(result);
@@ -187,7 +187,7 @@ NEVER_INLINE bool Interpreter::resolveGlobal(CallFrame* callFrame, Instruction*
return true;
}
- exceptionValue = callFrame->globalData().exception;
+ exceptionValue = callFrame->globalData().exception.get();
if (exceptionValue)
return false;
callFrame->uncheckedR(dst) = JSValue(result);
@@ -220,14 +220,14 @@ NEVER_INLINE bool Interpreter::resolveGlobalDynamic(CallFrame* callFrame, Instru
++iter;
}
while (skip--) {
- JSObject* o = *iter;
+ JSObject* o = iter->get();
if (o->hasCustomProperties()) {
Identifier& ident = codeBlock->identifier(property);
do {
PropertySlot slot(o);
if (o->getPropertySlot(callFrame, ident, slot)) {
JSValue result = slot.getValue(callFrame, ident);
- exceptionValue = callFrame->globalData().exception;
+ exceptionValue = callFrame->globalData().exception.get();
if (exceptionValue)
return false;
ASSERT(result);
@@ -236,7 +236,7 @@ NEVER_INLINE bool Interpreter::resolveGlobalDynamic(CallFrame* callFrame, Instru
}
if (iter == end)
break;
- o = *iter;
+ o = iter->get();
++iter;
} while (true);
exceptionValue = createUndefinedVariableError(callFrame, ident);
@@ -266,7 +266,7 @@ NEVER_INLINE bool Interpreter::resolveGlobalDynamic(CallFrame* callFrame, Instru
return true;
}
- exceptionValue = callFrame->globalData().exception;
+ exceptionValue = callFrame->globalData().exception.get();
if (exceptionValue)
return false;
ASSERT(result);
@@ -310,11 +310,11 @@ NEVER_INLINE bool Interpreter::resolveBaseAndProperty(CallFrame* callFrame, Inst
Identifier& ident = codeBlock->identifier(property);
JSObject* base;
do {
- base = *iter;
+ base = iter->get();
PropertySlot slot(base);
if (base->getPropertySlot(callFrame, ident, slot)) {
JSValue result = slot.getValue(callFrame, ident);
- exceptionValue = callFrame->globalData().exception;
+ exceptionValue = callFrame->globalData().exception.get();
if (exceptionValue)
return false;
callFrame->uncheckedR(propDst) = JSValue(result);
@@ -566,11 +566,13 @@ NEVER_INLINE bool Interpreter::unwindCallFrame(CallFrame*& callFrame, JSValue ex
}
while (!scopeChain->object->inherits(&JSActivation::info))
scopeChain = scopeChain->pop();
- JSActivation* activation = asActivation(scopeChain->object);
+
+ callFrame->setScopeChain(scopeChain);
+ JSActivation* activation = asActivation(scopeChain->object.get());
activation->copyRegisters();
if (JSValue arguments = callFrame->uncheckedR(unmodifiedArgumentsRegister(oldCodeBlock->argumentsRegister())).jsValue()) {
if (!oldCodeBlock->isStrictMode())
- asArguments(arguments)->setActivation(activation);
+ asArguments(arguments)->setActivation(callFrame->globalData(), activation);
}
} else if (oldCodeBlock->usesArguments() && !oldCodeBlock->isStrictMode()) {
if (JSValue arguments = callFrame->uncheckedR(unmodifiedArgumentsRegister(oldCodeBlock->argumentsRegister())).jsValue())
@@ -648,7 +650,7 @@ static void appendSourceToError(CallFrame* callFrame, ErrorInstance* exception,
message = makeUString(message, " (near '...", codeBlock->source()->getRange(start, stop), "...')");
}
- exception->putDirect(globalData->propertyNames->message, jsString(globalData, message));
+ exception->putDirect(*globalData, globalData->propertyNames->message, jsString(globalData, message));
}
NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSValue& exceptionValue, unsigned bytecodeOffset)
@@ -1085,7 +1087,7 @@ JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSObjec
for (ScopeChainNode* node = scopeChain; ; node = node->next) {
ASSERT(node);
if (node->object->isVariableObject()) {
- variableObject = static_cast<JSVariableObject*>(node->object);
+ variableObject = static_cast<JSVariableObject*>(node->object.get());
break;
}
}
@@ -1100,7 +1102,7 @@ JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSObjec
pushedScope = true;
}
// Scope for BatchedTransitionOptimizer
- BatchedTransitionOptimizer optimizer(variableObject);
+ BatchedTransitionOptimizer optimizer(callFrame->globalData(), variableObject);
for (unsigned i = 0; i < numVariables; ++i) {
const Identifier& ident = codeBlock->variable(i);
@@ -1371,7 +1373,7 @@ NEVER_INLINE void Interpreter::tryCacheGetByID(CallFrame* callFrame, CodeBlock*
// Since we're accessing a prototype in a loop, it's a good bet that it
// should not be treated as a dictionary.
if (baseObject->structure()->isDictionary()) {
- baseObject->flattenDictionaryObject();
+ baseObject->flattenDictionaryObject(callFrame->globalData());
offset = baseObject->structure()->get(propertyName);
}
@@ -1475,8 +1477,8 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
#define CHECK_FOR_EXCEPTION() \
do { \
- if (UNLIKELY(globalData->exception != JSValue())) { \
- exceptionValue = globalData->exception; \
+ if (UNLIKELY(globalData->exception.get() != JSValue())) { \
+ exceptionValue = globalData->exception.get(); \
goto vm_throw; \
} \
} while (0)
@@ -2408,7 +2410,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
ASSERT(iter != end);
}
ASSERT((*iter)->isVariableObject());
- JSVariableObject* scope = static_cast<JSVariableObject*>(*iter);
+ JSVariableObject* scope = static_cast<JSVariableObject*>(iter->get());
callFrame->uncheckedR(dst) = scope->registerAt(index);
ASSERT(callFrame->r(dst).jsValue());
vPC += OPCODE_LENGTH(op_get_scoped_var);
@@ -2439,7 +2441,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
}
ASSERT((*iter)->isVariableObject());
- JSVariableObject* scope = static_cast<JSVariableObject*>(*iter);
+ JSVariableObject* scope = static_cast<JSVariableObject*>(iter->get());
ASSERT(callFrame->r(value).jsValue());
scope->registerAt(index) = JSValue(callFrame->r(value).jsValue());
vPC += OPCODE_LENGTH(op_put_scoped_var);
@@ -3080,7 +3082,7 @@ skip_id_custom_self:
int value = vPC[3].u.operand;
unsigned offset = vPC[7].u.operand;
ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(codeBlock->identifier(vPC[2].u.operand))) == offset);
- baseObject->putDirectOffset(offset, callFrame->r(value).jsValue());
+ baseObject->putDirectOffset(callFrame->globalData(), offset, callFrame->r(value).jsValue());
vPC += OPCODE_LENGTH(op_put_by_id_transition);
NEXT_INSTRUCTION();
@@ -3115,7 +3117,7 @@ skip_id_custom_self:
unsigned offset = vPC[5].u.operand;
ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(codeBlock->identifier(vPC[2].u.operand))) == offset);
- baseObject->putDirectOffset(offset, callFrame->r(value).jsValue());
+ baseObject->putDirectOffset(callFrame->globalData(), offset, callFrame->r(value).jsValue());
vPC += OPCODE_LENGTH(op_put_by_id_replace);
NEXT_INSTRUCTION();
@@ -3309,7 +3311,7 @@ skip_id_custom_self:
if (isJSArray(globalData, baseValue)) {
JSArray* jsArray = asArray(baseValue);
if (jsArray->canSetIndex(i))
- jsArray->setIndex(i, callFrame->r(value).jsValue());
+ jsArray->setIndex(*globalData, i, callFrame->r(value).jsValue());
else
jsArray->JSArray::put(callFrame, i, callFrame->r(value).jsValue());
} else if (isJSByteArray(globalData, baseValue) && asByteArray(baseValue)->canAccessIndex(i)) {
@@ -3835,7 +3837,7 @@ skip_id_custom_self:
if (thisValue == globalObject && funcVal == globalObject->evalFunction()) {
JSValue result = callEval(callFrame, registerFile, argv, argCount, registerOffset);
- if ((exceptionValue = globalData->exception))
+ if ((exceptionValue = globalData->exception.get()))
goto vm_throw;
functionReturnValue = result;
@@ -4103,7 +4105,7 @@ skip_id_custom_self:
if (JSValue argumentsValue = callFrame->r(unmodifiedArgumentsRegister(arguments)).jsValue()) {
if (!codeBlock->isStrictMode())
- asArguments(argumentsValue)->setActivation(asActivation(activationValue));
+ asArguments(argumentsValue)->setActivation(*globalData, asActivation(activationValue));
}
} else if (JSValue argumentsValue = callFrame->r(unmodifiedArgumentsRegister(arguments)).jsValue()) {
if (!codeBlock->isStrictMode())