summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/interpreter/Interpreter.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-09-24 13:09:44 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-09-24 13:09:44 +0200
commitdc6262b587c71c14e30d93e57ed812e36a79a33e (patch)
tree03ff986e7aa38bba0c0ef374f44fda52aff93f01 /Source/JavaScriptCore/interpreter/Interpreter.cpp
parent02e1fbbefd49229b102ef107bd70ce974a2d85fb (diff)
downloadqtwebkit-dc6262b587c71c14e30d93e57ed812e36a79a33e.tar.gz
Imported WebKit commit 6339232fec7f5d9984a33388aecfd2cbc7832053 (http://svn.webkit.org/repository/webkit/trunk@129343)
New snapshot with build fixes for latest qtbase
Diffstat (limited to 'Source/JavaScriptCore/interpreter/Interpreter.cpp')
-rw-r--r--Source/JavaScriptCore/interpreter/Interpreter.cpp47
1 files changed, 26 insertions, 21 deletions
diff --git a/Source/JavaScriptCore/interpreter/Interpreter.cpp b/Source/JavaScriptCore/interpreter/Interpreter.cpp
index ef6cbd5a6..3b3409bd6 100644
--- a/Source/JavaScriptCore/interpreter/Interpreter.cpp
+++ b/Source/JavaScriptCore/interpreter/Interpreter.cpp
@@ -131,14 +131,6 @@ static NEVER_INLINE bool isInvalidParamForIn(CallFrame* callFrame, JSValue value
exceptionData = createInvalidParamError(callFrame, "in" , value);
return true;
}
-
-static NEVER_INLINE bool isInvalidParamForInstanceOf(CallFrame* callFrame, JSValue value, JSValue& exceptionData)
-{
- if (value.isObject() && asObject(value)->structure()->typeInfo().implementsHasInstance())
- return false;
- exceptionData = createInvalidParamError(callFrame, "instanceof" , value);
- return true;
-}
#endif
JSValue eval(CallFrame* callFrame)
@@ -202,7 +194,7 @@ CallFrame* loadVarargs(CallFrame* callFrame, RegisterFile* registerFile, JSValue
newCallFrame->setArgumentCountIncludingThis(argumentCountIncludingThis);
newCallFrame->setThisValue(thisValue);
for (size_t i = 0; i < callFrame->argumentCount(); ++i)
- newCallFrame->setArgument(i, callFrame->argument(i));
+ newCallFrame->setArgument(i, callFrame->argumentAfterCapture(i));
return newCallFrame;
}
@@ -2401,14 +2393,32 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
JSC API*). Raises an exception if register constructor is not
an valid parameter for instanceof.
*/
- int base = vPC[1].u.operand;
+ int dst = vPC[1].u.operand;
+ int value = vPC[2].u.operand;
+ int base = vPC[3].u.operand;
+ int target = vPC[4].u.operand;
+
JSValue baseVal = callFrame->r(base).jsValue();
- if (isInvalidParamForInstanceOf(callFrame, baseVal, exceptionValue))
- goto vm_throw;
+ if (baseVal.isObject()) {
+ TypeInfo info = asObject(baseVal)->structure()->typeInfo();
+ if (info.implementsDefaultHasInstance()) {
+ vPC += OPCODE_LENGTH(op_check_has_instance);
+ NEXT_INSTRUCTION();
+ }
+ if (info.implementsHasInstance()) {
+ JSValue baseVal = callFrame->r(base).jsValue();
+ bool result = asObject(baseVal)->methodTable()->customHasInstance(asObject(baseVal), callFrame, callFrame->r(value).jsValue());
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = jsBoolean(result);
- vPC += OPCODE_LENGTH(op_check_has_instance);
- NEXT_INSTRUCTION();
+ vPC += target;
+ NEXT_INSTRUCTION();
+ }
+ }
+
+ exceptionValue = createInvalidParamError(callFrame, "instanceof" , baseVal);
+ goto vm_throw;
}
DEFINE_OPCODE(op_instanceof) {
/* instanceof dst(r) value(r) constructor(r) constructorProto(r)
@@ -2425,14 +2435,9 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
int dst = vPC[1].u.operand;
int value = vPC[2].u.operand;
- int base = vPC[3].u.operand;
- int baseProto = vPC[4].u.operand;
-
- JSValue baseVal = callFrame->r(base).jsValue();
-
- ASSERT(!isInvalidParamForInstanceOf(callFrame, baseVal, exceptionValue));
+ int baseProto = vPC[3].u.operand;
- bool result = asObject(baseVal)->methodTable()->hasInstance(asObject(baseVal), callFrame, callFrame->r(value).jsValue(), callFrame->r(baseProto).jsValue());
+ bool result = JSObject::defaultHasInstance(callFrame, callFrame->r(value).jsValue(), callFrame->r(baseProto).jsValue());
CHECK_FOR_EXCEPTION();
callFrame->uncheckedR(dst) = jsBoolean(result);