summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-06-15 19:36:43 +0100
committerBen Murdoch <benm@google.com>2010-06-16 14:52:28 +0100
commit545e470e52f0ac6a3a072bf559c796b42c6066b6 (patch)
treec0c14763654d84d37577dde512c3d3b4699a9e86 /JavaScriptCore
parent719298a66237d38ea5c05f1547123ad8aacbc237 (diff)
downloadexternal_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.zip
external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.tar.gz
external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.tar.bz2
Merge webkit.org at r61121: Initial merge by git.
Change-Id: Icd6db395c62285be384d137164d95d7466c98760
Diffstat (limited to 'JavaScriptCore')
-rw-r--r--JavaScriptCore/API/JSCallbackConstructor.cpp14
-rw-r--r--JavaScriptCore/API/JSCallbackFunction.cpp7
-rw-r--r--JavaScriptCore/API/JSCallbackFunction.h2
-rw-r--r--JavaScriptCore/API/JSCallbackObject.h4
-rw-r--r--JavaScriptCore/API/JSCallbackObjectFunctions.h48
-rw-r--r--JavaScriptCore/API/JSObjectRef.cpp7
-rw-r--r--JavaScriptCore/CMakeLists.txt5
-rw-r--r--JavaScriptCore/ChangeLog1118
-rw-r--r--JavaScriptCore/Configurations/FeatureDefines.xcconfig4
-rw-r--r--JavaScriptCore/Configurations/JavaScriptCore.xcconfig18
-rw-r--r--JavaScriptCore/DerivedSources.make12
-rw-r--r--JavaScriptCore/JavaScriptCore.JSVALUE32_64only.exp2
-rw-r--r--JavaScriptCore/JavaScriptCore.JSVALUE32only.exp2
-rw-r--r--JavaScriptCore/JavaScriptCore.JSVALUE64only.exp2
-rw-r--r--JavaScriptCore/JavaScriptCore.exp20
-rw-r--r--JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def23
-rw-r--r--JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj23
-rw-r--r--JavaScriptCore/assembler/MacroAssemblerARMv7.h8
-rw-r--r--JavaScriptCore/bytecompiler/BytecodeGenerator.cpp113
-rw-r--r--JavaScriptCore/bytecompiler/BytecodeGenerator.h32
-rw-r--r--JavaScriptCore/bytecompiler/NodesCodegen.cpp164
-rw-r--r--JavaScriptCore/interpreter/CallFrame.h1
-rw-r--r--JavaScriptCore/interpreter/Interpreter.cpp140
-rw-r--r--JavaScriptCore/interpreter/Interpreter.h2
-rw-r--r--JavaScriptCore/jit/JITArithmetic32_64.cpp4
-rw-r--r--JavaScriptCore/jit/JITOpcodes.cpp1
-rw-r--r--JavaScriptCore/jit/JITOpcodes32_64.cpp4
-rw-r--r--JavaScriptCore/jit/JITStubs.cpp38
-rw-r--r--JavaScriptCore/jit/JITStubs.h1
-rw-r--r--JavaScriptCore/jsc.cpp77
-rw-r--r--JavaScriptCore/jsc/CMakeListsEfl.txt5
-rw-r--r--JavaScriptCore/parser/Nodes.h6
-rw-r--r--JavaScriptCore/pcre/pcre_exec.cpp2
-rw-r--r--JavaScriptCore/qt/api/qscriptengine.cpp13
-rw-r--r--JavaScriptCore/qt/api/qscriptengine.h1
-rw-r--r--JavaScriptCore/qt/api/qscriptengine_p.cpp9
-rw-r--r--JavaScriptCore/qt/api/qscriptengine_p.h6
-rw-r--r--JavaScriptCore/qt/api/qscriptprogram_p.h8
-rw-r--r--JavaScriptCore/qt/api/qscriptsyntaxcheckresult.cpp8
-rw-r--r--JavaScriptCore/qt/api/qscriptvalue.cpp18
-rw-r--r--JavaScriptCore/qt/api/qscriptvalue.h1
-rw-r--r--JavaScriptCore/qt/api/qscriptvalue_p.h185
-rw-r--r--JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp14
-rw-r--r--JavaScriptCore/qt/tests/qscriptvalue/qscriptvalue.pro1
-rw-r--r--JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h21
-rw-r--r--JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp1742
-rw-r--r--JavaScriptCore/runtime/ArrayConstructor.cpp18
-rw-r--r--JavaScriptCore/runtime/ArrayPrototype.cpp212
-rw-r--r--JavaScriptCore/runtime/BooleanConstructor.cpp9
-rw-r--r--JavaScriptCore/runtime/BooleanPrototype.cpp25
-rw-r--r--JavaScriptCore/runtime/CallData.h4
-rw-r--r--JavaScriptCore/runtime/ConstructData.cpp23
-rw-r--r--JavaScriptCore/runtime/ConstructData.h5
-rw-r--r--JavaScriptCore/runtime/DateConstructor.cpp29
-rw-r--r--JavaScriptCore/runtime/DatePrototype.cpp390
-rw-r--r--JavaScriptCore/runtime/Error.cpp206
-rw-r--r--JavaScriptCore/runtime/Error.h66
-rw-r--r--JavaScriptCore/runtime/ErrorConstructor.cpp20
-rw-r--r--JavaScriptCore/runtime/ErrorConstructor.h2
-rw-r--r--JavaScriptCore/runtime/ErrorInstance.cpp18
-rw-r--r--JavaScriptCore/runtime/ErrorInstance.h8
-rw-r--r--JavaScriptCore/runtime/ErrorPrototype.cpp16
-rw-r--r--JavaScriptCore/runtime/ExceptionHelpers.cpp42
-rw-r--r--JavaScriptCore/runtime/ExceptionHelpers.h5
-rw-r--r--JavaScriptCore/runtime/Executable.cpp18
-rw-r--r--JavaScriptCore/runtime/FunctionConstructor.cpp17
-rw-r--r--JavaScriptCore/runtime/FunctionPrototype.cpp40
-rw-r--r--JavaScriptCore/runtime/Identifier.cpp15
-rw-r--r--JavaScriptCore/runtime/Identifier.h3
-rw-r--r--JavaScriptCore/runtime/JSArray.cpp2
-rw-r--r--JavaScriptCore/runtime/JSCell.h14
-rw-r--r--JavaScriptCore/runtime/JSFunction.cpp5
-rw-r--r--JavaScriptCore/runtime/JSFunction.h2
-rw-r--r--JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp70
-rw-r--r--JavaScriptCore/runtime/JSGlobalObjectFunctions.h26
-rw-r--r--JavaScriptCore/runtime/JSONObject.cpp60
-rw-r--r--JavaScriptCore/runtime/JSObject.cpp39
-rw-r--r--JavaScriptCore/runtime/JSObject.h3
-rw-r--r--JavaScriptCore/runtime/JSValue.cpp7
-rw-r--r--JavaScriptCore/runtime/JSValue.h6
-rw-r--r--JavaScriptCore/runtime/MathObject.cpp112
-rw-r--r--JavaScriptCore/runtime/NativeErrorConstructor.cpp22
-rw-r--r--JavaScriptCore/runtime/NativeErrorConstructor.h2
-rw-r--r--JavaScriptCore/runtime/NumberConstructor.cpp10
-rw-r--r--JavaScriptCore/runtime/NumberPrototype.cpp84
-rw-r--r--JavaScriptCore/runtime/ObjectConstructor.cpp96
-rw-r--r--JavaScriptCore/runtime/ObjectPrototype.cpp70
-rw-r--r--JavaScriptCore/runtime/ObjectPrototype.h2
-rw-r--r--JavaScriptCore/runtime/RegExpConstructor.cpp14
-rw-r--r--JavaScriptCore/runtime/RegExpObject.cpp7
-rw-r--r--JavaScriptCore/runtime/RegExpPrototype.cpp40
-rw-r--r--JavaScriptCore/runtime/StringConstructor.cpp20
-rw-r--r--JavaScriptCore/runtime/StringPrototype.cpp268
-rw-r--r--JavaScriptCore/wtf/CMakeLists.txt4
-rw-r--r--JavaScriptCore/wtf/Deque.h9
-rw-r--r--JavaScriptCore/wtf/MainThread.cpp3
-rw-r--r--JavaScriptCore/wtf/MathExtras.h2
-rw-r--r--JavaScriptCore/wtf/MessageQueue.h4
-rw-r--r--JavaScriptCore/wtf/OwnPtrCommon.h4
-rw-r--r--JavaScriptCore/wtf/Platform.h17
-rw-r--r--JavaScriptCore/wtf/RandomNumber.cpp14
-rw-r--r--JavaScriptCore/wtf/RandomNumber.h6
-rw-r--r--JavaScriptCore/wtf/ThreadingPthreads.cpp16
-rw-r--r--JavaScriptCore/wtf/Vector.h10
-rw-r--r--JavaScriptCore/wtf/brew/OwnPtrBrew.cpp14
-rw-r--r--JavaScriptCore/wtf/gtk/ThreadingGtk.cpp11
-rw-r--r--JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h1
-rw-r--r--JavaScriptCore/wtf/unicode/wince/UnicodeWince.h1
108 files changed, 4697 insertions, 1527 deletions
diff --git a/JavaScriptCore/API/JSCallbackConstructor.cpp b/JavaScriptCore/API/JSCallbackConstructor.cpp
index 2948932..66c6b88 100644
--- a/JavaScriptCore/API/JSCallbackConstructor.cpp
+++ b/JavaScriptCore/API/JSCallbackConstructor.cpp
@@ -28,6 +28,7 @@
#include "APIShims.h"
#include "APICast.h"
+#include <runtime/Error.h>
#include <runtime/JSGlobalObject.h>
#include <runtime/JSLock.h>
#include <runtime/ObjectPrototype.h>
@@ -52,17 +53,18 @@ JSCallbackConstructor::~JSCallbackConstructor()
JSClassRelease(m_class);
}
-static JSObject* constructJSCallback(ExecState* exec, JSObject* constructor, const ArgList& args)
+static EncodedJSValue JSC_HOST_CALL constructJSCallback(ExecState* exec)
{
+ JSObject* constructor = exec->callee();
JSContextRef ctx = toRef(exec);
JSObjectRef constructorRef = toRef(constructor);
JSObjectCallAsConstructorCallback callback = static_cast<JSCallbackConstructor*>(constructor)->callback();
if (callback) {
- int argumentCount = static_cast<int>(args.size());
+ int argumentCount = static_cast<int>(exec->argumentCount());
Vector<JSValueRef, 16> arguments(argumentCount);
for (int i = 0; i < argumentCount; i++)
- arguments[i] = toRef(exec, args.at(i));
+ arguments[i] = toRef(exec, exec->argument(i));
JSValueRef exception = 0;
JSObjectRef result;
@@ -71,11 +73,11 @@ static JSObject* constructJSCallback(ExecState* exec, JSObject* constructor, con
result = callback(ctx, constructorRef, argumentCount, arguments.data(), &exception);
}
if (exception)
- exec->setException(toJS(exec, exception));
- return toJS(result);
+ throwError(exec, toJS(exec, exception));
+ return JSValue::encode(toJS(result));
}
- return toJS(JSObjectMake(ctx, static_cast<JSCallbackConstructor*>(constructor)->classRef(), 0));
+ return JSValue::encode(toJS(JSObjectMake(ctx, static_cast<JSCallbackConstructor*>(constructor)->classRef(), 0)));
}
ConstructType JSCallbackConstructor::getConstructData(ConstructData& constructData)
diff --git a/JavaScriptCore/API/JSCallbackFunction.cpp b/JavaScriptCore/API/JSCallbackFunction.cpp
index 9db9983..c488aa6 100644
--- a/JavaScriptCore/API/JSCallbackFunction.cpp
+++ b/JavaScriptCore/API/JSCallbackFunction.cpp
@@ -29,6 +29,7 @@
#include "APIShims.h"
#include "APICast.h"
#include "CodeBlock.h"
+#include "ExceptionHelpers.h"
#include "JSFunction.h"
#include "FunctionPrototype.h"
#include <runtime/JSGlobalObject.h>
@@ -47,7 +48,7 @@ JSCallbackFunction::JSCallbackFunction(ExecState* exec, JSGlobalObject* globalOb
{
}
-JSValue JSCallbackFunction::call(ExecState* exec)
+EncodedJSValue JSCallbackFunction::call(ExecState* exec)
{
JSContextRef execRef = toRef(exec);
JSObjectRef functionRef = toRef(exec->callee());
@@ -65,9 +66,9 @@ JSValue JSCallbackFunction::call(ExecState* exec)
result = static_cast<JSCallbackFunction*>(toJS(functionRef))->m_callback(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception);
}
if (exception)
- exec->setException(toJS(exec, exception));
+ throwError(exec, toJS(exec, exception));
- return toJS(exec, result);
+ return JSValue::encode(toJS(exec, result));
}
CallType JSCallbackFunction::getCallData(CallData& callData)
diff --git a/JavaScriptCore/API/JSCallbackFunction.h b/JavaScriptCore/API/JSCallbackFunction.h
index 3940e7d..b119b97 100644
--- a/JavaScriptCore/API/JSCallbackFunction.h
+++ b/JavaScriptCore/API/JSCallbackFunction.h
@@ -48,7 +48,7 @@ private:
virtual CallType getCallData(CallData&);
virtual const ClassInfo* classInfo() const { return &info; }
- static JSValue JSC_HOST_CALL call(ExecState*);
+ static EncodedJSValue JSC_HOST_CALL call(ExecState*);
JSObjectCallAsFunctionCallback m_callback;
};
diff --git a/JavaScriptCore/API/JSCallbackObject.h b/JavaScriptCore/API/JSCallbackObject.h
index 7216ac5..dfb9fa2 100644
--- a/JavaScriptCore/API/JSCallbackObject.h
+++ b/JavaScriptCore/API/JSCallbackObject.h
@@ -182,8 +182,8 @@ private:
static JSCallbackObject* asCallbackObject(JSValue);
- static JSValue JSC_HOST_CALL call(ExecState*);
- static JSObject* construct(ExecState*, JSObject* constructor, const ArgList&);
+ static EncodedJSValue JSC_HOST_CALL call(ExecState*);
+ static EncodedJSValue JSC_HOST_CALL construct(ExecState*);
static JSValue staticValueGetter(ExecState*, JSValue, const Identifier&);
static JSValue staticFunctionGetter(ExecState*, JSValue, const Identifier&);
diff --git a/JavaScriptCore/API/JSCallbackObjectFunctions.h b/JavaScriptCore/API/JSCallbackObjectFunctions.h
index ef1efd2..3a15bbe 100644
--- a/JavaScriptCore/API/JSCallbackObjectFunctions.h
+++ b/JavaScriptCore/API/JSCallbackObjectFunctions.h
@@ -27,6 +27,7 @@
#include "APIShims.h"
#include "APICast.h"
#include "Error.h"
+#include "ExceptionHelpers.h"
#include "JSCallbackFunction.h"
#include "JSClassRef.h"
#include "JSFunction.h"
@@ -134,7 +135,7 @@ bool JSCallbackObject<Base>::getOwnPropertySlot(ExecState* exec, const Identifie
value = getProperty(ctx, thisRef, propertyNameRef.get(), &exception);
}
if (exception) {
- exec->setException(toJS(exec, exception));
+ throwError(exec, toJS(exec, exception));
slot.setValue(jsUndefined());
return true;
}
@@ -206,7 +207,7 @@ void JSCallbackObject<Base>::put(ExecState* exec, const Identifier& propertyName
result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception);
}
if (exception)
- exec->setException(toJS(exec, exception));
+ throwError(exec, toJS(exec, exception));
if (result || exception)
return;
}
@@ -225,11 +226,11 @@ void JSCallbackObject<Base>::put(ExecState* exec, const Identifier& propertyName
result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception);
}
if (exception)
- exec->setException(toJS(exec, exception));
+ throwError(exec, toJS(exec, exception));
if (result || exception)
return;
} else
- throwError(exec, ReferenceError, "Attempt to set a property that is not settable.");
+ throwError(exec, createReferenceError(exec, "Attempt to set a property that is not settable."));
}
}
@@ -264,7 +265,7 @@ bool JSCallbackObject<Base>::deleteProperty(ExecState* exec, const Identifier& p
result = deleteProperty(ctx, thisRef, propertyNameRef.get(), &exception);
}
if (exception)
- exec->setException(toJS(exec, exception));
+ throwError(exec, toJS(exec, exception));
if (result || exception)
return true;
}
@@ -308,17 +309,18 @@ ConstructType JSCallbackObject<Base>::getConstructData(ConstructData& constructD
}
template <class Base>
-JSObject* JSCallbackObject<Base>::construct(ExecState* exec, JSObject* constructor, const ArgList& args)
+EncodedJSValue JSCallbackObject<Base>::construct(ExecState* exec)
{
+ JSObject* constructor = exec->callee();
JSContextRef execRef = toRef(exec);
JSObjectRef constructorRef = toRef(constructor);
for (JSClassRef jsClass = static_cast<JSCallbackObject<Base>*>(constructor)->classRef(); jsClass; jsClass = jsClass->parentClass) {
if (JSObjectCallAsConstructorCallback callAsConstructor = jsClass->callAsConstructor) {
- int argumentCount = static_cast<int>(args.size());
+ int argumentCount = static_cast<int>(exec->argumentCount());
Vector<JSValueRef, 16> arguments(argumentCount);
for (int i = 0; i < argumentCount; i++)
- arguments[i] = toRef(exec, args.at(i));
+ arguments[i] = toRef(exec, exec->argument(i));
JSValueRef exception = 0;
JSObject* result;
{
@@ -326,13 +328,13 @@ JSObject* JSCallbackObject<Base>::construct(ExecState* exec, JSObject* construct
result = toJS(callAsConstructor(execRef, constructorRef, argumentCount, arguments.data(), &exception));
}
if (exception)
- exec->setException(toJS(exec, exception));
- return result;
+ throwError(exec, toJS(exec, exception));
+ return JSValue::encode(result);
}
}
ASSERT_NOT_REACHED(); // getConstructData should prevent us from reaching here
- return 0;
+ return JSValue::encode(JSValue());
}
template <class Base>
@@ -351,7 +353,7 @@ bool JSCallbackObject<Base>::hasInstance(ExecState* exec, JSValue value, JSValue
result = hasInstance(execRef, thisRef, valueRef, &exception);
}
if (exception)
- exec->setException(toJS(exec, exception));
+ throwError(exec, toJS(exec, exception));
return result;
}
}
@@ -371,7 +373,7 @@ CallType JSCallbackObject<Base>::getCallData(CallData& callData)
}
template <class Base>
-JSValue JSCallbackObject<Base>::call(ExecState* exec)
+EncodedJSValue JSCallbackObject<Base>::call(ExecState* exec)
{
JSContextRef execRef = toRef(exec);
JSObjectRef functionRef = toRef(exec->callee());
@@ -390,13 +392,13 @@ JSValue JSCallbackObject<Base>::call(ExecState* exec)
result = toJS(exec, callAsFunction(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception));
}
if (exception)
- exec->setException(toJS(exec, exception));
- return result;
+ throwError(exec, toJS(exec, exception));
+ return JSValue::encode(result);
}
}
ASSERT_NOT_REACHED(); // getCallData should prevent us from reaching here
- return JSValue();
+ return JSValue::encode(JSValue());
}
template <class Base>
@@ -457,7 +459,7 @@ double JSCallbackObject<Base>::toNumber(ExecState* exec) const
value = convertToType(ctx, thisRef, kJSTypeNumber, &exception);
}
if (exception) {
- exec->setException(toJS(exec, exception));
+ throwError(exec, toJS(exec, exception));
return 0;
}
@@ -484,7 +486,7 @@ UString JSCallbackObject<Base>::toString(ExecState* exec) const
value = convertToType(ctx, thisRef, kJSTypeString, &exception);
}
if (exception) {
- exec->setException(toJS(exec, exception));
+ throwError(exec, toJS(exec, exception));
return "";
}
if (value)
@@ -537,14 +539,14 @@ JSValue JSCallbackObject<Base>::staticValueGetter(ExecState* exec, JSValue slotB
value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception);
}
if (exception) {
- exec->setException(toJS(exec, exception));
+ throwError(exec, toJS(exec, exception));
return jsUndefined();
}
if (value)
return toJS(exec, value);
}
- return throwError(exec, ReferenceError, "Static value property defined with NULL getProperty callback.");
+ return throwError(exec, createReferenceError(exec, "Static value property defined with NULL getProperty callback."));
}
template <class Base>
@@ -570,7 +572,7 @@ JSValue JSCallbackObject<Base>::staticFunctionGetter(ExecState* exec, JSValue sl
}
}
- return throwError(exec, ReferenceError, "Static function property defined with NULL callAsFunction callback.");
+ return throwError(exec, createReferenceError(exec, "Static function property defined with NULL callAsFunction callback."));
}
template <class Base>
@@ -592,14 +594,14 @@ JSValue JSCallbackObject<Base>::callbackGetter(ExecState* exec, JSValue slotBase
value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception);
}
if (exception) {
- exec->setException(toJS(exec, exception));
+ throwError(exec, toJS(exec, exception));
return jsUndefined();
}
if (value)
return toJS(exec, value);
}
- return throwError(exec, ReferenceError, "hasProperty callback returned true for a property that doesn't exist.");
+ return throwError(exec, createReferenceError(exec, "hasProperty callback returned true for a property that doesn't exist."));
}
} // namespace JSC
diff --git a/JavaScriptCore/API/JSObjectRef.cpp b/JavaScriptCore/API/JSObjectRef.cpp
index 70c4e14..5e0536f 100644
--- a/JavaScriptCore/API/JSObjectRef.cpp
+++ b/JavaScriptCore/API/JSObjectRef.cpp
@@ -184,11 +184,10 @@ JSObjectRef JSObjectMakeError(JSContextRef ctx, size_t argumentCount, const JSVa
ExecState* exec = toJS(ctx);
APIEntryShim entryShim(exec);
- MarkedArgumentBuffer argList;
- for (size_t i = 0; i < argumentCount; ++i)
- argList.append(toJS(exec, arguments[i]));
+ JSValue message = argumentCount ? toJS(exec, arguments[0]) : jsUndefined();
+ Structure* errorStructure = exec->lexicalGlobalObject()->errorStructure();
+ JSObject* result = ErrorInstance::create(exec, errorStructure, message);
- JSObject* result = constructError(exec, argList);
if (exec->hadException()) {
if (exception)
*exception = toRef(exec, exec->exception());
diff --git a/JavaScriptCore/CMakeLists.txt b/JavaScriptCore/CMakeLists.txt
index da7e119..d4a85d0 100644
--- a/JavaScriptCore/CMakeLists.txt
+++ b/JavaScriptCore/CMakeLists.txt
@@ -274,5 +274,6 @@ ADD_LIBRARY(${JavaScriptCore_LIBRARY_NAME} ${JavaScriptCore_LIBRARY_TYPE} ${Java
TARGET_LINK_LIBRARIES(${JavaScriptCore_LIBRARY_NAME} ${JavaScriptCore_LIBRARIES})
ADD_TARGET_PROPERTIES(${JavaScriptCore_LIBRARY_NAME} LINK_FLAGS ${JavaScriptCore_LINK_FLAGS})
-INSTALL(TARGETS ${JavaScriptCore_LIBRARY_NAME} DESTINATION lib)
-
+IF (SHARED_CORE)
+ INSTALL(TARGETS ${JavaScriptCore_LIBRARY_NAME} DESTINATION lib)
+ENDIF ()
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 3687d58..8d5b59e 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,1121 @@
+2010-06-11 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Rename the rest of the *Tokenizer classes to *DocumentParser
+ https://bugs.webkit.org/show_bug.cgi?id=40507
+
+ * wtf/Platform.h:
+ - fixed a comment to match new names.
+
+2010-06-11 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Explicit conversions from QtScript types to JSC opaque types were removed.
+ https://bugs.webkit.org/show_bug.cgi?id=40412
+
+ Conversion between a JSC C types and a QtScript private types, takes
+ main part of the source code. In most cases a mapping between the types
+ is one to one. New cast operators were added to simplify the code.
+
+ The QScriptValuePrivate could be casted to the JSValueRef and the JSObjectRef.
+ The QScriptEnginePrivate could be casted to the JSGlobalContext.
+ The QScriptProgramPrivate could be casted to the JSStringRef.
+
+ * qt/api/qscriptengine_p.cpp:
+ (QScriptEnginePrivate::evaluate):
+ (QScriptEnginePrivate::newObject):
+ (QScriptEnginePrivate::globalObject):
+ * qt/api/qscriptengine_p.h:
+ (QScriptEnginePrivate::operator JSGlobalContextRef):
+ * qt/api/qscriptprogram_p.h:
+ (QScriptProgramPrivate::operator JSStringRef):
+ * qt/api/qscriptsyntaxcheckresult.cpp:
+ (QScriptSyntaxCheckResultPrivate::~QScriptSyntaxCheckResultPrivate):
+ (QScriptSyntaxCheckResultPrivate::errorMessage):
+ (QScriptSyntaxCheckResultPrivate::errorLineNumber):
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::~QScriptValuePrivate):
+ (QScriptValuePrivate::QScriptValuePrivate):
+ (QScriptValuePrivate::isBool):
+ (QScriptValuePrivate::isNumber):
+ (QScriptValuePrivate::isNull):
+ (QScriptValuePrivate::isString):
+ (QScriptValuePrivate::isUndefined):
+ (QScriptValuePrivate::isFunction):
+ (QScriptValuePrivate::toString):
+ (QScriptValuePrivate::toNumber):
+ (QScriptValuePrivate::toBool):
+ (QScriptValuePrivate::toObject):
+ (QScriptValuePrivate::equals):
+ (QScriptValuePrivate::strictlyEquals):
+ (QScriptValuePrivate::instanceOf):
+ (QScriptValuePrivate::call):
+ (QScriptValuePrivate::operator JSValueRef):
+ (QScriptValuePrivate::operator JSObjectRef):
+ (QScriptValuePrivate::setValue):
+ (QScriptValuePrivate::inherits):
+ (QScriptValuePrivate::refinedJSValue):
+
+2010-05-31 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Implement the simple text code path.
+ https://bugs.webkit.org/show_bug.cgi?id=40077
+
+ Remove the FONT_FAST_PATH macro and use the Qt's
+ fast text implementation instead of the one of WebKit.
+
+ The Qt::TextBypassShaping flag is used to tell Qt to
+ only use the glyph advances.
+
+ Qt 4.7 is needed to get this flag thus the complex path is always
+ used if QtWebKit is compiled against an earlier version.
+
+ Contrary to the WebKit's implementation, the complex code path
+ is taken if the text is RightToLeft, justified or is formatted
+ with non-zero letter or word spacing.
+
+ * wtf/Platform.h:
+
+2010-06-11 Luiz Agostini <luiz.agostini@openbossa.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ add codePointCompare to JavaScriptCore.exp
+ https://bugs.webkit.org/show_bug.cgi?id=40426
+
+ * JavaScriptCore.exp:
+
+2010-06-10 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Math Javascript Bug on Safari 5 (webkit 533.16) under "32bit" mode
+ https://bugs.webkit.org/show_bug.cgi?id=40367
+
+ If we're in the slow case of right shift we must write the type tag as
+ the only reason we hit this code path is because we know we're working
+ with a double. eg. we are guaranteed that the tag cannot be reused.
+
+ * jit/JITArithmetic32_64.cpp:
+ (JSC::JIT::emitRightShiftSlowCase):
+
+2010-06-10 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ Remove weakRandomNumber
+ https://bugs.webkit.org/show_bug.cgi?id=40291
+
+ weakRandomNumber is used nowhere. Currently, WeakRandom is used instead.
+
+ * wtf/RandomNumber.cpp:
+ * wtf/RandomNumber.h:
+
+2010-06-09 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Brady Eidson.
+
+ Export StringImpl::ascii(). It might be not very useful, but it's a public function.
+
+ * JavaScriptCore.exp:
+
+2010-06-09 Leandro Pereira <leandro@profusion.mobi>
+
+ Reviewed by Adam Treat.
+
+ [EFL] Allow building core libraries as shared objects to speed up
+ linking time on machines with small amounts of memory.
+ http://webkit.org/b/39899
+
+ * CMakeLists.txt: If building with shared core, install the lib.
+ * jsc/CMakeListsEfl.txt: Needs Glib and Ecore to link dynamically.
+ * wtf/CMakeLists.txt: If building with shared core, install the lib.
+
+2010-06-09 Gabor Loki <loki@webkit.org>
+
+ Reviewed by David Levin.
+
+ Remove some unused variable warnings from JITOpcodes
+ https://bugs.webkit.org/show_bug.cgi?id=40298
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTINativeCall):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTINativeCall):
+
+2010-05-18 Yuzo Fujishima <yuzo@google.com>
+
+ Reviewed by Shinichiro Hamaji.
+
+ Fix for Bug 34529 - [CSSOM] issues with cssText and selectorText
+ Add U16_LENGTH that is needed to implement CSS character serialization.
+ https://bugs.webkit.org/show_bug.cgi?id=34529
+
+ * wtf/unicode/qt4/UnicodeQt4.h:
+ * wtf/unicode/wince/UnicodeWince.h:
+
+2010-06-08 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r60830.
+ http://trac.webkit.org/changeset/60830
+ https://bugs.webkit.org/show_bug.cgi?id=40305
+
+ Broke the Windows build (Requested by abarth on #webkit).
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * wtf/OwnPtrCommon.h:
+ * wtf/brew/OwnPtrBrew.h: Removed.
+ * wtf/win/OwnPtrWin.h: Removed.
+
+2010-06-08 MORITA Hajime <morrita@google.com>
+
+ Unreviewed. An attempt to fix test break.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-06-08 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Adam Barth.
+
+ Change OwnPtrCommon to include platform-specific headers
+ https://bugs.webkit.org/show_bug.cgi?id=40279
+
+ Adding new type to OwnPtrCommon needlessly causes all ports to do full rebuilds.
+ Change OwnPtrCommon to include platform-specific headers to avoid all ports rebuilds.
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * wtf/OwnPtrCommon.h:
+ * wtf/brew/OwnPtrBrew.h: Added.
+ * wtf/win/OwnPtrWin.h: Added.
+
+2010-06-07 MORITA Hajime <morrita@google.com>
+
+ Reviewed by Kent Tamura.
+
+ https://bugs.webkit.org/show_bug.cgi?id=40219
+ [Mac] ENABLE_METER_TAG should be enabled
+
+ Added ENABLE_METER_TAG.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-06-07 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Add more types to OwnPtr
+ https://bugs.webkit.org/show_bug.cgi?id=39667
+
+ Add ISSL and ISocket to the list of OwnPtr-ed type.
+
+ * wtf/OwnPtrCommon.h:
+ * wtf/brew/OwnPtrBrew.cpp:
+ (WTF::deleteOwnedPtr):
+
+2010-06-07 Benjamin Poulain <benjamin.poulain@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Crash when compiling on Snow Leopard and running on Leopard
+ https://bugs.webkit.org/show_bug.cgi?id=31403
+
+ Disable the use of pthread_setname_np and other symbols
+ when targetting Leopard.
+
+ Use the defines TARGETING_XX instead of BUILDING_ON_XX
+ for features that cannot be used before Snow Leopard.
+
+ * wtf/Platform.h:
+
+2010-06-07 Gabor Loki <loki@webkit.org>
+
+ Reviewed by NOBODY (JSVALUE32_64 build fix).
+
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTINativeCall):
+
+2010-06-06 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (windows build fix pt 2).
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-06-06 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (windows build fix pt 1).
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-06-06 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 40214 - Clean up error construction / throwing in JSC.
+
+ The one egregious insanity here is that creating an error requires
+ a VM-entry-esqe-host call (the string argument is wrapped as a JS
+ object & pushed on the RegisterFile, then unwrapped back to a
+ UString). Changing this also means you only require a global
+ object, not an ExecState, to create an error.
+
+ The methods to create error objects are also parameterized
+ requiring a switch on the type, which can be made cleaner and
+ faster by moving to a separate method per error type. Code to add
+ divot information to error had been duplicated, and is coalesced
+ back into a single function.
+
+ Convenience methods added to create & throw type & syntax error
+ with a default error message, since this is a common case.
+
+ Also, errors are currently thrown either using
+ "throwError(exec, error)" or "exec->setException(error)" - unify
+ on the former, since this is more commonly used. Add
+ "throwVMError(exec, error)" equivalents, as a convenience for
+ cases where the result was being wrapped in "JSValue::encode(...)".
+
+ * API/JSCallbackConstructor.cpp:
+ (JSC::constructJSCallback):
+ * API/JSCallbackFunction.cpp:
+ (JSC::JSCallbackFunction::call):
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::getOwnPropertySlot):
+ (JSC::::put):
+ (JSC::::deleteProperty):
+ (JSC::::construct):
+ (JSC::::hasInstance):
+ (JSC::::call):
+ (JSC::::toNumber):
+ (JSC::::toString):
+ (JSC::::staticValueGetter):
+ (JSC::::staticFunctionGetter):
+ (JSC::::callbackGetter):
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeError):
+ * JavaScriptCore.exp:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitNewError):
+ (JSC::BytecodeGenerator::emitThrowExpressionTooDeepException):
+ * bytecompiler/BytecodeGenerator.h:
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::ThrowableExpressionData::emitThrowError):
+ (JSC::RegExpNode::emitBytecode):
+ (JSC::PostfixErrorNode::emitBytecode):
+ (JSC::PrefixErrorNode::emitBytecode):
+ (JSC::AssignErrorNode::emitBytecode):
+ (JSC::ForInNode::emitBytecode):
+ (JSC::ContinueNode::emitBytecode):
+ (JSC::BreakNode::emitBytecode):
+ (JSC::ReturnNode::emitBytecode):
+ (JSC::LabelNode::emitBytecode):
+ * interpreter/CallFrame.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::throwException):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jsc.cpp:
+ (functionRun):
+ (functionLoad):
+ (functionCheckSyntax):
+ * parser/Nodes.h:
+ * runtime/ArrayConstructor.cpp:
+ (JSC::constructArrayWithSizeQuirk):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString):
+ (JSC::arrayProtoFuncToLocaleString):
+ (JSC::arrayProtoFuncJoin):
+ (JSC::arrayProtoFuncFilter):
+ (JSC::arrayProtoFuncMap):
+ (JSC::arrayProtoFuncEvery):
+ (JSC::arrayProtoFuncForEach):
+ (JSC::arrayProtoFuncSome):
+ (JSC::arrayProtoFuncReduce):
+ (JSC::arrayProtoFuncReduceRight):
+ * runtime/BooleanPrototype.cpp:
+ (JSC::booleanProtoFuncToString):
+ (JSC::booleanProtoFuncValueOf):
+ * runtime/DatePrototype.cpp:
+ (JSC::dateProtoFuncToString):
+ (JSC::dateProtoFuncToUTCString):
+ (JSC::dateProtoFuncToISOString):
+ (JSC::dateProtoFuncToDateString):
+ (JSC::dateProtoFuncToTimeString):
+ (JSC::dateProtoFuncToLocaleString):
+ (JSC::dateProtoFuncToLocaleDateString):
+ (JSC::dateProtoFuncToLocaleTimeString):
+ (JSC::dateProtoFuncGetTime):
+ (JSC::dateProtoFuncGetFullYear):
+ (JSC::dateProtoFuncGetUTCFullYear):
+ (JSC::dateProtoFuncToGMTString):
+ (JSC::dateProtoFuncGetMonth):
+ (JSC::dateProtoFuncGetUTCMonth):
+ (JSC::dateProtoFuncGetDate):
+ (JSC::dateProtoFuncGetUTCDate):
+ (JSC::dateProtoFuncGetDay):
+ (JSC::dateProtoFuncGetUTCDay):
+ (JSC::dateProtoFuncGetHours):
+ (JSC::dateProtoFuncGetUTCHours):
+ (JSC::dateProtoFuncGetMinutes):
+ (JSC::dateProtoFuncGetUTCMinutes):
+ (JSC::dateProtoFuncGetSeconds):
+ (JSC::dateProtoFuncGetUTCSeconds):
+ (JSC::dateProtoFuncGetMilliSeconds):
+ (JSC::dateProtoFuncGetUTCMilliseconds):
+ (JSC::dateProtoFuncGetTimezoneOffset):
+ (JSC::dateProtoFuncSetTime):
+ (JSC::setNewValueFromTimeArgs):
+ (JSC::setNewValueFromDateArgs):
+ (JSC::dateProtoFuncSetMilliSeconds):
+ (JSC::dateProtoFuncSetUTCMilliseconds):
+ (JSC::dateProtoFuncSetSeconds):
+ (JSC::dateProtoFuncSetUTCSeconds):
+ (JSC::dateProtoFuncSetMinutes):
+ (JSC::dateProtoFuncSetUTCMinutes):
+ (JSC::dateProtoFuncSetHours):
+ (JSC::dateProtoFuncSetUTCHours):
+ (JSC::dateProtoFuncSetDate):
+ (JSC::dateProtoFuncSetUTCDate):
+ (JSC::dateProtoFuncSetMonth):
+ (JSC::dateProtoFuncSetUTCMonth):
+ (JSC::dateProtoFuncSetFullYear):
+ (JSC::dateProtoFuncSetUTCFullYear):
+ (JSC::dateProtoFuncSetYear):
+ (JSC::dateProtoFuncGetYear):
+ (JSC::dateProtoFuncToJSON):
+ * runtime/Error.cpp:
+ (JSC::createError):
+ (JSC::createEvalError):
+ (JSC::createRangeError):
+ (JSC::createReferenceError):
+ (JSC::createSyntaxError):
+ (JSC::createTypeError):
+ (JSC::createURIError):
+ (JSC::addErrorSourceInfo):
+ (JSC::addErrorDivotInfo):
+ (JSC::addErrorInfo):
+ (JSC::hasErrorInfo):
+ (JSC::throwError):
+ (JSC::throwTypeError):
+ (JSC::throwSyntaxError):
+ * runtime/Error.h:
+ (JSC::throwVMError):
+ (JSC::throwVMTypeError):
+ * runtime/ErrorConstructor.cpp:
+ (JSC::constructWithErrorConstructor):
+ (JSC::callErrorConstructor):
+ * runtime/ErrorConstructor.h:
+ * runtime/ErrorInstance.cpp:
+ (JSC::ErrorInstance::ErrorInstance):
+ (JSC::ErrorInstance::create):
+ * runtime/ErrorInstance.h:
+ * runtime/ErrorPrototype.cpp:
+ (JSC::ErrorPrototype::ErrorPrototype):
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createStackOverflowError):
+ (JSC::createUndefinedVariableError):
+ (JSC::createInvalidParamError):
+ (JSC::createNotAConstructorError):
+ (JSC::createNotAFunctionError):
+ (JSC::createNotAnObjectError):
+ (JSC::throwOutOfMemoryError):
+ * runtime/ExceptionHelpers.h:
+ * runtime/Executable.cpp:
+ (JSC::EvalExecutable::compile):
+ (JSC::ProgramExecutable::checkSyntax):
+ (JSC::ProgramExecutable::compile):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructFunction):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString):
+ (JSC::functionProtoFuncApply):
+ (JSC::functionProtoFuncCall):
+ * runtime/Identifier.cpp:
+ (JSC::Identifier::from):
+ * runtime/Identifier.h:
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::put):
+ * runtime/JSFunction.cpp:
+ (JSC::callHostFunctionAsConstructor):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::encode):
+ (JSC::decode):
+ (JSC::globalFuncEval):
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::appendStringifiedValue):
+ (JSC::Walker::walk):
+ (JSC::JSONProtoFuncParse):
+ (JSC::JSONProtoFuncStringify):
+ * runtime/JSObject.cpp:
+ (JSC::throwSetterError):
+ (JSC::JSObject::put):
+ (JSC::JSObject::putWithAttributes):
+ (JSC::JSObject::defaultValue):
+ (JSC::JSObject::hasInstance):
+ (JSC::JSObject::defineOwnProperty):
+ * runtime/JSObject.h:
+ * runtime/JSValue.cpp:
+ (JSC::JSValue::toObjectSlowCase):
+ (JSC::JSValue::synthesizeObject):
+ (JSC::JSValue::synthesizePrototype):
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::constructWithNativeErrorConstructor):
+ (JSC::callNativeErrorConstructor):
+ * runtime/NativeErrorConstructor.h:
+ * runtime/NumberPrototype.cpp:
+ (JSC::numberProtoFuncToString):
+ (JSC::numberProtoFuncToLocaleString):
+ (JSC::numberProtoFuncValueOf):
+ (JSC::numberProtoFuncToFixed):
+ (JSC::numberProtoFuncToExponential):
+ (JSC::numberProtoFuncToPrecision):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::objectConstructorGetPrototypeOf):
+ (JSC::objectConstructorGetOwnPropertyDescriptor):
+ (JSC::objectConstructorGetOwnPropertyNames):
+ (JSC::objectConstructorKeys):
+ (JSC::toPropertyDescriptor):
+ (JSC::objectConstructorDefineProperty):
+ (JSC::objectConstructorDefineProperties):
+ (JSC::objectConstructorCreate):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::objectProtoFuncDefineGetter):
+ (JSC::objectProtoFuncDefineSetter):
+ * runtime/RegExpConstructor.cpp:
+ (JSC::constructRegExp):
+ * runtime/RegExpObject.cpp:
+ (JSC::RegExpObject::match):
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncTest):
+ (JSC::regExpProtoFuncExec):
+ (JSC::regExpProtoFuncCompile):
+ (JSC::regExpProtoFuncToString):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncToString):
+
+2010-06-05 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Add PLATFORM(BREWMP) guard for using std::xxx
+ https://bugs.webkit.org/show_bug.cgi?id=39710
+
+ Build fix for BREW MP.
+
+ * wtf/MathExtras.h:
+
+2010-06-04 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ HTML5 parser should be within 1% of old parser performance
+ https://bugs.webkit.org/show_bug.cgi?id=40172
+
+ Fix cast in this operator= to allow for assignment between vectors with
+ different inline capacities (as clearly intended by its author).
+
+ * wtf/Vector.h:
+ (WTF::::operator):
+
+2010-06-04 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ New QtScript API; QScriptValue::instanceOf.
+
+ New function create an easy way to check value's prototype hierarchy.
+
+ [Qt] QScriptValue should have an instanceOf method
+ https://bugs.webkit.org/show_bug.cgi?id=40120
+
+ * qt/api/qscriptvalue.cpp:
+ (QScriptValue::instanceOf):
+ * qt/api/qscriptvalue.h:
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::instanceOf):
+ * qt/tests/qscriptvalue/tst_qscriptvalue.h:
+ * qt/tests/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp:
+ (tst_QScriptValue::instanceOf_initData):
+ (tst_QScriptValue::instanceOf_makeData):
+ (tst_QScriptValue::instanceOf_test):
+
+2010-06-04 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (interpreter build fix).
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2010-06-04 Mark Rowe <mrowe@apple.com>
+
+ Silence some warnings seen on the build bot.
+
+ * JavaScriptCore.JSVALUE32_64only.exp: Add a trailing newline.
+ * JavaScriptCore.JSVALUE32only.exp: Ditto.
+ * JavaScriptCore.JSVALUE64only.exp: Ditto.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Remove the .exp files from all targets so that Xcode doesn't
+ complain about not knowing how to compile them.
+
+2010-06-04 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 40187 - Change function signature of NativeConstructor to match NativeFunction
+
+ Mostly for consistency, but constructor & args arguments are redundant,
+ and this will help if we wish to be able to JIT calls to more constructors.
+
+ * API/JSCallbackConstructor.cpp:
+ (JSC::constructJSCallback):
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::construct):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::executeConstruct):
+ * interpreter/Interpreter.h:
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/ArrayConstructor.cpp:
+ (JSC::constructWithArrayConstructor):
+ * runtime/BooleanConstructor.cpp:
+ (JSC::constructWithBooleanConstructor):
+ * runtime/ConstructData.cpp:
+ (JSC::construct):
+ * runtime/ConstructData.h:
+ * runtime/DateConstructor.cpp:
+ (JSC::constructWithDateConstructor):
+ * runtime/Error.cpp:
+ (JSC::constructNativeError):
+ (JSC::Error::create):
+ * runtime/ErrorConstructor.cpp:
+ (JSC::constructWithErrorConstructor):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructWithFunctionConstructor):
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::constructWithNativeErrorConstructor):
+ * runtime/NativeErrorConstructor.h:
+ (JSC::NativeErrorConstructor::errorStructure):
+ * runtime/NumberConstructor.cpp:
+ (JSC::constructWithNumberConstructor):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::constructWithObjectConstructor):
+ * runtime/RegExpConstructor.cpp:
+ (JSC::constructWithRegExpConstructor):
+ * runtime/StringConstructor.cpp:
+ (JSC::constructWithStringConstructor):
+
+2010-06-04 Tony Gentilcore <tonyg@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Add a takeFirst() method to Deque and use it where appropriate.
+ https://bugs.webkit.org/show_bug.cgi?id=40089
+
+ * wtf/Deque.h:
+ (WTF::::takeFirst):
+ * wtf/MainThread.cpp:
+ (WTF::dispatchFunctionsFromMainThread):
+ * wtf/MessageQueue.h:
+ (WTF::::tryGetMessage):
+
+2010-06-04 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Remove a QEXPECT_FAIL flag from an autotest.
+
+ Test tst_QScriptEngine::globalObject pass after 36600 bug
+ fix have been applied.
+
+ [Qt] Expected fail in the tst_QScriptEngine::globalObject should be removed.
+ https://bugs.webkit.org/show_bug.cgi?id=40114
+
+ * qt/tests/qscriptengine/tst_qscriptengine.cpp:
+ (tst_QScriptEngine::globalObject):
+
+2010-06-04 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Fix QScriptValue::equals.
+
+ Handling for a few edge cases were added. Now comparison between
+ NaN, an invalid objects should works as supposed.
+
+ [Qt] QScriptValue::equals problems
+ https://bugs.webkit.org/show_bug.cgi?id=40110
+
+ * qt/api/qscriptvalue.cpp:
+ (QScriptValue::equals):
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::equals):
+ * qt/tests/qscriptvalue/tst_qscriptvalue.h:
+ * qt/tests/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp:
+ (tst_QScriptValue::equals_initData):
+ (tst_QScriptValue::equals_makeData):
+ (tst_QScriptValue::equals_test):
+
+2010-06-03 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ New states in QScriptValuePrivate.
+
+ The CSpecial state was divided into CNull and CUndefined. It simplify
+ the QScriptValue code by avoiding a few "cast" and "if".
+ Moreover the MSVS compiler didn't like casting between a double and an
+ enum which is avoided now.
+
+ [Qt] The QScriptValuePrivate::CSpecial is too generic.
+ https://bugs.webkit.org/show_bug.cgi?id=40067
+
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::):
+ (QScriptValuePrivate::QScriptValuePrivate):
+ (QScriptValuePrivate::isNull):
+ (QScriptValuePrivate::isUndefined):
+ (QScriptValuePrivate::toString):
+ (QScriptValuePrivate::toNumber):
+ (QScriptValuePrivate::toBool):
+ (QScriptValuePrivate::toObject):
+ (QScriptValuePrivate::assignEngine):
+ (QScriptValuePrivate::isNumberBased):
+
+2010-06-03 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (Qt build fix).
+
+ * wtf/Platform.h:
+
+2010-06-03 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Bug 40150 - ENABLE_JIT_OPTIMIZE_NATIVE_CALL on all x86/x86_64 platforms
+ This was fixed in bug #40094.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * wtf/Platform.h:
+
+2010-06-03 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (Interpreter build fix).
+
+ * JavaScriptCore.JSVALUE32_64only.exp:
+ * JavaScriptCore.JSVALUE32only.exp:
+ * JavaScriptCore.JSVALUE64only.exp:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2010-06-03 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (windows build fix II).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-06-03 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (windows build fix).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-06-02 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 40094 - The return type of NativeFunction should be EncodedJSValue
+ On Windows & Linux, using JSVALUE32_64, EncodedJSValue is returned in registers, but JSValue is not.
+
+ * API/JSCallbackFunction.cpp:
+ (JSC::JSCallbackFunction::call):
+ * API/JSCallbackFunction.h:
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::call):
+ * JavaScriptCore.exp:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::executeCall):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ * jsc.cpp:
+ (functionPrint):
+ (functionDebug):
+ (functionGC):
+ (functionVersion):
+ (functionRun):
+ (functionLoad):
+ (functionCheckSyntax):
+ (functionSetSamplingFlags):
+ (functionClearSamplingFlags):
+ (functionReadline):
+ (functionQuit):
+ * runtime/ArrayConstructor.cpp:
+ (JSC::callArrayConstructor):
+ (JSC::arrayConstructorIsArray):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString):
+ (JSC::arrayProtoFuncToLocaleString):
+ (JSC::arrayProtoFuncJoin):
+ (JSC::arrayProtoFuncConcat):
+ (JSC::arrayProtoFuncPop):
+ (JSC::arrayProtoFuncPush):
+ (JSC::arrayProtoFuncReverse):
+ (JSC::arrayProtoFuncShift):
+ (JSC::arrayProtoFuncSlice):
+ (JSC::arrayProtoFuncSort):
+ (JSC::arrayProtoFuncSplice):
+ (JSC::arrayProtoFuncUnShift):
+ (JSC::arrayProtoFuncFilter):
+ (JSC::arrayProtoFuncMap):
+ (JSC::arrayProtoFuncEvery):
+ (JSC::arrayProtoFuncForEach):
+ (JSC::arrayProtoFuncSome):
+ (JSC::arrayProtoFuncReduce):
+ (JSC::arrayProtoFuncReduceRight):
+ (JSC::arrayProtoFuncIndexOf):
+ (JSC::arrayProtoFuncLastIndexOf):
+ * runtime/BooleanConstructor.cpp:
+ (JSC::callBooleanConstructor):
+ * runtime/BooleanPrototype.cpp:
+ (JSC::booleanProtoFuncToString):
+ (JSC::booleanProtoFuncValueOf):
+ * runtime/CallData.h:
+ * runtime/DateConstructor.cpp:
+ (JSC::callDate):
+ (JSC::dateParse):
+ (JSC::dateNow):
+ (JSC::dateUTC):
+ * runtime/DatePrototype.cpp:
+ (JSC::dateProtoFuncToString):
+ (JSC::dateProtoFuncToUTCString):
+ (JSC::dateProtoFuncToISOString):
+ (JSC::dateProtoFuncToDateString):
+ (JSC::dateProtoFuncToTimeString):
+ (JSC::dateProtoFuncToLocaleString):
+ (JSC::dateProtoFuncToLocaleDateString):
+ (JSC::dateProtoFuncToLocaleTimeString):
+ (JSC::dateProtoFuncGetTime):
+ (JSC::dateProtoFuncGetFullYear):
+ (JSC::dateProtoFuncGetUTCFullYear):
+ (JSC::dateProtoFuncToGMTString):
+ (JSC::dateProtoFuncGetMonth):
+ (JSC::dateProtoFuncGetUTCMonth):
+ (JSC::dateProtoFuncGetDate):
+ (JSC::dateProtoFuncGetUTCDate):
+ (JSC::dateProtoFuncGetDay):
+ (JSC::dateProtoFuncGetUTCDay):
+ (JSC::dateProtoFuncGetHours):
+ (JSC::dateProtoFuncGetUTCHours):
+ (JSC::dateProtoFuncGetMinutes):
+ (JSC::dateProtoFuncGetUTCMinutes):
+ (JSC::dateProtoFuncGetSeconds):
+ (JSC::dateProtoFuncGetUTCSeconds):
+ (JSC::dateProtoFuncGetMilliSeconds):
+ (JSC::dateProtoFuncGetUTCMilliseconds):
+ (JSC::dateProtoFuncGetTimezoneOffset):
+ (JSC::dateProtoFuncSetTime):
+ (JSC::dateProtoFuncSetMilliSeconds):
+ (JSC::dateProtoFuncSetUTCMilliseconds):
+ (JSC::dateProtoFuncSetSeconds):
+ (JSC::dateProtoFuncSetUTCSeconds):
+ (JSC::dateProtoFuncSetMinutes):
+ (JSC::dateProtoFuncSetUTCMinutes):
+ (JSC::dateProtoFuncSetHours):
+ (JSC::dateProtoFuncSetUTCHours):
+ (JSC::dateProtoFuncSetDate):
+ (JSC::dateProtoFuncSetUTCDate):
+ (JSC::dateProtoFuncSetMonth):
+ (JSC::dateProtoFuncSetUTCMonth):
+ (JSC::dateProtoFuncSetFullYear):
+ (JSC::dateProtoFuncSetUTCFullYear):
+ (JSC::dateProtoFuncSetYear):
+ (JSC::dateProtoFuncGetYear):
+ (JSC::dateProtoFuncToJSON):
+ * runtime/ErrorConstructor.cpp:
+ (JSC::callErrorConstructor):
+ * runtime/ErrorPrototype.cpp:
+ (JSC::errorProtoFuncToString):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::callFunctionConstructor):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::callFunctionPrototype):
+ (JSC::functionProtoFuncToString):
+ (JSC::functionProtoFuncApply):
+ (JSC::functionProtoFuncCall):
+ * runtime/JSCell.h:
+ (JSC::getCallData):
+ (JSC::getConstructData):
+ * runtime/JSFunction.cpp:
+ (JSC::callHostFunctionAsConstructor):
+ * runtime/JSFunction.h:
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncEval):
+ (JSC::globalFuncParseInt):
+ (JSC::globalFuncParseFloat):
+ (JSC::globalFuncIsNaN):
+ (JSC::globalFuncIsFinite):
+ (JSC::globalFuncDecodeURI):
+ (JSC::globalFuncDecodeURIComponent):
+ (JSC::globalFuncEncodeURI):
+ (JSC::globalFuncEncodeURIComponent):
+ (JSC::globalFuncEscape):
+ (JSC::globalFuncUnescape):
+ (JSC::globalFuncJSCPrint):
+ * runtime/JSGlobalObjectFunctions.h:
+ * runtime/JSONObject.cpp:
+ (JSC::JSONProtoFuncParse):
+ (JSC::JSONProtoFuncStringify):
+ * runtime/JSObject.cpp:
+ (JSC::callDefaultValueFunction):
+ * runtime/JSValue.h:
+ * runtime/MathObject.cpp:
+ (JSC::mathProtoFuncAbs):
+ (JSC::mathProtoFuncACos):
+ (JSC::mathProtoFuncASin):
+ (JSC::mathProtoFuncATan):
+ (JSC::mathProtoFuncATan2):
+ (JSC::mathProtoFuncCeil):
+ (JSC::mathProtoFuncCos):
+ (JSC::mathProtoFuncExp):
+ (JSC::mathProtoFuncFloor):
+ (JSC::mathProtoFuncLog):
+ (JSC::mathProtoFuncMax):
+ (JSC::mathProtoFuncMin):
+ (JSC::mathProtoFuncPow):
+ (JSC::mathProtoFuncRandom):
+ (JSC::mathProtoFuncRound):
+ (JSC::mathProtoFuncSin):
+ (JSC::mathProtoFuncSqrt):
+ (JSC::mathProtoFuncTan):
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::callNativeErrorConstructor):
+ * runtime/NumberConstructor.cpp:
+ (JSC::callNumberConstructor):
+ * runtime/NumberPrototype.cpp:
+ (JSC::numberProtoFuncToString):
+ (JSC::numberProtoFuncToLocaleString):
+ (JSC::numberProtoFuncValueOf):
+ (JSC::numberProtoFuncToFixed):
+ (JSC::numberProtoFuncToExponential):
+ (JSC::numberProtoFuncToPrecision):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::callObjectConstructor):
+ (JSC::objectConstructorGetPrototypeOf):
+ (JSC::objectConstructorGetOwnPropertyDescriptor):
+ (JSC::objectConstructorGetOwnPropertyNames):
+ (JSC::objectConstructorKeys):
+ (JSC::toPropertyDescriptor):
+ (JSC::objectConstructorDefineProperty):
+ (JSC::objectConstructorDefineProperties):
+ (JSC::objectConstructorCreate):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::objectProtoFuncValueOf):
+ (JSC::objectProtoFuncHasOwnProperty):
+ (JSC::objectProtoFuncIsPrototypeOf):
+ (JSC::objectProtoFuncDefineGetter):
+ (JSC::objectProtoFuncDefineSetter):
+ (JSC::objectProtoFuncLookupGetter):
+ (JSC::objectProtoFuncLookupSetter):
+ (JSC::objectProtoFuncPropertyIsEnumerable):
+ (JSC::objectProtoFuncToLocaleString):
+ (JSC::objectProtoFuncToString):
+ * runtime/ObjectPrototype.h:
+ * runtime/RegExpConstructor.cpp:
+ (JSC::callRegExpConstructor):
+ * runtime/RegExpObject.cpp:
+ (JSC::callRegExpObject):
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncTest):
+ (JSC::regExpProtoFuncExec):
+ (JSC::regExpProtoFuncCompile):
+ (JSC::regExpProtoFuncToString):
+ * runtime/StringConstructor.cpp:
+ (JSC::stringFromCharCode):
+ (JSC::callStringConstructor):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace):
+ (JSC::stringProtoFuncToString):
+ (JSC::stringProtoFuncCharAt):
+ (JSC::stringProtoFuncCharCodeAt):
+ (JSC::stringProtoFuncConcat):
+ (JSC::stringProtoFuncIndexOf):
+ (JSC::stringProtoFuncLastIndexOf):
+ (JSC::stringProtoFuncMatch):
+ (JSC::stringProtoFuncSearch):
+ (JSC::stringProtoFuncSlice):
+ (JSC::stringProtoFuncSplit):
+ (JSC::stringProtoFuncSubstr):
+ (JSC::stringProtoFuncSubstring):
+ (JSC::stringProtoFuncToLowerCase):
+ (JSC::stringProtoFuncToUpperCase):
+ (JSC::stringProtoFuncLocaleCompare):
+ (JSC::stringProtoFuncBig):
+ (JSC::stringProtoFuncSmall):
+ (JSC::stringProtoFuncBlink):
+ (JSC::stringProtoFuncBold):
+ (JSC::stringProtoFuncFixed):
+ (JSC::stringProtoFuncItalics):
+ (JSC::stringProtoFuncStrike):
+ (JSC::stringProtoFuncSub):
+ (JSC::stringProtoFuncSup):
+ (JSC::stringProtoFuncFontcolor):
+ (JSC::stringProtoFuncFontsize):
+ (JSC::stringProtoFuncAnchor):
+ (JSC::stringProtoFuncLink):
+ (JSC::stringProtoFuncTrim):
+ (JSC::stringProtoFuncTrimLeft):
+ (JSC::stringProtoFuncTrimRight):
+
+2010-06-02 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Add value-representation specific sections to the mac export file.
+
+ * Configurations/JavaScriptCore.xcconfig:
+ * DerivedSources.make:
+ * JavaScriptCore.JSVALUE32_64only.exp: Added.
+ * JavaScriptCore.JSVALUE32only.exp: Added.
+ * JavaScriptCore.JSVALUE64only.exp: Added.
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2010-06-02 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ <rdar://problem/8054988> Work around an LLVM GCC code generation bug that results in crashes inside PCRE.
+
+ * pcre/pcre_exec.cpp:
+ (repeatInformationFromInstructionOffset): Change the type of instructionOffset to int. There's no good
+ reason for it to be a short, and using int prevents this code from triggering the LLVM GCC bug.
+
+2010-06-02 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Fix the QScriptValue::strictlyEquals function.
+
+ Handling for a few edge cases was added.
+
+ New autotest that covers the QScriptValue::strictlyEquals function.
+
+ [Qt] QScriptValue::strictlyEquals is broken
+ https://bugs.webkit.org/show_bug.cgi?id=36600
+
+ * qt/api/qscriptvalue.cpp:
+ (QScriptValue::strictlyEquals):
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::strictlyEquals):
+ * qt/tests/qscriptvalue/qscriptvalue.pro:
+ * qt/tests/qscriptvalue/tst_qscriptvalue.h:
+ * qt/tests/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp: Added.
+ (tst_QScriptValue::strictlyEquals_initData):
+ (tst_QScriptValue::strictlyEquals_makeData):
+ (tst_QScriptValue::strictlyEquals_test):
+
+2010-06-02 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ New function QScriptEngine::newObject.
+
+ The function creates a object of class Object and returns it
+ as a QScriptValue.
+
+ [Qt] QScriptEngine API should contain a newObject function
+ https://bugs.webkit.org/show_bug.cgi?id=39114
+
+ * qt/api/qscriptengine.cpp:
+ (QScriptEngine::newObject):
+ * qt/api/qscriptengine.h:
+ * qt/api/qscriptengine_p.cpp:
+ (QScriptEnginePrivate::newObject):
+ * qt/api/qscriptengine_p.h:
+ * qt/tests/qscriptengine/tst_qscriptengine.cpp:
+ (tst_QScriptEngine::newObject):
+
+2010-06-02 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+ https://bugs.webkit.org/show_bug.cgi?id=40011
+
+ Thumb-2 build fix: The offset parameter of ldrh should be encoded as an
+ imm12 immediate constant in load16. If it is not fit in the instruction
+ a temporary register has to be used.
+
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::load16):
+
+2010-06-02 Sterling Swigart <sswigart@google.com>
+
+ Reviewed by David Levin.
+
+ Image Resizer Patch 0: Added compilation argument to conditionally compile pending patches.
+ https://bugs.webkit.org/show_bug.cgi?id=39906
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-06-01 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 40021 - Refactor bytecode generation for calls so that register for this & args are allocated together
+
+ This is a useful stepping stone towards reversing argument order.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::addParameter):
+ (JSC::BytecodeGenerator::emitCall):
+ (JSC::BytecodeGenerator::emitCallEval):
+ (JSC::BytecodeGenerator::emitConstruct):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::CallArguments::thisRegister):
+ (JSC::CallArguments::argumentRegister):
+ (JSC::CallArguments::callFrame):
+ (JSC::CallArguments::count):
+ (JSC::BytecodeGenerator::shouldEmitProfileHooks):
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::NewExprNode::emitBytecode):
+ (JSC::CallArguments::CallArguments):
+ (JSC::EvalFunctionCallNode::emitBytecode):
+ (JSC::FunctionCallValueNode::emitBytecode):
+ (JSC::FunctionCallResolveNode::emitBytecode):
+ (JSC::FunctionCallBracketNode::emitBytecode):
+ (JSC::FunctionCallDotNode::emitBytecode):
+ (JSC::CallFunctionCallDotNode::emitBytecode):
+ (JSC::ApplyFunctionCallDotNode::emitBytecode):
+
+2010-06-01 Yong Li <yoli@rim.com>
+
+ Reviewed by Darin Adler.
+
+ Explicitly use PTHREAD_MUTEX_NORMAL to create pthread mutex.
+ https://bugs.webkit.org/show_bug.cgi?id=39893
+
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::Mutex::Mutex):
+
+2010-06-01 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] Use DEFINE_STATIC_LOCAL for threadMapMutex and threadMap
+ https://bugs.webkit.org/show_bug.cgi?id=39831
+
+ Use DEFINE_STATIC_LOCAL for static local variables.
+
+ * wtf/gtk/ThreadingGtk.cpp:
+ (WTF::threadMapMutex):
+ (WTF::threadMap):
+ (WTF::identifierByGthreadHandle):
+
2010-06-01 Kent Tamura <tkent@chromium.org>
Reviewed by Shinichiro Hamaji.
diff --git a/JavaScriptCore/Configurations/FeatureDefines.xcconfig b/JavaScriptCore/Configurations/FeatureDefines.xcconfig
index c64d94c..5b52793 100644
--- a/JavaScriptCore/Configurations/FeatureDefines.xcconfig
+++ b/JavaScriptCore/Configurations/FeatureDefines.xcconfig
@@ -55,9 +55,11 @@ ENABLE_FILE_READER = ENABLE_FILE_READER;
ENABLE_FILE_WRITER = ;
ENABLE_GEOLOCATION = ENABLE_GEOLOCATION;
ENABLE_ICONDATABASE = ENABLE_ICONDATABASE;
+ENABLE_IMAGE_RESIZER = ;
ENABLE_INDEXED_DATABASE = ;
ENABLE_JAVASCRIPT_DEBUGGER = ENABLE_JAVASCRIPT_DEBUGGER;
ENABLE_MATHML = ;
+ENABLE_METER_TAG = ENABLE_METER_TAG;
ENABLE_NOTIFICATIONS = ;
ENABLE_OFFLINE_WEB_APPLICATIONS = ENABLE_OFFLINE_WEB_APPLICATIONS;
ENABLE_PROGRESS_TAG = ENABLE_PROGRESS_TAG;
@@ -79,4 +81,4 @@ ENABLE_XHTMLMP = ;
ENABLE_XPATH = ENABLE_XPATH;
ENABLE_XSLT = ENABLE_XSLT;
-FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT);
+FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT);
diff --git a/JavaScriptCore/Configurations/JavaScriptCore.xcconfig b/JavaScriptCore/Configurations/JavaScriptCore.xcconfig
index b6ba560..8c2f26d 100644
--- a/JavaScriptCore/Configurations/JavaScriptCore.xcconfig
+++ b/JavaScriptCore/Configurations/JavaScriptCore.xcconfig
@@ -24,14 +24,16 @@
#include "FeatureDefines.xcconfig"
#include "Version.xcconfig"
-EXPORTED_SYMBOLS_FILE = $(EXPORTED_SYMBOLS_FILE_$(CURRENT_ARCH));
-EXPORTED_SYMBOLS_FILE_ = JavaScriptCore.exp;
-EXPORTED_SYMBOLS_FILE_armv6 = JavaScriptCore.exp;
-EXPORTED_SYMBOLS_FILE_armv7 = JavaScriptCore.exp;
-EXPORTED_SYMBOLS_FILE_i386 = JavaScriptCore.exp;
-EXPORTED_SYMBOLS_FILE_ppc = JavaScriptCore.exp;
-EXPORTED_SYMBOLS_FILE_ppc64 = $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/JavaScriptCore.LP64.exp;
-EXPORTED_SYMBOLS_FILE_x86_64 = $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/JavaScriptCore.LP64.exp;
+JSVALUE_MODEL = $(JSVALUE_MODEL_$(CURRENT_ARCH));
+JSVALUE_MODEL_ = UNKNOWN_JSVALUE_MODEL;
+JSVALUE_MODEL_armv6 = 32;
+JSVALUE_MODEL_armv7 = 32;
+JSVALUE_MODEL_i386 = 32_64;
+JSVALUE_MODEL_ppc = 32_64;
+JSVALUE_MODEL_ppc64 = 32;
+JSVALUE_MODEL_x86_64 = 64;
+
+EXPORTED_SYMBOLS_FILE = $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/JavaScriptCore.JSVALUE$(JSVALUE_MODEL).exp;
OTHER_LDFLAGS_BASE = -lobjc -Wl,-Y,3;
OTHER_LDFLAGS = $(OTHER_LDFLAGS_$(REAL_PLATFORM_NAME));
OTHER_LDFLAGS_iphoneos = $(OTHER_LDFLAGS_BASE);
diff --git a/JavaScriptCore/DerivedSources.make b/JavaScriptCore/DerivedSources.make
index 4fc9cad..37020f1 100644
--- a/JavaScriptCore/DerivedSources.make
+++ b/JavaScriptCore/DerivedSources.make
@@ -49,6 +49,9 @@ all : \
StringPrototype.lut.h \
docs/bytecode.html \
RegExpJitTables.h \
+ JavaScriptCore.JSVALUE32.exp \
+ JavaScriptCore.JSVALUE32_64.exp \
+ JavaScriptCore.JSVALUE64.exp \
#
# lookup tables for classes
@@ -79,3 +82,12 @@ docs/bytecode.html: make-bytecode-docs.pl Interpreter.cpp
#character tables for Yarr
RegExpJitTables.h: create_regex_tables
python $^ > $@
+
+JavaScriptCore.JSVALUE32.exp: JavaScriptCore.exp JavaScriptCore.JSVALUE32only.exp
+ cat $^ > $@
+
+JavaScriptCore.JSVALUE32_64.exp: JavaScriptCore.exp JavaScriptCore.JSVALUE32_64only.exp
+ cat $^ > $@
+
+JavaScriptCore.JSVALUE64.exp: JavaScriptCore.exp JavaScriptCore.JSVALUE64only.exp
+ cat $^ > $@
diff --git a/JavaScriptCore/JavaScriptCore.JSVALUE32_64only.exp b/JavaScriptCore/JavaScriptCore.JSVALUE32_64only.exp
new file mode 100644
index 0000000..7e520ae
--- /dev/null
+++ b/JavaScriptCore/JavaScriptCore.JSVALUE32_64only.exp
@@ -0,0 +1,2 @@
+__ZN3JSC10JSFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFxS2_E
+__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFxS2_E
diff --git a/JavaScriptCore/JavaScriptCore.JSVALUE32only.exp b/JavaScriptCore/JavaScriptCore.JSVALUE32only.exp
new file mode 100644
index 0000000..73efb9d
--- /dev/null
+++ b/JavaScriptCore/JavaScriptCore.JSVALUE32only.exp
@@ -0,0 +1,2 @@
+__ZN3JSC10JSFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFPvS2_E
+__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFPvS2_E
diff --git a/JavaScriptCore/JavaScriptCore.JSVALUE64only.exp b/JavaScriptCore/JavaScriptCore.JSVALUE64only.exp
new file mode 100644
index 0000000..73efb9d
--- /dev/null
+++ b/JavaScriptCore/JavaScriptCore.JSVALUE64only.exp
@@ -0,0 +1,2 @@
+__ZN3JSC10JSFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFPvS2_E
+__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFPvS2_E
diff --git a/JavaScriptCore/JavaScriptCore.exp b/JavaScriptCore/JavaScriptCore.exp
index 3985d4e..93e01e2 100644
--- a/JavaScriptCore/JavaScriptCore.exp
+++ b/JavaScriptCore/JavaScriptCore.exp
@@ -109,14 +109,13 @@ __ZN3JSC10Identifier4fromEPNS_9ExecStateEj
__ZN3JSC10Identifier5equalEPKN7WebCore10StringImplEPKc
__ZN3JSC10JSFunction4infoE
__ZN3JSC10JSFunction4nameEPNS_9ExecStateE
-__ZN3JSC10JSFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFNS_7JSValueES2_E
-__ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeE
-__ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeEPKc
-__ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeERKNS_7UStringE
+__ZN3JSC10throwErrorEPNS_9ExecStateENS_7JSValueE
+__ZN3JSC10throwErrorEPNS_9ExecStateEPNS_8JSObjectE
__ZN3JSC11JSByteArray15createStructureENS_7JSValueE
__ZN3JSC11JSByteArrayC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS3_9ByteArrayEPKNS_9ClassInfoE
__ZN3JSC11ParserArena5resetEv
__ZN3JSC11checkSyntaxEPNS_9ExecStateERKNS_10SourceCodeE
+__ZN3JSC11createErrorEPNS_9ExecStateERKNS_7UStringE
__ZN3JSC12DateInstance4infoE
__ZN3JSC12DateInstanceC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEd
__ZN3JSC12DateInstanceC1EPNS_9ExecStateEd
@@ -162,8 +161,9 @@ __ZN3JSC14SamplingThread4stopEv
__ZN3JSC14SamplingThread5startEj
__ZN3JSC14TimeoutChecker10didTimeOutEPNS_9ExecStateE
__ZN3JSC14TimeoutChecker5resetEv
+__ZN3JSC14throwTypeErrorEPNS_9ExecStateE
__ZN3JSC15JSWrapperObject12markChildrenERNS_9MarkStackE
-__ZN3JSC15createTypeErrorEPNS_9ExecStateEPKc
+__ZN3JSC15createTypeErrorEPNS_9ExecStateERKNS_7UStringE
__ZN3JSC15toInt32SlowCaseEdRb
__ZN3JSC16InternalFunction4infoE
__ZN3JSC16InternalFunction4nameEPNS_9ExecStateE
@@ -171,11 +171,13 @@ __ZN3JSC16InternalFunctionC2EPNS_12JSGlobalDataEPNS_14JSGlobalObjectEN3WTF17NonN
__ZN3JSC16JSVariableObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
__ZN3JSC16JSVariableObject14symbolTableGetERKNS_10IdentifierERNS_18PropertyDescriptorE
__ZN3JSC16JSVariableObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
+__ZN3JSC16createRangeErrorEPNS_9ExecStateERKNS_7UStringE
+__ZN3JSC16throwSyntaxErrorEPNS_9ExecStateE
__ZN3JSC16toUInt32SlowCaseEdRb
__ZN3JSC17BytecodeGenerator21setDumpsGeneratedCodeEb
__ZN3JSC17PropertyNameArray3addEPN7WebCore10StringImplE
-__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFNS_7JSValueES2_E
__ZN3JSC17constructFunctionEPNS_9ExecStateERKNS_7ArgListERKNS_10IdentifierERKNS_7UStringEi
+__ZN3JSC17createSyntaxErrorEPNS_9ExecStateERKNS_7UStringE
__ZN3JSC18DebuggerActivationC1EPNS_8JSObjectE
__ZN3JSC18PropertyDescriptor11setWritableEb
__ZN3JSC18PropertyDescriptor12setUndefinedEv
@@ -188,6 +190,7 @@ __ZN3JSC18PropertyDescriptor9setGetterENS_7JSValueE
__ZN3JSC18PropertyDescriptor9setSetterENS_7JSValueE
__ZN3JSC19initializeThreadingEv
__ZN3JSC20MarkedArgumentBuffer10slowAppendENS_7JSValueE
+__ZN3JSC20createReferenceErrorEPNS_9ExecStateERKNS_7UStringE
__ZN3JSC23AbstractSamplingCounter4dumpEv
__ZN3JSC23objectProtoFuncToStringEPNS_9ExecStateE
__ZN3JSC23setUpStaticFunctionSlotEPNS_9ExecStateEPKNS_9HashEntryEPNS_8JSObjectERKNS_10IdentifierERNS_12PropertySlotE
@@ -268,6 +271,9 @@ __ZN3JSC8JSObject17createInheritorIDEv
__ZN3JSC8JSObject17defineOwnPropertyEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorEb
__ZN3JSC8JSObject17putDirectFunctionEPNS_9ExecStateEPNS_10JSFunctionEj
__ZN3JSC8JSObject17putDirectFunctionEPNS_9ExecStateEPNS_16InternalFunctionEj
+__ZN3JSC8JSObject17putWithAttributesEPNS_12JSGlobalDataERKNS_10IdentifierENS_7JSValueEj
+__ZN3JSC8JSObject17putWithAttributesEPNS_12JSGlobalDataERKNS_10IdentifierENS_7JSValueEjbRNS_15PutPropertySlotE
+__ZN3JSC8JSObject17putWithAttributesEPNS_12JSGlobalDataEjNS_7JSValueEj
__ZN3JSC8JSObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueEj
__ZN3JSC8JSObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueEjbRNS_15PutPropertySlotE
__ZN3JSC8JSObject17putWithAttributesEPNS_9ExecStateEjNS_7JSValueEj
@@ -390,6 +396,7 @@ __ZN7WebCore10StringImpl4findEPKcib
__ZN7WebCore10StringImpl4findEPS0_ib
__ZN7WebCore10StringImpl4findEti
__ZN7WebCore10StringImpl5adoptERNS_12StringBufferE
+__ZN7WebCore10StringImpl5asciiEv
__ZN7WebCore10StringImpl5emptyEv
__ZN7WebCore10StringImpl5lowerEv
__ZN7WebCore10StringImpl5toIntEPb
@@ -415,6 +422,7 @@ __ZN7WebCore12AtomicString3addEPKtjj
__ZN7WebCore12AtomicString4findEPKtjj
__ZN7WebCore12AtomicString4initEv
__ZN7WebCore15charactersToIntEPKtmPb
+__ZN7WebCore16codePointCompareERKNS_6StringES2_
__ZN7WebCore17charactersToFloatEPKtmPb
__ZN7WebCore17equalIgnoringCaseEPKtPKcj
__ZN7WebCore17equalIgnoringCaseEPNS_10StringImplEPKc
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
index 1176bcf..a6ff1c2 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
+++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
@@ -10,11 +10,11 @@ EXPORTS
??0JSArray@JSC@@QAE@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@@Z
??0JSArray@JSC@@QAE@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@ABVArgList@1@@Z
??0JSByteArray@JSC@@QAE@PAVExecState@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@PAVByteArray@4@PBUClassInfo@1@@Z
- ??0JSFunction@JSC@@QAE@PAVExecState@1@PAVJSGlobalObject@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6I?AVJSValue@1@0@Z@Z
+ ??0JSFunction@JSC@@QAE@PAVExecState@1@PAVJSGlobalObject@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6I_J0@Z@Z
??0JSObjectWithGlobalObject@JSC@@IAE@PAVJSGlobalObject@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@@Z
??0MD5@WTF@@QAE@XZ
??0Mutex@WTF@@QAE@XZ
- ??0PrototypeFunction@JSC@@QAE@PAVExecState@1@PAVJSGlobalObject@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6I?AVJSValue@1@0@Z@Z
+ ??0PrototypeFunction@JSC@@QAE@PAVExecState@1@PAVJSGlobalObject@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6I_J0@Z@Z
??0RefCountedLeakCounter@WTF@@QAE@PBD@Z
??0StringObject@JSC@@QAE@PAVExecState@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@ABVUString@1@@Z
??0Structure@JSC@@AAE@VJSValue@1@ABVTypeInfo@1@I@Z
@@ -78,16 +78,19 @@ EXPORTS
?create@JSGlobalData@JSC@@SA?AV?$PassRefPtr@VJSGlobalData@JSC@@@WTF@@W4ThreadStackType@2@@Z
?create@OpaqueJSString@@SA?AV?$PassRefPtr@UOpaqueJSString@@@WTF@@ABVUString@JSC@@@Z
?createEmptyString@SmallStrings@JSC@@AAEXPAVJSGlobalData@2@@Z
+ ?createError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z
?createInheritorID@JSObject@JSC@@AAEPAVStructure@2@XZ
?createInterruptedExecutionException@JSC@@YA?AVJSValue@1@PAVJSGlobalData@1@@Z
?createLeaked@JSGlobalData@JSC@@SA?AV?$PassRefPtr@VJSGlobalData@JSC@@@WTF@@W4ThreadStackType@2@@Z
+ ?createReferenceError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z
?createSingleCharacterString@SmallStrings@JSC@@AAEXPAVJSGlobalData@2@E@Z
- ?createStackOverflowError@JSC@@YA?AVJSValue@1@PAVExecState@1@@Z
+ ?createStackOverflowError@JSC@@YAPAVJSObject@1@PAVExecState@1@@Z
?createStructure@JSByteArray@JSC@@SA?AV?$PassRefPtr@VStructure@JSC@@@WTF@@VJSValue@2@@Z
+ ?createSyntaxError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z
?createTable@HashTable@JSC@@ABEXPAVJSGlobalData@2@@Z
?createThread@WTF@@YAIP6APAXPAX@Z0@Z
?createThread@WTF@@YAIP6APAXPAX@Z0PBD@Z
- ?createTypeError@JSC@@YA?AVJSValue@1@PAVExecState@1@PBD@Z
+ ?createTypeError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z
?currentThread@WTF@@YAIXZ
?currentTime@WTF@@YANXZ
?data@CString@WTF@@QBEPBDXZ
@@ -220,7 +223,7 @@ EXPORTS
?newUninitialized@CString@WTF@@SA?AV12@IAAPAD@Z
?nonInlineNaN@JSC@@YANXZ
?objectCount@Heap@JSC@@QBEIXZ
- ?objectProtoFuncToString@JSC@@YI?AVJSValue@1@PAVExecState@1@@Z
+ ?objectProtoFuncToString@JSC@@YI_JPAVExecState@1@@Z
?parse@Parser@JSC@@AAEXPAVJSGlobalData@2@PAHPAVUString@2@@Z
?parseDateFromNullTerminatedCharacters@WTF@@YANPBD@Z
?profiler@Profiler@JSC@@SAPAV12@XZ
@@ -240,6 +243,9 @@ EXPORTS
?putWithAttributes@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@VJSValue@2@I@Z
?putWithAttributes@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@VJSValue@2@I_NAAVPutPropertySlot@2@@Z
?putWithAttributes@JSObject@JSC@@UAEXPAVExecState@2@IVJSValue@2@I@Z
+ ?putWithAttributes@JSObject@JSC@@UAEXPAVJSGlobalData@2@ABVIdentifier@2@VJSValue@2@I@Z
+ ?putWithAttributes@JSObject@JSC@@UAEXPAVJSGlobalData@2@ABVIdentifier@2@VJSValue@2@I_NAAVPutPropertySlot@2@@Z
+ ?putWithAttributes@JSObject@JSC@@UAEXPAVJSGlobalData@2@IVJSValue@2@I@Z
?randomNumber@WTF@@YANXZ
?recompileAllJSFunctions@Debugger@JSC@@QAEXPAVJSGlobalData@2@@Z
?recordExtraCost@Heap@JSC@@AAEXI@Z
@@ -280,9 +286,10 @@ EXPORTS
?symbolTableGet@JSVariableObject@JSC@@IAE_NABVIdentifier@2@AAVPropertyDescriptor@2@@Z
?synthesizePrototype@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z
?thisObject@DebuggerCallFrame@JSC@@QBEPAVJSObject@2@XZ
- ?throwError@JSC@@YAPAVJSObject@1@PAVExecState@1@W4ErrorType@1@@Z
- ?throwError@JSC@@YAPAVJSObject@1@PAVExecState@1@W4ErrorType@1@ABVUString@1@@Z
- ?throwError@JSC@@YAPAVJSObject@1@PAVExecState@1@W4ErrorType@1@PBD@Z
+ ?throwError@JSC@@YA?AVJSValue@1@PAVExecState@1@V21@@Z
+ ?throwError@JSC@@YAPAVJSObject@1@PAVExecState@1@PAV21@@Z
+ ?throwSyntaxError@JSC@@YAPAVJSObject@1@PAVExecState@1@@Z
+ ?throwTypeError@JSC@@YAPAVJSObject@1@PAVExecState@1@@Z
?timedWait@ThreadCondition@WTF@@QAE_NAAVMutex@2@N@Z
?tlsKeyCount@WTF@@YAAAJXZ
?tlsKeys@WTF@@YAPAKXZ
diff --git a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
index 8d10ab3..3b448c5 100644
--- a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
+++ b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
@@ -766,6 +766,9 @@
86565740115BE3DA00291F40 /* CString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CString.cpp; path = text/CString.cpp; sourceTree = "<group>"; };
86565741115BE3DA00291F40 /* CString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CString.h; path = text/CString.h; sourceTree = "<group>"; };
865F408710E7D56300947361 /* APIShims.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIShims.h; sourceTree = "<group>"; };
+ 867FC35F11B763950025105E /* JavaScriptCore.JSVALUE32_64only.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = JavaScriptCore.JSVALUE32_64only.exp; sourceTree = "<group>"; };
+ 867FC36011B763950025105E /* JavaScriptCore.JSVALUE32only.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = JavaScriptCore.JSVALUE32only.exp; sourceTree = "<group>"; };
+ 867FC36111B763950025105E /* JavaScriptCore.JSVALUE64only.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = JavaScriptCore.JSVALUE64only.exp; sourceTree = "<group>"; };
868BFA00117CEFD100B908B1 /* AtomicString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AtomicString.cpp; path = text/AtomicString.cpp; sourceTree = "<group>"; };
868BFA01117CEFD100B908B1 /* AtomicString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AtomicString.h; path = text/AtomicString.h; sourceTree = "<group>"; };
868BFA02117CEFD100B908B1 /* AtomicStringImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AtomicStringImpl.h; path = text/AtomicStringImpl.h; sourceTree = "<group>"; };
@@ -1162,6 +1165,9 @@
937B63CC09E766D200A671DD /* DerivedSources.make */,
F692A8540255597D01FF60F7 /* create_hash_table */,
14B8ECA60A5653980062BE54 /* JavaScriptCore.exp */,
+ 867FC36011B763950025105E /* JavaScriptCore.JSVALUE32only.exp */,
+ 867FC35F11B763950025105E /* JavaScriptCore.JSVALUE32_64only.exp */,
+ 867FC36111B763950025105E /* JavaScriptCore.JSVALUE64only.exp */,
F5C290E60284F98E018635CA /* JavaScriptCorePrefix.h */,
45E12D8806A49B0F00E9DF84 /* jsc.cpp */,
F68EBB8C0255D4C601FF60F7 /* config.h */,
@@ -2210,7 +2216,6 @@
5D2F7CF90C6875BB00B5B72B /* Update Info.plist with version information */,
932F5B3F0822A1C700736975 /* Headers */,
932F5B910822A1C700736975 /* Sources */,
- 1C395CBC0C6BCC16000D1E52 /* Generate 64-bit Export File */,
932F5BD20822A1C700736975 /* Frameworks */,
9319586B09D9F91A00A56FD4 /* Check For Global Initializers */,
933457200EBFDC3F00B80894 /* Check For Exit Time Destructors */,
@@ -2297,22 +2302,6 @@
shellPath = /bin/sh;
shellScript = "cp \"${SRCROOT}/API/tests/testapi.js\" \"${BUILT_PRODUCTS_DIR}\"";
};
- 1C395CBC0C6BCC16000D1E52 /* Generate 64-bit Export File */ = {
- isa = PBXShellScriptBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- inputPaths = (
- "$(SRCROOT)/JavaScriptCore.exp",
- );
- name = "Generate 64-bit Export File";
- outputPaths = (
- "$(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/JavaScriptCore.LP64.exp",
- );
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "# exclude NPN functions on 64-bit\nsed -e s/^.\\*NPN.\\*$// \"${SRCROOT}/JavaScriptCore.exp\" > \"${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore/JavaScriptCore.LP64.exp\"\n";
- };
5D29D8BE0E9860B400C3D2D0 /* Check For Weak VTables and Externals */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
diff --git a/JavaScriptCore/assembler/MacroAssemblerARMv7.h b/JavaScriptCore/assembler/MacroAssemblerARMv7.h
index 31a68d9..380d5f8 100644
--- a/JavaScriptCore/assembler/MacroAssemblerARMv7.h
+++ b/JavaScriptCore/assembler/MacroAssemblerARMv7.h
@@ -459,7 +459,13 @@ public:
void load16(ImplicitAddress address, RegisterID dest)
{
- m_assembler.ldrh(dest, address.base, address.offset);
+ ARMThumbImmediate armImm = ARMThumbImmediate::makeUInt12(address.offset);
+ if (armImm.isValid())
+ m_assembler.ldrh(dest, address.base, armImm);
+ else {
+ move(Imm32(address.offset), dataTempRegister);
+ m_assembler.ldrh(dest, address.base, dataTempRegister);
+ }
}
DataLabel32 store32WithAddressOffsetPatch(RegisterID src, Address address)
diff --git a/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
index bebfdbb..777e1e6 100644
--- a/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
+++ b/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
@@ -357,16 +357,15 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, const Debug
FunctionParameters& parameters = *functionBody->parameters();
size_t parameterCount = parameters.size();
- m_nextParameterIndex = -RegisterFile::CallFrameHeaderSize - parameterCount - 1;
+ int nextParameterIndex = -RegisterFile::CallFrameHeaderSize - parameterCount - 1;
m_parameters.grow(1 + parameterCount); // reserve space for "this"
// Add "this" as a parameter
- m_thisRegister.setIndex(m_nextParameterIndex);
- ++m_nextParameterIndex;
+ m_thisRegister.setIndex(nextParameterIndex);
++m_codeBlock->m_numParameters;
for (size_t i = 0; i < parameterCount; ++i)
- addParameter(parameters[i]);
+ addParameter(parameters[i], ++nextParameterIndex);
preserveLastVar();
@@ -431,23 +430,19 @@ BytecodeGenerator::BytecodeGenerator(EvalNode* evalNode, const Debugger* debugge
preserveLastVar();
}
-RegisterID* BytecodeGenerator::addParameter(const Identifier& ident)
+void BytecodeGenerator::addParameter(const Identifier& ident, int parameterIndex)
{
// Parameters overwrite var declarations, but not function declarations.
- RegisterID* result = 0;
UString::Rep* rep = ident.ustring().rep();
if (!m_functions.contains(rep)) {
- symbolTable().set(rep, m_nextParameterIndex);
- RegisterID& parameter = registerFor(m_nextParameterIndex);
- parameter.setIndex(m_nextParameterIndex);
- result = &parameter;
+ symbolTable().set(rep, parameterIndex);
+ RegisterID& parameter = registerFor(parameterIndex);
+ parameter.setIndex(parameterIndex);
}
// To maintain the calling convention, we have to allocate unique space for
// each parameter, even if the parameter doesn't make it into the symbol table.
- ++m_nextParameterIndex;
++m_codeBlock->m_numParameters;
- return result;
}
RegisterID* BytecodeGenerator::registerFor(const Identifier& ident)
@@ -1415,9 +1410,9 @@ RegisterID* BytecodeGenerator::emitNewFunctionExpression(RegisterID* r0, FuncExp
return r0;
}
-RegisterID* BytecodeGenerator::emitCall(RegisterID* dst, RegisterID* func, RegisterID* thisRegister, ArgumentsNode* argumentsNode, unsigned divot, unsigned startOffset, unsigned endOffset)
+RegisterID* BytecodeGenerator::emitCall(RegisterID* dst, RegisterID* func, CallArguments& callArguments, unsigned divot, unsigned startOffset, unsigned endOffset)
{
- return emitCall(op_call, dst, func, thisRegister, argumentsNode, divot, startOffset, endOffset);
+ return emitCall(op_call, dst, func, callArguments, divot, startOffset, endOffset);
}
void BytecodeGenerator::createArgumentsIfNecessary()
@@ -1430,40 +1425,23 @@ void BytecodeGenerator::createArgumentsIfNecessary()
instructions().append(m_codeBlock->argumentsRegister());
}
-RegisterID* BytecodeGenerator::emitCallEval(RegisterID* dst, RegisterID* func, RegisterID* thisRegister, ArgumentsNode* argumentsNode, unsigned divot, unsigned startOffset, unsigned endOffset)
+RegisterID* BytecodeGenerator::emitCallEval(RegisterID* dst, RegisterID* func, CallArguments& callArguments, unsigned divot, unsigned startOffset, unsigned endOffset)
{
- return emitCall(op_call_eval, dst, func, thisRegister, argumentsNode, divot, startOffset, endOffset);
+ return emitCall(op_call_eval, dst, func, callArguments, divot, startOffset, endOffset);
}
-RegisterID* BytecodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* dst, RegisterID* func, RegisterID* thisRegister, ArgumentsNode* argumentsNode, unsigned divot, unsigned startOffset, unsigned endOffset)
+RegisterID* BytecodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* dst, RegisterID* func, CallArguments& callArguments, unsigned divot, unsigned startOffset, unsigned endOffset)
{
ASSERT(opcodeID == op_call || opcodeID == op_call_eval);
ASSERT(func->refCount());
- ASSERT(thisRegister->refCount());
- RegisterID* originalFunc = func;
- if (m_shouldEmitProfileHooks) {
- // If codegen decided to recycle func as this call's destination register,
- // we need to undo that optimization here so that func will still be around
- // for the sake of op_profile_did_call.
- if (dst == func) {
- RefPtr<RegisterID> movedThisRegister = emitMove(newTemporary(), thisRegister);
- RefPtr<RegisterID> movedFunc = emitMove(thisRegister, func);
-
- thisRegister = movedThisRegister.release().releaseRef();
- func = movedFunc.release().releaseRef();
- }
- }
+ if (m_shouldEmitProfileHooks)
+ emitMove(callArguments.profileHookRegister(), func);
// Generate code for arguments.
- Vector<RefPtr<RegisterID>, 16> argv;
- argv.append(thisRegister);
- for (ArgumentListNode* n = argumentsNode->m_listNode; n; n = n->m_next) {
- argv.append(newTemporary());
- // op_call requires the arguments to be a sequential range of registers
- ASSERT(argv[argv.size() - 1]->index() == argv[argv.size() - 2]->index() + 1);
- emitNode(argv.last().get(), n);
- }
+ unsigned argumentIndex = 0;
+ for (ArgumentListNode* n = callArguments.argumentsNode()->m_listNode; n; n = n->m_next)
+ emitNode(callArguments.argumentRegister(argumentIndex++), n);
// Reserve space for call frame.
Vector<RefPtr<RegisterID>, RegisterFile::CallFrameHeaderSize> callFrame;
@@ -1472,10 +1450,10 @@ RegisterID* BytecodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* dst, Regi
if (m_shouldEmitProfileHooks) {
emitOpcode(op_profile_will_call);
- instructions().append(func->index());
+ instructions().append(callArguments.profileHookRegister()->index());
#if ENABLE(JIT)
- m_codeBlock->addFunctionRegisterInfo(instructions().size(), func->index());
+ m_codeBlock->addFunctionRegisterInfo(instructions().size(), callArguments.profileHookRegister()->index());
#endif
}
@@ -1488,8 +1466,8 @@ RegisterID* BytecodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* dst, Regi
// Emit call.
emitOpcode(opcodeID);
instructions().append(func->index()); // func
- instructions().append(argv.size()); // argCount
- instructions().append(argv[0]->index() + argv.size() + RegisterFile::CallFrameHeaderSize); // registerOffset
+ instructions().append(callArguments.count()); // argCount
+ instructions().append(callArguments.callFrame()); // registerOffset
if (dst != ignoredResult()) {
emitOpcode(op_call_put_result);
instructions().append(dst->index()); // dst
@@ -1497,12 +1475,7 @@ RegisterID* BytecodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* dst, Regi
if (m_shouldEmitProfileHooks) {
emitOpcode(op_profile_did_call);
- instructions().append(func->index());
-
- if (dst == originalFunc) {
- thisRegister->deref();
- func->deref();
- }
+ instructions().append(callArguments.profileHookRegister()->index());
}
return dst;
@@ -1579,34 +1552,23 @@ RegisterID* BytecodeGenerator::emitUnaryNoDstOp(OpcodeID opcodeID, RegisterID* s
return src;
}
-RegisterID* BytecodeGenerator::emitConstruct(RegisterID* dst, RegisterID* func, ArgumentsNode* argumentsNode, unsigned divot, unsigned startOffset, unsigned endOffset)
+RegisterID* BytecodeGenerator::emitConstruct(RegisterID* dst, RegisterID* func, CallArguments& callArguments, unsigned divot, unsigned startOffset, unsigned endOffset)
{
ASSERT(func->refCount());
- RegisterID* originalFunc = func;
- if (m_shouldEmitProfileHooks) {
- // If codegen decided to recycle func as this call's destination register,
- // we need to undo that optimization here so that func will still be around
- // for the sake of op_profile_did_call.
- if (dst == func) {
- RefPtr<RegisterID> movedFunc = emitMove(newTemporary(), func);
- func = movedFunc.release().releaseRef();
- }
- }
+ if (m_shouldEmitProfileHooks)
+ emitMove(callArguments.profileHookRegister(), func);
// Generate code for arguments.
- Vector<RefPtr<RegisterID>, 16> argv;
- argv.append(newTemporary()); // reserve space for "this"
- for (ArgumentListNode* n = argumentsNode ? argumentsNode->m_listNode : 0; n; n = n->m_next) {
- argv.append(newTemporary());
- // op_construct requires the arguments to be a sequential range of registers
- ASSERT(argv[argv.size() - 1]->index() == argv[argv.size() - 2]->index() + 1);
- emitNode(argv.last().get(), n);
+ unsigned argumentIndex = 0;
+ if (ArgumentsNode* argumentsNode = callArguments.argumentsNode()) {
+ for (ArgumentListNode* n = argumentsNode->m_listNode; n; n = n->m_next)
+ emitNode(callArguments.argumentRegister(argumentIndex++), n);
}
if (m_shouldEmitProfileHooks) {
emitOpcode(op_profile_will_call);
- instructions().append(func->index());
+ instructions().append(callArguments.profileHookRegister()->index());
}
// Reserve space for call frame.
@@ -1622,8 +1584,8 @@ RegisterID* BytecodeGenerator::emitConstruct(RegisterID* dst, RegisterID* func,
emitOpcode(op_construct);
instructions().append(func->index()); // func
- instructions().append(argv.size()); // argCount
- instructions().append(argv[0]->index() + argv.size() + RegisterFile::CallFrameHeaderSize); // registerOffset
+ instructions().append(callArguments.count()); // argCount
+ instructions().append(callArguments.callFrame()); // registerOffset
if (dst != ignoredResult()) {
emitOpcode(op_call_put_result);
instructions().append(dst->index()); // dst
@@ -1631,10 +1593,7 @@ RegisterID* BytecodeGenerator::emitConstruct(RegisterID* dst, RegisterID* func,
if (m_shouldEmitProfileHooks) {
emitOpcode(op_profile_did_call);
- instructions().append(func->index());
-
- if (dst == originalFunc)
- func->deref();
+ instructions().append(callArguments.profileHookRegister()->index());
}
return dst;
@@ -1895,11 +1854,11 @@ RegisterID* BytecodeGenerator::emitCatch(RegisterID* targetRegister, Label* star
return targetRegister;
}
-RegisterID* BytecodeGenerator::emitNewError(RegisterID* dst, ErrorType type, JSValue message)
+RegisterID* BytecodeGenerator::emitNewError(RegisterID* dst, bool isReferenceError, JSValue message)
{
emitOpcode(op_new_error);
instructions().append(dst->index());
- instructions().append(static_cast<int>(type));
+ instructions().append(isReferenceError);
instructions().append(addConstantValue(message)->index());
return dst;
}
@@ -2056,7 +2015,7 @@ RegisterID* BytecodeGenerator::emitThrowExpressionTooDeepException()
// that from an arbitrary node. However, calling emitExpressionInfo without any useful data
// is still good enough to get us an accurate line number.
emitExpressionInfo(0, 0, 0);
- RegisterID* exception = emitNewError(newTemporary(), SyntaxError, jsString(globalData(), "Expression too deep"));
+ RegisterID* exception = emitNewError(newTemporary(), false, jsString(globalData(), "Expression too deep"));
emitThrow(exception);
return exception;
}
diff --git a/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/JavaScriptCore/bytecompiler/BytecodeGenerator.h
index 398d666..8f0ce34 100644
--- a/JavaScriptCore/bytecompiler/BytecodeGenerator.h
+++ b/JavaScriptCore/bytecompiler/BytecodeGenerator.h
@@ -51,6 +51,23 @@ namespace JSC {
class ScopeChain;
class ScopeNode;
+ class CallArguments {
+ public:
+ CallArguments(BytecodeGenerator& generator, ArgumentsNode* argumentsNode);
+
+ RegisterID* thisRegister() { return m_argv[0].get(); }
+ RegisterID* argumentRegister(unsigned i) { return m_argv[i + 1].get(); }
+ unsigned callFrame() { return thisRegister()->index() + count() + RegisterFile::CallFrameHeaderSize; }
+ unsigned count() { return m_argv.size(); }
+ RegisterID* profileHookRegister() { return m_profileHookRegister.get(); }
+ ArgumentsNode* argumentsNode() { return m_argumentsNode; }
+
+ private:
+ RefPtr<RegisterID> m_profileHookRegister;
+ ArgumentsNode* m_argumentsNode;
+ Vector<RefPtr<RegisterID>, 16> m_argv;
+ };
+
struct FinallyContext {
Label* finallyAddr;
RegisterID* retAddrDst;
@@ -319,15 +336,15 @@ namespace JSC {
RegisterID* emitPutGetter(RegisterID* base, const Identifier& property, RegisterID* value);
RegisterID* emitPutSetter(RegisterID* base, const Identifier& property, RegisterID* value);
- RegisterID* emitCall(RegisterID* dst, RegisterID* func, RegisterID* thisRegister, ArgumentsNode*, unsigned divot, unsigned startOffset, unsigned endOffset);
- RegisterID* emitCallEval(RegisterID* dst, RegisterID* func, RegisterID* thisRegister, ArgumentsNode*, unsigned divot, unsigned startOffset, unsigned endOffset);
+ RegisterID* emitCall(RegisterID* dst, RegisterID* func, CallArguments&, unsigned divot, unsigned startOffset, unsigned endOffset);
+ RegisterID* emitCallEval(RegisterID* dst, RegisterID* func, CallArguments&, unsigned divot, unsigned startOffset, unsigned endOffset);
RegisterID* emitCallVarargs(RegisterID* dst, RegisterID* func, RegisterID* thisRegister, RegisterID* argCount, unsigned divot, unsigned startOffset, unsigned endOffset);
RegisterID* emitLoadVarargs(RegisterID* argCountDst, RegisterID* args);
RegisterID* emitReturn(RegisterID* src);
RegisterID* emitEnd(RegisterID* src) { return emitUnaryNoDstOp(op_end, src); }
- RegisterID* emitConstruct(RegisterID* dst, RegisterID* func, ArgumentsNode*, unsigned divot, unsigned startOffset, unsigned endOffset);
+ RegisterID* emitConstruct(RegisterID* dst, RegisterID* func, CallArguments&, unsigned divot, unsigned startOffset, unsigned endOffset);
RegisterID* emitStrcat(RegisterID* dst, RegisterID* src, int count);
void emitToPrimitive(RegisterID* dst, RegisterID* src);
@@ -347,7 +364,7 @@ namespace JSC {
RegisterID* emitCatch(RegisterID*, Label* start, Label* end);
void emitThrow(RegisterID* exc) { emitUnaryNoDstOp(op_throw, exc); }
- RegisterID* emitNewError(RegisterID* dst, ErrorType type, JSValue message);
+ RegisterID* emitNewError(RegisterID* dst, bool isReferenceError, JSValue message);
void emitPushNewScope(RegisterID* dst, const Identifier& property, RegisterID* value);
RegisterID* emitPushScope(RegisterID* scope);
@@ -386,6 +403,8 @@ namespace JSC {
m_codeBlockBeingRegeneratedFrom = originalCodeBlock;
}
+ bool shouldEmitProfileHooks() { return m_shouldEmitProfileHooks; }
+
private:
void emitOpcode(OpcodeID);
void retrieveLastBinaryOp(int& dstIndex, int& src1Index, int& src2Index);
@@ -410,7 +429,7 @@ namespace JSC {
typedef HashMap<double, JSValue> NumberMap;
typedef HashMap<UString::Rep*, JSString*, IdentifierRepHash> IdentifierStringMap;
- RegisterID* emitCall(OpcodeID, RegisterID* dst, RegisterID* func, RegisterID* thisRegister, ArgumentsNode*, unsigned divot, unsigned startOffset, unsigned endOffset);
+ RegisterID* emitCall(OpcodeID, RegisterID* dst, RegisterID* func, CallArguments&, unsigned divot, unsigned startOffset, unsigned endOffset);
RegisterID* newRegister();
@@ -442,7 +461,7 @@ namespace JSC {
// Returns true if a new RegisterID was added, false if a pre-existing RegisterID was re-used.
bool addGlobalVar(const Identifier&, bool isConstant, RegisterID*&);
- RegisterID* addParameter(const Identifier&);
+ void addParameter(const Identifier&, int parameterIndex);
void preserveLastVar();
@@ -515,7 +534,6 @@ namespace JSC {
Vector<ForInContext> m_forInContextStack;
int m_nextGlobalIndex;
- int m_nextParameterIndex;
int m_firstConstantIndex;
int m_nextConstantOffset;
unsigned m_globalConstantIndex;
diff --git a/JavaScriptCore/bytecompiler/NodesCodegen.cpp b/JavaScriptCore/bytecompiler/NodesCodegen.cpp
index c514b7a..765230e 100644
--- a/JavaScriptCore/bytecompiler/NodesCodegen.cpp
+++ b/JavaScriptCore/bytecompiler/NodesCodegen.cpp
@@ -81,27 +81,27 @@ static void substitute(UString& string, const UString& substring)
string = makeString(string.substr(0, position), substring, string.substr(position + 2));
}
-RegisterID* ThrowableExpressionData::emitThrowError(BytecodeGenerator& generator, ErrorType type, const char* message)
+RegisterID* ThrowableExpressionData::emitThrowError(BytecodeGenerator& generator, bool isReferenceError, const char* message)
{
generator.emitExpressionInfo(divot(), startOffset(), endOffset());
- RegisterID* exception = generator.emitNewError(generator.newTemporary(), type, jsString(generator.globalData(), message));
+ RegisterID* exception = generator.emitNewError(generator.newTemporary(), isReferenceError, jsString(generator.globalData(), message));
generator.emitThrow(exception);
return exception;
}
-RegisterID* ThrowableExpressionData::emitThrowError(BytecodeGenerator& generator, ErrorType type, const char* messageTemplate, const UString& label)
+RegisterID* ThrowableExpressionData::emitThrowError(BytecodeGenerator& generator, bool isReferenceError, const char* messageTemplate, const UString& label)
{
UString message = messageTemplate;
substitute(message, label);
generator.emitExpressionInfo(divot(), startOffset(), endOffset());
- RegisterID* exception = generator.emitNewError(generator.newTemporary(), type, jsString(generator.globalData(), message));
+ RegisterID* exception = generator.emitNewError(generator.newTemporary(), isReferenceError, jsString(generator.globalData(), message));
generator.emitThrow(exception);
return exception;
}
-inline RegisterID* ThrowableExpressionData::emitThrowError(BytecodeGenerator& generator, ErrorType type, const char* messageTemplate, const Identifier& label)
+inline RegisterID* ThrowableExpressionData::emitThrowError(BytecodeGenerator& generator, bool isReferenceError, const char* messageTemplate, const Identifier& label)
{
- return emitThrowError(generator, type, messageTemplate, label.ustring());
+ return emitThrowError(generator, isReferenceError, messageTemplate, label.ustring());
}
// ------------------------------ NullNode -------------------------------------
@@ -146,7 +146,7 @@ RegisterID* RegExpNode::emitBytecode(BytecodeGenerator& generator, RegisterID* d
{
RefPtr<RegExp> regExp = RegExp::create(generator.globalData(), m_pattern.ustring(), m_flags.ustring());
if (!regExp->isValid())
- return emitThrowError(generator, SyntaxError, "Invalid regular expression: %s", regExp->errorMessage());
+ return emitThrowError(generator, false, "Invalid regular expression: %s", regExp->errorMessage());
if (dst == generator.ignoredResult())
return 0;
return generator.emitNewRegExp(generator.finalDestination(dst), regExp.get());
@@ -316,7 +316,23 @@ RegisterID* ArgumentListNode::emitBytecode(BytecodeGenerator& generator, Registe
RegisterID* NewExprNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
{
RefPtr<RegisterID> func = generator.emitNode(m_expr);
- return generator.emitConstruct(generator.finalDestinationOrIgnored(dst), func.get(), m_args, divot(), startOffset(), endOffset());
+ CallArguments callArguments(generator, m_args);
+ return generator.emitConstruct(generator.finalDestinationOrIgnored(dst), func.get(), callArguments, divot(), startOffset(), endOffset());
+}
+
+CallArguments::CallArguments(BytecodeGenerator& generator, ArgumentsNode* argumentsNode)
+ : m_argumentsNode(argumentsNode)
+{
+ if (generator.shouldEmitProfileHooks())
+ m_profileHookRegister = generator.newTemporary();
+ m_argv.append(generator.newTemporary());
+ if (argumentsNode) {
+ for (ArgumentListNode* n = argumentsNode->m_listNode; n; n = n->m_next) {
+ m_argv.append(generator.newTemporary());
+ // op_call requires the arguments to be a sequential range of registers
+ ASSERT(m_argv[m_argv.size() - 1]->index() == m_argv[m_argv.size() - 2]->index() + 1);
+ }
+ }
}
// ------------------------------ EvalFunctionCallNode ----------------------------------
@@ -324,10 +340,10 @@ RegisterID* NewExprNode::emitBytecode(BytecodeGenerator& generator, RegisterID*
RegisterID* EvalFunctionCallNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
{
RefPtr<RegisterID> func = generator.tempDestination(dst);
- RefPtr<RegisterID> thisRegister = generator.newTemporary();
+ CallArguments callArguments(generator, m_args);
generator.emitExpressionInfo(divot() - startOffset() + 4, 4, 0);
- generator.emitResolveWithBase(thisRegister.get(), func.get(), generator.propertyNames().eval);
- return generator.emitCallEval(generator.finalDestination(dst, func.get()), func.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
+ generator.emitResolveWithBase(callArguments.thisRegister(), func.get(), generator.propertyNames().eval);
+ return generator.emitCallEval(generator.finalDestination(dst, func.get()), func.get(), callArguments, divot(), startOffset(), endOffset());
}
// ------------------------------ FunctionCallValueNode ----------------------------------
@@ -335,8 +351,9 @@ RegisterID* EvalFunctionCallNode::emitBytecode(BytecodeGenerator& generator, Reg
RegisterID* FunctionCallValueNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
{
RefPtr<RegisterID> func = generator.emitNode(m_expr);
- RefPtr<RegisterID> thisRegister = generator.emitLoad(generator.newTemporary(), jsNull());
- return generator.emitCall(generator.finalDestinationOrIgnored(dst, func.get()), func.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
+ CallArguments callArguments(generator, m_args);
+ generator.emitLoad(callArguments.thisRegister(), jsNull());
+ return generator.emitCall(generator.finalDestinationOrIgnored(dst, func.get()), func.get(), callArguments, divot(), startOffset(), endOffset());
}
// ------------------------------ FunctionCallResolveNode ----------------------------------
@@ -344,8 +361,9 @@ RegisterID* FunctionCallValueNode::emitBytecode(BytecodeGenerator& generator, Re
RegisterID* FunctionCallResolveNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
{
if (RefPtr<RegisterID> local = generator.registerFor(m_ident)) {
- RefPtr<RegisterID> thisRegister = generator.emitLoad(generator.newTemporary(), jsNull());
- return generator.emitCall(generator.finalDestinationOrIgnored(dst, thisRegister.get()), local.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
+ CallArguments callArguments(generator, m_args);
+ generator.emitLoad(callArguments.thisRegister(), jsNull());
+ return generator.emitCall(generator.finalDestinationOrIgnored(dst, callArguments.thisRegister()), local.get(), callArguments, divot(), startOffset(), endOffset());
}
int index = 0;
@@ -354,16 +372,17 @@ RegisterID* FunctionCallResolveNode::emitBytecode(BytecodeGenerator& generator,
bool requiresDynamicChecks = false;
if (generator.findScopedProperty(m_ident, index, depth, false, requiresDynamicChecks, globalObject) && index != missingSymbolMarker() && !requiresDynamicChecks) {
RefPtr<RegisterID> func = generator.emitGetScopedVar(generator.newTemporary(), depth, index, globalObject);
- RefPtr<RegisterID> thisRegister = generator.emitLoad(generator.newTemporary(), jsNull());
- return generator.emitCall(generator.finalDestinationOrIgnored(dst, func.get()), func.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
+ CallArguments callArguments(generator, m_args);
+ generator.emitLoad(callArguments.thisRegister(), jsNull());
+ return generator.emitCall(generator.finalDestinationOrIgnored(dst, func.get()), func.get(), callArguments, divot(), startOffset(), endOffset());
}
RefPtr<RegisterID> func = generator.newTemporary();
- RefPtr<RegisterID> thisRegister = generator.newTemporary();
+ CallArguments callArguments(generator, m_args);
int identifierStart = divot() - startOffset();
generator.emitExpressionInfo(identifierStart + m_ident.size(), m_ident.size(), 0);
- generator.emitResolveWithBase(thisRegister.get(), func.get(), m_ident);
- return generator.emitCall(generator.finalDestinationOrIgnored(dst, func.get()), func.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
+ generator.emitResolveWithBase(callArguments.thisRegister(), func.get(), m_ident);
+ return generator.emitCall(generator.finalDestinationOrIgnored(dst, func.get()), func.get(), callArguments, divot(), startOffset(), endOffset());
}
// ------------------------------ FunctionCallBracketNode ----------------------------------
@@ -374,8 +393,9 @@ RegisterID* FunctionCallBracketNode::emitBytecode(BytecodeGenerator& generator,
RegisterID* property = generator.emitNode(m_subscript);
generator.emitExpressionInfo(divot() - m_subexpressionDivotOffset, startOffset() - m_subexpressionDivotOffset, m_subexpressionEndOffset);
RefPtr<RegisterID> function = generator.emitGetByVal(generator.tempDestination(dst), base.get(), property);
- RefPtr<RegisterID> thisRegister = generator.emitMove(generator.newTemporary(), base.get());
- return generator.emitCall(generator.finalDestinationOrIgnored(dst, function.get()), function.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
+ CallArguments callArguments(generator, m_args);
+ generator.emitMove(callArguments.thisRegister(), base.get());
+ return generator.emitCall(generator.finalDestinationOrIgnored(dst, function.get()), function.get(), callArguments, divot(), startOffset(), endOffset());
}
// ------------------------------ FunctionCallDotNode ----------------------------------
@@ -383,12 +403,12 @@ RegisterID* FunctionCallBracketNode::emitBytecode(BytecodeGenerator& generator,
RegisterID* FunctionCallDotNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
{
RefPtr<RegisterID> function = generator.tempDestination(dst);
- RefPtr<RegisterID> thisRegister = generator.newTemporary();
- generator.emitNode(thisRegister.get(), m_base);
+ CallArguments callArguments(generator, m_args);
+ generator.emitNode(callArguments.thisRegister(), m_base);
generator.emitExpressionInfo(divot() - m_subexpressionDivotOffset, startOffset() - m_subexpressionDivotOffset, m_subexpressionEndOffset);
generator.emitMethodCheck();
- generator.emitGetById(function.get(), thisRegister.get(), m_ident);
- return generator.emitCall(generator.finalDestinationOrIgnored(dst, function.get()), function.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
+ generator.emitGetById(function.get(), callArguments.thisRegister(), m_ident);
+ return generator.emitCall(generator.finalDestinationOrIgnored(dst, function.get()), function.get(), callArguments, divot(), startOffset(), endOffset());
}
RegisterID* CallFunctionCallDotNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
@@ -401,28 +421,36 @@ RegisterID* CallFunctionCallDotNode::emitBytecode(BytecodeGenerator& generator,
RefPtr<RegisterID> finalDestinationOrIgnored = generator.finalDestinationOrIgnored(dst, function.get());
generator.emitJumpIfNotFunctionCall(function.get(), realCall.get());
{
- RefPtr<RegisterID> realFunction = generator.emitMove(generator.tempDestination(dst), base.get());
- RefPtr<RegisterID> thisRegister = generator.newTemporary();
- ArgumentListNode* oldList = m_args->m_listNode;
if (m_args->m_listNode && m_args->m_listNode->m_expr) {
- generator.emitNode(thisRegister.get(), m_args->m_listNode->m_expr);
+ ArgumentListNode* oldList = m_args->m_listNode;
m_args->m_listNode = m_args->m_listNode->m_next;
- } else
- generator.emitLoad(thisRegister.get(), jsNull());
- generator.emitCall(finalDestinationOrIgnored.get(), realFunction.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
- generator.emitJump(end.get());
- m_args->m_listNode = oldList;
+ RefPtr<RegisterID> realFunction = generator.emitMove(generator.tempDestination(dst), base.get());
+ CallArguments callArguments(generator, m_args);
+ generator.emitNode(callArguments.thisRegister(), oldList->m_expr);
+ generator.emitCall(finalDestinationOrIgnored.get(), realFunction.get(), callArguments, divot(), startOffset(), endOffset());
+ generator.emitJump(end.get());
+
+ m_args->m_listNode = oldList;
+
+ } else {
+ RefPtr<RegisterID> realFunction = generator.emitMove(generator.tempDestination(dst), base.get());
+ CallArguments callArguments(generator, m_args);
+ generator.emitLoad(callArguments.thisRegister(), jsNull());
+ generator.emitCall(finalDestinationOrIgnored.get(), realFunction.get(), callArguments, divot(), startOffset(), endOffset());
+ generator.emitJump(end.get());
+ }
}
generator.emitLabel(realCall.get());
{
- RefPtr<RegisterID> thisRegister = generator.emitMove(generator.newTemporary(), base.get());
- generator.emitCall(finalDestinationOrIgnored.get(), function.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
+ CallArguments callArguments(generator, m_args);
+ generator.emitMove(callArguments.thisRegister(), base.get());
+ generator.emitCall(finalDestinationOrIgnored.get(), function.get(), callArguments, divot(), startOffset(), endOffset());
}
generator.emitLabel(end.get());
return finalDestinationOrIgnored.get();
}
-
+
static bool areTrivialApplyArguments(ArgumentsNode* args)
{
return !args->m_listNode || !args->m_listNode->m_expr || !args->m_listNode->m_next
@@ -445,21 +473,30 @@ RegisterID* ApplyFunctionCallDotNode::emitBytecode(BytecodeGenerator& generator,
generator.emitJumpIfNotFunctionApply(function.get(), realCall.get());
{
if (mayBeCall) {
- RefPtr<RegisterID> realFunction = generator.emitMove(generator.tempDestination(dst), base.get());
- RefPtr<RegisterID> thisRegister = generator.newTemporary();
- ArgumentListNode* oldList = m_args->m_listNode;
if (m_args->m_listNode && m_args->m_listNode->m_expr) {
- generator.emitNode(thisRegister.get(), m_args->m_listNode->m_expr);
- m_args->m_listNode = m_args->m_listNode->m_next;
- if (m_args->m_listNode) {
- ASSERT(m_args->m_listNode->m_expr->isSimpleArray());
- ASSERT(!m_args->m_listNode->m_next);
- m_args->m_listNode = static_cast<ArrayNode*>(m_args->m_listNode->m_expr)->toArgumentList(generator.globalData());
+ ArgumentListNode* oldList = m_args->m_listNode;
+ if (m_args->m_listNode->m_next) {
+ ASSERT(m_args->m_listNode->m_next->m_expr->isSimpleArray());
+ ASSERT(!m_args->m_listNode->m_next->m_next);
+ m_args->m_listNode = static_cast<ArrayNode*>(m_args->m_listNode->m_next->m_expr)->toArgumentList(generator.globalData());
+ RefPtr<RegisterID> realFunction = generator.emitMove(generator.tempDestination(dst), base.get());
+ CallArguments callArguments(generator, m_args);
+ generator.emitNode(callArguments.thisRegister(), oldList->m_expr);
+ generator.emitCall(finalDestinationOrIgnored.get(), realFunction.get(), callArguments, divot(), startOffset(), endOffset());
+ } else {
+ m_args->m_listNode = m_args->m_listNode->m_next;
+ RefPtr<RegisterID> realFunction = generator.emitMove(generator.tempDestination(dst), base.get());
+ CallArguments callArguments(generator, m_args);
+ generator.emitNode(callArguments.thisRegister(), oldList->m_expr);
+ generator.emitCall(finalDestinationOrIgnored.get(), realFunction.get(), callArguments, divot(), startOffset(), endOffset());
}
- } else
- generator.emitLoad(thisRegister.get(), jsNull());
- generator.emitCall(finalDestinationOrIgnored.get(), realFunction.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
- m_args->m_listNode = oldList;
+ m_args->m_listNode = oldList;
+ } else {
+ RefPtr<RegisterID> realFunction = generator.emitMove(generator.tempDestination(dst), base.get());
+ CallArguments callArguments(generator, m_args);
+ generator.emitLoad(callArguments.thisRegister(), jsNull());
+ generator.emitCall(finalDestinationOrIgnored.get(), realFunction.get(), callArguments, divot(), startOffset(), endOffset());
+ }
} else {
ASSERT(m_args->m_listNode && m_args->m_listNode->m_next);
RefPtr<RegisterID> realFunction = generator.emitMove(generator.newTemporary(), base.get());
@@ -487,8 +524,9 @@ RegisterID* ApplyFunctionCallDotNode::emitBytecode(BytecodeGenerator& generator,
}
generator.emitLabel(realCall.get());
{
- RefPtr<RegisterID> thisRegister = generator.emitMove(generator.newTemporary(), base.get());
- generator.emitCall(finalDestinationOrIgnored.get(), function.get(), thisRegister.get(), m_args, divot(), startOffset(), endOffset());
+ CallArguments callArguments(generator, m_args);
+ generator.emitMove(callArguments.thisRegister(), base.get());
+ generator.emitCall(finalDestinationOrIgnored.get(), function.get(), callArguments, divot(), startOffset(), endOffset());
}
generator.emitLabel(end.get());
return finalDestinationOrIgnored.get();
@@ -604,7 +642,7 @@ RegisterID* PostfixDotNode::emitBytecode(BytecodeGenerator& generator, RegisterI
RegisterID* PostfixErrorNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
{
- return emitThrowError(generator, ReferenceError, m_operator == OpPlusPlus
+ return emitThrowError(generator, true, m_operator == OpPlusPlus
? "Postfix ++ operator applied to value that is not a reference."
: "Postfix -- operator applied to value that is not a reference.");
}
@@ -769,7 +807,7 @@ RegisterID* PrefixDotNode::emitBytecode(BytecodeGenerator& generator, RegisterID
RegisterID* PrefixErrorNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
{
- return emitThrowError(generator, ReferenceError, m_operator == OpPlusPlus
+ return emitThrowError(generator, true, m_operator == OpPlusPlus
? "Prefix ++ operator applied to value that is not a reference."
: "Prefix -- operator applied to value that is not a reference.");
}
@@ -1212,7 +1250,7 @@ RegisterID* ReadModifyDotNode::emitBytecode(BytecodeGenerator& generator, Regist
RegisterID* AssignErrorNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
{
- return emitThrowError(generator, ReferenceError, "Left side of assignment is not a reference.");
+ return emitThrowError(generator, true, "Left side of assignment is not a reference.");
}
// ------------------------------ AssignBracketNode -----------------------------------
@@ -1517,7 +1555,7 @@ RegisterID* ForInNode::emitBytecode(BytecodeGenerator& generator, RegisterID* ds
RefPtr<LabelScope> scope = generator.newLabelScope(LabelScope::Loop);
if (!m_lexpr->isLocation())
- return emitThrowError(generator, ReferenceError, "Left side of for-in statement is not a reference.");
+ return emitThrowError(generator, true, "Left side of for-in statement is not a reference.");
generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
@@ -1596,8 +1634,8 @@ RegisterID* ContinueNode::emitBytecode(BytecodeGenerator& generator, RegisterID*
if (!scope)
return m_ident.isEmpty()
- ? emitThrowError(generator, SyntaxError, "Invalid continue statement.")
- : emitThrowError(generator, SyntaxError, "Undefined label: '%s'.", m_ident);
+ ? emitThrowError(generator, false, "Invalid continue statement.")
+ : emitThrowError(generator, false, "Undefined label: '%s'.", m_ident);
generator.emitJumpScopes(scope->continueTarget(), scope->scopeDepth());
return dst;
@@ -1614,8 +1652,8 @@ RegisterID* BreakNode::emitBytecode(BytecodeGenerator& generator, RegisterID* ds
if (!scope)
return m_ident.isEmpty()
- ? emitThrowError(generator, SyntaxError, "Invalid break statement.")
- : emitThrowError(generator, SyntaxError, "Undefined label: '%s'.", m_ident);
+ ? emitThrowError(generator, false, "Invalid break statement.")
+ : emitThrowError(generator, false, "Undefined label: '%s'.", m_ident);
generator.emitJumpScopes(scope->breakTarget(), scope->scopeDepth());
return dst;
@@ -1627,7 +1665,7 @@ RegisterID* ReturnNode::emitBytecode(BytecodeGenerator& generator, RegisterID* d
{
generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
if (generator.codeType() != FunctionCode)
- return emitThrowError(generator, SyntaxError, "Invalid return statement.");
+ return emitThrowError(generator, false, "Invalid return statement.");
if (dst == generator.ignoredResult())
dst = 0;
@@ -1833,7 +1871,7 @@ RegisterID* LabelNode::emitBytecode(BytecodeGenerator& generator, RegisterID* ds
generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
if (generator.breakTarget(m_name))
- return emitThrowError(generator, SyntaxError, "Duplicate label: %s.", m_name);
+ return emitThrowError(generator, false, "Duplicate label: %s.", m_name);
RefPtr<LabelScope> scope = generator.newLabelScope(LabelScope::NamedLabel, &m_name);
RegisterID* r0 = generator.emitNode(dst, m_statement);
diff --git a/JavaScriptCore/interpreter/CallFrame.h b/JavaScriptCore/interpreter/CallFrame.h
index 2a7bce2..723d4ae 100644
--- a/JavaScriptCore/interpreter/CallFrame.h
+++ b/JavaScriptCore/interpreter/CallFrame.h
@@ -77,7 +77,6 @@ namespace JSC {
// pointer, so these are inefficient, and should be used sparingly in new code.
// But they're used in many places in legacy code, so they're not going away any time soon.
- void setException(JSValue exception) { globalData().exception = exception; }
void clearException() { globalData().exception = JSValue(); }
JSValue exception() const { return globalData().exception; }
JSValue* exceptionSlot() { return &globalData().exception; }
diff --git a/JavaScriptCore/interpreter/Interpreter.cpp b/JavaScriptCore/interpreter/Interpreter.cpp
index 12ac323..91f5c0a 100644
--- a/JavaScriptCore/interpreter/Interpreter.cpp
+++ b/JavaScriptCore/interpreter/Interpreter.cpp
@@ -564,27 +564,15 @@ NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSV
exception = createNotAnObjectError(callFrame, static_cast<JSNotAnObjectErrorStub*>(exception), bytecodeOffset, codeBlock);
exceptionValue = exception;
} else {
- if (!exception->hasProperty(callFrame, Identifier(callFrame, "line")) &&
- !exception->hasProperty(callFrame, Identifier(callFrame, "sourceId")) &&
- !exception->hasProperty(callFrame, Identifier(callFrame, "sourceURL")) &&
- !exception->hasProperty(callFrame, Identifier(callFrame, expressionBeginOffsetPropertyName)) &&
- !exception->hasProperty(callFrame, Identifier(callFrame, expressionCaretOffsetPropertyName)) &&
- !exception->hasProperty(callFrame, Identifier(callFrame, expressionEndOffsetPropertyName))) {
+ if (!hasErrorInfo(callFrame, exception)) {
if (explicitThrow) {
int startOffset = 0;
int endOffset = 0;
int divotPoint = 0;
int line = codeBlock->expressionRangeForBytecodeOffset(callFrame, bytecodeOffset, divotPoint, startOffset, endOffset);
- exception->putWithAttributes(callFrame, Identifier(callFrame, "line"), jsNumber(callFrame, line), ReadOnly | DontDelete);
-
- // We only hit this path for error messages and throw statements, which don't have a specific failure position
- // So we just give the full range of the error/throw statement.
- exception->putWithAttributes(callFrame, Identifier(callFrame, expressionBeginOffsetPropertyName), jsNumber(callFrame, divotPoint - startOffset), ReadOnly | DontDelete);
- exception->putWithAttributes(callFrame, Identifier(callFrame, expressionEndOffsetPropertyName), jsNumber(callFrame, divotPoint + endOffset), ReadOnly | DontDelete);
+ addErrorInfo(callFrame, exception, line, codeBlock->ownerExecutable()->source(), divotPoint, startOffset, endOffset, false);
} else
- exception->putWithAttributes(callFrame, Identifier(callFrame, "line"), jsNumber(callFrame, codeBlock->lineNumberForBytecodeOffset(callFrame, bytecodeOffset)), ReadOnly | DontDelete);
- exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceId"), jsNumber(callFrame, codeBlock->ownerExecutable()->sourceID()), ReadOnly | DontDelete);
- exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceURL"), jsOwnedString(callFrame, codeBlock->ownerExecutable()->sourceURL()), ReadOnly | DontDelete);
+ addErrorInfo(callFrame, exception, codeBlock->lineNumberForBytecodeOffset(callFrame, bytecodeOffset), codeBlock->ownerExecutable()->source());
}
ComplType exceptionType = exception->exceptionType();
@@ -785,7 +773,7 @@ JSValue Interpreter::executeCall(CallFrame* callFrame, JSObject* function, CallT
JSValue result;
{
SamplingTool::HostCallRecord callRecord(m_sampler.get());
- result = callData.native.function(newCallFrame);
+ result = JSValue::decode(callData.native.function(newCallFrame));
}
if (*profiler)
@@ -795,66 +783,99 @@ JSValue Interpreter::executeCall(CallFrame* callFrame, JSObject* function, CallT
return result;
}
-JSValue Interpreter::executeConstruct(FunctionExecutable* functionExecutable, CallFrame* callFrame, JSFunction* function, JSObject* thisObj, const ArgList& args, ScopeChainNode* scopeChain, JSValue* exception)
+JSObject* Interpreter::executeConstruct(CallFrame* callFrame, JSObject* constructor, ConstructType constructType, const ConstructData& constructData, const ArgList& args, JSValue* exception)
{
- ASSERT(!scopeChain->globalData->exception);
+ ASSERT(!callFrame->hadException());
if (m_reentryDepth >= MaxSmallThreadReentryDepth) {
if (m_reentryDepth >= callFrame->globalData().maxReentryDepth) {
*exception = createStackOverflowError(callFrame);
- return jsNull();
+ return 0;
}
}
Register* oldEnd = m_registerFile.end();
- int argc = 1 + args.size(); // implicit "this" parameter
+ int argCount = 1 + args.size(); // implicit "this" parameter
+ size_t registerOffset = argCount + RegisterFile::CallFrameHeaderSize;
- if (!m_registerFile.grow(oldEnd + argc)) {
+ if (!m_registerFile.grow(oldEnd + registerOffset)) {
*exception = createStackOverflowError(callFrame);
- return jsNull();
+ return 0;
}
CallFrame* newCallFrame = CallFrame::create(oldEnd);
size_t dst = 0;
- newCallFrame->r(0) = JSValue(thisObj);
ArgList::const_iterator end = args.end();
for (ArgList::const_iterator it = args.begin(); it != end; ++it)
newCallFrame->r(++dst) = *it;
- CodeBlock* codeBlock = &functionExecutable->bytecodeForConstruct(callFrame, scopeChain);
- newCallFrame = slideRegisterWindowForCall(codeBlock, &m_registerFile, newCallFrame, argc + RegisterFile::CallFrameHeaderSize, argc);
- if (UNLIKELY(!newCallFrame)) {
- *exception = createStackOverflowError(callFrame);
+ if (constructType == ConstructTypeJS) {
+ ScopeChainNode* constructDataScopeChain = constructData.js.scopeChain;
+ CodeBlock* newCodeBlock = &constructData.js.functionExecutable->bytecodeForConstruct(callFrame, constructDataScopeChain);
+
+ newCallFrame = slideRegisterWindowForCall(newCodeBlock, &m_registerFile, newCallFrame, registerOffset, argCount);
+ if (UNLIKELY(!newCallFrame)) {
+ *exception = createStackOverflowError(callFrame);
+ m_registerFile.shrink(oldEnd);
+ return 0;
+ }
+
+ newCallFrame->init(newCodeBlock, 0, constructDataScopeChain, callFrame->addHostCallFrameFlag(), argCount, constructor);
+
+ DynamicGlobalObjectScope globalObjectScope(newCallFrame, constructDataScopeChain->globalObject);
+
+ Profiler** profiler = Profiler::enabledProfilerReference();
+ if (*profiler)
+ (*profiler)->willExecute(newCallFrame, constructor);
+
+ JSValue result;
+ {
+ SamplingTool::CallRecord callRecord(m_sampler.get());
+
+ m_reentryDepth++;
+ #if ENABLE(JIT)
+ result = constructData.js.functionExecutable->jitCodeForConstruct(newCallFrame, constructDataScopeChain).execute(&m_registerFile, newCallFrame, constructDataScopeChain->globalData, exception);
+ #else
+ result = privateExecute(Normal, &m_registerFile, newCallFrame, exception);
+ #endif
+ m_reentryDepth--;
+ }
+
+ if (*profiler)
+ (*profiler)->didExecute(newCallFrame, constructor);
+
m_registerFile.shrink(oldEnd);
- return jsNull();
+ if (callFrame->hadException())
+ return 0;
+ ASSERT(result.isObject());
+ return asObject(result);
}
- // a 0 codeBlock indicates a built-in caller
- newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), argc, function);
- DynamicGlobalObjectScope globalObjectScope(callFrame, scopeChain->globalObject);
+ ASSERT(constructType == ConstructTypeHost);
+ ScopeChainNode* scopeChain = callFrame->scopeChain();
+ newCallFrame = CallFrame::create(newCallFrame->registers() + registerOffset);
+ newCallFrame->init(0, 0, scopeChain, callFrame->addHostCallFrameFlag(), argCount, constructor);
+
+ DynamicGlobalObjectScope globalObjectScope(newCallFrame, scopeChain->globalObject);
Profiler** profiler = Profiler::enabledProfilerReference();
if (*profiler)
- (*profiler)->willExecute(callFrame, function);
+ (*profiler)->willExecute(newCallFrame, constructor);
JSValue result;
{
- SamplingTool::CallRecord callRecord(m_sampler.get());
-
- m_reentryDepth++;
-#if ENABLE(JIT)
- result = functionExecutable->jitCodeForConstruct(newCallFrame, scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception);
-#else
- result = privateExecute(Normal, &m_registerFile, newCallFrame, exception);
-#endif
- m_reentryDepth--;
+ SamplingTool::HostCallRecord callRecord(m_sampler.get());
+ result = JSValue::decode(constructData.native.function(newCallFrame));
}
if (*profiler)
- (*profiler)->didExecute(callFrame, function);
+ (*profiler)->didExecute(newCallFrame, constructor);
m_registerFile.shrink(oldEnd);
- return result;
+ if (callFrame->hadException())
+ return 0;
+ ASSERT(result.isObject());
+ return asObject(result);
}
CallFrameClosure Interpreter::prepareForRepeatCall(FunctionExecutable* FunctionExecutable, CallFrame* callFrame, JSFunction* function, int argCount, ScopeChainNode* scopeChain, JSValue* exception)
@@ -3594,7 +3615,7 @@ skip_id_custom_self:
JSValue v = callFrame->r(func).jsValue();
CallData callData;
- CallType callType = v.getCallData(callData);
+ CallType callType = getCallData(v, callData);
if (callType == CallTypeJS) {
ScopeChainNode* callDataScopeChain = callData.js.scopeChain;
@@ -3626,13 +3647,10 @@ skip_id_custom_self:
CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset);
newCallFrame->init(0, vPC + OPCODE_LENGTH(op_call), scopeChain, callFrame, argCount, asObject(v));
- Register* thisRegister = newCallFrame->registers() - RegisterFile::CallFrameHeaderSize - argCount;
- ArgList args(thisRegister + 1, argCount - 1);
-
JSValue returnValue;
{
SamplingTool::HostCallRecord callRecord(m_sampler.get());
- returnValue = callData.native.function(newCallFrame);
+ returnValue = JSValue::decode(callData.native.function(newCallFrame));
}
CHECK_FOR_EXCEPTION();
@@ -3744,7 +3762,7 @@ skip_id_custom_self:
int argCount = callFrame->r(argCountReg).i();
registerOffset += argCount;
CallData callData;
- CallType callType = v.getCallData(callData);
+ CallType callType = getCallData(v, callData);
if (callType == CallTypeJS) {
ScopeChainNode* callDataScopeChain = callData.js.scopeChain;
@@ -3776,13 +3794,10 @@ skip_id_custom_self:
CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset);
newCallFrame->init(0, vPC + OPCODE_LENGTH(op_call_varargs), scopeChain, callFrame, argCount, asObject(v));
- Register* thisRegister = newCallFrame->registers() - RegisterFile::CallFrameHeaderSize - argCount;
- ArgList args(thisRegister + 1, argCount - 1);
-
JSValue returnValue;
{
SamplingTool::HostCallRecord callRecord(m_sampler.get());
- returnValue = callData.native.function(newCallFrame);
+ returnValue = JSValue::decode(callData.native.function(newCallFrame));
}
CHECK_FOR_EXCEPTION();
@@ -4066,7 +4081,7 @@ skip_id_custom_self:
JSValue v = callFrame->r(func).jsValue();
ConstructData constructData;
- ConstructType constructType = v.getConstructData(constructData);
+ ConstructType constructType = getConstructData(v, constructData);
if (constructType == ConstructTypeJS) {
ScopeChainNode* callDataScopeChain = constructData.js.scopeChain;
@@ -4095,18 +4110,15 @@ skip_id_custom_self:
if (constructType == ConstructTypeHost) {
ScopeChainNode* scopeChain = callFrame->scopeChain();
CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset);
- newCallFrame->init(0, vPC + OPCODE_LENGTH(op_construct), scopeChain, callFrame, argCount, 0);
-
- Register* thisRegister = newCallFrame->registers() - RegisterFile::CallFrameHeaderSize - argCount;
- ArgList args(thisRegister + 1, argCount - 1);
+ newCallFrame->init(0, vPC + OPCODE_LENGTH(op_construct), scopeChain, callFrame, argCount, asObject(v));
JSValue returnValue;
{
SamplingTool::HostCallRecord callRecord(m_sampler.get());
- returnValue = constructData.native.function(newCallFrame, asObject(v), args);
+ returnValue = JSValue::decode(constructData.native.function(newCallFrame));
}
CHECK_FOR_EXCEPTION();
- functionReturnValue = JSValue(returnValue);
+ functionReturnValue = returnValue;
vPC += OPCODE_LENGTH(op_construct);
NEXT_INSTRUCTION();
@@ -4314,10 +4326,12 @@ skip_id_custom_self:
written to register dst.
*/
int dst = vPC[1].u.operand;
- int type = vPC[2].u.operand;
- int message = vPC[3].u.operand;
+ int isReference = vPC[2].u.operand;
+ UString message = callFrame->r(vPC[3].u.operand).jsValue().toString(callFrame);
- callFrame->r(dst) = JSValue(Error::create(callFrame, (ErrorType)type, callFrame->r(message).jsValue().toString(callFrame), codeBlock->lineNumberForBytecodeOffset(callFrame, vPC - codeBlock->instructions().begin()), codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL()));
+ JSObject* error = isReference ? createReferenceError(callFrame, message) : createSyntaxError(callFrame, message);
+ addErrorInfo(globalData, error, codeBlock->lineNumberForBytecodeOffset(callFrame, vPC - codeBlock->instructions().begin()), codeBlock->ownerExecutable()->source());
+ callFrame->r(dst) = JSValue(error);
vPC += OPCODE_LENGTH(op_new_error);
NEXT_INSTRUCTION();
diff --git a/JavaScriptCore/interpreter/Interpreter.h b/JavaScriptCore/interpreter/Interpreter.h
index 13df468..555bbf9 100644
--- a/JavaScriptCore/interpreter/Interpreter.h
+++ b/JavaScriptCore/interpreter/Interpreter.h
@@ -96,7 +96,7 @@ namespace JSC {
JSValue execute(ProgramExecutable*, CallFrame*, ScopeChainNode*, JSObject* thisObj, JSValue* exception);
JSValue executeCall(CallFrame*, JSObject* function, CallType, const CallData&, JSValue thisValue, const ArgList&, JSValue* exception);
- JSValue executeConstruct(FunctionExecutable*, CallFrame*, JSFunction*, JSObject* thisObj, const ArgList& args, ScopeChainNode*, JSValue* exception);
+ JSObject* executeConstruct(CallFrame*, JSObject* function, ConstructType, const ConstructData&, const ArgList&, JSValue* exception);
JSValue execute(EvalExecutable* evalNode, CallFrame* exec, JSObject* thisObj, ScopeChainNode* scopeChain, JSValue* exception);
JSValue retrieveArguments(CallFrame*, JSFunction*) const;
diff --git a/JavaScriptCore/jit/JITArithmetic32_64.cpp b/JavaScriptCore/jit/JITArithmetic32_64.cpp
index 023426e..4f36d66 100644
--- a/JavaScriptCore/jit/JITArithmetic32_64.cpp
+++ b/JavaScriptCore/jit/JITArithmetic32_64.cpp
@@ -460,7 +460,7 @@ void JIT::emitRightShiftSlowCase(Instruction* currentInstruction, Vector<SlowCas
failures.append(branch32(LessThan, regT0, Imm32(0)));
} else if (shift)
rshift32(Imm32(shift & 0x1f), regT0);
- emitStoreInt32(dst, regT0, dst == op1 || dst == op2);
+ emitStoreInt32(dst, regT0, false);
emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_rshift));
failures.link(this);
}
@@ -480,7 +480,7 @@ void JIT::emitRightShiftSlowCase(Instruction* currentInstruction, Vector<SlowCas
urshift32(regT2, regT0);
else
rshift32(regT2, regT0);
- emitStoreInt32(dst, regT0, dst == op1 || dst == op2);
+ emitStoreInt32(dst, regT0, false);
emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_rshift));
notDouble.link(this);
notInt.link(this);
diff --git a/JavaScriptCore/jit/JITOpcodes.cpp b/JavaScriptCore/jit/JITOpcodes.cpp
index 64e1f3c..0848348 100644
--- a/JavaScriptCore/jit/JITOpcodes.cpp
+++ b/JavaScriptCore/jit/JITOpcodes.cpp
@@ -207,6 +207,7 @@ JIT::Label JIT::privateCompileCTINativeCall(JSGlobalData* globalData, bool isCon
#elif ENABLE(JIT_OPTIMIZE_NATIVE_CALL)
#error "JIT_OPTIMIZE_NATIVE_CALL not yet supported on this platform."
#else
+ UNUSED_PARAM(executableOffsetToFunction);
breakpoint();
#endif
diff --git a/JavaScriptCore/jit/JITOpcodes32_64.cpp b/JavaScriptCore/jit/JITOpcodes32_64.cpp
index a730b67..239751f 100644
--- a/JavaScriptCore/jit/JITOpcodes32_64.cpp
+++ b/JavaScriptCore/jit/JITOpcodes32_64.cpp
@@ -208,6 +208,7 @@ JIT::Label JIT::privateCompileCTINativeCall(JSGlobalData* globalData, bool isCon
#elif ENABLE(JIT_OPTIMIZE_NATIVE_CALL)
#error "JIT_OPTIMIZE_NATIVE_CALL not yet supported on this platform."
#else
+ UNUSED_PARAM(executableOffsetToFunction);
breakpoint();
#endif // CPU(X86)
@@ -231,6 +232,7 @@ JIT::Label JIT::privateCompileCTINativeCall(JSGlobalData* globalData, bool isCon
JIT::CodePtr JIT::privateCompileCTINativeCall(PassRefPtr<ExecutablePool> executablePool, JSGlobalData* globalData, NativeFunction func)
{
+ Call nativeCall;
Label nativeCallThunk = align();
#if CPU(X86)
@@ -252,7 +254,7 @@ JIT::CodePtr JIT::privateCompileCTINativeCall(PassRefPtr<ExecutablePool> executa
move(regT0, callFrameRegister); // Eagerly restore caller frame register to avoid loading from stack.
// call the function
- Call nativeCall = call();
+ nativeCall = call();
addPtr(Imm32(16 - sizeof(void*)), stackPointerRegister);
diff --git a/JavaScriptCore/jit/JITStubs.cpp b/JavaScriptCore/jit/JITStubs.cpp
index 9da3c40..ff0dc3f 100644
--- a/JavaScriptCore/jit/JITStubs.cpp
+++ b/JavaScriptCore/jit/JITStubs.cpp
@@ -1750,7 +1750,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_instanceof)
return JSValue::encode(jsBoolean(false));
if (!proto.isObject()) {
- throwError(callFrame, TypeError, "instanceof called on an object with an invalid prototype property.");
+ throwError(callFrame, createTypeError(callFrame, "instanceof called on an object with an invalid prototype property."));
VM_THROW_EXCEPTION();
}
}
@@ -2031,7 +2031,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_call_NotJSFunction)
JSValue funcVal = stackFrame.args[0].jsValue();
CallData callData;
- CallType callType = funcVal.getCallData(callData);
+ CallType callType = getCallData(funcVal, callData);
ASSERT(callType != CallTypeJS);
@@ -2044,7 +2044,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_call_NotJSFunction)
callFrame->init(0, static_cast<Instruction*>((STUB_RETURN_ADDRESS).value()), previousCallFrame->scopeChain(), previousCallFrame, argCount, asObject(funcVal));
stackFrame.callFrame = callFrame;
- JSValue returnValue;
+ EncodedJSValue returnValue;
{
SamplingTool::HostCallRecord callRecord(CTI_SAMPLER);
returnValue = callData.native.function(callFrame);
@@ -2052,7 +2052,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_call_NotJSFunction)
stackFrame.callFrame = previousCallFrame;
CHECK_FOR_EXCEPTION();
- return JSValue::encode(returnValue);
+ return returnValue;
}
ASSERT(callType == CallTypeNone);
@@ -2163,31 +2163,36 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_construct_NotJSConstruct)
{
STUB_INIT_STACK_FRAME(stackFrame);
- CallFrame* callFrame = stackFrame.callFrame;
-
JSValue constrVal = stackFrame.args[0].jsValue();
- int argCount = stackFrame.args[2].int32();
ConstructData constructData;
- ConstructType constructType = constrVal.getConstructData(constructData);
+ ConstructType constructType = getConstructData(constrVal, constructData);
+
+ ASSERT(constructType != ConstructTypeJS);
if (constructType == ConstructTypeHost) {
int registerOffset = stackFrame.args[1].int32();
- Register* thisRegister = callFrame->registers() + registerOffset - RegisterFile::CallFrameHeaderSize - argCount;
- ArgList argList(thisRegister + 1, argCount - 1);
+ int argCount = stackFrame.args[2].int32();
+ CallFrame* previousCallFrame = stackFrame.callFrame;
+ CallFrame* callFrame = CallFrame::create(previousCallFrame->registers() + registerOffset);
+
+ callFrame->init(0, static_cast<Instruction*>((STUB_RETURN_ADDRESS).value()), previousCallFrame->scopeChain(), previousCallFrame, argCount, asObject(constrVal));
+ stackFrame.callFrame = callFrame;
- JSValue returnValue;
+ EncodedJSValue returnValue;
{
SamplingTool::HostCallRecord callRecord(CTI_SAMPLER);
- returnValue = constructData.native.function(callFrame, asObject(constrVal), argList);
+ returnValue = constructData.native.function(callFrame);
}
+ stackFrame.callFrame = previousCallFrame;
CHECK_FOR_EXCEPTION();
- return JSValue::encode(returnValue);
+ return returnValue;
}
ASSERT(constructType == ConstructTypeNone);
+ CallFrame* callFrame = stackFrame.callFrame;
CodeBlock* codeBlock = callFrame->codeBlock();
unsigned vPCIndex = codeBlock->bytecodeOffset(callFrame, STUB_RETURN_ADDRESS);
stackFrame.globalData->exception = createNotAConstructorError(callFrame, constrVal, vPCIndex, codeBlock);
@@ -3389,12 +3394,13 @@ DEFINE_STUB_FUNCTION(JSObject*, op_new_error)
CallFrame* callFrame = stackFrame.callFrame;
CodeBlock* codeBlock = callFrame->codeBlock();
- unsigned type = stackFrame.args[0].int32();
- JSValue message = stackFrame.args[1].jsValue();
+ unsigned isReference = stackFrame.args[0].int32();
+ UString message = stackFrame.args[1].jsValue().toString(callFrame);
unsigned bytecodeOffset = stackFrame.args[2].int32();
+ JSObject* error = isReference ? createReferenceError(callFrame, message) : createSyntaxError(callFrame, message);
unsigned lineNumber = codeBlock->lineNumberForBytecodeOffset(callFrame, bytecodeOffset);
- return Error::create(callFrame, static_cast<ErrorType>(type), message.toString(callFrame), lineNumber, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL());
+ return addErrorInfo(stackFrame.globalData, error, lineNumber, codeBlock->ownerExecutable()->source());
}
DEFINE_STUB_FUNCTION(void, op_debug)
diff --git a/JavaScriptCore/jit/JITStubs.h b/JavaScriptCore/jit/JITStubs.h
index bfed811..6d627a1 100644
--- a/JavaScriptCore/jit/JITStubs.h
+++ b/JavaScriptCore/jit/JITStubs.h
@@ -29,6 +29,7 @@
#ifndef JITStubs_h
#define JITStubs_h
+#include "CallData.h"
#include "MacroAssemblerCodeRef.h"
#include "Register.h"
#include "ThunkGenerators.h"
diff --git a/JavaScriptCore/jsc.cpp b/JavaScriptCore/jsc.cpp
index 35ac7f4..c91bcb3 100644
--- a/JavaScriptCore/jsc.cpp
+++ b/JavaScriptCore/jsc.cpp
@@ -25,6 +25,7 @@
#include "BytecodeGenerator.h"
#include "Completion.h"
#include "CurrentTime.h"
+#include "ExceptionHelpers.h"
#include "InitializeThreading.h"
#include "JSArray.h"
#include "JSFunction.h"
@@ -71,19 +72,19 @@ using namespace WTF;
static void cleanupGlobalData(JSGlobalData*);
static bool fillBufferWithContentsOfFile(const UString& fileName, Vector<char>& buffer);
-static JSValue JSC_HOST_CALL functionPrint(ExecState*);
-static JSValue JSC_HOST_CALL functionDebug(ExecState*);
-static JSValue JSC_HOST_CALL functionGC(ExecState*);
-static JSValue JSC_HOST_CALL functionVersion(ExecState*);
-static JSValue JSC_HOST_CALL functionRun(ExecState*);
-static JSValue JSC_HOST_CALL functionLoad(ExecState*);
-static JSValue JSC_HOST_CALL functionCheckSyntax(ExecState*);
-static JSValue JSC_HOST_CALL functionReadline(ExecState*);
-static NO_RETURN_WITH_VALUE JSValue JSC_HOST_CALL functionQuit(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionPrint(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionDebug(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionGC(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionVersion(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionRun(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionLoad(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionCheckSyntax(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionReadline(ExecState*);
+static NO_RETURN_WITH_VALUE EncodedJSValue JSC_HOST_CALL functionQuit(ExecState*);
#if ENABLE(SAMPLING_FLAGS)
-static JSValue JSC_HOST_CALL functionSetSamplingFlags(ExecState*);
-static JSValue JSC_HOST_CALL functionClearSamplingFlags(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionSetSamplingFlags(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionClearSamplingFlags(ExecState*);
#endif
struct Script {
@@ -171,7 +172,7 @@ GlobalObject::GlobalObject(const Vector<UString>& arguments)
putDirect(Identifier(globalExec(), "arguments"), array);
}
-JSValue JSC_HOST_CALL functionPrint(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL functionPrint(ExecState* exec)
{
for (unsigned i = 0; i < exec->argumentCount(); ++i) {
if (i)
@@ -182,36 +183,36 @@ JSValue JSC_HOST_CALL functionPrint(ExecState* exec)
putchar('\n');
fflush(stdout);
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL functionDebug(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL functionDebug(ExecState* exec)
{
fprintf(stderr, "--> %s\n", exec->argument(0).toString(exec).UTF8String().data());
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL functionGC(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL functionGC(ExecState* exec)
{
JSLock lock(SilenceAssertionsOnly);
exec->heap()->collectAllGarbage();
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL functionVersion(ExecState*)
+EncodedJSValue JSC_HOST_CALL functionVersion(ExecState*)
{
// We need this function for compatibility with the Mozilla JS tests but for now
// we don't actually do any version-specific handling
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL functionRun(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL functionRun(ExecState* exec)
{
StopWatch stopWatch;
UString fileName = exec->argument(0).toString(exec);
Vector<char> script;
if (!fillBufferWithContentsOfFile(fileName, script))
- return throwError(exec, GeneralError, "Could not open file.");
+ return JSValue::encode(throwError(exec, createError(exec, "Could not open file.")));
JSGlobalObject* globalObject = exec->lexicalGlobalObject();
@@ -219,60 +220,60 @@ JSValue JSC_HOST_CALL functionRun(ExecState* exec)
evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(script.data(), fileName));
stopWatch.stop();
- return jsNumber(globalObject->globalExec(), stopWatch.getElapsedMS());
+ return JSValue::encode(jsNumber(globalObject->globalExec(), stopWatch.getElapsedMS()));
}
-JSValue JSC_HOST_CALL functionLoad(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL functionLoad(ExecState* exec)
{
UString fileName = exec->argument(0).toString(exec);
Vector<char> script;
if (!fillBufferWithContentsOfFile(fileName, script))
- return throwError(exec, GeneralError, "Could not open file.");
+ return JSValue::encode(throwError(exec, createError(exec, "Could not open file.")));
JSGlobalObject* globalObject = exec->lexicalGlobalObject();
Completion result = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(script.data(), fileName));
if (result.complType() == Throw)
- exec->setException(result.value());
- return result.value();
+ throwError(exec, result.value());
+ return JSValue::encode(result.value());
}
-JSValue JSC_HOST_CALL functionCheckSyntax(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL functionCheckSyntax(ExecState* exec)
{
UString fileName = exec->argument(0).toString(exec);
Vector<char> script;
if (!fillBufferWithContentsOfFile(fileName, script))
- return throwError(exec, GeneralError, "Could not open file.");
+ return JSValue::encode(throwError(exec, createError(exec, "Could not open file.")));
JSGlobalObject* globalObject = exec->lexicalGlobalObject();
Completion result = checkSyntax(globalObject->globalExec(), makeSource(script.data(), fileName));
if (result.complType() == Throw)
- exec->setException(result.value());
- return result.value();
+ throwError(exec, result.value());
+ return JSValue::encode(result.value());
}
#if ENABLE(SAMPLING_FLAGS)
-JSValue JSC_HOST_CALL functionSetSamplingFlags(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL functionSetSamplingFlags(ExecState* exec)
{
for (unsigned i = 0; i < exec->argumentCount(); ++i) {
unsigned flag = static_cast<unsigned>(exec->argument(i).toNumber(exec));
if ((flag >= 1) && (flag <= 32))
SamplingFlags::setFlag(flag);
}
- return jsNull();
+ return JSValue::encode(jsNull());
}
-JSValue JSC_HOST_CALL functionClearSamplingFlags(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL functionClearSamplingFlags(ExecState* exec)
{
for (unsigned i = 0; i < exec->argumentCount(); ++i) {
unsigned flag = static_cast<unsigned>(exec->argument(i).toNumber(exec));
if ((flag >= 1) && (flag <= 32))
SamplingFlags::clearFlag(flag);
}
- return jsNull();
+ return JSValue::encode(jsNull());
}
#endif
-JSValue JSC_HOST_CALL functionReadline(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL functionReadline(ExecState* exec)
{
Vector<char, 256> line;
int c;
@@ -283,10 +284,10 @@ JSValue JSC_HOST_CALL functionReadline(ExecState* exec)
line.append(c);
}
line.append('\0');
- return jsString(exec, line.data());
+ return JSValue::encode(jsString(exec, line.data()));
}
-JSValue JSC_HOST_CALL functionQuit(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL functionQuit(ExecState* exec)
{
// Technically, destroying the heap in the middle of JS execution is a no-no,
// but we want to maintain compatibility with the Mozilla test suite, so
@@ -298,7 +299,7 @@ JSValue JSC_HOST_CALL functionQuit(ExecState* exec)
#if COMPILER(MSVC) && OS(WINCE)
// Without this, Visual Studio will complain that this method does not return a value.
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
#endif
}
diff --git a/JavaScriptCore/jsc/CMakeListsEfl.txt b/JavaScriptCore/jsc/CMakeListsEfl.txt
index ab1a013..58d44f4 100644
--- a/JavaScriptCore/jsc/CMakeListsEfl.txt
+++ b/JavaScriptCore/jsc/CMakeListsEfl.txt
@@ -1,3 +1,8 @@
+LIST(APPEND JSC_LIBRARIES
+ ${Glib_LIBRARIES}
+ ${ECORE_LIBRARIES}
+)
+
LIST(APPEND JSC_LINK_FLAGS
${ECORE_LDFLAGS}
)
diff --git a/JavaScriptCore/parser/Nodes.h b/JavaScriptCore/parser/Nodes.h
index 7852165..57c8f4f 100644
--- a/JavaScriptCore/parser/Nodes.h
+++ b/JavaScriptCore/parser/Nodes.h
@@ -265,9 +265,9 @@ namespace JSC {
uint16_t endOffset() const { return m_endOffset; }
protected:
- RegisterID* emitThrowError(BytecodeGenerator&, ErrorType, const char* message);
- RegisterID* emitThrowError(BytecodeGenerator&, ErrorType, const char* message, const UString&);
- RegisterID* emitThrowError(BytecodeGenerator&, ErrorType, const char* message, const Identifier&);
+ RegisterID* emitThrowError(BytecodeGenerator&, bool isReferenceError, const char* message);
+ RegisterID* emitThrowError(BytecodeGenerator&, bool isReferenceError, const char* message, const UString&);
+ RegisterID* emitThrowError(BytecodeGenerator&, bool isReferenceError, const char* message, const Identifier&);
private:
uint32_t m_divot;
diff --git a/JavaScriptCore/pcre/pcre_exec.cpp b/JavaScriptCore/pcre/pcre_exec.cpp
index 50973d0..994ec57 100644
--- a/JavaScriptCore/pcre/pcre_exec.cpp
+++ b/JavaScriptCore/pcre/pcre_exec.cpp
@@ -427,7 +427,7 @@ static inline void startNewGroup(MatchFrame* currentFrame)
}
// FIXME: "minimize" means "not greedy", we should invert the callers to ask for "greedy" to be less confusing
-static inline void repeatInformationFromInstructionOffset(short instructionOffset, bool& minimize, int& minimumRepeats, int& maximumRepeats)
+static inline void repeatInformationFromInstructionOffset(int instructionOffset, bool& minimize, int& minimumRepeats, int& maximumRepeats)
{
// Instruction offsets are based off of OP_CRSTAR, OP_STAR, OP_TYPESTAR, OP_NOTSTAR
static const char minimumRepeatsFromInstructionOffset[] = { 0, 0, 1, 1, 0, 0 };
diff --git a/JavaScriptCore/qt/api/qscriptengine.cpp b/JavaScriptCore/qt/api/qscriptengine.cpp
index dc08cd9..e1bdf77 100644
--- a/JavaScriptCore/qt/api/qscriptengine.cpp
+++ b/JavaScriptCore/qt/api/qscriptengine.cpp
@@ -193,6 +193,19 @@ QScriptValue QScriptEngine::undefinedValue()
}
/*!
+ Creates a QtScript object of class Object.
+
+ The prototype of the created object will be the Object
+ prototype object.
+
+ \sa newArray(), QScriptValue::setProperty()
+*/
+QScriptValue QScriptEngine::newObject()
+{
+ return QScriptValuePrivate::get(d_ptr->newObject());
+}
+
+/*!
Returns this engine's Global Object.
By default, the Global Object contains the built-in objects that are
diff --git a/JavaScriptCore/qt/api/qscriptengine.h b/JavaScriptCore/qt/api/qscriptengine.h
index e19ebda..653dffe 100644
--- a/JavaScriptCore/qt/api/qscriptengine.h
+++ b/JavaScriptCore/qt/api/qscriptengine.h
@@ -50,6 +50,7 @@ public:
QScriptValue nullValue();
QScriptValue undefinedValue();
+ QScriptValue newObject();
QScriptValue globalObject() const;
private:
friend class QScriptEnginePrivate;
diff --git a/JavaScriptCore/qt/api/qscriptengine_p.cpp b/JavaScriptCore/qt/api/qscriptengine_p.cpp
index 38185ab..a6cf4a4 100644
--- a/JavaScriptCore/qt/api/qscriptengine_p.cpp
+++ b/JavaScriptCore/qt/api/qscriptengine_p.cpp
@@ -74,11 +74,16 @@ QScriptValuePrivate* QScriptEnginePrivate::evaluate(const QScriptProgramPrivate*
{
if (program->isNull())
return new QScriptValuePrivate;
- return new QScriptValuePrivate(this, evaluate(program->program(), program->file(), program->line()));
+ return new QScriptValuePrivate(this, evaluate(*program, program->file(), program->line()));
+}
+
+QScriptValuePrivate* QScriptEnginePrivate::newObject() const
+{
+ return new QScriptValuePrivate(this, JSObjectMake(m_context, /* jsClass */ 0, /* userData */ 0));
}
QScriptValuePrivate* QScriptEnginePrivate::globalObject() const
{
- JSObjectRef globalObject = JSContextGetGlobalObject(context());
+ JSObjectRef globalObject = JSContextGetGlobalObject(m_context);
return new QScriptValuePrivate(this, globalObject, globalObject);
}
diff --git a/JavaScriptCore/qt/api/qscriptengine_p.h b/JavaScriptCore/qt/api/qscriptengine_p.h
index c6c64dd..9083f7d 100644
--- a/JavaScriptCore/qt/api/qscriptengine_p.h
+++ b/JavaScriptCore/qt/api/qscriptengine_p.h
@@ -56,11 +56,12 @@ public:
inline JSValueRef makeJSValue(bool number) const;
inline JSValueRef makeJSValue(QScriptValue::SpecialValue value) const;
+ QScriptValuePrivate* newObject() const;
QScriptValuePrivate* globalObject() const;
inline QScriptStringPrivate* toStringHandle(const QString& str) const;
- inline JSGlobalContextRef context() const;
+ inline operator JSGlobalContextRef() const;
private:
QScriptEngine* q_ptr;
JSGlobalContextRef m_context;
@@ -132,8 +133,9 @@ QScriptStringPrivate* QScriptEnginePrivate::toStringHandle(const QString& str) c
return new QScriptStringPrivate(str);
}
-JSGlobalContextRef QScriptEnginePrivate::context() const
+QScriptEnginePrivate::operator JSGlobalContextRef() const
{
+ Q_ASSERT(this);
return m_context;
}
diff --git a/JavaScriptCore/qt/api/qscriptprogram_p.h b/JavaScriptCore/qt/api/qscriptprogram_p.h
index 6e80e85..f6882c5 100644
--- a/JavaScriptCore/qt/api/qscriptprogram_p.h
+++ b/JavaScriptCore/qt/api/qscriptprogram_p.h
@@ -52,7 +52,7 @@ public:
inline bool operator==(const QScriptProgramPrivate& other) const;
inline bool operator!=(const QScriptProgramPrivate& other) const;
- inline JSStringRef program() const;
+ inline operator JSStringRef() const;
inline JSStringRef file() const;
inline int line() const;
private:
@@ -122,7 +122,11 @@ bool QScriptProgramPrivate::operator!=(const QScriptProgramPrivate& other) const
|| !JSStringIsEqual(m_program, other.m_program);
}
-JSStringRef QScriptProgramPrivate::program() const { return m_program; }
+QScriptProgramPrivate::operator JSStringRef() const
+{
+ return m_program;
+}
+
JSStringRef QScriptProgramPrivate::file() const {return m_fileName; }
int QScriptProgramPrivate::line() const { return m_line; }
diff --git a/JavaScriptCore/qt/api/qscriptsyntaxcheckresult.cpp b/JavaScriptCore/qt/api/qscriptsyntaxcheckresult.cpp
index 5cf02ef..3948c5d 100644
--- a/JavaScriptCore/qt/api/qscriptsyntaxcheckresult.cpp
+++ b/JavaScriptCore/qt/api/qscriptsyntaxcheckresult.cpp
@@ -119,7 +119,7 @@ QString QScriptSyntaxCheckResult::errorMessage() const
QScriptSyntaxCheckResultPrivate::~QScriptSyntaxCheckResultPrivate()
{
if (m_exception)
- JSValueUnprotect(m_engine->context(), m_exception);
+ JSValueUnprotect(*m_engine, m_exception);
}
QString QScriptSyntaxCheckResultPrivate::errorMessage() const
@@ -127,7 +127,7 @@ QString QScriptSyntaxCheckResultPrivate::errorMessage() const
if (!m_exception)
return QString();
- JSStringRef tmp = JSValueToStringCopy(m_engine->context(), m_exception, /* exception */ 0);
+ JSStringRef tmp = JSValueToStringCopy(*m_engine, m_exception, /* exception */ 0);
QString message = QScriptConverter::toString(tmp);
JSStringRelease(tmp);
return message;
@@ -139,10 +139,10 @@ int QScriptSyntaxCheckResultPrivate::errorLineNumber() const
return -1;
// m_exception is an instance of the Exception so it has "line" attribute.
JSStringRef lineAttrName = QScriptConverter::toString("line");
- JSValueRef line = JSObjectGetProperty(m_engine->context(),
+ JSValueRef line = JSObjectGetProperty(*m_engine,
m_exception,
lineAttrName,
/* exceptions */0);
JSStringRelease(lineAttrName);
- return JSValueToNumber(m_engine->context(), line, /* exceptions */0);
+ return JSValueToNumber(*m_engine, line, /* exceptions */0);
}
diff --git a/JavaScriptCore/qt/api/qscriptvalue.cpp b/JavaScriptCore/qt/api/qscriptvalue.cpp
index a53a2fe..22ff8be 100644
--- a/JavaScriptCore/qt/api/qscriptvalue.cpp
+++ b/JavaScriptCore/qt/api/qscriptvalue.cpp
@@ -556,7 +556,7 @@ QScriptValue& QScriptValue::operator=(const QScriptValue& other)
*/
bool QScriptValue::equals(const QScriptValue& other) const
{
- return d_ptr == other.d_ptr || d_ptr->equals(QScriptValuePrivate::get(other));
+ return d_ptr->equals(QScriptValuePrivate::get(other));
}
/*!
@@ -583,5 +583,19 @@ bool QScriptValue::equals(const QScriptValue& other) const
*/
bool QScriptValue::strictlyEquals(const QScriptValue& other) const
{
- return d_ptr == other.d_ptr || d_ptr->strictlyEquals(QScriptValuePrivate::get(other));
+ return d_ptr->strictlyEquals(QScriptValuePrivate::get(other));
+}
+
+/*!
+ Returns true if this QScriptValue is an instance of
+ \a other; otherwise returns false.
+
+ This QScriptValue is considered to be an instance of \a other if
+ \a other is a function and the value of the \c{prototype}
+ property of \a other is in the prototype chain of this
+ QScriptValue.
+*/
+bool QScriptValue::instanceOf(const QScriptValue& other) const
+{
+ return d_ptr->instanceOf(QScriptValuePrivate::get(other));
}
diff --git a/JavaScriptCore/qt/api/qscriptvalue.h b/JavaScriptCore/qt/api/qscriptvalue.h
index 182f311..6c42429 100644
--- a/JavaScriptCore/qt/api/qscriptvalue.h
+++ b/JavaScriptCore/qt/api/qscriptvalue.h
@@ -61,6 +61,7 @@ public:
QScriptValue& operator=(const QScriptValue& other);
bool equals(const QScriptValue& other) const;
bool strictlyEquals(const QScriptValue& other) const;
+ bool instanceOf(const QScriptValue& other) const;
QScriptEngine* engine() const;
diff --git a/JavaScriptCore/qt/api/qscriptvalue_p.h b/JavaScriptCore/qt/api/qscriptvalue_p.h
index 5959c03..1bb8a77 100644
--- a/JavaScriptCore/qt/api/qscriptvalue_p.h
+++ b/JavaScriptCore/qt/api/qscriptvalue_p.h
@@ -50,8 +50,8 @@ class QScriptValue;
value is kept in m_number
CBool -> QSVP is created from bool and no JSC engine has been associated yet. Current value is kept
in m_number
- CSpecial -> QSVP is Undefined or Null, but a JSC engine hasn't been associated yet, current value
- is kept in m_number (cast of QScriptValue::SpecialValue)
+ CNull -> QSVP is null, but a JSC engine hasn't been associated yet.
+ CUndefined -> QSVP is undefined, but a JSC engine hasn't been associated yet.
JSValue -> QSVP is associated with engine, but there is no information about real type, the state
have really short live cycle. Normally it is created as a function call result.
JSPrimitive -> QSVP is associated with engine, and it is sure that it isn't a JavaScript object.
@@ -59,6 +59,10 @@ class QScriptValue;
Each state keep all necessary information to invoke all methods, if not it should be changed to
a proper state. Changed state shouldn't be reverted.
+
+ The QScriptValuePrivate use the JSC C API directly. The QSVP type is equal to combination of
+ the JSValueRef and the JSObjectRef, and it could be automatically casted to these types by cast
+ operators.
*/
class QScriptValuePrivate : public QSharedData {
@@ -108,14 +112,15 @@ public:
inline QScriptValuePrivate* toObject();
inline bool equals(QScriptValuePrivate* other);
- inline bool strictlyEquals(const QScriptValuePrivate* other) const;
+ inline bool strictlyEquals(QScriptValuePrivate* other);
+ inline bool instanceOf(QScriptValuePrivate* other);
inline bool assignEngine(QScriptEnginePrivate* engine);
inline QScriptValuePrivate* call(const QScriptValuePrivate* , const QScriptValueList& args);
- inline JSGlobalContextRef context() const;
- inline JSValueRef value() const;
- inline JSObjectRef object() const;
+ inline operator JSValueRef() const;
+ inline operator JSObjectRef() const;
+
inline QScriptEnginePrivate* engine() const;
private:
@@ -125,7 +130,8 @@ private:
CString = 0x1000,
CNumber,
CBool,
- CSpecial,
+ CNull,
+ CUndefined,
JSValue = 0x2000, // JS values are equal or higher then this value.
JSPrimitive,
JSObject
@@ -161,7 +167,7 @@ QScriptValue QScriptValuePrivate::get(QScriptValuePrivate* d)
QScriptValuePrivate::~QScriptValuePrivate()
{
if (m_value)
- JSValueUnprotect(context(), m_value);
+ JSValueUnprotect(*m_engine, m_value);
}
QScriptValuePrivate::QScriptValuePrivate()
@@ -206,8 +212,7 @@ QScriptValuePrivate::QScriptValuePrivate(qsreal number)
}
QScriptValuePrivate::QScriptValuePrivate(QScriptValue::SpecialValue value)
- : m_state(CSpecial)
- , m_number(value)
+ : m_state(value == QScriptValue::NullValue ? CNull : CUndefined)
, m_value(0)
{
}
@@ -218,7 +223,7 @@ QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, boo
, m_value(engine->makeJSValue(value))
{
Q_ASSERT(engine);
- JSValueProtect(context(), m_value);
+ JSValueProtect(*m_engine, m_value);
}
QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, int value)
@@ -227,7 +232,7 @@ QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, int
, m_value(m_engine->makeJSValue(value))
{
Q_ASSERT(engine);
- JSValueProtect(context(), m_value);
+ JSValueProtect(*m_engine, m_value);
}
QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, uint value)
@@ -236,7 +241,7 @@ QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, uin
, m_value(m_engine->makeJSValue(value))
{
Q_ASSERT(engine);
- JSValueProtect(context(), m_value);
+ JSValueProtect(*m_engine, m_value);
}
QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, qsreal value)
@@ -245,7 +250,7 @@ QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, qsr
, m_value(m_engine->makeJSValue(value))
{
Q_ASSERT(engine);
- JSValueProtect(context(), m_value);
+ JSValueProtect(*m_engine, m_value);
}
QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, const QString& value)
@@ -254,7 +259,7 @@ QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, con
, m_value(m_engine->makeJSValue(value))
{
Q_ASSERT(engine);
- JSValueProtect(context(), m_value);
+ JSValueProtect(*m_engine, m_value);
}
QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, QScriptValue::SpecialValue value)
@@ -263,7 +268,7 @@ QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, QSc
, m_value(m_engine->makeJSValue(value))
{
Q_ASSERT(engine);
- JSValueProtect(context(), m_value);
+ JSValueProtect(*m_engine, m_value);
}
QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, JSValueRef value)
@@ -273,7 +278,7 @@ QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, JSV
{
Q_ASSERT(engine);
Q_ASSERT(value);
- JSValueProtect(context(), m_value);
+ JSValueProtect(*m_engine, m_value);
}
QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, JSValueRef value, JSObjectRef object)
@@ -285,7 +290,7 @@ QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, JSV
Q_ASSERT(engine);
Q_ASSERT(value);
Q_ASSERT(object);
- JSValueProtect(context(), m_value);
+ JSValueProtect(*m_engine, m_value);
}
bool QScriptValuePrivate::isValid() const { return m_state != Invalid; }
@@ -300,7 +305,7 @@ bool QScriptValuePrivate::isBool()
return false;
// Fall-through.
case JSPrimitive:
- return JSValueIsBoolean(context(), value());
+ return JSValueIsBoolean(*m_engine, *this);
default:
return false;
}
@@ -316,7 +321,7 @@ bool QScriptValuePrivate::isNumber()
return false;
// Fall-through.
case JSPrimitive:
- return JSValueIsNumber(context(), value());
+ return JSValueIsNumber(*m_engine, *this);
default:
return false;
}
@@ -325,14 +330,14 @@ bool QScriptValuePrivate::isNumber()
bool QScriptValuePrivate::isNull()
{
switch (m_state) {
- case CSpecial:
- return m_number == static_cast<int>(QScriptValue::NullValue);
+ case CNull:
+ return true;
case JSValue:
if (refinedJSValue() != JSPrimitive)
return false;
// Fall-through.
case JSPrimitive:
- return JSValueIsNull(context(), value());
+ return JSValueIsNull(*m_engine, *this);
default:
return false;
}
@@ -348,7 +353,7 @@ bool QScriptValuePrivate::isString()
return false;
// Fall-through.
case JSPrimitive:
- return JSValueIsString(context(), value());
+ return JSValueIsString(*m_engine, *this);
default:
return false;
}
@@ -357,14 +362,14 @@ bool QScriptValuePrivate::isString()
bool QScriptValuePrivate::isUndefined()
{
switch (m_state) {
- case CSpecial:
- return m_number == static_cast<int>(QScriptValue::UndefinedValue);
+ case CUndefined:
+ return true;
case JSValue:
if (refinedJSValue() != JSPrimitive)
return false;
// Fall-through.
case JSPrimitive:
- return JSValueIsUndefined(context(), value());
+ return JSValueIsUndefined(*m_engine, *this);
default:
return false;
}
@@ -405,7 +410,7 @@ bool QScriptValuePrivate::isFunction()
return false;
// Fall-through.
case JSObject:
- return JSObjectIsFunction(context(), object());
+ return JSObjectIsFunction(*m_engine, *this);
default:
return false;
}
@@ -422,12 +427,14 @@ QString QScriptValuePrivate::toString() const
return m_string;
case CNumber:
return QScriptConverter::toString(m_number);
- case CSpecial:
- return m_number == QScriptValue::NullValue ? QString::fromLatin1("null") : QString::fromLatin1("undefined");
+ case CNull:
+ return QString::fromLatin1("null");
+ case CUndefined:
+ return QString::fromLatin1("undefined");
case JSValue:
case JSPrimitive:
case JSObject:
- JSRetainPtr<JSStringRef> ptr(Adopt, JSValueToStringCopy(context(), value(), /* exception */ 0));
+ JSRetainPtr<JSStringRef> ptr(Adopt, JSValueToStringCopy(*m_engine, *this, /* exception */ 0));
return QScriptConverter::toString(ptr.get());
}
@@ -441,15 +448,16 @@ qsreal QScriptValuePrivate::toNumber() const
case JSValue:
case JSPrimitive:
case JSObject:
- return JSValueToNumber(context(), value(), /* exception */ 0);
+ return JSValueToNumber(*m_engine, *this, /* exception */ 0);
case CNumber:
return m_number;
case CBool:
return m_number ? 1 : 0;
+ case CNull:
case Invalid:
return 0;
- case CSpecial:
- return m_number == QScriptValue::NullValue ? 0 : qQNaN();
+ case CUndefined:
+ return qQNaN();
case CString:
bool ok;
qsreal result = m_string.toDouble(&ok);
@@ -472,7 +480,7 @@ bool QScriptValuePrivate::toBool() const
switch (m_state) {
case JSValue:
case JSPrimitive:
- return JSValueToBoolean(context(), value());
+ return JSValueToBoolean(*m_engine, *this);
case JSObject:
return true;
case CNumber:
@@ -480,7 +488,8 @@ bool QScriptValuePrivate::toBool() const
case CBool:
return m_number;
case Invalid:
- case CSpecial:
+ case CNull:
+ case CUndefined:
return false;
case CString:
return m_string.length();
@@ -536,26 +545,27 @@ QScriptValuePrivate* QScriptValuePrivate::toObject(QScriptEnginePrivate* engine)
{
switch (m_state) {
case Invalid:
- case CSpecial:
+ case CNull:
+ case CUndefined:
return new QScriptValuePrivate;
case CString:
{
// Exception can't occur here.
- JSObjectRef object = JSValueToObject(engine->context(), engine->makeJSValue(m_string), /* exception */ 0);
+ JSObjectRef object = JSValueToObject(*engine, engine->makeJSValue(m_string), /* exception */ 0);
Q_ASSERT(object);
return new QScriptValuePrivate(engine, object, object);
}
case CNumber:
{
// Exception can't occur here.
- JSObjectRef object = JSValueToObject(engine->context(), engine->makeJSValue(m_number), /* exception */ 0);
+ JSObjectRef object = JSValueToObject(*engine, engine->makeJSValue(m_number), /* exception */ 0);
Q_ASSERT(object);
return new QScriptValuePrivate(engine, object, object);
}
case CBool:
{
// Exception can't occure here.
- JSObjectRef object = JSValueToObject(engine->context(), engine->makeJSValue(static_cast<bool>(m_number)), /* exception */ 0);
+ JSObjectRef object = JSValueToObject(*engine, engine->makeJSValue(static_cast<bool>(m_number)), /* exception */ 0);
Q_ASSERT(object);
return new QScriptValuePrivate(engine, object, object);
}
@@ -567,7 +577,7 @@ QScriptValuePrivate* QScriptValuePrivate::toObject(QScriptEnginePrivate* engine)
{
if (engine != this->engine())
qWarning("QScriptEngine::toObject: cannot convert value created in a different engine");
- JSObjectRef object = JSValueToObject(context(), value(), /* exception */ 0);
+ JSObjectRef object = JSValueToObject(*m_engine, *this, /* exception */ 0);
if (object)
return new QScriptValuePrivate(m_engine.constData(), object);
}
@@ -597,47 +607,79 @@ QScriptValuePrivate* QScriptValuePrivate::toObject()
bool QScriptValuePrivate::equals(QScriptValuePrivate* other)
{
- if (!isValid() || !other->isValid())
+ if (!isValid())
+ return !other->isValid();
+
+ if (!other->isValid())
return false;
if ((m_state == other->m_state) && !isJSBased()) {
if (isNumberBased())
return m_number == other->m_number;
+ Q_ASSERT(isStringBased());
return m_string == other->m_string;
}
+ if (!isJSBased() && !other->isJSBased())
+ return false;
+
if (isJSBased() && !other->isJSBased()) {
if (!other->assignEngine(engine())) {
qWarning("equals(): Cannot compare to a value created in a different engine");
return false;
}
} else if (!isJSBased() && other->isJSBased()) {
- if (!other->assignEngine(other->engine())) {
+ if (!assignEngine(other->engine())) {
qWarning("equals(): Cannot compare to a value created in a different engine");
return false;
}
}
- return JSValueIsEqual(context(), value(), other->value(), /* exception */ 0);
+ return JSValueIsEqual(*m_engine, *this, *other, /* exception */ 0);
}
-bool QScriptValuePrivate::strictlyEquals(const QScriptValuePrivate* other) const
+bool QScriptValuePrivate::strictlyEquals(QScriptValuePrivate* other)
{
- if (m_state != other->m_state)
- return false;
if (isJSBased()) {
+ // We can't compare these two values without binding to the same engine.
+ if (!other->isJSBased()) {
+ if (other->assignEngine(engine()))
+ return JSValueIsStrictEqual(*m_engine, *this, *other);
+ return false;
+ }
if (other->engine() != engine()) {
qWarning("strictlyEquals(): Cannot compare to a value created in a different engine");
return false;
}
- return JSValueIsStrictEqual(context(), value(), other->value());
+ return JSValueIsStrictEqual(*m_engine, *this, *other);
}
- if (isStringBased())
- return m_string == other->m_string;
- if (isNumberBased())
- return m_number == other->m_number;
+ if (isStringBased()) {
+ if (other->isStringBased())
+ return m_string == other->m_string;
+ if (other->isJSBased()) {
+ assignEngine(other->engine());
+ return JSValueIsStrictEqual(*m_engine, *this, *other);
+ }
+ }
+ if (isNumberBased()) {
+ if (other->isNumberBased())
+ return m_number == other->m_number;
+ if (other->isJSBased()) {
+ assignEngine(other->engine());
+ return JSValueIsStrictEqual(*m_engine, *this, *other);
+ }
+ }
+ if (!isValid() && !other->isValid())
+ return true;
- return false; // Invalid state.
+ return false;
+}
+
+inline bool QScriptValuePrivate::instanceOf(QScriptValuePrivate* other)
+{
+ if (!isJSBased() || !other->isObject())
+ return false;
+ return JSValueIsInstanceOfConstructor(*m_engine, *this, *other, /* exception */ 0);
}
/*!
@@ -656,8 +698,11 @@ bool QScriptValuePrivate::assignEngine(QScriptEnginePrivate* engine)
case CNumber:
value = engine->makeJSValue(m_number);
break;
- case CSpecial:
- value = engine->makeJSValue(static_cast<QScriptValue::SpecialValue>(m_number));
+ case CNull:
+ value = engine->makeJSValue(QScriptValue::NullValue);
+ break;
+ case CUndefined:
+ value = engine->makeJSValue(QScriptValue::UndefinedValue);
break;
default:
if (!isJSBased())
@@ -691,12 +736,12 @@ QScriptValuePrivate* QScriptValuePrivate::call(const QScriptValuePrivate*, const
qWarning("QScriptValue::call() failed: cannot call function with values created in a different engine");
return new QScriptValuePrivate;
}
- argv[j] = value->value();
+ argv[j] = *value;
}
// Make the call
JSValueRef exception = 0;
- JSValueRef result = JSObjectCallAsFunction(context(), object(), /* thisObject */ 0, argc, argv.constData(), &exception);
+ JSValueRef result = JSObjectCallAsFunction(*m_engine, *this, /* thisObject */ 0, argc, argv.constData(), &exception);
if (!result && exception)
return new QScriptValuePrivate(engine(), exception);
if (result && !exception)
@@ -715,19 +760,13 @@ QScriptEnginePrivate* QScriptValuePrivate::engine() const
return m_engine.data();
}
-JSGlobalContextRef QScriptValuePrivate::context() const
-{
- Q_ASSERT(isJSBased());
- return m_engine->context();
-}
-
-JSValueRef QScriptValuePrivate::value() const
+QScriptValuePrivate::operator JSValueRef() const
{
Q_ASSERT(isJSBased());
return m_value;
}
-JSObjectRef QScriptValuePrivate::object() const
+QScriptValuePrivate::operator JSObjectRef() const
{
Q_ASSERT(m_state == JSObject);
return m_object;
@@ -736,9 +775,9 @@ JSObjectRef QScriptValuePrivate::object() const
void QScriptValuePrivate::setValue(JSValueRef value)
{
if (m_value)
- JSValueUnprotect(context(), m_value);
+ JSValueUnprotect(*m_engine, m_value);
if (value)
- JSValueProtect(context(), value);
+ JSValueProtect(*m_engine, value);
m_value = value;
}
@@ -750,11 +789,11 @@ void QScriptValuePrivate::setValue(JSValueRef value)
bool QScriptValuePrivate::inherits(const char* name)
{
Q_ASSERT(isJSBased());
- JSObjectRef globalObject = JSContextGetGlobalObject(context());
+ JSObjectRef globalObject = JSContextGetGlobalObject(*m_engine);
JSStringRef errorAttrName = QScriptConverter::toString(name);
- JSValueRef error = JSObjectGetProperty(context(), globalObject, errorAttrName, /* exception */ 0);
+ JSValueRef error = JSObjectGetProperty(*m_engine, globalObject, errorAttrName, /* exception */ 0);
JSStringRelease(errorAttrName);
- return JSValueIsInstanceOfConstructor(context(), value(), JSValueToObject(context(), error, /* exception */ 0), /* exception */ 0);
+ return JSValueIsInstanceOfConstructor(*m_engine, *this, JSValueToObject(*m_engine, error, /* exception */ 0), /* exception */ 0);
}
/*!
@@ -764,12 +803,12 @@ bool QScriptValuePrivate::inherits(const char* name)
QScriptValuePrivate::State QScriptValuePrivate::refinedJSValue()
{
Q_ASSERT(m_state == JSValue);
- if (!JSValueIsObject(context(), value())) {
+ if (!JSValueIsObject(*m_engine, *this)) {
m_state = JSPrimitive;
} else {
m_state = JSObject;
// We are sure that value is an JSObject, so we can const_cast safely without
- // calling JSC C API (JSValueToObject(context(), value(), /* exceptions */ 0)).
+ // calling JSC C API (JSValueToObject(*m_engine, *this, /* exceptions */ 0)).
m_object = const_cast<JSObjectRef>(m_value);
}
return m_state;
@@ -785,7 +824,7 @@ bool QScriptValuePrivate::isJSBased() const { return m_state >= JSValue; }
\internal
Returns true if current value of QSV is placed in m_number.
*/
-bool QScriptValuePrivate::isNumberBased() const { return !isJSBased() && !isStringBased() && m_state != Invalid; }
+bool QScriptValuePrivate::isNumberBased() const { return m_state == CNumber || m_state == CBool; }
/*!
\internal
diff --git a/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp b/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp
index 38243d2..d545f37 100644
--- a/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp
+++ b/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp
@@ -35,6 +35,7 @@ public slots:
void cleanup() {}
private slots:
+ void newObject();
void globalObject();
void evaluate();
void collectGarbage();
@@ -56,6 +57,18 @@ void tst_QScriptEngine::evaluate()
QVERIFY2(engine.evaluate("ping").isValid(), "Script throwing an unhandled exception should return an exception value");
}
+void tst_QScriptEngine::newObject()
+{
+ QScriptEngine engine;
+ QScriptValue object = engine.newObject();
+ QVERIFY(object.isObject());
+ QVERIFY(object.engine() == &engine);
+ QVERIFY(!object.isError());
+ QVERIFY(!object.equals(engine.newObject()));
+ QVERIFY(!object.strictlyEquals(engine.newObject()));
+ QCOMPARE(object.toString(), QString::fromAscii("[object Object]"));
+}
+
void tst_QScriptEngine::globalObject()
{
QScriptEngine engine;
@@ -63,7 +76,6 @@ void tst_QScriptEngine::globalObject()
QScriptValue self = engine.evaluate("this");
QVERIFY(global.isObject());
QVERIFY(engine.globalObject().equals(engine.evaluate("this")));
- QEXPECT_FAIL("", "strictlyEquals is broken - bug 36600 in bugs.webkit.org", Continue);
QVERIFY(engine.globalObject().strictlyEquals(self));
}
diff --git a/JavaScriptCore/qt/tests/qscriptvalue/qscriptvalue.pro b/JavaScriptCore/qt/tests/qscriptvalue/qscriptvalue.pro
index 532d430..02e94ec 100644
--- a/JavaScriptCore/qt/tests/qscriptvalue/qscriptvalue.pro
+++ b/JavaScriptCore/qt/tests/qscriptvalue/qscriptvalue.pro
@@ -7,6 +7,7 @@ include(../tests.pri)
SOURCES += \
tst_qscriptvalue.cpp \
tst_qscriptvalue_generated_init.cpp \
+ tst_qscriptvalue_generated_comparison.cpp \
tst_qscriptvalue_generated_istype.cpp \
tst_qscriptvalue_generated_totype.cpp \
diff --git a/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h b/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h
index 3d33f8e..0565b6f 100644
--- a/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h
+++ b/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h
@@ -103,6 +103,15 @@ private slots:
void toUInt16_data();
void toUInt16();
+ void equals_data();
+ void equals();
+
+ void strictlyEquals_data();
+ void strictlyEquals();
+
+ void instanceOf_data();
+ void instanceOf();
+
private:
typedef void (tst_QScriptValue::*InitDataFunction)();
typedef void (tst_QScriptValue::*DefineDataFunction)(const char*);
@@ -184,6 +193,18 @@ private:
void toUInt16_makeData(const char*);
void toUInt16_test(const char*, const QScriptValue&);
+ void equals_initData();
+ void equals_makeData(const char*);
+ void equals_test(const char*, const QScriptValue&);
+
+ void strictlyEquals_initData();
+ void strictlyEquals_makeData(const char*);
+ void strictlyEquals_test(const char*, const QScriptValue&);
+
+ void instanceOf_initData();
+ void instanceOf_makeData(const char*);
+ void instanceOf_test(const char*, const QScriptValue&);
+
private:
QScriptEngine* engine;
QHash<QString, QScriptValue> m_values;
diff --git a/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp b/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp
new file mode 100644
index 0000000..7586b15
--- /dev/null
+++ b/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp
@@ -0,0 +1,1742 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+/****************************************************************************
+*************** This file has been generated. DO NOT MODIFY! ****************
+****************************************************************************/
+
+#include "tst_qscriptvalue.h"
+
+void tst_QScriptValue::equals_initData()
+{
+ QTest::addColumn<QScriptValue>("other");
+ QTest::addColumn<bool>("expected");
+ initScriptValues();
+}
+
+static QString equals_array[] = {
+ "QScriptValue() <=> QScriptValue()",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"null\")",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> engine->nullValue()",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> engine->undefinedValue()",
+ "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"{}\")",
+ "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"undefined\")",
+ "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"null\")",
+ "QScriptValue(QScriptValue::NullValue) <=> engine->nullValue()",
+ "QScriptValue(QScriptValue::NullValue) <=> engine->undefinedValue()",
+ "QScriptValue(true) <=> QScriptValue(true)",
+ "QScriptValue(true) <=> QScriptValue(0, true)",
+ "QScriptValue(true) <=> QScriptValue(engine, true)",
+ "QScriptValue(true) <=> engine->evaluate(\"true\")",
+ "QScriptValue(false) <=> QScriptValue(false)",
+ "QScriptValue(false) <=> QScriptValue(0)",
+ "QScriptValue(false) <=> QScriptValue(0.0)",
+ "QScriptValue(false) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(false) <=> QScriptValue(QString())",
+ "QScriptValue(false) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(false) <=> QScriptValue(0, false)",
+ "QScriptValue(false) <=> QScriptValue(0, 0)",
+ "QScriptValue(false) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(false) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(false) <=> QScriptValue(0, QString())",
+ "QScriptValue(false) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(false) <=> QScriptValue(engine, false)",
+ "QScriptValue(false) <=> QScriptValue(engine, 0)",
+ "QScriptValue(false) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(false) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(false) <=> QScriptValue(engine, QString())",
+ "QScriptValue(false) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(false) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(false) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(false) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(false) <=> engine->evaluate(\"false\")",
+ "QScriptValue(false) <=> engine->evaluate(\"0\")",
+ "QScriptValue(false) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(false) <=> engine->evaluate(\"''\")",
+ "QScriptValue(false) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(int(122)) <=> QScriptValue(int(122))",
+ "QScriptValue(int(122)) <=> QScriptValue(0, int(122))",
+ "QScriptValue(int(122)) <=> QScriptValue(engine, int(122))",
+ "QScriptValue(int(122)) <=> engine->evaluate(\"122\")",
+ "QScriptValue(uint(124)) <=> QScriptValue(uint(124))",
+ "QScriptValue(uint(124)) <=> QScriptValue(0, uint(124))",
+ "QScriptValue(uint(124)) <=> QScriptValue(engine, uint(124))",
+ "QScriptValue(uint(124)) <=> engine->evaluate(\"124\")",
+ "QScriptValue(0) <=> QScriptValue(false)",
+ "QScriptValue(0) <=> QScriptValue(0)",
+ "QScriptValue(0) <=> QScriptValue(0.0)",
+ "QScriptValue(0) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(0) <=> QScriptValue(QString())",
+ "QScriptValue(0) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(0) <=> QScriptValue(0, false)",
+ "QScriptValue(0) <=> QScriptValue(0, 0)",
+ "QScriptValue(0) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(0) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0) <=> QScriptValue(0, QString())",
+ "QScriptValue(0) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0) <=> QScriptValue(engine, false)",
+ "QScriptValue(0) <=> QScriptValue(engine, 0)",
+ "QScriptValue(0) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(0) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(0) <=> QScriptValue(engine, QString())",
+ "QScriptValue(0) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(0) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(0) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(0) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(0) <=> engine->evaluate(\"false\")",
+ "QScriptValue(0) <=> engine->evaluate(\"0\")",
+ "QScriptValue(0) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(0) <=> engine->evaluate(\"''\")",
+ "QScriptValue(0) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(0.0) <=> QScriptValue(false)",
+ "QScriptValue(0.0) <=> QScriptValue(0)",
+ "QScriptValue(0.0) <=> QScriptValue(0.0)",
+ "QScriptValue(0.0) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(0.0) <=> QScriptValue(QString())",
+ "QScriptValue(0.0) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(0.0) <=> QScriptValue(0, false)",
+ "QScriptValue(0.0) <=> QScriptValue(0, 0)",
+ "QScriptValue(0.0) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(0.0) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0.0) <=> QScriptValue(0, QString())",
+ "QScriptValue(0.0) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0.0) <=> QScriptValue(engine, false)",
+ "QScriptValue(0.0) <=> QScriptValue(engine, 0)",
+ "QScriptValue(0.0) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(0.0) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(0.0) <=> QScriptValue(engine, QString())",
+ "QScriptValue(0.0) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(0.0) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(0.0) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(0.0) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(0.0) <=> engine->evaluate(\"false\")",
+ "QScriptValue(0.0) <=> engine->evaluate(\"0\")",
+ "QScriptValue(0.0) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(0.0) <=> engine->evaluate(\"''\")",
+ "QScriptValue(0.0) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(123.0) <=> QScriptValue(123.0)",
+ "QScriptValue(123.0) <=> QScriptValue(QString(\"123\"))",
+ "QScriptValue(123.0) <=> QScriptValue(0, 123.0)",
+ "QScriptValue(123.0) <=> QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(123.0) <=> QScriptValue(engine, 123.0)",
+ "QScriptValue(123.0) <=> QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(123.0) <=> engine->evaluate(\"123.0\")",
+ "QScriptValue(123.0) <=> engine->evaluate(\"'123'\")",
+ "QScriptValue(6.37e-8) <=> QScriptValue(6.37e-8)",
+ "QScriptValue(6.37e-8) <=> QScriptValue(0, 6.37e-8)",
+ "QScriptValue(6.37e-8) <=> QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(6.37e-8) <=> engine->evaluate(\"6.37e-8\")",
+ "QScriptValue(-6.37e-8) <=> QScriptValue(-6.37e-8)",
+ "QScriptValue(-6.37e-8) <=> QScriptValue(0, -6.37e-8)",
+ "QScriptValue(-6.37e-8) <=> QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(-6.37e-8) <=> engine->evaluate(\"-6.37e-8\")",
+ "QScriptValue(0x43211234) <=> QScriptValue(0x43211234)",
+ "QScriptValue(0x43211234) <=> QScriptValue(0, 0x43211234)",
+ "QScriptValue(0x43211234) <=> QScriptValue(engine, 0x43211234)",
+ "QScriptValue(0x43211234) <=> engine->evaluate(\"0x43211234\")",
+ "QScriptValue(0x10000) <=> QScriptValue(0x10000)",
+ "QScriptValue(0x10000) <=> QScriptValue(0, 0x10000)",
+ "QScriptValue(0x10000) <=> QScriptValue(engine, 0x10000)",
+ "QScriptValue(0x10000) <=> engine->evaluate(\"0x10000\")",
+ "QScriptValue(0x10001) <=> QScriptValue(0x10001)",
+ "QScriptValue(0x10001) <=> QScriptValue(0, 0x10001)",
+ "QScriptValue(0x10001) <=> QScriptValue(engine, 0x10001)",
+ "QScriptValue(0x10001) <=> engine->evaluate(\"0x10001\")",
+ "QScriptValue(qInf()) <=> QScriptValue(qInf())",
+ "QScriptValue(qInf()) <=> QScriptValue(\"Infinity\")",
+ "QScriptValue(qInf()) <=> QScriptValue(0, qInf())",
+ "QScriptValue(qInf()) <=> QScriptValue(0, \"Infinity\")",
+ "QScriptValue(qInf()) <=> QScriptValue(engine, qInf())",
+ "QScriptValue(qInf()) <=> QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(qInf()) <=> engine->evaluate(\"Infinity\")",
+ "QScriptValue(-qInf()) <=> QScriptValue(-qInf())",
+ "QScriptValue(-qInf()) <=> QScriptValue(\"-Infinity\")",
+ "QScriptValue(-qInf()) <=> QScriptValue(0, -qInf())",
+ "QScriptValue(-qInf()) <=> QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(-qInf()) <=> QScriptValue(engine, -qInf())",
+ "QScriptValue(-qInf()) <=> QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(-qInf()) <=> engine->evaluate(\"-Infinity\")",
+ "QScriptValue(\"NaN\") <=> QScriptValue(\"NaN\")",
+ "QScriptValue(\"NaN\") <=> QScriptValue(0, \"NaN\")",
+ "QScriptValue(\"NaN\") <=> QScriptValue(engine, \"NaN\")",
+ "QScriptValue(\"Infinity\") <=> QScriptValue(qInf())",
+ "QScriptValue(\"Infinity\") <=> QScriptValue(\"Infinity\")",
+ "QScriptValue(\"Infinity\") <=> QScriptValue(0, qInf())",
+ "QScriptValue(\"Infinity\") <=> QScriptValue(0, \"Infinity\")",
+ "QScriptValue(\"Infinity\") <=> QScriptValue(engine, qInf())",
+ "QScriptValue(\"Infinity\") <=> QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(\"Infinity\") <=> engine->evaluate(\"Infinity\")",
+ "QScriptValue(\"-Infinity\") <=> QScriptValue(-qInf())",
+ "QScriptValue(\"-Infinity\") <=> QScriptValue(\"-Infinity\")",
+ "QScriptValue(\"-Infinity\") <=> QScriptValue(0, -qInf())",
+ "QScriptValue(\"-Infinity\") <=> QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, -qInf())",
+ "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"-Infinity\")",
+ "QScriptValue(\"ciao\") <=> QScriptValue(\"ciao\")",
+ "QScriptValue(\"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(\"ciao\") <=> QScriptValue(0, \"ciao\")",
+ "QScriptValue(\"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(\"ciao\") <=> QScriptValue(engine, \"ciao\")",
+ "QScriptValue(\"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(\"ciao\") <=> engine->evaluate(\"'ciao'\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(false)",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(0)",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(0.0)",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(QString())",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(0, false)",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(0, 0)",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(0, QString())",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(engine, false)",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(engine, 0)",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString())",
+ "QScriptValue(QString(\"\")) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(QString(\"\")) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(QString(\"\")) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(QString(\"\")) <=> engine->evaluate(\"false\")",
+ "QScriptValue(QString(\"\")) <=> engine->evaluate(\"0\")",
+ "QScriptValue(QString(\"\")) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(QString(\"\")) <=> engine->evaluate(\"''\")",
+ "QScriptValue(QString()) <=> QScriptValue(false)",
+ "QScriptValue(QString()) <=> QScriptValue(0)",
+ "QScriptValue(QString()) <=> QScriptValue(0.0)",
+ "QScriptValue(QString()) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(QString()) <=> QScriptValue(QString())",
+ "QScriptValue(QString()) <=> QScriptValue(0, false)",
+ "QScriptValue(QString()) <=> QScriptValue(0, 0)",
+ "QScriptValue(QString()) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(QString()) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(QString()) <=> QScriptValue(0, QString())",
+ "QScriptValue(QString()) <=> QScriptValue(engine, false)",
+ "QScriptValue(QString()) <=> QScriptValue(engine, 0)",
+ "QScriptValue(QString()) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(QString()) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(QString()) <=> QScriptValue(engine, QString())",
+ "QScriptValue(QString()) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(QString()) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(QString()) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(QString()) <=> engine->evaluate(\"false\")",
+ "QScriptValue(QString()) <=> engine->evaluate(\"0\")",
+ "QScriptValue(QString()) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(QString()) <=> engine->evaluate(\"''\")",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(false)",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(0)",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(0.0)",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(0, false)",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(0, 0)",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, false)",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, 0)",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"false\")",
+ "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"0\")",
+ "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(QString(\"123\")) <=> QScriptValue(123.0)",
+ "QScriptValue(QString(\"123\")) <=> QScriptValue(QString(\"123\"))",
+ "QScriptValue(QString(\"123\")) <=> QScriptValue(0, 123.0)",
+ "QScriptValue(QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(QString(\"123\")) <=> QScriptValue(engine, 123.0)",
+ "QScriptValue(QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"123.0\")",
+ "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"'123'\")",
+ "QScriptValue(QString(\"12.4\")) <=> QScriptValue(QString(\"12.4\"))",
+ "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"'12.4'\")",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"null\")",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->nullValue()",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->undefinedValue()",
+ "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"{}\")",
+ "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"undefined\")",
+ "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"null\")",
+ "QScriptValue(0, QScriptValue::NullValue) <=> engine->nullValue()",
+ "QScriptValue(0, QScriptValue::NullValue) <=> engine->undefinedValue()",
+ "QScriptValue(0, true) <=> QScriptValue(true)",
+ "QScriptValue(0, true) <=> QScriptValue(0, true)",
+ "QScriptValue(0, true) <=> QScriptValue(engine, true)",
+ "QScriptValue(0, true) <=> engine->evaluate(\"true\")",
+ "QScriptValue(0, false) <=> QScriptValue(false)",
+ "QScriptValue(0, false) <=> QScriptValue(0)",
+ "QScriptValue(0, false) <=> QScriptValue(0.0)",
+ "QScriptValue(0, false) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(0, false) <=> QScriptValue(QString())",
+ "QScriptValue(0, false) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(0, false) <=> QScriptValue(0, false)",
+ "QScriptValue(0, false) <=> QScriptValue(0, 0)",
+ "QScriptValue(0, false) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(0, false) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, false) <=> QScriptValue(0, QString())",
+ "QScriptValue(0, false) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, false) <=> QScriptValue(engine, false)",
+ "QScriptValue(0, false) <=> QScriptValue(engine, 0)",
+ "QScriptValue(0, false) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(0, false) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(0, false) <=> QScriptValue(engine, QString())",
+ "QScriptValue(0, false) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(0, false) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(0, false) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(0, false) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(0, false) <=> engine->evaluate(\"false\")",
+ "QScriptValue(0, false) <=> engine->evaluate(\"0\")",
+ "QScriptValue(0, false) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(0, false) <=> engine->evaluate(\"''\")",
+ "QScriptValue(0, false) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(0, int(122)) <=> QScriptValue(int(122))",
+ "QScriptValue(0, int(122)) <=> QScriptValue(0, int(122))",
+ "QScriptValue(0, int(122)) <=> QScriptValue(engine, int(122))",
+ "QScriptValue(0, int(122)) <=> engine->evaluate(\"122\")",
+ "QScriptValue(0, uint(124)) <=> QScriptValue(uint(124))",
+ "QScriptValue(0, uint(124)) <=> QScriptValue(0, uint(124))",
+ "QScriptValue(0, uint(124)) <=> QScriptValue(engine, uint(124))",
+ "QScriptValue(0, uint(124)) <=> engine->evaluate(\"124\")",
+ "QScriptValue(0, 0) <=> QScriptValue(false)",
+ "QScriptValue(0, 0) <=> QScriptValue(0)",
+ "QScriptValue(0, 0) <=> QScriptValue(0.0)",
+ "QScriptValue(0, 0) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(0, 0) <=> QScriptValue(QString())",
+ "QScriptValue(0, 0) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(0, 0) <=> QScriptValue(0, false)",
+ "QScriptValue(0, 0) <=> QScriptValue(0, 0)",
+ "QScriptValue(0, 0) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(0, 0) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, 0) <=> QScriptValue(0, QString())",
+ "QScriptValue(0, 0) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, 0) <=> QScriptValue(engine, false)",
+ "QScriptValue(0, 0) <=> QScriptValue(engine, 0)",
+ "QScriptValue(0, 0) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(0, 0) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(0, 0) <=> QScriptValue(engine, QString())",
+ "QScriptValue(0, 0) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(0, 0) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(0, 0) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(0, 0) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(0, 0) <=> engine->evaluate(\"false\")",
+ "QScriptValue(0, 0) <=> engine->evaluate(\"0\")",
+ "QScriptValue(0, 0) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(0, 0) <=> engine->evaluate(\"''\")",
+ "QScriptValue(0, 0) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(0, 0.0) <=> QScriptValue(false)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(0)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(0.0)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(0, 0.0) <=> QScriptValue(QString())",
+ "QScriptValue(0, 0.0) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(0, 0.0) <=> QScriptValue(0, false)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(0, 0)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, 0.0) <=> QScriptValue(0, QString())",
+ "QScriptValue(0, 0.0) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, 0.0) <=> QScriptValue(engine, false)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(engine, 0)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(0, 0.0) <=> QScriptValue(engine, QString())",
+ "QScriptValue(0, 0.0) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(0, 0.0) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(0, 0.0) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(0, 0.0) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(0, 0.0) <=> engine->evaluate(\"false\")",
+ "QScriptValue(0, 0.0) <=> engine->evaluate(\"0\")",
+ "QScriptValue(0, 0.0) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(0, 0.0) <=> engine->evaluate(\"''\")",
+ "QScriptValue(0, 0.0) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(0, 123.0) <=> QScriptValue(123.0)",
+ "QScriptValue(0, 123.0) <=> QScriptValue(QString(\"123\"))",
+ "QScriptValue(0, 123.0) <=> QScriptValue(0, 123.0)",
+ "QScriptValue(0, 123.0) <=> QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, 123.0) <=> QScriptValue(engine, 123.0)",
+ "QScriptValue(0, 123.0) <=> QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(0, 123.0) <=> engine->evaluate(\"123.0\")",
+ "QScriptValue(0, 123.0) <=> engine->evaluate(\"'123'\")",
+ "QScriptValue(0, 6.37e-8) <=> QScriptValue(6.37e-8)",
+ "QScriptValue(0, 6.37e-8) <=> QScriptValue(0, 6.37e-8)",
+ "QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"6.37e-8\")",
+ "QScriptValue(0, -6.37e-8) <=> QScriptValue(-6.37e-8)",
+ "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, -6.37e-8)",
+ "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"-6.37e-8\")",
+ "QScriptValue(0, 0x43211234) <=> QScriptValue(0x43211234)",
+ "QScriptValue(0, 0x43211234) <=> QScriptValue(0, 0x43211234)",
+ "QScriptValue(0, 0x43211234) <=> QScriptValue(engine, 0x43211234)",
+ "QScriptValue(0, 0x43211234) <=> engine->evaluate(\"0x43211234\")",
+ "QScriptValue(0, 0x10000) <=> QScriptValue(0x10000)",
+ "QScriptValue(0, 0x10000) <=> QScriptValue(0, 0x10000)",
+ "QScriptValue(0, 0x10000) <=> QScriptValue(engine, 0x10000)",
+ "QScriptValue(0, 0x10000) <=> engine->evaluate(\"0x10000\")",
+ "QScriptValue(0, 0x10001) <=> QScriptValue(0x10001)",
+ "QScriptValue(0, 0x10001) <=> QScriptValue(0, 0x10001)",
+ "QScriptValue(0, 0x10001) <=> QScriptValue(engine, 0x10001)",
+ "QScriptValue(0, 0x10001) <=> engine->evaluate(\"0x10001\")",
+ "QScriptValue(0, qInf()) <=> QScriptValue(qInf())",
+ "QScriptValue(0, qInf()) <=> QScriptValue(\"Infinity\")",
+ "QScriptValue(0, qInf()) <=> QScriptValue(0, qInf())",
+ "QScriptValue(0, qInf()) <=> QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, qInf()) <=> QScriptValue(engine, qInf())",
+ "QScriptValue(0, qInf()) <=> QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(0, qInf()) <=> engine->evaluate(\"Infinity\")",
+ "QScriptValue(0, -qInf()) <=> QScriptValue(-qInf())",
+ "QScriptValue(0, -qInf()) <=> QScriptValue(\"-Infinity\")",
+ "QScriptValue(0, -qInf()) <=> QScriptValue(0, -qInf())",
+ "QScriptValue(0, -qInf()) <=> QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, -qInf()) <=> QScriptValue(engine, -qInf())",
+ "QScriptValue(0, -qInf()) <=> QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(0, -qInf()) <=> engine->evaluate(\"-Infinity\")",
+ "QScriptValue(0, \"NaN\") <=> QScriptValue(\"NaN\")",
+ "QScriptValue(0, \"NaN\") <=> QScriptValue(0, \"NaN\")",
+ "QScriptValue(0, \"NaN\") <=> QScriptValue(engine, \"NaN\")",
+ "QScriptValue(0, \"Infinity\") <=> QScriptValue(qInf())",
+ "QScriptValue(0, \"Infinity\") <=> QScriptValue(\"Infinity\")",
+ "QScriptValue(0, \"Infinity\") <=> QScriptValue(0, qInf())",
+ "QScriptValue(0, \"Infinity\") <=> QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, \"Infinity\") <=> QScriptValue(engine, qInf())",
+ "QScriptValue(0, \"Infinity\") <=> QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"Infinity\")",
+ "QScriptValue(0, \"-Infinity\") <=> QScriptValue(-qInf())",
+ "QScriptValue(0, \"-Infinity\") <=> QScriptValue(\"-Infinity\")",
+ "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, -qInf())",
+ "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, -qInf())",
+ "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"-Infinity\")",
+ "QScriptValue(0, \"ciao\") <=> QScriptValue(\"ciao\")",
+ "QScriptValue(0, \"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, \"ciao\") <=> QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, \"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, \"ciao\") <=> QScriptValue(engine, \"ciao\")",
+ "QScriptValue(0, \"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, \"ciao\") <=> engine->evaluate(\"'ciao'\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(false)",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(0)",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(0.0)",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(QString())",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, false)",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, 0)",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString())",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, false)",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, 0)",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString())",
+ "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"false\")",
+ "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"0\")",
+ "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"''\")",
+ "QScriptValue(0, QString()) <=> QScriptValue(false)",
+ "QScriptValue(0, QString()) <=> QScriptValue(0)",
+ "QScriptValue(0, QString()) <=> QScriptValue(0.0)",
+ "QScriptValue(0, QString()) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(0, QString()) <=> QScriptValue(QString())",
+ "QScriptValue(0, QString()) <=> QScriptValue(0, false)",
+ "QScriptValue(0, QString()) <=> QScriptValue(0, 0)",
+ "QScriptValue(0, QString()) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(0, QString()) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString()) <=> QScriptValue(0, QString())",
+ "QScriptValue(0, QString()) <=> QScriptValue(engine, false)",
+ "QScriptValue(0, QString()) <=> QScriptValue(engine, 0)",
+ "QScriptValue(0, QString()) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(0, QString()) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(0, QString()) <=> QScriptValue(engine, QString())",
+ "QScriptValue(0, QString()) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(0, QString()) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(0, QString()) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(0, QString()) <=> engine->evaluate(\"false\")",
+ "QScriptValue(0, QString()) <=> engine->evaluate(\"0\")",
+ "QScriptValue(0, QString()) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(0, QString()) <=> engine->evaluate(\"''\")",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(false)",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0)",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0.0)",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, false)",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, 0)",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, false)",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, 0)",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"false\")",
+ "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"0\")",
+ "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(0, QString(\"123\")) <=> QScriptValue(123.0)",
+ "QScriptValue(0, QString(\"123\")) <=> QScriptValue(QString(\"123\"))",
+ "QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, 123.0)",
+ "QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, 123.0)",
+ "QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"123.0\")",
+ "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"'123'\")",
+ "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, QString(\"12.3\"))",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"null\")",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->nullValue()",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->undefinedValue()",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"{}\")",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"undefined\")",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"null\")",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> engine->nullValue()",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> engine->undefinedValue()",
+ "QScriptValue(engine, true) <=> QScriptValue(true)",
+ "QScriptValue(engine, true) <=> QScriptValue(0, true)",
+ "QScriptValue(engine, true) <=> QScriptValue(engine, true)",
+ "QScriptValue(engine, true) <=> engine->evaluate(\"true\")",
+ "QScriptValue(engine, false) <=> QScriptValue(false)",
+ "QScriptValue(engine, false) <=> QScriptValue(0)",
+ "QScriptValue(engine, false) <=> QScriptValue(0.0)",
+ "QScriptValue(engine, false) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(engine, false) <=> QScriptValue(QString())",
+ "QScriptValue(engine, false) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(engine, false) <=> QScriptValue(0, false)",
+ "QScriptValue(engine, false) <=> QScriptValue(0, 0)",
+ "QScriptValue(engine, false) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(engine, false) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(engine, false) <=> QScriptValue(0, QString())",
+ "QScriptValue(engine, false) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(engine, false) <=> QScriptValue(engine, false)",
+ "QScriptValue(engine, false) <=> QScriptValue(engine, 0)",
+ "QScriptValue(engine, false) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, false) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, false) <=> QScriptValue(engine, QString())",
+ "QScriptValue(engine, false) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, false) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(engine, false) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(engine, false) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(engine, false) <=> engine->evaluate(\"false\")",
+ "QScriptValue(engine, false) <=> engine->evaluate(\"0\")",
+ "QScriptValue(engine, false) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(engine, false) <=> engine->evaluate(\"''\")",
+ "QScriptValue(engine, false) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(engine, int(122)) <=> QScriptValue(int(122))",
+ "QScriptValue(engine, int(122)) <=> QScriptValue(0, int(122))",
+ "QScriptValue(engine, int(122)) <=> QScriptValue(engine, int(122))",
+ "QScriptValue(engine, int(122)) <=> engine->evaluate(\"122\")",
+ "QScriptValue(engine, uint(124)) <=> QScriptValue(uint(124))",
+ "QScriptValue(engine, uint(124)) <=> QScriptValue(0, uint(124))",
+ "QScriptValue(engine, uint(124)) <=> QScriptValue(engine, uint(124))",
+ "QScriptValue(engine, uint(124)) <=> engine->evaluate(\"124\")",
+ "QScriptValue(engine, 0) <=> QScriptValue(false)",
+ "QScriptValue(engine, 0) <=> QScriptValue(0)",
+ "QScriptValue(engine, 0) <=> QScriptValue(0.0)",
+ "QScriptValue(engine, 0) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(engine, 0) <=> QScriptValue(QString())",
+ "QScriptValue(engine, 0) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(engine, 0) <=> QScriptValue(0, false)",
+ "QScriptValue(engine, 0) <=> QScriptValue(0, 0)",
+ "QScriptValue(engine, 0) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(engine, 0) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(engine, 0) <=> QScriptValue(0, QString())",
+ "QScriptValue(engine, 0) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(engine, 0) <=> QScriptValue(engine, false)",
+ "QScriptValue(engine, 0) <=> QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 0) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, 0) <=> QScriptValue(engine, QString())",
+ "QScriptValue(engine, 0) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, 0) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(engine, 0) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(engine, 0) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(engine, 0) <=> engine->evaluate(\"false\")",
+ "QScriptValue(engine, 0) <=> engine->evaluate(\"0\")",
+ "QScriptValue(engine, 0) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(engine, 0) <=> engine->evaluate(\"''\")",
+ "QScriptValue(engine, 0) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(false)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(0)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(0.0)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(QString())",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(0, false)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(0, 0)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(0, QString())",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(engine, false)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(engine, QString())",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, 0.0) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(engine, 0.0) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(engine, 0.0) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(engine, 0.0) <=> engine->evaluate(\"false\")",
+ "QScriptValue(engine, 0.0) <=> engine->evaluate(\"0\")",
+ "QScriptValue(engine, 0.0) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(engine, 0.0) <=> engine->evaluate(\"''\")",
+ "QScriptValue(engine, 0.0) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(engine, 123.0) <=> QScriptValue(123.0)",
+ "QScriptValue(engine, 123.0) <=> QScriptValue(QString(\"123\"))",
+ "QScriptValue(engine, 123.0) <=> QScriptValue(0, 123.0)",
+ "QScriptValue(engine, 123.0) <=> QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(engine, 123.0) <=> QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, 123.0) <=> QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, 123.0) <=> engine->evaluate(\"123.0\")",
+ "QScriptValue(engine, 123.0) <=> engine->evaluate(\"'123'\")",
+ "QScriptValue(engine, 6.37e-8) <=> QScriptValue(6.37e-8)",
+ "QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, 6.37e-8)",
+ "QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"6.37e-8\")",
+ "QScriptValue(engine, -6.37e-8) <=> QScriptValue(-6.37e-8)",
+ "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, -6.37e-8)",
+ "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"-6.37e-8\")",
+ "QScriptValue(engine, 0x43211234) <=> QScriptValue(0x43211234)",
+ "QScriptValue(engine, 0x43211234) <=> QScriptValue(0, 0x43211234)",
+ "QScriptValue(engine, 0x43211234) <=> QScriptValue(engine, 0x43211234)",
+ "QScriptValue(engine, 0x43211234) <=> engine->evaluate(\"0x43211234\")",
+ "QScriptValue(engine, 0x10000) <=> QScriptValue(0x10000)",
+ "QScriptValue(engine, 0x10000) <=> QScriptValue(0, 0x10000)",
+ "QScriptValue(engine, 0x10000) <=> QScriptValue(engine, 0x10000)",
+ "QScriptValue(engine, 0x10000) <=> engine->evaluate(\"0x10000\")",
+ "QScriptValue(engine, 0x10001) <=> QScriptValue(0x10001)",
+ "QScriptValue(engine, 0x10001) <=> QScriptValue(0, 0x10001)",
+ "QScriptValue(engine, 0x10001) <=> QScriptValue(engine, 0x10001)",
+ "QScriptValue(engine, 0x10001) <=> engine->evaluate(\"0x10001\")",
+ "QScriptValue(engine, qInf()) <=> QScriptValue(qInf())",
+ "QScriptValue(engine, qInf()) <=> QScriptValue(\"Infinity\")",
+ "QScriptValue(engine, qInf()) <=> QScriptValue(0, qInf())",
+ "QScriptValue(engine, qInf()) <=> QScriptValue(0, \"Infinity\")",
+ "QScriptValue(engine, qInf()) <=> QScriptValue(engine, qInf())",
+ "QScriptValue(engine, qInf()) <=> QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, qInf()) <=> engine->evaluate(\"Infinity\")",
+ "QScriptValue(engine, -qInf()) <=> QScriptValue(-qInf())",
+ "QScriptValue(engine, -qInf()) <=> QScriptValue(\"-Infinity\")",
+ "QScriptValue(engine, -qInf()) <=> QScriptValue(0, -qInf())",
+ "QScriptValue(engine, -qInf()) <=> QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, -qInf())",
+ "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"-Infinity\")",
+ "QScriptValue(engine, \"NaN\") <=> QScriptValue(\"NaN\")",
+ "QScriptValue(engine, \"NaN\") <=> QScriptValue(0, \"NaN\")",
+ "QScriptValue(engine, \"NaN\") <=> QScriptValue(engine, \"NaN\")",
+ "QScriptValue(engine, \"Infinity\") <=> QScriptValue(qInf())",
+ "QScriptValue(engine, \"Infinity\") <=> QScriptValue(\"Infinity\")",
+ "QScriptValue(engine, \"Infinity\") <=> QScriptValue(0, qInf())",
+ "QScriptValue(engine, \"Infinity\") <=> QScriptValue(0, \"Infinity\")",
+ "QScriptValue(engine, \"Infinity\") <=> QScriptValue(engine, qInf())",
+ "QScriptValue(engine, \"Infinity\") <=> QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"Infinity\")",
+ "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(-qInf())",
+ "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(\"-Infinity\")",
+ "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, -qInf())",
+ "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, -qInf())",
+ "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"-Infinity\")",
+ "QScriptValue(engine, \"ciao\") <=> QScriptValue(\"ciao\")",
+ "QScriptValue(engine, \"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, \"ciao\") <=> QScriptValue(0, \"ciao\")",
+ "QScriptValue(engine, \"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, \"ciao\") <=> QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, \"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"'ciao'\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(false)",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0)",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0.0)",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString())",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, false)",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, 0)",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString())",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, false)",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, 0)",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"false\")",
+ "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"0\")",
+ "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"''\")",
+ "QScriptValue(engine, QString()) <=> QScriptValue(false)",
+ "QScriptValue(engine, QString()) <=> QScriptValue(0)",
+ "QScriptValue(engine, QString()) <=> QScriptValue(0.0)",
+ "QScriptValue(engine, QString()) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(engine, QString()) <=> QScriptValue(QString())",
+ "QScriptValue(engine, QString()) <=> QScriptValue(0, false)",
+ "QScriptValue(engine, QString()) <=> QScriptValue(0, 0)",
+ "QScriptValue(engine, QString()) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(engine, QString()) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(engine, QString()) <=> QScriptValue(0, QString())",
+ "QScriptValue(engine, QString()) <=> QScriptValue(engine, false)",
+ "QScriptValue(engine, QString()) <=> QScriptValue(engine, 0)",
+ "QScriptValue(engine, QString()) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, QString()) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString()) <=> QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString()) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(engine, QString()) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(engine, QString()) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(engine, QString()) <=> engine->evaluate(\"false\")",
+ "QScriptValue(engine, QString()) <=> engine->evaluate(\"0\")",
+ "QScriptValue(engine, QString()) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(engine, QString()) <=> engine->evaluate(\"''\")",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(false)",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0)",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0.0)",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, false)",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, 0)",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, false)",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, 0)",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"false\")",
+ "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"0\")",
+ "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(123.0)",
+ "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(QString(\"123\"))",
+ "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, 123.0)",
+ "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"123.0\")",
+ "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"'123'\")",
+ "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, QString(\"1.23\"))",
+ "engine->evaluate(\"[]\") <=> QScriptValue(false)",
+ "engine->evaluate(\"[]\") <=> QScriptValue(0)",
+ "engine->evaluate(\"[]\") <=> QScriptValue(0.0)",
+ "engine->evaluate(\"[]\") <=> QScriptValue(QString(\"\"))",
+ "engine->evaluate(\"[]\") <=> QScriptValue(QString())",
+ "engine->evaluate(\"[]\") <=> QScriptValue(0, false)",
+ "engine->evaluate(\"[]\") <=> QScriptValue(0, 0)",
+ "engine->evaluate(\"[]\") <=> QScriptValue(0, 0.0)",
+ "engine->evaluate(\"[]\") <=> QScriptValue(0, QString(\"\"))",
+ "engine->evaluate(\"[]\") <=> QScriptValue(0, QString())",
+ "engine->evaluate(\"[]\") <=> QScriptValue(engine, false)",
+ "engine->evaluate(\"[]\") <=> QScriptValue(engine, 0)",
+ "engine->evaluate(\"[]\") <=> QScriptValue(engine, 0.0)",
+ "engine->evaluate(\"[]\") <=> QScriptValue(engine, QString(\"\"))",
+ "engine->evaluate(\"[]\") <=> QScriptValue(engine, QString())",
+ "engine->evaluate(\"[]\") <=> engine->evaluate(\"[]\")",
+ "engine->evaluate(\"[]\") <=> engine->evaluate(\"false\")",
+ "engine->evaluate(\"[]\") <=> engine->evaluate(\"0\")",
+ "engine->evaluate(\"[]\") <=> engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"[]\") <=> engine->evaluate(\"''\")",
+ "engine->evaluate(\"{}\") <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"{}\") <=> QScriptValue(QScriptValue::NullValue)",
+ "engine->evaluate(\"{}\") <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"{}\") <=> QScriptValue(0, QScriptValue::NullValue)",
+ "engine->evaluate(\"{}\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"{}\") <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "engine->evaluate(\"{}\") <=> engine->evaluate(\"{}\")",
+ "engine->evaluate(\"{}\") <=> engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"{}\") <=> engine->evaluate(\"null\")",
+ "engine->evaluate(\"{}\") <=> engine->nullValue()",
+ "engine->evaluate(\"{}\") <=> engine->undefinedValue()",
+ "engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"Object.prototype\")",
+ "engine->evaluate(\"Date.prototype\") <=> engine->evaluate(\"Date.prototype\")",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(false)",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0)",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0.0)",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(QString(\"\"))",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(QString())",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, false)",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, 0)",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, 0.0)",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, QString(\"\"))",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, QString())",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, false)",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, 0)",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, 0.0)",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, QString(\"\"))",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, QString())",
+ "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"false\")",
+ "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"0\")",
+ "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"''\")",
+ "engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Error.prototype\")",
+ "engine->evaluate(\"Object\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\") <=> engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\") <=> engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\") <=> engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"(function() { return 1; })\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")",
+ "engine->evaluate(\"(function() { throw new Error('foo' })\") <=> engine->evaluate(\"(function() { throw new Error('foo' })\")",
+ "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"/foo/\")",
+ "engine->evaluate(\"new Object()\") <=> engine->evaluate(\"new Object()\")",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(false)",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(0)",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(0.0)",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(QString(\"\"))",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(QString())",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(0, false)",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(0, 0)",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(0, 0.0)",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(0, QString(\"\"))",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(0, QString())",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, false)",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, 0)",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, 0.0)",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, QString(\"\"))",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, QString())",
+ "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"false\")",
+ "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"0\")",
+ "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"''\")",
+ "engine->evaluate(\"new Error()\") <=> engine->evaluate(\"new Error()\")",
+ "engine->evaluate(\"a = new Object( a.foo = 22; a.foo\") <=> engine->evaluate(\"a = new Object( a.foo = 22; a.foo\")",
+ "engine->evaluate(\"Undefined\") <=> engine->evaluate(\"Undefined\")",
+ "engine->evaluate(\"Null\") <=> engine->evaluate(\"Null\")",
+ "engine->evaluate(\"True\") <=> engine->evaluate(\"True\")",
+ "engine->evaluate(\"False\") <=> engine->evaluate(\"False\")",
+ "engine->evaluate(\"undefined\") <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"undefined\") <=> QScriptValue(QScriptValue::NullValue)",
+ "engine->evaluate(\"undefined\") <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"undefined\") <=> QScriptValue(0, QScriptValue::NullValue)",
+ "engine->evaluate(\"undefined\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"undefined\") <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "engine->evaluate(\"undefined\") <=> engine->evaluate(\"{}\")",
+ "engine->evaluate(\"undefined\") <=> engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"undefined\") <=> engine->evaluate(\"null\")",
+ "engine->evaluate(\"undefined\") <=> engine->nullValue()",
+ "engine->evaluate(\"undefined\") <=> engine->undefinedValue()",
+ "engine->evaluate(\"null\") <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"null\") <=> QScriptValue(QScriptValue::NullValue)",
+ "engine->evaluate(\"null\") <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"null\") <=> QScriptValue(0, QScriptValue::NullValue)",
+ "engine->evaluate(\"null\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"null\") <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "engine->evaluate(\"null\") <=> engine->evaluate(\"{}\")",
+ "engine->evaluate(\"null\") <=> engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"null\") <=> engine->evaluate(\"null\")",
+ "engine->evaluate(\"null\") <=> engine->nullValue()",
+ "engine->evaluate(\"null\") <=> engine->undefinedValue()",
+ "engine->evaluate(\"true\") <=> QScriptValue(true)",
+ "engine->evaluate(\"true\") <=> QScriptValue(0, true)",
+ "engine->evaluate(\"true\") <=> QScriptValue(engine, true)",
+ "engine->evaluate(\"true\") <=> engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\") <=> QScriptValue(false)",
+ "engine->evaluate(\"false\") <=> QScriptValue(0)",
+ "engine->evaluate(\"false\") <=> QScriptValue(0.0)",
+ "engine->evaluate(\"false\") <=> QScriptValue(QString(\"\"))",
+ "engine->evaluate(\"false\") <=> QScriptValue(QString())",
+ "engine->evaluate(\"false\") <=> QScriptValue(QString(\"0\"))",
+ "engine->evaluate(\"false\") <=> QScriptValue(0, false)",
+ "engine->evaluate(\"false\") <=> QScriptValue(0, 0)",
+ "engine->evaluate(\"false\") <=> QScriptValue(0, 0.0)",
+ "engine->evaluate(\"false\") <=> QScriptValue(0, QString(\"\"))",
+ "engine->evaluate(\"false\") <=> QScriptValue(0, QString())",
+ "engine->evaluate(\"false\") <=> QScriptValue(0, QString(\"0\"))",
+ "engine->evaluate(\"false\") <=> QScriptValue(engine, false)",
+ "engine->evaluate(\"false\") <=> QScriptValue(engine, 0)",
+ "engine->evaluate(\"false\") <=> QScriptValue(engine, 0.0)",
+ "engine->evaluate(\"false\") <=> QScriptValue(engine, QString(\"\"))",
+ "engine->evaluate(\"false\") <=> QScriptValue(engine, QString())",
+ "engine->evaluate(\"false\") <=> QScriptValue(engine, QString(\"0\"))",
+ "engine->evaluate(\"false\") <=> engine->evaluate(\"[]\")",
+ "engine->evaluate(\"false\") <=> engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"false\") <=> engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"false\") <=> engine->evaluate(\"false\")",
+ "engine->evaluate(\"false\") <=> engine->evaluate(\"0\")",
+ "engine->evaluate(\"false\") <=> engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"false\") <=> engine->evaluate(\"''\")",
+ "engine->evaluate(\"false\") <=> engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"122\") <=> QScriptValue(int(122))",
+ "engine->evaluate(\"122\") <=> QScriptValue(0, int(122))",
+ "engine->evaluate(\"122\") <=> QScriptValue(engine, int(122))",
+ "engine->evaluate(\"122\") <=> engine->evaluate(\"122\")",
+ "engine->evaluate(\"124\") <=> QScriptValue(uint(124))",
+ "engine->evaluate(\"124\") <=> QScriptValue(0, uint(124))",
+ "engine->evaluate(\"124\") <=> QScriptValue(engine, uint(124))",
+ "engine->evaluate(\"124\") <=> engine->evaluate(\"124\")",
+ "engine->evaluate(\"0\") <=> QScriptValue(false)",
+ "engine->evaluate(\"0\") <=> QScriptValue(0)",
+ "engine->evaluate(\"0\") <=> QScriptValue(0.0)",
+ "engine->evaluate(\"0\") <=> QScriptValue(QString(\"\"))",
+ "engine->evaluate(\"0\") <=> QScriptValue(QString())",
+ "engine->evaluate(\"0\") <=> QScriptValue(QString(\"0\"))",
+ "engine->evaluate(\"0\") <=> QScriptValue(0, false)",
+ "engine->evaluate(\"0\") <=> QScriptValue(0, 0)",
+ "engine->evaluate(\"0\") <=> QScriptValue(0, 0.0)",
+ "engine->evaluate(\"0\") <=> QScriptValue(0, QString(\"\"))",
+ "engine->evaluate(\"0\") <=> QScriptValue(0, QString())",
+ "engine->evaluate(\"0\") <=> QScriptValue(0, QString(\"0\"))",
+ "engine->evaluate(\"0\") <=> QScriptValue(engine, false)",
+ "engine->evaluate(\"0\") <=> QScriptValue(engine, 0)",
+ "engine->evaluate(\"0\") <=> QScriptValue(engine, 0.0)",
+ "engine->evaluate(\"0\") <=> QScriptValue(engine, QString(\"\"))",
+ "engine->evaluate(\"0\") <=> QScriptValue(engine, QString())",
+ "engine->evaluate(\"0\") <=> QScriptValue(engine, QString(\"0\"))",
+ "engine->evaluate(\"0\") <=> engine->evaluate(\"[]\")",
+ "engine->evaluate(\"0\") <=> engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"0\") <=> engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"0\") <=> engine->evaluate(\"false\")",
+ "engine->evaluate(\"0\") <=> engine->evaluate(\"0\")",
+ "engine->evaluate(\"0\") <=> engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"0\") <=> engine->evaluate(\"''\")",
+ "engine->evaluate(\"0\") <=> engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(false)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(0)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(0.0)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(QString(\"\"))",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(QString())",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(QString(\"0\"))",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(0, false)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(0, 0)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(0, 0.0)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(0, QString(\"\"))",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(0, QString())",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(0, QString(\"0\"))",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(engine, false)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0.0)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(engine, QString(\"\"))",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(engine, QString())",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(engine, QString(\"0\"))",
+ "engine->evaluate(\"0.0\") <=> engine->evaluate(\"[]\")",
+ "engine->evaluate(\"0.0\") <=> engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"0.0\") <=> engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"0.0\") <=> engine->evaluate(\"false\")",
+ "engine->evaluate(\"0.0\") <=> engine->evaluate(\"0\")",
+ "engine->evaluate(\"0.0\") <=> engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"0.0\") <=> engine->evaluate(\"''\")",
+ "engine->evaluate(\"0.0\") <=> engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"123.0\") <=> QScriptValue(123.0)",
+ "engine->evaluate(\"123.0\") <=> QScriptValue(QString(\"123\"))",
+ "engine->evaluate(\"123.0\") <=> QScriptValue(0, 123.0)",
+ "engine->evaluate(\"123.0\") <=> QScriptValue(0, QString(\"123\"))",
+ "engine->evaluate(\"123.0\") <=> QScriptValue(engine, 123.0)",
+ "engine->evaluate(\"123.0\") <=> QScriptValue(engine, QString(\"123\"))",
+ "engine->evaluate(\"123.0\") <=> engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"123.0\") <=> engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"6.37e-8\") <=> QScriptValue(6.37e-8)",
+ "engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, 6.37e-8)",
+ "engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, 6.37e-8)",
+ "engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"6.37e-8\")",
+ "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(-6.37e-8)",
+ "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, -6.37e-8)",
+ "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, -6.37e-8)",
+ "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"-6.37e-8\")",
+ "engine->evaluate(\"0x43211234\") <=> QScriptValue(0x43211234)",
+ "engine->evaluate(\"0x43211234\") <=> QScriptValue(0, 0x43211234)",
+ "engine->evaluate(\"0x43211234\") <=> QScriptValue(engine, 0x43211234)",
+ "engine->evaluate(\"0x43211234\") <=> engine->evaluate(\"0x43211234\")",
+ "engine->evaluate(\"0x10000\") <=> QScriptValue(0x10000)",
+ "engine->evaluate(\"0x10000\") <=> QScriptValue(0, 0x10000)",
+ "engine->evaluate(\"0x10000\") <=> QScriptValue(engine, 0x10000)",
+ "engine->evaluate(\"0x10000\") <=> engine->evaluate(\"0x10000\")",
+ "engine->evaluate(\"0x10001\") <=> QScriptValue(0x10001)",
+ "engine->evaluate(\"0x10001\") <=> QScriptValue(0, 0x10001)",
+ "engine->evaluate(\"0x10001\") <=> QScriptValue(engine, 0x10001)",
+ "engine->evaluate(\"0x10001\") <=> engine->evaluate(\"0x10001\")",
+ "engine->evaluate(\"Infinity\") <=> QScriptValue(qInf())",
+ "engine->evaluate(\"Infinity\") <=> QScriptValue(\"Infinity\")",
+ "engine->evaluate(\"Infinity\") <=> QScriptValue(0, qInf())",
+ "engine->evaluate(\"Infinity\") <=> QScriptValue(0, \"Infinity\")",
+ "engine->evaluate(\"Infinity\") <=> QScriptValue(engine, qInf())",
+ "engine->evaluate(\"Infinity\") <=> QScriptValue(engine, \"Infinity\")",
+ "engine->evaluate(\"Infinity\") <=> engine->evaluate(\"Infinity\")",
+ "engine->evaluate(\"-Infinity\") <=> QScriptValue(-qInf())",
+ "engine->evaluate(\"-Infinity\") <=> QScriptValue(\"-Infinity\")",
+ "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, -qInf())",
+ "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, \"-Infinity\")",
+ "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, -qInf())",
+ "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")",
+ "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"-Infinity\")",
+ "engine->evaluate(\"'ciao'\") <=> QScriptValue(\"ciao\")",
+ "engine->evaluate(\"'ciao'\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "engine->evaluate(\"'ciao'\") <=> QScriptValue(0, \"ciao\")",
+ "engine->evaluate(\"'ciao'\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "engine->evaluate(\"'ciao'\") <=> QScriptValue(engine, \"ciao\")",
+ "engine->evaluate(\"'ciao'\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"'ciao'\")",
+ "engine->evaluate(\"''\") <=> QScriptValue(false)",
+ "engine->evaluate(\"''\") <=> QScriptValue(0)",
+ "engine->evaluate(\"''\") <=> QScriptValue(0.0)",
+ "engine->evaluate(\"''\") <=> QScriptValue(QString(\"\"))",
+ "engine->evaluate(\"''\") <=> QScriptValue(QString())",
+ "engine->evaluate(\"''\") <=> QScriptValue(0, false)",
+ "engine->evaluate(\"''\") <=> QScriptValue(0, 0)",
+ "engine->evaluate(\"''\") <=> QScriptValue(0, 0.0)",
+ "engine->evaluate(\"''\") <=> QScriptValue(0, QString(\"\"))",
+ "engine->evaluate(\"''\") <=> QScriptValue(0, QString())",
+ "engine->evaluate(\"''\") <=> QScriptValue(engine, false)",
+ "engine->evaluate(\"''\") <=> QScriptValue(engine, 0)",
+ "engine->evaluate(\"''\") <=> QScriptValue(engine, 0.0)",
+ "engine->evaluate(\"''\") <=> QScriptValue(engine, QString(\"\"))",
+ "engine->evaluate(\"''\") <=> QScriptValue(engine, QString())",
+ "engine->evaluate(\"''\") <=> engine->evaluate(\"[]\")",
+ "engine->evaluate(\"''\") <=> engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"''\") <=> engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"''\") <=> engine->evaluate(\"false\")",
+ "engine->evaluate(\"''\") <=> engine->evaluate(\"0\")",
+ "engine->evaluate(\"''\") <=> engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"''\") <=> engine->evaluate(\"''\")",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(false)",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(0)",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(0.0)",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(QString(\"0\"))",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(0, false)",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(0, 0)",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(0, 0.0)",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(0, QString(\"0\"))",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(engine, false)",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(engine, 0)",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(engine, 0.0)",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(engine, QString(\"0\"))",
+ "engine->evaluate(\"'0'\") <=> engine->evaluate(\"false\")",
+ "engine->evaluate(\"'0'\") <=> engine->evaluate(\"0\")",
+ "engine->evaluate(\"'0'\") <=> engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"'0'\") <=> engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"'123'\") <=> QScriptValue(123.0)",
+ "engine->evaluate(\"'123'\") <=> QScriptValue(QString(\"123\"))",
+ "engine->evaluate(\"'123'\") <=> QScriptValue(0, 123.0)",
+ "engine->evaluate(\"'123'\") <=> QScriptValue(0, QString(\"123\"))",
+ "engine->evaluate(\"'123'\") <=> QScriptValue(engine, 123.0)",
+ "engine->evaluate(\"'123'\") <=> QScriptValue(engine, QString(\"123\"))",
+ "engine->evaluate(\"'123'\") <=> engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"'123'\") <=> engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"'12.4'\") <=> QScriptValue(QString(\"12.4\"))",
+ "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"'12.4'\")",
+ "engine->nullValue() <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "engine->nullValue() <=> QScriptValue(QScriptValue::NullValue)",
+ "engine->nullValue() <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "engine->nullValue() <=> QScriptValue(0, QScriptValue::NullValue)",
+ "engine->nullValue() <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "engine->nullValue() <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "engine->nullValue() <=> engine->evaluate(\"{}\")",
+ "engine->nullValue() <=> engine->evaluate(\"undefined\")",
+ "engine->nullValue() <=> engine->evaluate(\"null\")",
+ "engine->nullValue() <=> engine->nullValue()",
+ "engine->nullValue() <=> engine->undefinedValue()",
+ "engine->undefinedValue() <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "engine->undefinedValue() <=> QScriptValue(QScriptValue::NullValue)",
+ "engine->undefinedValue() <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "engine->undefinedValue() <=> QScriptValue(0, QScriptValue::NullValue)",
+ "engine->undefinedValue() <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "engine->undefinedValue() <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "engine->undefinedValue() <=> engine->evaluate(\"{}\")",
+ "engine->undefinedValue() <=> engine->evaluate(\"undefined\")",
+ "engine->undefinedValue() <=> engine->evaluate(\"null\")",
+ "engine->undefinedValue() <=> engine->nullValue()",
+ "engine->undefinedValue() <=> engine->undefinedValue()"};
+
+void tst_QScriptValue::equals_makeData(const char *expr)
+{
+ static QSet<QString> equals;
+ if (equals.isEmpty()) {
+ equals.reserve(1085);
+ for (unsigned i = 0; i < 1085; ++i)
+ equals.insert(equals_array[i]);
+ }
+ QHash<QString, QScriptValue>::const_iterator it;
+ for (it = m_values.constBegin(); it != m_values.constEnd(); ++it) {
+ QString tag = QString::fromLatin1("%20 <=> %21").arg(expr).arg(it.key());
+ newRow(tag.toLatin1()) << it.value() << equals.contains(tag);
+ }
+}
+
+void tst_QScriptValue::equals_test(const char *, const QScriptValue& value)
+{
+ QFETCH(QScriptValue, other);
+ QFETCH(bool, expected);
+ QCOMPARE(value.equals(other), expected);
+}
+
+DEFINE_TEST_FUNCTION(equals)
+
+
+void tst_QScriptValue::strictlyEquals_initData()
+{
+ QTest::addColumn<QScriptValue>("other");
+ QTest::addColumn<bool>("expected");
+ initScriptValues();
+}
+
+static QString strictlyEquals_array[] = {
+ "QScriptValue() <=> QScriptValue()",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> engine->undefinedValue()",
+ "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"null\")",
+ "QScriptValue(QScriptValue::NullValue) <=> engine->nullValue()",
+ "QScriptValue(true) <=> QScriptValue(true)",
+ "QScriptValue(true) <=> QScriptValue(0, true)",
+ "QScriptValue(true) <=> QScriptValue(engine, true)",
+ "QScriptValue(true) <=> engine->evaluate(\"true\")",
+ "QScriptValue(false) <=> QScriptValue(false)",
+ "QScriptValue(false) <=> QScriptValue(0, false)",
+ "QScriptValue(false) <=> QScriptValue(engine, false)",
+ "QScriptValue(false) <=> engine->evaluate(\"false\")",
+ "QScriptValue(int(122)) <=> QScriptValue(int(122))",
+ "QScriptValue(int(122)) <=> QScriptValue(0, int(122))",
+ "QScriptValue(int(122)) <=> QScriptValue(engine, int(122))",
+ "QScriptValue(int(122)) <=> engine->evaluate(\"122\")",
+ "QScriptValue(uint(124)) <=> QScriptValue(uint(124))",
+ "QScriptValue(uint(124)) <=> QScriptValue(0, uint(124))",
+ "QScriptValue(uint(124)) <=> QScriptValue(engine, uint(124))",
+ "QScriptValue(uint(124)) <=> engine->evaluate(\"124\")",
+ "QScriptValue(0) <=> QScriptValue(0)",
+ "QScriptValue(0) <=> QScriptValue(0.0)",
+ "QScriptValue(0) <=> QScriptValue(0, 0)",
+ "QScriptValue(0) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(0) <=> QScriptValue(engine, 0)",
+ "QScriptValue(0) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(0) <=> engine->evaluate(\"0\")",
+ "QScriptValue(0) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(0.0) <=> QScriptValue(0)",
+ "QScriptValue(0.0) <=> QScriptValue(0.0)",
+ "QScriptValue(0.0) <=> QScriptValue(0, 0)",
+ "QScriptValue(0.0) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(0.0) <=> QScriptValue(engine, 0)",
+ "QScriptValue(0.0) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(0.0) <=> engine->evaluate(\"0\")",
+ "QScriptValue(0.0) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(123.0) <=> QScriptValue(123.0)",
+ "QScriptValue(123.0) <=> QScriptValue(0, 123.0)",
+ "QScriptValue(123.0) <=> QScriptValue(engine, 123.0)",
+ "QScriptValue(123.0) <=> engine->evaluate(\"123.0\")",
+ "QScriptValue(6.37e-8) <=> QScriptValue(6.37e-8)",
+ "QScriptValue(6.37e-8) <=> QScriptValue(0, 6.37e-8)",
+ "QScriptValue(6.37e-8) <=> QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(6.37e-8) <=> engine->evaluate(\"6.37e-8\")",
+ "QScriptValue(-6.37e-8) <=> QScriptValue(-6.37e-8)",
+ "QScriptValue(-6.37e-8) <=> QScriptValue(0, -6.37e-8)",
+ "QScriptValue(-6.37e-8) <=> QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(-6.37e-8) <=> engine->evaluate(\"-6.37e-8\")",
+ "QScriptValue(0x43211234) <=> QScriptValue(0x43211234)",
+ "QScriptValue(0x43211234) <=> QScriptValue(0, 0x43211234)",
+ "QScriptValue(0x43211234) <=> QScriptValue(engine, 0x43211234)",
+ "QScriptValue(0x43211234) <=> engine->evaluate(\"0x43211234\")",
+ "QScriptValue(0x10000) <=> QScriptValue(0x10000)",
+ "QScriptValue(0x10000) <=> QScriptValue(0, 0x10000)",
+ "QScriptValue(0x10000) <=> QScriptValue(engine, 0x10000)",
+ "QScriptValue(0x10000) <=> engine->evaluate(\"0x10000\")",
+ "QScriptValue(0x10001) <=> QScriptValue(0x10001)",
+ "QScriptValue(0x10001) <=> QScriptValue(0, 0x10001)",
+ "QScriptValue(0x10001) <=> QScriptValue(engine, 0x10001)",
+ "QScriptValue(0x10001) <=> engine->evaluate(\"0x10001\")",
+ "QScriptValue(qInf()) <=> QScriptValue(qInf())",
+ "QScriptValue(qInf()) <=> QScriptValue(0, qInf())",
+ "QScriptValue(qInf()) <=> QScriptValue(engine, qInf())",
+ "QScriptValue(qInf()) <=> engine->evaluate(\"Infinity\")",
+ "QScriptValue(-qInf()) <=> QScriptValue(-qInf())",
+ "QScriptValue(-qInf()) <=> QScriptValue(0, -qInf())",
+ "QScriptValue(-qInf()) <=> QScriptValue(engine, -qInf())",
+ "QScriptValue(-qInf()) <=> engine->evaluate(\"-Infinity\")",
+ "QScriptValue(\"NaN\") <=> QScriptValue(\"NaN\")",
+ "QScriptValue(\"NaN\") <=> QScriptValue(0, \"NaN\")",
+ "QScriptValue(\"NaN\") <=> QScriptValue(engine, \"NaN\")",
+ "QScriptValue(\"Infinity\") <=> QScriptValue(\"Infinity\")",
+ "QScriptValue(\"Infinity\") <=> QScriptValue(0, \"Infinity\")",
+ "QScriptValue(\"Infinity\") <=> QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(\"-Infinity\") <=> QScriptValue(\"-Infinity\")",
+ "QScriptValue(\"-Infinity\") <=> QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(\"ciao\") <=> QScriptValue(\"ciao\")",
+ "QScriptValue(\"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(\"ciao\") <=> QScriptValue(0, \"ciao\")",
+ "QScriptValue(\"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(\"ciao\") <=> QScriptValue(engine, \"ciao\")",
+ "QScriptValue(\"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(\"ciao\") <=> engine->evaluate(\"'ciao'\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(QString())",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(0, QString())",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString())",
+ "QScriptValue(QString(\"\")) <=> engine->evaluate(\"''\")",
+ "QScriptValue(QString()) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(QString()) <=> QScriptValue(QString())",
+ "QScriptValue(QString()) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(QString()) <=> QScriptValue(0, QString())",
+ "QScriptValue(QString()) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(QString()) <=> QScriptValue(engine, QString())",
+ "QScriptValue(QString()) <=> engine->evaluate(\"''\")",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(QString(\"123\")) <=> QScriptValue(QString(\"123\"))",
+ "QScriptValue(QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"'123'\")",
+ "QScriptValue(QString(\"12.4\")) <=> QScriptValue(QString(\"12.4\"))",
+ "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"'12.4'\")",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->undefinedValue()",
+ "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"null\")",
+ "QScriptValue(0, QScriptValue::NullValue) <=> engine->nullValue()",
+ "QScriptValue(0, true) <=> QScriptValue(true)",
+ "QScriptValue(0, true) <=> QScriptValue(0, true)",
+ "QScriptValue(0, true) <=> QScriptValue(engine, true)",
+ "QScriptValue(0, true) <=> engine->evaluate(\"true\")",
+ "QScriptValue(0, false) <=> QScriptValue(false)",
+ "QScriptValue(0, false) <=> QScriptValue(0, false)",
+ "QScriptValue(0, false) <=> QScriptValue(engine, false)",
+ "QScriptValue(0, false) <=> engine->evaluate(\"false\")",
+ "QScriptValue(0, int(122)) <=> QScriptValue(int(122))",
+ "QScriptValue(0, int(122)) <=> QScriptValue(0, int(122))",
+ "QScriptValue(0, int(122)) <=> QScriptValue(engine, int(122))",
+ "QScriptValue(0, int(122)) <=> engine->evaluate(\"122\")",
+ "QScriptValue(0, uint(124)) <=> QScriptValue(uint(124))",
+ "QScriptValue(0, uint(124)) <=> QScriptValue(0, uint(124))",
+ "QScriptValue(0, uint(124)) <=> QScriptValue(engine, uint(124))",
+ "QScriptValue(0, uint(124)) <=> engine->evaluate(\"124\")",
+ "QScriptValue(0, 0) <=> QScriptValue(0)",
+ "QScriptValue(0, 0) <=> QScriptValue(0.0)",
+ "QScriptValue(0, 0) <=> QScriptValue(0, 0)",
+ "QScriptValue(0, 0) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(0, 0) <=> QScriptValue(engine, 0)",
+ "QScriptValue(0, 0) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(0, 0) <=> engine->evaluate(\"0\")",
+ "QScriptValue(0, 0) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(0, 0.0) <=> QScriptValue(0)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(0.0)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(0, 0)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(engine, 0)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(0, 0.0) <=> engine->evaluate(\"0\")",
+ "QScriptValue(0, 0.0) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(0, 123.0) <=> QScriptValue(123.0)",
+ "QScriptValue(0, 123.0) <=> QScriptValue(0, 123.0)",
+ "QScriptValue(0, 123.0) <=> QScriptValue(engine, 123.0)",
+ "QScriptValue(0, 123.0) <=> engine->evaluate(\"123.0\")",
+ "QScriptValue(0, 6.37e-8) <=> QScriptValue(6.37e-8)",
+ "QScriptValue(0, 6.37e-8) <=> QScriptValue(0, 6.37e-8)",
+ "QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"6.37e-8\")",
+ "QScriptValue(0, -6.37e-8) <=> QScriptValue(-6.37e-8)",
+ "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, -6.37e-8)",
+ "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"-6.37e-8\")",
+ "QScriptValue(0, 0x43211234) <=> QScriptValue(0x43211234)",
+ "QScriptValue(0, 0x43211234) <=> QScriptValue(0, 0x43211234)",
+ "QScriptValue(0, 0x43211234) <=> QScriptValue(engine, 0x43211234)",
+ "QScriptValue(0, 0x43211234) <=> engine->evaluate(\"0x43211234\")",
+ "QScriptValue(0, 0x10000) <=> QScriptValue(0x10000)",
+ "QScriptValue(0, 0x10000) <=> QScriptValue(0, 0x10000)",
+ "QScriptValue(0, 0x10000) <=> QScriptValue(engine, 0x10000)",
+ "QScriptValue(0, 0x10000) <=> engine->evaluate(\"0x10000\")",
+ "QScriptValue(0, 0x10001) <=> QScriptValue(0x10001)",
+ "QScriptValue(0, 0x10001) <=> QScriptValue(0, 0x10001)",
+ "QScriptValue(0, 0x10001) <=> QScriptValue(engine, 0x10001)",
+ "QScriptValue(0, 0x10001) <=> engine->evaluate(\"0x10001\")",
+ "QScriptValue(0, qInf()) <=> QScriptValue(qInf())",
+ "QScriptValue(0, qInf()) <=> QScriptValue(0, qInf())",
+ "QScriptValue(0, qInf()) <=> QScriptValue(engine, qInf())",
+ "QScriptValue(0, qInf()) <=> engine->evaluate(\"Infinity\")",
+ "QScriptValue(0, -qInf()) <=> QScriptValue(-qInf())",
+ "QScriptValue(0, -qInf()) <=> QScriptValue(0, -qInf())",
+ "QScriptValue(0, -qInf()) <=> QScriptValue(engine, -qInf())",
+ "QScriptValue(0, -qInf()) <=> engine->evaluate(\"-Infinity\")",
+ "QScriptValue(0, \"NaN\") <=> QScriptValue(\"NaN\")",
+ "QScriptValue(0, \"NaN\") <=> QScriptValue(0, \"NaN\")",
+ "QScriptValue(0, \"NaN\") <=> QScriptValue(engine, \"NaN\")",
+ "QScriptValue(0, \"Infinity\") <=> QScriptValue(\"Infinity\")",
+ "QScriptValue(0, \"Infinity\") <=> QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, \"Infinity\") <=> QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(0, \"-Infinity\") <=> QScriptValue(\"-Infinity\")",
+ "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(0, \"ciao\") <=> QScriptValue(\"ciao\")",
+ "QScriptValue(0, \"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, \"ciao\") <=> QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, \"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, \"ciao\") <=> QScriptValue(engine, \"ciao\")",
+ "QScriptValue(0, \"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, \"ciao\") <=> engine->evaluate(\"'ciao'\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(QString())",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString())",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString())",
+ "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"''\")",
+ "QScriptValue(0, QString()) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(0, QString()) <=> QScriptValue(QString())",
+ "QScriptValue(0, QString()) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString()) <=> QScriptValue(0, QString())",
+ "QScriptValue(0, QString()) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(0, QString()) <=> QScriptValue(engine, QString())",
+ "QScriptValue(0, QString()) <=> engine->evaluate(\"''\")",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(0, QString(\"123\")) <=> QScriptValue(QString(\"123\"))",
+ "QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"'123'\")",
+ "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, QString(\"12.3\"))",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->undefinedValue()",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"null\")",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> engine->nullValue()",
+ "QScriptValue(engine, true) <=> QScriptValue(true)",
+ "QScriptValue(engine, true) <=> QScriptValue(0, true)",
+ "QScriptValue(engine, true) <=> QScriptValue(engine, true)",
+ "QScriptValue(engine, true) <=> engine->evaluate(\"true\")",
+ "QScriptValue(engine, false) <=> QScriptValue(false)",
+ "QScriptValue(engine, false) <=> QScriptValue(0, false)",
+ "QScriptValue(engine, false) <=> QScriptValue(engine, false)",
+ "QScriptValue(engine, false) <=> engine->evaluate(\"false\")",
+ "QScriptValue(engine, int(122)) <=> QScriptValue(int(122))",
+ "QScriptValue(engine, int(122)) <=> QScriptValue(0, int(122))",
+ "QScriptValue(engine, int(122)) <=> QScriptValue(engine, int(122))",
+ "QScriptValue(engine, int(122)) <=> engine->evaluate(\"122\")",
+ "QScriptValue(engine, uint(124)) <=> QScriptValue(uint(124))",
+ "QScriptValue(engine, uint(124)) <=> QScriptValue(0, uint(124))",
+ "QScriptValue(engine, uint(124)) <=> QScriptValue(engine, uint(124))",
+ "QScriptValue(engine, uint(124)) <=> engine->evaluate(\"124\")",
+ "QScriptValue(engine, 0) <=> QScriptValue(0)",
+ "QScriptValue(engine, 0) <=> QScriptValue(0.0)",
+ "QScriptValue(engine, 0) <=> QScriptValue(0, 0)",
+ "QScriptValue(engine, 0) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(engine, 0) <=> QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 0) <=> engine->evaluate(\"0\")",
+ "QScriptValue(engine, 0) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(0)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(0.0)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(0, 0)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 0.0) <=> engine->evaluate(\"0\")",
+ "QScriptValue(engine, 0.0) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(engine, 123.0) <=> QScriptValue(123.0)",
+ "QScriptValue(engine, 123.0) <=> QScriptValue(0, 123.0)",
+ "QScriptValue(engine, 123.0) <=> QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, 123.0) <=> engine->evaluate(\"123.0\")",
+ "QScriptValue(engine, 6.37e-8) <=> QScriptValue(6.37e-8)",
+ "QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, 6.37e-8)",
+ "QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"6.37e-8\")",
+ "QScriptValue(engine, -6.37e-8) <=> QScriptValue(-6.37e-8)",
+ "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, -6.37e-8)",
+ "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"-6.37e-8\")",
+ "QScriptValue(engine, 0x43211234) <=> QScriptValue(0x43211234)",
+ "QScriptValue(engine, 0x43211234) <=> QScriptValue(0, 0x43211234)",
+ "QScriptValue(engine, 0x43211234) <=> QScriptValue(engine, 0x43211234)",
+ "QScriptValue(engine, 0x43211234) <=> engine->evaluate(\"0x43211234\")",
+ "QScriptValue(engine, 0x10000) <=> QScriptValue(0x10000)",
+ "QScriptValue(engine, 0x10000) <=> QScriptValue(0, 0x10000)",
+ "QScriptValue(engine, 0x10000) <=> QScriptValue(engine, 0x10000)",
+ "QScriptValue(engine, 0x10000) <=> engine->evaluate(\"0x10000\")",
+ "QScriptValue(engine, 0x10001) <=> QScriptValue(0x10001)",
+ "QScriptValue(engine, 0x10001) <=> QScriptValue(0, 0x10001)",
+ "QScriptValue(engine, 0x10001) <=> QScriptValue(engine, 0x10001)",
+ "QScriptValue(engine, 0x10001) <=> engine->evaluate(\"0x10001\")",
+ "QScriptValue(engine, qInf()) <=> QScriptValue(qInf())",
+ "QScriptValue(engine, qInf()) <=> QScriptValue(0, qInf())",
+ "QScriptValue(engine, qInf()) <=> QScriptValue(engine, qInf())",
+ "QScriptValue(engine, qInf()) <=> engine->evaluate(\"Infinity\")",
+ "QScriptValue(engine, -qInf()) <=> QScriptValue(-qInf())",
+ "QScriptValue(engine, -qInf()) <=> QScriptValue(0, -qInf())",
+ "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, -qInf())",
+ "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"-Infinity\")",
+ "QScriptValue(engine, \"NaN\") <=> QScriptValue(\"NaN\")",
+ "QScriptValue(engine, \"NaN\") <=> QScriptValue(0, \"NaN\")",
+ "QScriptValue(engine, \"NaN\") <=> QScriptValue(engine, \"NaN\")",
+ "QScriptValue(engine, \"Infinity\") <=> QScriptValue(\"Infinity\")",
+ "QScriptValue(engine, \"Infinity\") <=> QScriptValue(0, \"Infinity\")",
+ "QScriptValue(engine, \"Infinity\") <=> QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(\"-Infinity\")",
+ "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, \"ciao\") <=> QScriptValue(\"ciao\")",
+ "QScriptValue(engine, \"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, \"ciao\") <=> QScriptValue(0, \"ciao\")",
+ "QScriptValue(engine, \"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, \"ciao\") <=> QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, \"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"'ciao'\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString())",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString())",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"''\")",
+ "QScriptValue(engine, QString()) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(engine, QString()) <=> QScriptValue(QString())",
+ "QScriptValue(engine, QString()) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(engine, QString()) <=> QScriptValue(0, QString())",
+ "QScriptValue(engine, QString()) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString()) <=> QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString()) <=> engine->evaluate(\"''\")",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(QString(\"123\"))",
+ "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"'123'\")",
+ "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, QString(\"1.23\"))",
+ "engine->evaluate(\"[]\") <=> engine->evaluate(\"[]\")",
+ "engine->evaluate(\"{}\") <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"{}\") <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"{}\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"{}\") <=> engine->evaluate(\"{}\")",
+ "engine->evaluate(\"{}\") <=> engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"{}\") <=> engine->undefinedValue()",
+ "engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"Object.prototype\")",
+ "engine->evaluate(\"Date.prototype\") <=> engine->evaluate(\"Date.prototype\")",
+ "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Error.prototype\")",
+ "engine->evaluate(\"Object\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\") <=> engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\") <=> engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\") <=> engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"(function() { return 1; })\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")",
+ "engine->evaluate(\"(function() { throw new Error('foo' })\") <=> engine->evaluate(\"(function() { throw new Error('foo' })\")",
+ "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"/foo/\")",
+ "engine->evaluate(\"new Object()\") <=> engine->evaluate(\"new Object()\")",
+ "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"new Error()\") <=> engine->evaluate(\"new Error()\")",
+ "engine->evaluate(\"a = new Object( a.foo = 22; a.foo\") <=> engine->evaluate(\"a = new Object( a.foo = 22; a.foo\")",
+ "engine->evaluate(\"Undefined\") <=> engine->evaluate(\"Undefined\")",
+ "engine->evaluate(\"Null\") <=> engine->evaluate(\"Null\")",
+ "engine->evaluate(\"True\") <=> engine->evaluate(\"True\")",
+ "engine->evaluate(\"False\") <=> engine->evaluate(\"False\")",
+ "engine->evaluate(\"undefined\") <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"undefined\") <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"undefined\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"undefined\") <=> engine->evaluate(\"{}\")",
+ "engine->evaluate(\"undefined\") <=> engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"undefined\") <=> engine->undefinedValue()",
+ "engine->evaluate(\"null\") <=> QScriptValue(QScriptValue::NullValue)",
+ "engine->evaluate(\"null\") <=> QScriptValue(0, QScriptValue::NullValue)",
+ "engine->evaluate(\"null\") <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "engine->evaluate(\"null\") <=> engine->evaluate(\"null\")",
+ "engine->evaluate(\"null\") <=> engine->nullValue()",
+ "engine->evaluate(\"true\") <=> QScriptValue(true)",
+ "engine->evaluate(\"true\") <=> QScriptValue(0, true)",
+ "engine->evaluate(\"true\") <=> QScriptValue(engine, true)",
+ "engine->evaluate(\"true\") <=> engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\") <=> QScriptValue(false)",
+ "engine->evaluate(\"false\") <=> QScriptValue(0, false)",
+ "engine->evaluate(\"false\") <=> QScriptValue(engine, false)",
+ "engine->evaluate(\"false\") <=> engine->evaluate(\"false\")",
+ "engine->evaluate(\"122\") <=> QScriptValue(int(122))",
+ "engine->evaluate(\"122\") <=> QScriptValue(0, int(122))",
+ "engine->evaluate(\"122\") <=> QScriptValue(engine, int(122))",
+ "engine->evaluate(\"122\") <=> engine->evaluate(\"122\")",
+ "engine->evaluate(\"124\") <=> QScriptValue(uint(124))",
+ "engine->evaluate(\"124\") <=> QScriptValue(0, uint(124))",
+ "engine->evaluate(\"124\") <=> QScriptValue(engine, uint(124))",
+ "engine->evaluate(\"124\") <=> engine->evaluate(\"124\")",
+ "engine->evaluate(\"0\") <=> QScriptValue(0)",
+ "engine->evaluate(\"0\") <=> QScriptValue(0.0)",
+ "engine->evaluate(\"0\") <=> QScriptValue(0, 0)",
+ "engine->evaluate(\"0\") <=> QScriptValue(0, 0.0)",
+ "engine->evaluate(\"0\") <=> QScriptValue(engine, 0)",
+ "engine->evaluate(\"0\") <=> QScriptValue(engine, 0.0)",
+ "engine->evaluate(\"0\") <=> engine->evaluate(\"0\")",
+ "engine->evaluate(\"0\") <=> engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(0)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(0.0)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(0, 0)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(0, 0.0)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0.0)",
+ "engine->evaluate(\"0.0\") <=> engine->evaluate(\"0\")",
+ "engine->evaluate(\"0.0\") <=> engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"123.0\") <=> QScriptValue(123.0)",
+ "engine->evaluate(\"123.0\") <=> QScriptValue(0, 123.0)",
+ "engine->evaluate(\"123.0\") <=> QScriptValue(engine, 123.0)",
+ "engine->evaluate(\"123.0\") <=> engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"6.37e-8\") <=> QScriptValue(6.37e-8)",
+ "engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, 6.37e-8)",
+ "engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, 6.37e-8)",
+ "engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"6.37e-8\")",
+ "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(-6.37e-8)",
+ "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, -6.37e-8)",
+ "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, -6.37e-8)",
+ "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"-6.37e-8\")",
+ "engine->evaluate(\"0x43211234\") <=> QScriptValue(0x43211234)",
+ "engine->evaluate(\"0x43211234\") <=> QScriptValue(0, 0x43211234)",
+ "engine->evaluate(\"0x43211234\") <=> QScriptValue(engine, 0x43211234)",
+ "engine->evaluate(\"0x43211234\") <=> engine->evaluate(\"0x43211234\")",
+ "engine->evaluate(\"0x10000\") <=> QScriptValue(0x10000)",
+ "engine->evaluate(\"0x10000\") <=> QScriptValue(0, 0x10000)",
+ "engine->evaluate(\"0x10000\") <=> QScriptValue(engine, 0x10000)",
+ "engine->evaluate(\"0x10000\") <=> engine->evaluate(\"0x10000\")",
+ "engine->evaluate(\"0x10001\") <=> QScriptValue(0x10001)",
+ "engine->evaluate(\"0x10001\") <=> QScriptValue(0, 0x10001)",
+ "engine->evaluate(\"0x10001\") <=> QScriptValue(engine, 0x10001)",
+ "engine->evaluate(\"0x10001\") <=> engine->evaluate(\"0x10001\")",
+ "engine->evaluate(\"Infinity\") <=> QScriptValue(qInf())",
+ "engine->evaluate(\"Infinity\") <=> QScriptValue(0, qInf())",
+ "engine->evaluate(\"Infinity\") <=> QScriptValue(engine, qInf())",
+ "engine->evaluate(\"Infinity\") <=> engine->evaluate(\"Infinity\")",
+ "engine->evaluate(\"-Infinity\") <=> QScriptValue(-qInf())",
+ "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, -qInf())",
+ "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, -qInf())",
+ "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"-Infinity\")",
+ "engine->evaluate(\"'ciao'\") <=> QScriptValue(\"ciao\")",
+ "engine->evaluate(\"'ciao'\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "engine->evaluate(\"'ciao'\") <=> QScriptValue(0, \"ciao\")",
+ "engine->evaluate(\"'ciao'\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "engine->evaluate(\"'ciao'\") <=> QScriptValue(engine, \"ciao\")",
+ "engine->evaluate(\"'ciao'\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"'ciao'\")",
+ "engine->evaluate(\"''\") <=> QScriptValue(QString(\"\"))",
+ "engine->evaluate(\"''\") <=> QScriptValue(QString())",
+ "engine->evaluate(\"''\") <=> QScriptValue(0, QString(\"\"))",
+ "engine->evaluate(\"''\") <=> QScriptValue(0, QString())",
+ "engine->evaluate(\"''\") <=> QScriptValue(engine, QString(\"\"))",
+ "engine->evaluate(\"''\") <=> QScriptValue(engine, QString())",
+ "engine->evaluate(\"''\") <=> engine->evaluate(\"''\")",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(QString(\"0\"))",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(0, QString(\"0\"))",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(engine, QString(\"0\"))",
+ "engine->evaluate(\"'0'\") <=> engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"'123'\") <=> QScriptValue(QString(\"123\"))",
+ "engine->evaluate(\"'123'\") <=> QScriptValue(0, QString(\"123\"))",
+ "engine->evaluate(\"'123'\") <=> QScriptValue(engine, QString(\"123\"))",
+ "engine->evaluate(\"'123'\") <=> engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"'12.4'\") <=> QScriptValue(QString(\"12.4\"))",
+ "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"'12.4'\")",
+ "engine->nullValue() <=> QScriptValue(QScriptValue::NullValue)",
+ "engine->nullValue() <=> QScriptValue(0, QScriptValue::NullValue)",
+ "engine->nullValue() <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "engine->nullValue() <=> engine->evaluate(\"null\")",
+ "engine->nullValue() <=> engine->nullValue()",
+ "engine->undefinedValue() <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "engine->undefinedValue() <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "engine->undefinedValue() <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "engine->undefinedValue() <=> engine->evaluate(\"{}\")",
+ "engine->undefinedValue() <=> engine->evaluate(\"undefined\")",
+ "engine->undefinedValue() <=> engine->undefinedValue()"};
+
+void tst_QScriptValue::strictlyEquals_makeData(const char* expr)
+{
+ static QSet<QString> equals;
+ if (equals.isEmpty()) {
+ equals.reserve(503);
+ for (unsigned i = 0; i < 503; ++i)
+ equals.insert(strictlyEquals_array[i]);
+ }
+ QHash<QString, QScriptValue>::const_iterator it;
+ for (it = m_values.constBegin(); it != m_values.constEnd(); ++it) {
+ QString tag = QString::fromLatin1("%20 <=> %21").arg(expr).arg(it.key());
+ newRow(tag.toLatin1()) << it.value() << equals.contains(tag);
+ }
+}
+
+void tst_QScriptValue::strictlyEquals_test(const char*, const QScriptValue& value)
+{
+ QFETCH(QScriptValue, other);
+ QFETCH(bool, expected);
+ QCOMPARE(value.strictlyEquals(other), expected);
+}
+
+DEFINE_TEST_FUNCTION(strictlyEquals)
+
+
+void tst_QScriptValue::instanceOf_initData()
+{
+ QTest::addColumn<QScriptValue>("other");
+ QTest::addColumn<bool>("expected");
+ initScriptValues();
+}
+
+static QString instanceOf_array[] = {
+ "engine->evaluate(\"[]\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"[]\") <=> engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Date.prototype\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Object\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Object\") <=> engine->evaluate(\"Function\")",
+ "engine->evaluate(\"Array\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\") <=> engine->evaluate(\"Function\")",
+ "engine->evaluate(\"Number\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Number\") <=> engine->evaluate(\"Function\")",
+ "engine->evaluate(\"Function\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Function\") <=> engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { throw new Error('foo' })\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"new Object()\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Array\")",
+ "engine->evaluate(\"new Error()\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"a = new Object( a.foo = 22; a.foo\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Undefined\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Null\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"True\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"False\") <=> engine->evaluate(\"Object\")"};
+
+void tst_QScriptValue::instanceOf_makeData(const char *expr)
+{
+ static QSet<QString> equals;
+ if (equals.isEmpty()) {
+ equals.reserve(29);
+ for (unsigned i = 0; i < 29; ++i)
+ equals.insert(instanceOf_array[i]);
+ }
+ QHash<QString, QScriptValue>::const_iterator it;
+ for (it = m_values.constBegin(); it != m_values.constEnd(); ++it) {
+ QString tag = QString::fromLatin1("%20 <=> %21").arg(expr).arg(it.key());
+ newRow(tag.toLatin1()) << it.value() << equals.contains(tag);
+ }
+}
+
+void tst_QScriptValue::instanceOf_test(const char *, const QScriptValue& value)
+{
+ QFETCH(QScriptValue, other);
+ QFETCH(bool, expected);
+ QCOMPARE(value.instanceOf(other), expected);
+}
+
+DEFINE_TEST_FUNCTION(instanceOf)
diff --git a/JavaScriptCore/runtime/ArrayConstructor.cpp b/JavaScriptCore/runtime/ArrayConstructor.cpp
index 674d00a..589739a 100644
--- a/JavaScriptCore/runtime/ArrayConstructor.cpp
+++ b/JavaScriptCore/runtime/ArrayConstructor.cpp
@@ -26,6 +26,7 @@
#include "ArrayPrototype.h"
#include "Error.h"
+#include "ExceptionHelpers.h"
#include "JSArray.h"
#include "JSFunction.h"
#include "Lookup.h"
@@ -35,7 +36,7 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(ArrayConstructor);
-static JSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState*);
ArrayConstructor::ArrayConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, ArrayPrototype* arrayPrototype, Structure* prototypeFunctionStructure)
: InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, arrayPrototype->classInfo()->className))
@@ -56,7 +57,7 @@ static inline JSObject* constructArrayWithSizeQuirk(ExecState* exec, const ArgLi
if (args.size() == 1 && args.at(0).isNumber()) {
uint32_t n = args.at(0).toUInt32(exec);
if (n != args.at(0).toNumber(exec))
- return throwError(exec, RangeError, "Array size is not a small enough positive integer.");
+ return throwError(exec, createRangeError(exec, "Array size is not a small enough positive integer."));
return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), n);
}
@@ -64,9 +65,10 @@ static inline JSObject* constructArrayWithSizeQuirk(ExecState* exec, const ArgLi
return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), args);
}
-static JSObject* constructWithArrayConstructor(ExecState* exec, JSObject*, const ArgList& args)
+static EncodedJSValue JSC_HOST_CALL constructWithArrayConstructor(ExecState* exec)
{
- return constructArrayWithSizeQuirk(exec, args);
+ ArgList args(exec);
+ return JSValue::encode(constructArrayWithSizeQuirk(exec, args));
}
// ECMA 15.4.2
@@ -76,10 +78,10 @@ ConstructType ArrayConstructor::getConstructData(ConstructData& constructData)
return ConstructTypeHost;
}
-static JSValue JSC_HOST_CALL callArrayConstructor(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callArrayConstructor(ExecState* exec)
{
ArgList args(exec);
- return constructArrayWithSizeQuirk(exec, args);
+ return JSValue::encode(constructArrayWithSizeQuirk(exec, args));
}
// ECMA 15.6.1
@@ -90,9 +92,9 @@ CallType ArrayConstructor::getCallData(CallData& callData)
return CallTypeHost;
}
-JSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState* exec)
{
- return jsBoolean(exec->argument(0).inherits(&JSArray::info));
+ return JSValue::encode(jsBoolean(exec->argument(0).inherits(&JSArray::info)));
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/ArrayPrototype.cpp b/JavaScriptCore/runtime/ArrayPrototype.cpp
index c7dea3b..699fbe6 100644
--- a/JavaScriptCore/runtime/ArrayPrototype.cpp
+++ b/JavaScriptCore/runtime/ArrayPrototype.cpp
@@ -40,27 +40,27 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(ArrayPrototype);
-static JSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncConcat(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncPop(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncReverse(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncShift(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncSlice(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncSort(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncUnShift(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncForEach(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncIndexOf(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncConcat(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncPop(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncReverse(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncShift(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncSlice(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncSort(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncUnShift(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncForEach(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncIndexOf(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState*);
}
@@ -149,23 +149,23 @@ static void putProperty(ExecState* exec, JSObject* obj, const Identifier& proper
obj->put(exec, propertyName, value, slot);
}
-JSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
bool isRealArray = isJSArray(&exec->globalData(), thisValue);
if (!isRealArray && !thisValue.inherits(&JSArray::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSArray* thisObj = asArray(thisValue);
HashSet<JSObject*>& arrayVisitedElements = exec->globalData().arrayVisitedElements;
if (arrayVisitedElements.size() >= MaxSmallThreadReentryDepth) {
if (arrayVisitedElements.size() >= exec->globalData().maxReentryDepth)
- return throwError(exec, RangeError, "Maximum call stack size exceeded.");
+ return throwVMError(exec, createStackOverflowError(exec));
}
bool alreadyVisited = !arrayVisitedElements.add(thisObj).second;
if (alreadyVisited)
- return jsEmptyString(exec); // return an empty string, avoiding infinite recursion.
+ return JSValue::encode(jsEmptyString(exec)); // return an empty string, avoiding infinite recursion.
unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
unsigned totalSize = length ? length - 1 : 0;
@@ -193,11 +193,11 @@ JSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec)
}
arrayVisitedElements.remove(thisObj);
if (!totalSize)
- return jsEmptyString(exec);
+ return JSValue::encode(jsEmptyString(exec));
Vector<UChar> buffer;
buffer.reserveCapacity(totalSize);
if (!buffer.data())
- return throwOutOfMemoryError(exec);
+ return JSValue::encode(throwOutOfMemoryError(exec));
for (unsigned i = 0; i < length; i++) {
if (i)
@@ -206,25 +206,25 @@ JSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec)
buffer.append(rep->characters(), rep->length());
}
ASSERT(buffer.size() == totalSize);
- return jsString(exec, UString::adopt(buffer));
+ return JSValue::encode(jsString(exec, UString::adopt(buffer)));
}
-JSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSArray::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSObject* thisObj = asArray(thisValue);
HashSet<JSObject*>& arrayVisitedElements = exec->globalData().arrayVisitedElements;
if (arrayVisitedElements.size() >= MaxSmallThreadReentryDepth) {
if (arrayVisitedElements.size() >= exec->globalData().maxReentryDepth)
- return throwError(exec, RangeError, "Maximum call stack size exceeded.");
+ return throwVMError(exec, createStackOverflowError(exec));
}
bool alreadyVisited = !arrayVisitedElements.add(thisObj).second;
if (alreadyVisited)
- return jsEmptyString(exec); // return an empty string, avoding infinite recursion.
+ return JSValue::encode(jsEmptyString(exec)); // return an empty string, avoding infinite recursion.
JSStringBuilder strBuffer;
unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
@@ -238,7 +238,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec)
JSValue conversionFunction = o->get(exec, exec->propertyNames().toLocaleString);
UString str;
CallData callData;
- CallType callType = conversionFunction.getCallData(callData);
+ CallType callType = getCallData(conversionFunction, callData);
if (callType != CallTypeNone)
str = call(exec, conversionFunction, callType, callData, element, exec->emptyList()).toString(exec);
else
@@ -247,10 +247,10 @@ JSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec)
}
}
arrayVisitedElements.remove(thisObj);
- return strBuffer.build(exec);
+ return JSValue::encode(strBuffer.build(exec));
}
-JSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
@@ -258,12 +258,12 @@ JSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState* exec)
HashSet<JSObject*>& arrayVisitedElements = exec->globalData().arrayVisitedElements;
if (arrayVisitedElements.size() >= MaxSmallThreadReentryDepth) {
if (arrayVisitedElements.size() >= exec->globalData().maxReentryDepth)
- return throwError(exec, RangeError, "Maximum call stack size exceeded.");
+ return throwVMError(exec, createStackOverflowError(exec));
}
bool alreadyVisited = !arrayVisitedElements.add(thisObj).second;
if (alreadyVisited)
- return jsEmptyString(exec); // return an empty string, avoding infinite recursion.
+ return JSValue::encode(jsEmptyString(exec)); // return an empty string, avoding infinite recursion.
JSStringBuilder strBuffer;
@@ -319,10 +319,10 @@ JSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState* exec)
strBuffer.append(element.toString(exec));
}
arrayVisitedElements.remove(thisObj);
- return strBuffer.build(exec);
+ return JSValue::encode(strBuffer.build(exec));
}
-JSValue JSC_HOST_CALL arrayProtoFuncConcat(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncConcat(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSArray* arr = constructEmptyArray(exec);
@@ -349,14 +349,14 @@ JSValue JSC_HOST_CALL arrayProtoFuncConcat(ExecState* exec)
++i;
}
arr->setLength(n);
- return arr;
+ return JSValue::encode(arr);
}
-JSValue JSC_HOST_CALL arrayProtoFuncPop(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncPop(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (isJSArray(&exec->globalData(), thisValue))
- return asArray(thisValue)->pop();
+ return JSValue::encode(asArray(thisValue)->pop());
JSObject* thisObj = thisValue.toThisObject(exec);
JSValue result;
@@ -369,16 +369,16 @@ JSValue JSC_HOST_CALL arrayProtoFuncPop(ExecState* exec)
thisObj->deleteProperty(exec, length - 1);
putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(exec, length - 1));
}
- return result;
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (isJSArray(&exec->globalData(), thisValue) && exec->argumentCount() == 1) {
JSArray* array = asArray(thisValue);
array->push(exec, exec->argument(0));
- return jsNumber(exec, array->length());
+ return JSValue::encode(jsNumber(exec, array->length()));
}
JSObject* thisObj = thisValue.toThisObject(exec);
@@ -387,10 +387,10 @@ JSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState* exec)
thisObj->put(exec, length + n, exec->argument(n));
length += exec->argumentCount();
putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(exec, length));
- return jsNumber(exec, length);
+ return JSValue::encode(jsNumber(exec, length));
}
-JSValue JSC_HOST_CALL arrayProtoFuncReverse(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncReverse(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
@@ -412,10 +412,10 @@ JSValue JSC_HOST_CALL arrayProtoFuncReverse(ExecState* exec)
else
thisObj->deleteProperty(exec, lk1);
}
- return thisObj;
+ return JSValue::encode(thisObj);
}
-JSValue JSC_HOST_CALL arrayProtoFuncShift(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncShift(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
@@ -436,10 +436,10 @@ JSValue JSC_HOST_CALL arrayProtoFuncShift(ExecState* exec)
thisObj->deleteProperty(exec, length - 1);
putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(exec, length - 1));
}
- return result;
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL arrayProtoFuncSlice(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncSlice(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
// http://developer.netscape.com/docs/manuals/js/client/jsref/array.htm#1193713 or 15.4.4.10
@@ -482,17 +482,17 @@ JSValue JSC_HOST_CALL arrayProtoFuncSlice(ExecState* exec)
resObj->put(exec, n, v);
}
resObj->setLength(n);
- return result;
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL arrayProtoFuncSort(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncSort(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
JSValue function = exec->argument(0);
CallData callData;
- CallType callType = function.getCallData(callData);
+ CallType callType = getCallData(function, callData);
if (thisObj->classInfo() == &JSArray::info) {
if (isNumericCompareFunction(exec, callType, callData))
@@ -501,13 +501,13 @@ JSValue JSC_HOST_CALL arrayProtoFuncSort(ExecState* exec)
asArray(thisObj)->sort(exec, function, callType, callData);
else
asArray(thisObj)->sort(exec);
- return thisObj;
+ return JSValue::encode(thisObj);
}
unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
if (!length)
- return thisObj;
+ return JSValue::encode(thisObj);
// "Min" sort. Not the fastest, but definitely less code than heapsort
// or quicksort, and much less swapping than bubblesort/insertionsort.
@@ -541,10 +541,10 @@ JSValue JSC_HOST_CALL arrayProtoFuncSort(ExecState* exec)
thisObj->put(exec, themin, iObj);
}
}
- return thisObj;
+ return JSValue::encode(thisObj);
}
-JSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
@@ -555,7 +555,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState* exec)
// FIXME: Firefox returns an empty array.
if (!exec->argumentCount())
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
double relativeBegin = exec->argument(0).toInteger(exec);
@@ -602,10 +602,10 @@ JSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState* exec)
thisObj->put(exec, k + begin, exec->argument(k + 2));
putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(exec, length - deleteCount + additionalArgs));
- return result;
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL arrayProtoFuncUnShift(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncUnShift(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
@@ -625,19 +625,19 @@ JSValue JSC_HOST_CALL arrayProtoFuncUnShift(ExecState* exec)
thisObj->put(exec, k, exec->argument(k));
JSValue result = jsNumber(exec, length + nrArgs);
putProperty(exec, thisObj, exec->propertyNames().length, result);
- return result;
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
JSValue function = exec->argument(0);
CallData callData;
- CallType callType = function.getCallData(callData);
+ CallType callType = getCallData(function, callData);
if (callType == CallTypeNone)
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSObject* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec);
JSArray* resultArray = constructEmptyArray(exec);
@@ -663,7 +663,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState* exec)
resultArray->put(exec, filterIndex++, v);
}
if (k == length)
- return resultArray;
+ return JSValue::encode(resultArray);
}
for (; k < length && !exec->hadException(); ++k) {
PropertySlot slot(thisObj);
@@ -684,19 +684,19 @@ JSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState* exec)
if (result.toBoolean(exec))
resultArray->put(exec, filterIndex++, v);
}
- return resultArray;
+ return JSValue::encode(resultArray);
}
-JSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
JSValue function = exec->argument(0);
CallData callData;
- CallType callType = function.getCallData(callData);
+ CallType callType = getCallData(function, callData);
if (callType == CallTypeNone)
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSObject* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec);
@@ -737,7 +737,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState* exec)
resultArray->put(exec, k, result);
}
- return resultArray;
+ return JSValue::encode(resultArray);
}
// Documentation for these three is available at:
@@ -745,16 +745,16 @@ JSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState* exec)
// http://developer-test.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array:forEach
// http://developer-test.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array:some
-JSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
JSValue function = exec->argument(0);
CallData callData;
- CallType callType = function.getCallData(callData);
+ CallType callType = getCallData(function, callData);
if (callType == CallTypeNone)
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSObject* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec);
@@ -776,7 +776,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState* exec)
cachedCall.setArgument(2, thisObj);
JSValue result = cachedCall.call();
if (!result.toBoolean(cachedCall.newCallFrame(exec)))
- return jsBoolean(false);
+ return JSValue::encode(jsBoolean(false));
}
}
for (; k < length && !exec->hadException(); ++k) {
@@ -799,19 +799,19 @@ JSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState* exec)
}
}
- return result;
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL arrayProtoFuncForEach(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncForEach(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
JSValue function = exec->argument(0);
CallData callData;
- CallType callType = function.getCallData(callData);
+ CallType callType = getCallData(function, callData);
if (callType == CallTypeNone)
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSObject* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec);
@@ -845,19 +845,19 @@ JSValue JSC_HOST_CALL arrayProtoFuncForEach(ExecState* exec)
call(exec, function, callType, callData, applyThis, eachArguments);
}
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
JSValue function = exec->argument(0);
CallData callData;
- CallType callType = function.getCallData(callData);
+ CallType callType = getCallData(function, callData);
if (callType == CallTypeNone)
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSObject* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec);
@@ -879,7 +879,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState* exec)
cachedCall.setArgument(2, thisObj);
JSValue result = cachedCall.call();
if (result.toBoolean(cachedCall.newCallFrame(exec)))
- return jsBoolean(true);
+ return JSValue::encode(jsBoolean(true));
}
}
for (; k < length && !exec->hadException(); ++k) {
@@ -899,25 +899,25 @@ JSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState* exec)
break;
}
}
- return result;
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
JSValue function = exec->argument(0);
CallData callData;
- CallType callType = function.getCallData(callData);
+ CallType callType = getCallData(function, callData);
if (callType == CallTypeNone)
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
unsigned i = 0;
JSValue rv;
unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
if (!length && exec->argumentCount() == 1)
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSArray* array = 0;
if (isJSArray(&exec->globalData(), thisObj))
array = asArray(thisObj);
@@ -934,7 +934,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState* exec)
break;
}
if (!rv)
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
i++;
}
@@ -954,7 +954,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState* exec)
rv = cachedCall.call();
}
if (i == length) // only return if we reached the end of the array
- return rv;
+ return JSValue::encode(rv);
}
for (; i < length && !exec->hadException(); ++i) {
@@ -970,25 +970,25 @@ JSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState* exec)
rv = call(exec, function, callType, callData, jsNull(), eachArguments);
}
- return rv;
+ return JSValue::encode(rv);
}
-JSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
JSValue function = exec->argument(0);
CallData callData;
- CallType callType = function.getCallData(callData);
+ CallType callType = getCallData(function, callData);
if (callType == CallTypeNone)
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
unsigned i = 0;
JSValue rv;
unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
if (!length && exec->argumentCount() == 1)
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSArray* array = 0;
if (isJSArray(&exec->globalData(), thisObj))
array = asArray(thisObj);
@@ -1005,7 +1005,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState* exec)
break;
}
if (!rv)
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
i++;
}
@@ -1023,7 +1023,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState* exec)
rv = cachedCall.call();
}
if (i == length) // only return if we reached the end of the array
- return rv;
+ return JSValue::encode(rv);
}
for (; i < length && !exec->hadException(); ++i) {
@@ -1040,10 +1040,10 @@ JSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState* exec)
rv = call(exec, function, callType, callData, jsNull(), eachArguments);
}
- return rv;
+ return JSValue::encode(rv);
}
-JSValue JSC_HOST_CALL arrayProtoFuncIndexOf(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncIndexOf(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
// JavaScript 1.5 Extension by Mozilla
@@ -1069,13 +1069,13 @@ JSValue JSC_HOST_CALL arrayProtoFuncIndexOf(ExecState* exec)
if (!e)
continue;
if (JSValue::strictEqual(exec, searchElement, e))
- return jsNumber(exec, index);
+ return JSValue::encode(jsNumber(exec, index));
}
- return jsNumber(exec, -1);
+ return JSValue::encode(jsNumber(exec, -1));
}
-JSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
// JavaScript 1.6 Extension by Mozilla
@@ -1090,7 +1090,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState* exec)
if (d < 0) {
d += length;
if (d < 0)
- return jsNumber(exec, -1);
+ return JSValue::encode(jsNumber(exec, -1));
}
if (d < length)
index = static_cast<int>(d);
@@ -1101,10 +1101,10 @@ JSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState* exec)
if (!e)
continue;
if (JSValue::strictEqual(exec, searchElement, e))
- return jsNumber(exec, index);
+ return JSValue::encode(jsNumber(exec, index));
}
- return jsNumber(exec, -1);
+ return JSValue::encode(jsNumber(exec, -1));
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/BooleanConstructor.cpp b/JavaScriptCore/runtime/BooleanConstructor.cpp
index bc12858..953bddc 100644
--- a/JavaScriptCore/runtime/BooleanConstructor.cpp
+++ b/JavaScriptCore/runtime/BooleanConstructor.cpp
@@ -45,9 +45,10 @@ JSObject* constructBoolean(ExecState* exec, const ArgList& args)
return obj;
}
-static JSObject* constructWithBooleanConstructor(ExecState* exec, JSObject*, const ArgList& args)
+static EncodedJSValue JSC_HOST_CALL constructWithBooleanConstructor(ExecState* exec)
{
- return constructBoolean(exec, args);
+ ArgList args(exec);
+ return JSValue::encode(constructBoolean(exec, args));
}
ConstructType BooleanConstructor::getConstructData(ConstructData& constructData)
@@ -57,9 +58,9 @@ ConstructType BooleanConstructor::getConstructData(ConstructData& constructData)
}
// ECMA 15.6.1
-static JSValue JSC_HOST_CALL callBooleanConstructor(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callBooleanConstructor(ExecState* exec)
{
- return jsBoolean(exec->argument(0).toBoolean(exec));
+ return JSValue::encode(jsBoolean(exec->argument(0).toBoolean(exec)));
}
CallType BooleanConstructor::getCallData(CallData& callData)
diff --git a/JavaScriptCore/runtime/BooleanPrototype.cpp b/JavaScriptCore/runtime/BooleanPrototype.cpp
index dbb27b2..7ffd095 100644
--- a/JavaScriptCore/runtime/BooleanPrototype.cpp
+++ b/JavaScriptCore/runtime/BooleanPrototype.cpp
@@ -22,6 +22,7 @@
#include "BooleanPrototype.h"
#include "Error.h"
+#include "ExceptionHelpers.h"
#include "JSFunction.h"
#include "JSString.h"
#include "ObjectPrototype.h"
@@ -32,8 +33,8 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(BooleanPrototype);
// Functions
-static JSValue JSC_HOST_CALL booleanProtoFuncToString(ExecState*);
-static JSValue JSC_HOST_CALL booleanProtoFuncValueOf(ExecState*);
+static EncodedJSValue JSC_HOST_CALL booleanProtoFuncToString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL booleanProtoFuncValueOf(ExecState*);
// ECMA 15.6.4
@@ -51,35 +52,35 @@ BooleanPrototype::BooleanPrototype(ExecState* exec, JSGlobalObject* globalObject
// ECMA 15.6.4.2 + 15.6.4.3
-JSValue JSC_HOST_CALL booleanProtoFuncToString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL booleanProtoFuncToString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (thisValue == jsBoolean(false))
- return jsNontrivialString(exec, "false");
+ return JSValue::encode(jsNontrivialString(exec, "false"));
if (thisValue == jsBoolean(true))
- return jsNontrivialString(exec, "true");
+ return JSValue::encode(jsNontrivialString(exec, "true"));
if (!thisValue.inherits(&BooleanObject::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
if (asBooleanObject(thisValue)->internalValue() == jsBoolean(false))
- return jsNontrivialString(exec, "false");
+ return JSValue::encode(jsNontrivialString(exec, "false"));
ASSERT(asBooleanObject(thisValue)->internalValue() == jsBoolean(true));
- return jsNontrivialString(exec, "true");
+ return JSValue::encode(jsNontrivialString(exec, "true"));
}
-JSValue JSC_HOST_CALL booleanProtoFuncValueOf(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL booleanProtoFuncValueOf(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (thisValue.isBoolean())
- return thisValue;
+ return JSValue::encode(thisValue);
if (!thisValue.inherits(&BooleanObject::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
- return asBooleanObject(thisValue)->internalValue();
+ return JSValue::encode(asBooleanObject(thisValue)->internalValue());
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/CallData.h b/JavaScriptCore/runtime/CallData.h
index 5294e54..32e1094 100644
--- a/JavaScriptCore/runtime/CallData.h
+++ b/JavaScriptCore/runtime/CallData.h
@@ -29,6 +29,7 @@
#ifndef CallData_h
#define CallData_h
+#include "JSValue.h"
#include "NativeFunctionWrapper.h"
namespace JSC {
@@ -37,7 +38,6 @@ namespace JSC {
class ExecState;
class FunctionExecutable;
class JSObject;
- class JSValue;
class ScopeChainNode;
enum CallType {
@@ -46,7 +46,7 @@ namespace JSC {
CallTypeJS
};
- typedef JSValue (JSC_HOST_CALL *NativeFunction)(ExecState*);
+ typedef EncodedJSValue (JSC_HOST_CALL *NativeFunction)(ExecState*);
union CallData {
struct {
diff --git a/JavaScriptCore/runtime/ConstructData.cpp b/JavaScriptCore/runtime/ConstructData.cpp
index a7b97e6..0d27e25 100644
--- a/JavaScriptCore/runtime/ConstructData.cpp
+++ b/JavaScriptCore/runtime/ConstructData.cpp
@@ -33,27 +33,10 @@
namespace JSC {
-JSObject* construct(ExecState* exec, JSValue object, ConstructType constructType, const ConstructData& constructData, const ArgList& args)
+JSObject* construct(ExecState* exec, JSValue constructorObject, ConstructType constructType, const ConstructData& constructData, const ArgList& args)
{
- if (constructType == ConstructTypeHost)
- return constructData.native.function(exec, asObject(object), args);
-
- ASSERT(constructType == ConstructTypeJS);
- JSFunction* jsFunction = asFunction(object);
-
- ASSERT(!jsFunction->isHostFunction());
- Structure* structure;
- JSValue prototype = jsFunction->get(exec, exec->propertyNames().prototype);
- if (prototype.isObject())
- structure = asObject(prototype)->inheritorID();
- else
- structure = exec->lexicalGlobalObject()->emptyObjectStructure();
- JSObject* thisObj = new (exec) JSObject(structure);
-
- JSValue result = exec->interpreter()->executeConstruct(jsFunction->jsExecutable(), exec, jsFunction, thisObj, args, jsFunction->scope().node(), exec->exceptionSlot());
- if (exec->hadException() || !result.isObject())
- return thisObj;
- return asObject(result);
+ ASSERT(constructType == ConstructTypeJS || constructType == ConstructTypeHost);
+ return exec->interpreter()->executeConstruct(exec, asObject(constructorObject), constructType, constructData, args, exec->exceptionSlot());
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/ConstructData.h b/JavaScriptCore/runtime/ConstructData.h
index 6b954a6..3d5f732 100644
--- a/JavaScriptCore/runtime/ConstructData.h
+++ b/JavaScriptCore/runtime/ConstructData.h
@@ -29,13 +29,14 @@
#ifndef ConstructData_h
#define ConstructData_h
+#include "JSValue.h"
+
namespace JSC {
class ArgList;
class ExecState;
class FunctionExecutable;
class JSObject;
- class JSValue;
class ScopeChainNode;
enum ConstructType {
@@ -44,7 +45,7 @@ namespace JSC {
ConstructTypeJS
};
- typedef JSObject* (*NativeConstructor)(ExecState*, JSObject*, const ArgList&);
+ typedef EncodedJSValue (JSC_HOST_CALL *NativeConstructor)(ExecState*);
union ConstructData {
struct {
diff --git a/JavaScriptCore/runtime/DateConstructor.cpp b/JavaScriptCore/runtime/DateConstructor.cpp
index 015a01a..5b2f916 100644
--- a/JavaScriptCore/runtime/DateConstructor.cpp
+++ b/JavaScriptCore/runtime/DateConstructor.cpp
@@ -54,9 +54,9 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(DateConstructor);
-static JSValue JSC_HOST_CALL dateParse(ExecState*);
-static JSValue JSC_HOST_CALL dateNow(ExecState*);
-static JSValue JSC_HOST_CALL dateUTC(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateParse(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateNow(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateUTC(ExecState*);
DateConstructor::DateConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure, DatePrototype* datePrototype)
: InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, datePrototype->classInfo()->className))
@@ -116,9 +116,10 @@ JSObject* constructDate(ExecState* exec, const ArgList& args)
return new (exec) DateInstance(exec, value);
}
-static JSObject* constructWithDateConstructor(ExecState* exec, JSObject*, const ArgList& args)
+static EncodedJSValue JSC_HOST_CALL constructWithDateConstructor(ExecState* exec)
{
- return constructDate(exec, args);
+ ArgList args(exec);
+ return JSValue::encode(constructDate(exec, args));
}
ConstructType DateConstructor::getConstructData(ConstructData& constructData)
@@ -128,7 +129,7 @@ ConstructType DateConstructor::getConstructData(ConstructData& constructData)
}
// ECMA 15.9.2
-static JSValue JSC_HOST_CALL callDate(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callDate(ExecState* exec)
{
time_t localTime = time(0);
tm localTM;
@@ -138,7 +139,7 @@ static JSValue JSC_HOST_CALL callDate(ExecState* exec)
DateConversionBuffer time;
formatDate(ts, date);
formatTime(ts, time);
- return jsMakeNontrivialString(exec, date, " ", time);
+ return JSValue::encode(jsMakeNontrivialString(exec, date, " ", time));
}
CallType DateConstructor::getCallData(CallData& callData)
@@ -147,17 +148,17 @@ CallType DateConstructor::getCallData(CallData& callData)
return CallTypeHost;
}
-static JSValue JSC_HOST_CALL dateParse(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL dateParse(ExecState* exec)
{
- return jsNumber(exec, parseDate(exec, exec->argument(0).toString(exec)));
+ return JSValue::encode(jsNumber(exec, parseDate(exec, exec->argument(0).toString(exec))));
}
-static JSValue JSC_HOST_CALL dateNow(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL dateNow(ExecState* exec)
{
- return jsNumber(exec, jsCurrentTime());
+ return JSValue::encode(jsNumber(exec, jsCurrentTime()));
}
-static JSValue JSC_HOST_CALL dateUTC(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL dateUTC(ExecState* exec)
{
int n = exec->argumentCount();
if (isnan(exec->argument(0).toNumber(exec))
@@ -167,7 +168,7 @@ static JSValue JSC_HOST_CALL dateUTC(ExecState* exec)
|| (n >= 5 && isnan(exec->argument(4).toNumber(exec)))
|| (n >= 6 && isnan(exec->argument(5).toNumber(exec)))
|| (n >= 7 && isnan(exec->argument(6).toNumber(exec))))
- return jsNaN(exec);
+ return JSValue::encode(jsNaN(exec));
GregorianDateTime t;
int year = exec->argument(0).toInt32(exec);
@@ -178,7 +179,7 @@ static JSValue JSC_HOST_CALL dateUTC(ExecState* exec)
t.minute = exec->argument(4).toInt32(exec);
t.second = exec->argument(5).toInt32(exec);
double ms = (n >= 7) ? exec->argument(6).toNumber(exec) : 0;
- return jsNumber(exec, timeClip(gregorianDateTimeToMS(exec, t, ms, true)));
+ return JSValue::encode(jsNumber(exec, timeClip(gregorianDateTimeToMS(exec, t, ms, true))));
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/DatePrototype.cpp b/JavaScriptCore/runtime/DatePrototype.cpp
index c31a4d0..f8d2224 100644
--- a/JavaScriptCore/runtime/DatePrototype.cpp
+++ b/JavaScriptCore/runtime/DatePrototype.cpp
@@ -73,51 +73,51 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(DatePrototype);
-static JSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetDate(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetFullYear(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetHours(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetMilliSeconds(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetMinutes(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetMonth(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetSeconds(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetTime(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetUTCDate(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetUTCFullYear(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetUTCHours(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetUTCMilliseconds(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetUTCMinutes(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetUTCMonth(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetUTCSeconds(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncToString(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncToTimeString(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncToJSON(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetDate(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetFullYear(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetHours(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetMilliSeconds(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetMinutes(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetMonth(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetSeconds(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetTime(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCDate(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCFullYear(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCHours(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCMilliseconds(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCMinutes(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCMonth(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCSeconds(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToTimeString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToJSON(ExecState*);
}
@@ -437,411 +437,411 @@ bool DatePrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier&
// Functions
-JSValue JSC_HOST_CALL dateProtoFuncToString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
- return jsNontrivialString(exec, "Invalid Date");
+ return JSValue::encode(jsNontrivialString(exec, "Invalid Date"));
DateConversionBuffer date;
DateConversionBuffer time;
formatDate(*gregorianDateTime, date);
formatTime(*gregorianDateTime, time);
- return jsMakeNontrivialString(exec, date, " ", time);
+ return JSValue::encode(jsMakeNontrivialString(exec, date, " ", time));
}
-JSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
- return jsNontrivialString(exec, "Invalid Date");
+ return JSValue::encode(jsNontrivialString(exec, "Invalid Date"));
DateConversionBuffer date;
DateConversionBuffer time;
formatDateUTCVariant(*gregorianDateTime, date);
formatTimeUTC(*gregorianDateTime, time);
- return jsMakeNontrivialString(exec, date, " ", time);
+ return JSValue::encode(jsMakeNontrivialString(exec, date, " ", time));
}
-JSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
- return jsNontrivialString(exec, "Invalid Date");
+ return JSValue::encode(jsNontrivialString(exec, "Invalid Date"));
// Maximum amount of space we need in buffer: 6 (max. digits in year) + 2 * 5 (2 characters each for month, day, hour, minute, second) + 4 (. + 3 digits for milliseconds)
// 6 for formatting and one for null termination = 27. We add one extra character to allow us to force null termination.
char buffer[28];
snprintf(buffer, sizeof(buffer) - 1, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", 1900 + gregorianDateTime->year, gregorianDateTime->month + 1, gregorianDateTime->monthDay, gregorianDateTime->hour, gregorianDateTime->minute, gregorianDateTime->second, static_cast<int>(fmod(thisDateObj->internalNumber(), 1000)));
buffer[sizeof(buffer) - 1] = 0;
- return jsNontrivialString(exec, buffer);
+ return JSValue::encode(jsNontrivialString(exec, buffer));
}
-JSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
- return jsNontrivialString(exec, "Invalid Date");
+ return JSValue::encode(jsNontrivialString(exec, "Invalid Date"));
DateConversionBuffer date;
formatDate(*gregorianDateTime, date);
- return jsNontrivialString(exec, date);
+ return JSValue::encode(jsNontrivialString(exec, date));
}
-JSValue JSC_HOST_CALL dateProtoFuncToTimeString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToTimeString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
- return jsNontrivialString(exec, "Invalid Date");
+ return JSValue::encode(jsNontrivialString(exec, "Invalid Date"));
DateConversionBuffer time;
formatTime(*gregorianDateTime, time);
- return jsNontrivialString(exec, time);
+ return JSValue::encode(jsNontrivialString(exec, time));
}
-JSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
- return formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleDateAndTime);
+ return JSValue::encode(formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleDateAndTime));
}
-JSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
- return formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleDate);
+ return JSValue::encode(formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleDate));
}
-JSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
- return formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleTime);
+ return JSValue::encode(formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleTime));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
- return asDateInstance(thisValue)->internalValue();
+ return JSValue::encode(asDateInstance(thisValue)->internalValue());
}
-JSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, 1900 + gregorianDateTime->year);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, 1900 + gregorianDateTime->year));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, 1900 + gregorianDateTime->year);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, 1900 + gregorianDateTime->year));
}
-JSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
- return jsNontrivialString(exec, "Invalid Date");
+ return JSValue::encode(jsNontrivialString(exec, "Invalid Date"));
DateConversionBuffer date;
DateConversionBuffer time;
formatDateUTCVariant(*gregorianDateTime, date);
formatTimeUTC(*gregorianDateTime, time);
- return jsMakeNontrivialString(exec, date, " ", time);
+ return JSValue::encode(jsMakeNontrivialString(exec, date, " ", time));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->month);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->month));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->month);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->month));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->monthDay);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->monthDay));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->monthDay);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->monthDay));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->weekDay);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->weekDay));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->weekDay);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->weekDay));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->hour);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->hour));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->hour);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->hour));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->minute);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->minute));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->minute);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->minute));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->second);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->second));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->second);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->second));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
double milli = thisDateObj->internalNumber();
if (isnan(milli))
- return jsNaN(exec);
+ return JSValue::encode(jsNaN(exec));
double secs = floor(milli / msPerSecond);
double ms = milli - secs * msPerSecond;
- return jsNumber(exec, ms);
+ return JSValue::encode(jsNumber(exec, ms));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
double milli = thisDateObj->internalNumber();
if (isnan(milli))
- return jsNaN(exec);
+ return JSValue::encode(jsNaN(exec));
double secs = floor(milli / msPerSecond);
double ms = milli - secs * msPerSecond;
- return jsNumber(exec, ms);
+ return JSValue::encode(jsNumber(exec, ms));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, -gregorianDateTime->utcOffset / minutesPerHour);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, -gregorianDateTime->utcOffset / minutesPerHour));
}
-JSValue JSC_HOST_CALL dateProtoFuncSetTime(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetTime(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
double milli = timeClip(exec->argument(0).toNumber(exec));
JSValue result = jsNumber(exec, milli);
thisDateObj->setInternalValue(result);
- return result;
+ return JSValue::encode(result);
}
-static JSValue setNewValueFromTimeArgs(ExecState* exec, int numArgsToUse, bool inputIsUTC)
+static EncodedJSValue setNewValueFromTimeArgs(ExecState* exec, int numArgsToUse, bool inputIsUTC)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
double milli = thisDateObj->internalNumber();
@@ -849,7 +849,7 @@ static JSValue setNewValueFromTimeArgs(ExecState* exec, int numArgsToUse, bool i
if (!exec->argumentCount() || isnan(milli)) {
JSValue result = jsNaN(exec);
thisDateObj->setInternalValue(result);
- return result;
+ return JSValue::encode(result);
}
double secs = floor(milli / msPerSecond);
@@ -859,32 +859,32 @@ static JSValue setNewValueFromTimeArgs(ExecState* exec, int numArgsToUse, bool i
? thisDateObj->gregorianDateTimeUTC(exec)
: thisDateObj->gregorianDateTime(exec);
if (!other)
- return jsNaN(exec);
+ return JSValue::encode(jsNaN(exec));
GregorianDateTime gregorianDateTime;
gregorianDateTime.copyFrom(*other);
if (!fillStructuresUsingTimeArgs(exec, numArgsToUse, &ms, &gregorianDateTime)) {
JSValue result = jsNaN(exec);
thisDateObj->setInternalValue(result);
- return result;
+ return JSValue::encode(result);
}
JSValue result = jsNumber(exec, gregorianDateTimeToMS(exec, gregorianDateTime, ms, inputIsUTC));
thisDateObj->setInternalValue(result);
- return result;
+ return JSValue::encode(result);
}
-static JSValue setNewValueFromDateArgs(ExecState* exec, int numArgsToUse, bool inputIsUTC)
+static EncodedJSValue setNewValueFromDateArgs(ExecState* exec, int numArgsToUse, bool inputIsUTC)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
if (!exec->argumentCount()) {
JSValue result = jsNaN(exec);
thisDateObj->setInternalValue(result);
- return result;
+ return JSValue::encode(result);
}
double milli = thisDateObj->internalNumber();
@@ -899,116 +899,116 @@ static JSValue setNewValueFromDateArgs(ExecState* exec, int numArgsToUse, bool i
? thisDateObj->gregorianDateTimeUTC(exec)
: thisDateObj->gregorianDateTime(exec);
if (!other)
- return jsNaN(exec);
+ return JSValue::encode(jsNaN(exec));
gregorianDateTime.copyFrom(*other);
}
if (!fillStructuresUsingDateArgs(exec, numArgsToUse, &ms, &gregorianDateTime)) {
JSValue result = jsNaN(exec);
thisDateObj->setInternalValue(result);
- return result;
+ return JSValue::encode(result);
}
JSValue result = jsNumber(exec, gregorianDateTimeToMS(exec, gregorianDateTime, ms, inputIsUTC));
thisDateObj->setInternalValue(result);
- return result;
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL dateProtoFuncSetMilliSeconds(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetMilliSeconds(ExecState* exec)
{
const bool inputIsUTC = false;
return setNewValueFromTimeArgs(exec, 1, inputIsUTC);
}
-JSValue JSC_HOST_CALL dateProtoFuncSetUTCMilliseconds(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCMilliseconds(ExecState* exec)
{
const bool inputIsUTC = true;
return setNewValueFromTimeArgs(exec, 1, inputIsUTC);
}
-JSValue JSC_HOST_CALL dateProtoFuncSetSeconds(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetSeconds(ExecState* exec)
{
const bool inputIsUTC = false;
return setNewValueFromTimeArgs(exec, 2, inputIsUTC);
}
-JSValue JSC_HOST_CALL dateProtoFuncSetUTCSeconds(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCSeconds(ExecState* exec)
{
const bool inputIsUTC = true;
return setNewValueFromTimeArgs(exec, 2, inputIsUTC);
}
-JSValue JSC_HOST_CALL dateProtoFuncSetMinutes(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetMinutes(ExecState* exec)
{
const bool inputIsUTC = false;
return setNewValueFromTimeArgs(exec, 3, inputIsUTC);
}
-JSValue JSC_HOST_CALL dateProtoFuncSetUTCMinutes(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCMinutes(ExecState* exec)
{
const bool inputIsUTC = true;
return setNewValueFromTimeArgs(exec, 3, inputIsUTC);
}
-JSValue JSC_HOST_CALL dateProtoFuncSetHours(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetHours(ExecState* exec)
{
const bool inputIsUTC = false;
return setNewValueFromTimeArgs(exec, 4, inputIsUTC);
}
-JSValue JSC_HOST_CALL dateProtoFuncSetUTCHours(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCHours(ExecState* exec)
{
const bool inputIsUTC = true;
return setNewValueFromTimeArgs(exec, 4, inputIsUTC);
}
-JSValue JSC_HOST_CALL dateProtoFuncSetDate(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetDate(ExecState* exec)
{
const bool inputIsUTC = false;
return setNewValueFromDateArgs(exec, 1, inputIsUTC);
}
-JSValue JSC_HOST_CALL dateProtoFuncSetUTCDate(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCDate(ExecState* exec)
{
const bool inputIsUTC = true;
return setNewValueFromDateArgs(exec, 1, inputIsUTC);
}
-JSValue JSC_HOST_CALL dateProtoFuncSetMonth(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetMonth(ExecState* exec)
{
const bool inputIsUTC = false;
return setNewValueFromDateArgs(exec, 2, inputIsUTC);
}
-JSValue JSC_HOST_CALL dateProtoFuncSetUTCMonth(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCMonth(ExecState* exec)
{
const bool inputIsUTC = true;
return setNewValueFromDateArgs(exec, 2, inputIsUTC);
}
-JSValue JSC_HOST_CALL dateProtoFuncSetFullYear(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetFullYear(ExecState* exec)
{
const bool inputIsUTC = false;
return setNewValueFromDateArgs(exec, 3, inputIsUTC);
}
-JSValue JSC_HOST_CALL dateProtoFuncSetUTCFullYear(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCFullYear(ExecState* exec)
{
const bool inputIsUTC = true;
return setNewValueFromDateArgs(exec, 3, inputIsUTC);
}
-JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
if (!exec->argumentCount()) {
JSValue result = jsNaN(exec);
thisDateObj->setInternalValue(result);
- return result;
+ return JSValue::encode(result);
}
double milli = thisDateObj->internalNumber();
@@ -1031,53 +1031,53 @@ JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec)
if (!ok) {
JSValue result = jsNaN(exec);
thisDateObj->setInternalValue(result);
- return result;
+ return JSValue::encode(result);
}
gregorianDateTime.year = (year > 99 || year < 0) ? year - 1900 : year;
JSValue result = jsNumber(exec, gregorianDateTimeToMS(exec, gregorianDateTime, ms, false));
thisDateObj->setInternalValue(result);
- return result;
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
+ return JSValue::encode(jsNaN(exec));
// NOTE: IE returns the full year even in getYear.
- return jsNumber(exec, gregorianDateTime->year);
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->year));
}
-JSValue JSC_HOST_CALL dateProtoFuncToJSON(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToJSON(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* object = thisValue.toThisObject(exec);
if (exec->hadException())
- return jsNull();
+ return JSValue::encode(jsNull());
JSValue toISOValue = object->get(exec, exec->globalData().propertyNames->toISOString);
if (exec->hadException())
- return jsNull();
+ return JSValue::encode(jsNull());
CallData callData;
- CallType callType = toISOValue.getCallData(callData);
+ CallType callType = getCallData(toISOValue, callData);
if (callType == CallTypeNone)
- return throwError(exec, TypeError, "toISOString is not a function");
+ return throwVMError(exec, createTypeError(exec, "toISOString is not a function"));
JSValue result = call(exec, asObject(toISOValue), callType, callData, object, exec->emptyList());
if (exec->hadException())
- return jsNull();
+ return JSValue::encode(jsNull());
if (result.isObject())
- return throwError(exec, TypeError, "toISOString did not return a primitive value");
- return result;
+ return throwVMError(exec, createTypeError(exec, "toISOString did not return a primitive value"));
+ return JSValue::encode(result);
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/Error.cpp b/JavaScriptCore/runtime/Error.cpp
index 69464b7..a2be473 100644
--- a/JavaScriptCore/runtime/Error.cpp
+++ b/JavaScriptCore/runtime/Error.cpp
@@ -31,104 +31,168 @@
#include "JSObject.h"
#include "JSString.h"
#include "NativeErrorConstructor.h"
+#include "SourceCode.h"
namespace JSC {
-const char* expressionBeginOffsetPropertyName = "expressionBeginOffset";
-const char* expressionCaretOffsetPropertyName = "expressionCaretOffset";
-const char* expressionEndOffsetPropertyName = "expressionEndOffset";
-
-JSObject* Error::create(ExecState* exec, ErrorType type, const UString& message, int lineNumber, intptr_t sourceID, const UString& sourceURL)
-{
- JSObject* constructor;
- const char* name;
- switch (type) {
- case EvalError:
- constructor = exec->lexicalGlobalObject()->evalErrorConstructor();
- name = "Evaluation error";
- break;
- case RangeError:
- constructor = exec->lexicalGlobalObject()->rangeErrorConstructor();
- name = "Range error";
- break;
- case ReferenceError:
- constructor = exec->lexicalGlobalObject()->referenceErrorConstructor();
- name = "Reference error";
- break;
- case SyntaxError:
- constructor = exec->lexicalGlobalObject()->syntaxErrorConstructor();
- name = "Syntax error";
- break;
- case TypeError:
- constructor = exec->lexicalGlobalObject()->typeErrorConstructor();
- name = "Type error";
- break;
- case URIError:
- constructor = exec->lexicalGlobalObject()->URIErrorConstructor();
- name = "URI error";
- break;
- default:
- constructor = exec->lexicalGlobalObject()->errorConstructor();
- name = "Error";
- break;
- }
-
- MarkedArgumentBuffer args;
- if (message.isEmpty())
- args.append(jsString(exec, name));
- else
- args.append(jsString(exec, message));
- ConstructData constructData;
- ConstructType constructType = constructor->getConstructData(constructData);
- JSObject* error = construct(exec, constructor, constructType, constructData, args);
-
- if (lineNumber != -1)
- error->putWithAttributes(exec, Identifier(exec, "line"), jsNumber(exec, lineNumber), ReadOnly | DontDelete);
+static const char* linePropertyName = "line";
+static const char* sourceIdPropertyName = "sourceId";
+static const char* sourceURLPropertyName = "sourceURL";
+static const char* expressionBeginOffsetPropertyName = "expressionBeginOffset";
+static const char* expressionCaretOffsetPropertyName = "expressionCaretOffset";
+static const char* expressionEndOffsetPropertyName = "expressionEndOffset";
+
+JSObject* createError(JSGlobalObject* globalObject, const UString& message)
+{
+ ASSERT(!message.isEmpty());
+ return ErrorInstance::create(globalObject->globalData(), globalObject->errorStructure(), message);
+}
+
+JSObject* createEvalError(JSGlobalObject* globalObject, const UString& message)
+{
+ ASSERT(!message.isEmpty());
+ return ErrorInstance::create(globalObject->globalData(), globalObject->evalErrorConstructor()->errorStructure(), message);
+}
+
+JSObject* createRangeError(JSGlobalObject* globalObject, const UString& message)
+{
+ ASSERT(!message.isEmpty());
+ return ErrorInstance::create(globalObject->globalData(), globalObject->rangeErrorConstructor()->errorStructure(), message);
+}
+
+JSObject* createReferenceError(JSGlobalObject* globalObject, const UString& message)
+{
+ ASSERT(!message.isEmpty());
+ return ErrorInstance::create(globalObject->globalData(), globalObject->referenceErrorConstructor()->errorStructure(), message);
+}
+
+JSObject* createSyntaxError(JSGlobalObject* globalObject, const UString& message)
+{
+ ASSERT(!message.isEmpty());
+ return ErrorInstance::create(globalObject->globalData(), globalObject->syntaxErrorConstructor()->errorStructure(), message);
+}
+
+JSObject* createTypeError(JSGlobalObject* globalObject, const UString& message)
+{
+ ASSERT(!message.isEmpty());
+ return ErrorInstance::create(globalObject->globalData(), globalObject->typeErrorConstructor()->errorStructure(), message);
+}
+
+JSObject* createURIError(JSGlobalObject* globalObject, const UString& message)
+{
+ ASSERT(!message.isEmpty());
+ return ErrorInstance::create(globalObject->globalData(), globalObject->URIErrorConstructor()->errorStructure(), message);
+}
+
+JSObject* createError(ExecState* exec, const UString& message)
+{
+ return createError(exec->lexicalGlobalObject(), message);
+}
+
+JSObject* createEvalError(ExecState* exec, const UString& message)
+{
+ return createEvalError(exec->lexicalGlobalObject(), message);
+}
+
+JSObject* createRangeError(ExecState* exec, const UString& message)
+{
+ return createRangeError(exec->lexicalGlobalObject(), message);
+}
+
+JSObject* createReferenceError(ExecState* exec, const UString& message)
+{
+ return createReferenceError(exec->lexicalGlobalObject(), message);
+}
+
+JSObject* createSyntaxError(ExecState* exec, const UString& message)
+{
+ return createSyntaxError(exec->lexicalGlobalObject(), message);
+}
+
+JSObject* createTypeError(ExecState* exec, const UString& message)
+{
+ return createTypeError(exec->lexicalGlobalObject(), message);
+}
+
+JSObject* createURIError(ExecState* exec, const UString& message)
+{
+ return createURIError(exec->lexicalGlobalObject(), message);
+}
+
+static void addErrorSourceInfo(JSGlobalData* globalData, JSObject* error, int line, const SourceCode& source)
+{
+ intptr_t sourceID = source.provider()->asID();
+ const UString& sourceURL = source.provider()->url();
+
+ if (line != -1)
+ error->putWithAttributes(globalData, Identifier(globalData, linePropertyName), jsNumber(globalData, line), ReadOnly | DontDelete);
if (sourceID != -1)
- error->putWithAttributes(exec, Identifier(exec, "sourceId"), jsNumber(exec, sourceID), ReadOnly | DontDelete);
+ error->putWithAttributes(globalData, Identifier(globalData, sourceIdPropertyName), jsNumber(globalData, (double)sourceID), ReadOnly | DontDelete);
if (!sourceURL.isNull())
- error->putWithAttributes(exec, Identifier(exec, "sourceURL"), jsString(exec, sourceURL), ReadOnly | DontDelete);
-
- return error;
+ error->putWithAttributes(globalData, Identifier(globalData, sourceURLPropertyName), jsString(globalData, sourceURL), ReadOnly | DontDelete);
}
-JSObject* Error::create(ExecState* exec, ErrorType type, const char* message)
+static void addErrorDivotInfo(JSGlobalData* globalData, JSObject* error, int divotPoint, int startOffset, int endOffset, bool withCaret)
{
- return create(exec, type, message, -1, -1, UString());
+ error->putWithAttributes(globalData, Identifier(globalData, expressionBeginOffsetPropertyName), jsNumber(globalData, divotPoint - startOffset), ReadOnly | DontDelete);
+ error->putWithAttributes(globalData, Identifier(globalData, expressionEndOffsetPropertyName), jsNumber(globalData, divotPoint + endOffset), ReadOnly | DontDelete);
+ if (withCaret)
+ error->putWithAttributes(globalData, Identifier(globalData, expressionCaretOffsetPropertyName), jsNumber(globalData, divotPoint), ReadOnly | DontDelete);
}
-JSObject* throwError(ExecState* exec, JSObject* error)
+JSObject* addErrorInfo(JSGlobalData* globalData, JSObject* error, int line, const SourceCode& source)
{
- exec->setException(error);
+ addErrorSourceInfo(globalData, error, line, source);
return error;
}
-JSObject* throwError(ExecState* exec, ErrorType type)
+JSObject* addErrorInfo(JSGlobalData* globalData, JSObject* error, int line, const SourceCode& source, int divotPoint, int startOffset, int endOffset, bool withCaret)
{
- JSObject* error = Error::create(exec, type, UString(), -1, -1, UString());
- exec->setException(error);
+ addErrorSourceInfo(globalData, error, line, source);
+ addErrorDivotInfo(globalData, error, divotPoint, startOffset, endOffset, withCaret);
return error;
}
-JSObject* throwError(ExecState* exec, ErrorType type, const UString& message)
+JSObject* addErrorInfo(ExecState* exec, JSObject* error, int line, const SourceCode& source)
{
- JSObject* error = Error::create(exec, type, message, -1, -1, UString());
- exec->setException(error);
- return error;
+ return addErrorInfo(&exec->globalData(), error, line, source);
+}
+
+JSObject* addErrorInfo(ExecState* exec, JSObject* error, int line, const SourceCode& source, int divotPoint, int startOffset, int endOffset, bool withCaret)
+{
+ return addErrorInfo(&exec->globalData(), error, line, source, divotPoint, startOffset, endOffset, withCaret);
+}
+
+bool hasErrorInfo(ExecState* exec, JSObject* error)
+{
+ return error->hasProperty(exec, Identifier(exec, linePropertyName))
+ || error->hasProperty(exec, Identifier(exec, sourceIdPropertyName))
+ || error->hasProperty(exec, Identifier(exec, sourceURLPropertyName))
+ || error->hasProperty(exec, Identifier(exec, expressionBeginOffsetPropertyName))
+ || error->hasProperty(exec, Identifier(exec, expressionCaretOffsetPropertyName))
+ || error->hasProperty(exec, Identifier(exec, expressionEndOffsetPropertyName));
}
-JSObject* throwError(ExecState* exec, ErrorType type, const char* message)
+JSValue throwError(ExecState* exec, JSValue error)
{
- JSObject* error = Error::create(exec, type, message, -1, -1, UString());
- exec->setException(error);
+ exec->globalData().exception = error;
return error;
}
-JSObject* throwError(ExecState* exec, ErrorType type, const UString& message, int line, intptr_t sourceID, const UString& sourceURL)
+JSObject* throwError(ExecState* exec, JSObject* error)
{
- JSObject* error = Error::create(exec, type, message, line, sourceID, sourceURL);
- exec->setException(error);
+ exec->globalData().exception = error;
return error;
}
+JSObject* throwTypeError(ExecState* exec)
+{
+ return throwError(exec, createTypeError(exec, "Type error"));
+}
+
+JSObject* throwSyntaxError(ExecState* exec)
+{
+ return throwError(exec, createSyntaxError(exec, "Syntax error"));
+}
+
} // namespace JSC
diff --git a/JavaScriptCore/runtime/Error.h b/JavaScriptCore/runtime/Error.h
index e959cff..1a0ece5 100644
--- a/JavaScriptCore/runtime/Error.h
+++ b/JavaScriptCore/runtime/Error.h
@@ -23,44 +23,56 @@
#ifndef Error_h
#define Error_h
+#include "JSObject.h"
#include <stdint.h>
namespace JSC {
class ExecState;
+ class JSGlobalData;
+ class JSGlobalObject;
class JSObject;
+ class SourceCode;
+ class Structure;
class UString;
- /**
- * Types of Native Errors available. For custom errors, GeneralError
- * should be used.
- */
- enum ErrorType {
- GeneralError = 0,
- EvalError = 1,
- RangeError = 2,
- ReferenceError = 3,
- SyntaxError = 4,
- TypeError = 5,
- URIError = 6
- };
-
- extern const char* expressionBeginOffsetPropertyName;
- extern const char* expressionCaretOffsetPropertyName;
- extern const char* expressionEndOffsetPropertyName;
-
- class Error {
- public:
- static JSObject* create(ExecState*, ErrorType, const UString& message, int lineNumber, intptr_t sourceID, const UString& sourceURL);
- static JSObject* create(ExecState*, ErrorType, const char* message);
- };
+ // Methods to create a range of internal errors.
+ JSObject* createError(JSGlobalObject*, const UString&);
+ JSObject* createEvalError(JSGlobalObject*, const UString&);
+ JSObject* createRangeError(JSGlobalObject*, const UString&);
+ JSObject* createReferenceError(JSGlobalObject*, const UString&);
+ JSObject* createSyntaxError(JSGlobalObject*, const UString&);
+ JSObject* createTypeError(JSGlobalObject*, const UString&);
+ JSObject* createURIError(JSGlobalObject*, const UString&);
+ // ExecState wrappers.
+ JSObject* createError(ExecState*, const UString&);
+ JSObject* createEvalError(ExecState*, const UString&);
+ JSObject* createRangeError(ExecState*, const UString&);
+ JSObject* createReferenceError(ExecState*, const UString&);
+ JSObject* createSyntaxError(ExecState*, const UString&);
+ JSObject* createTypeError(ExecState*, const UString&);
+ JSObject* createURIError(ExecState*, const UString&);
- JSObject* throwError(ExecState*, ErrorType, const UString& message, int lineNumber, intptr_t sourceID, const UString& sourceURL);
- JSObject* throwError(ExecState*, ErrorType, const UString& message);
- JSObject* throwError(ExecState*, ErrorType, const char* message);
- JSObject* throwError(ExecState*, ErrorType);
+ // Methods to add
+ bool hasErrorInfo(ExecState*, JSObject* error);
+ JSObject* addErrorInfo(JSGlobalData*, JSObject* error, int line, const SourceCode&);
+ JSObject* addErrorInfo(JSGlobalData*, JSObject* error, int line, const SourceCode&, int divotPoint, int startOffset, int endOffset, bool withCaret = true);
+ // ExecState wrappers.
+ JSObject* addErrorInfo(ExecState*, JSObject* error, int line, const SourceCode&);
+ JSObject* addErrorInfo(ExecState*, JSObject* error, int line, const SourceCode&, int divotPoint, int startOffset, int endOffset, bool withCaret = true);
+
+ // Methods to throw Errors.
+ JSValue throwError(ExecState*, JSValue);
JSObject* throwError(ExecState*, JSObject*);
+ // Convenience wrappers, create an throw an exception with a default message.
+ JSObject* throwTypeError(ExecState*);
+ JSObject* throwSyntaxError(ExecState*);
+
+ // Convenience wrappers, wrap result as an EncodedJSValue.
+ inline EncodedJSValue throwVMError(ExecState* exec, JSValue error) { return JSValue::encode(throwError(exec, error)); }
+ inline EncodedJSValue throwVMTypeError(ExecState* exec) { return JSValue::encode(throwTypeError(exec)); }
+
} // namespace JSC
#endif // Error_h
diff --git a/JavaScriptCore/runtime/ErrorConstructor.cpp b/JavaScriptCore/runtime/ErrorConstructor.cpp
index b4b0ba2..a0874d4 100644
--- a/JavaScriptCore/runtime/ErrorConstructor.cpp
+++ b/JavaScriptCore/runtime/ErrorConstructor.cpp
@@ -38,17 +38,12 @@ ErrorConstructor::ErrorConstructor(ExecState* exec, JSGlobalObject* globalObject
}
// ECMA 15.9.3
-ErrorInstance* constructError(ExecState* exec, const ArgList& args)
-{
- ErrorInstance* obj = new (exec) ErrorInstance(exec->lexicalGlobalObject()->errorStructure());
- if (!args.at(0).isUndefined())
- obj->putDirect(exec->propertyNames().message, jsString(exec, args.at(0).toString(exec)));
- return obj;
-}
-static JSObject* constructWithErrorConstructor(ExecState* exec, JSObject*, const ArgList& args)
+static EncodedJSValue JSC_HOST_CALL constructWithErrorConstructor(ExecState* exec)
{
- return constructError(exec, args);
+ JSValue message = exec->argumentCount() ? exec->argument(0) : jsUndefined();
+ Structure* errorStructure = exec->lexicalGlobalObject()->errorStructure();
+ return JSValue::encode(ErrorInstance::create(exec, errorStructure, message));
}
ConstructType ErrorConstructor::getConstructData(ConstructData& constructData)
@@ -57,10 +52,11 @@ ConstructType ErrorConstructor::getConstructData(ConstructData& constructData)
return ConstructTypeHost;
}
-static JSValue JSC_HOST_CALL callErrorConstructor(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callErrorConstructor(ExecState* exec)
{
- ArgList args(exec);
- return constructError(exec, args);
+ JSValue message = exec->argumentCount() ? exec->argument(0) : jsUndefined();
+ Structure* errorStructure = exec->lexicalGlobalObject()->errorStructure();
+ return JSValue::encode(ErrorInstance::create(exec, errorStructure, message));
}
CallType ErrorConstructor::getCallData(CallData& callData)
diff --git a/JavaScriptCore/runtime/ErrorConstructor.h b/JavaScriptCore/runtime/ErrorConstructor.h
index c0e3323..3d0d706 100644
--- a/JavaScriptCore/runtime/ErrorConstructor.h
+++ b/JavaScriptCore/runtime/ErrorConstructor.h
@@ -37,8 +37,6 @@ namespace JSC {
virtual CallType getCallData(CallData&);
};
- ErrorInstance* constructError(ExecState*, const ArgList&);
-
} // namespace JSC
#endif // ErrorConstructor_h
diff --git a/JavaScriptCore/runtime/ErrorInstance.cpp b/JavaScriptCore/runtime/ErrorInstance.cpp
index 1cdb87a..be6d0fb 100644
--- a/JavaScriptCore/runtime/ErrorInstance.cpp
+++ b/JavaScriptCore/runtime/ErrorInstance.cpp
@@ -30,4 +30,22 @@ ErrorInstance::ErrorInstance(NonNullPassRefPtr<Structure> structure)
{
}
+ErrorInstance::ErrorInstance(JSGlobalData* globalData, NonNullPassRefPtr<Structure> structure, const UString& message)
+ : JSObject(structure)
+{
+ putDirect(globalData->propertyNames->message, jsString(globalData, message));
+}
+
+ErrorInstance* ErrorInstance::create(JSGlobalData* globalData, NonNullPassRefPtr<Structure> structure, const UString& message)
+{
+ return new (globalData) ErrorInstance(globalData, structure, message);
+}
+
+ErrorInstance* ErrorInstance::create(ExecState* exec, NonNullPassRefPtr<Structure> structure, JSValue message)
+{
+ if (message.isUndefined())
+ return new (exec) ErrorInstance(structure);
+ return new (exec) ErrorInstance(&exec->globalData(), structure, message.toString(exec));
+}
+
} // namespace JSC
diff --git a/JavaScriptCore/runtime/ErrorInstance.h b/JavaScriptCore/runtime/ErrorInstance.h
index 9f53b51..35edcb0 100644
--- a/JavaScriptCore/runtime/ErrorInstance.h
+++ b/JavaScriptCore/runtime/ErrorInstance.h
@@ -27,10 +27,16 @@ namespace JSC {
class ErrorInstance : public JSObject {
public:
- explicit ErrorInstance(NonNullPassRefPtr<Structure>);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
+
+ static ErrorInstance* create(JSGlobalData*, NonNullPassRefPtr<Structure>, const UString&);
+ static ErrorInstance* create(ExecState* exec, NonNullPassRefPtr<Structure>, JSValue message);
+
+ protected:
+ explicit ErrorInstance(NonNullPassRefPtr<Structure>);
+ explicit ErrorInstance(JSGlobalData*, NonNullPassRefPtr<Structure>, const UString&);
};
} // namespace JSC
diff --git a/JavaScriptCore/runtime/ErrorPrototype.cpp b/JavaScriptCore/runtime/ErrorPrototype.cpp
index 4c895fa..0e14a30 100644
--- a/JavaScriptCore/runtime/ErrorPrototype.cpp
+++ b/JavaScriptCore/runtime/ErrorPrototype.cpp
@@ -32,21 +32,19 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(ErrorPrototype);
-static JSValue JSC_HOST_CALL errorProtoFuncToString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL errorProtoFuncToString(ExecState*);
// ECMA 15.9.4
ErrorPrototype::ErrorPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
- : ErrorInstance(structure)
+ : ErrorInstance(&exec->globalData(), structure, "Unknown error")
{
// The constructor will be added later in ErrorConstructor's constructor
putDirectWithoutTransition(exec->propertyNames().name, jsNontrivialString(exec, "Error"), DontEnum);
- putDirectWithoutTransition(exec->propertyNames().message, jsNontrivialString(exec, "Unknown error"), DontEnum);
-
putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().toString, errorProtoFuncToString), DontEnum);
}
-JSValue JSC_HOST_CALL errorProtoFuncToString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL errorProtoFuncToString(ExecState* exec)
{
JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
JSValue name = thisObj->get(exec, exec->propertyNames().name);
@@ -56,12 +54,12 @@ JSValue JSC_HOST_CALL errorProtoFuncToString(ExecState* exec)
if (!name.isUndefined()) {
if (!message.isUndefined())
- return jsMakeNontrivialString(exec, name.toString(exec), ": ", message.toString(exec));
- return jsNontrivialString(exec, name.toString(exec));
+ return JSValue::encode(jsMakeNontrivialString(exec, name.toString(exec), ": ", message.toString(exec)));
+ return JSValue::encode(jsNontrivialString(exec, name.toString(exec)));
}
if (!message.isUndefined())
- return jsMakeNontrivialString(exec, "Error: ", message.toString(exec));
- return jsNontrivialString(exec, "Error");
+ return JSValue::encode(jsMakeNontrivialString(exec, "Error: ", message.toString(exec)));
+ return JSValue::encode(jsNontrivialString(exec, "Error"));
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/ExceptionHelpers.cpp b/JavaScriptCore/runtime/ExceptionHelpers.cpp
index b76c226..0647e81 100644
--- a/JavaScriptCore/runtime/ExceptionHelpers.cpp
+++ b/JavaScriptCore/runtime/ExceptionHelpers.cpp
@@ -73,19 +73,9 @@ JSValue createTerminatedExecutionException(JSGlobalData* globalData)
return new (globalData) TerminatedExecutionError(globalData);
}
-static JSValue createError(ExecState* exec, ErrorType e, const char* msg)
+JSObject* createStackOverflowError(ExecState* exec)
{
- return Error::create(exec, e, msg, -1, -1, UString());
-}
-
-JSValue createStackOverflowError(ExecState* exec)
-{
- return createError(exec, RangeError, "Maximum call stack size exceeded.");
-}
-
-JSValue createTypeError(ExecState* exec, const char* message)
-{
- return createError(exec, TypeError, message);
+ return createRangeError(exec, "Maximum call stack size exceeded.");
}
JSValue createUndefinedVariableError(ExecState* exec, const Identifier& ident, unsigned bytecodeOffset, CodeBlock* codeBlock)
@@ -94,10 +84,8 @@ JSValue createUndefinedVariableError(ExecState* exec, const Identifier& ident, u
int endOffset = 0;
int divotPoint = 0;
int line = codeBlock->expressionRangeForBytecodeOffset(exec, bytecodeOffset, divotPoint, startOffset, endOffset);
- JSObject* exception = Error::create(exec, ReferenceError, makeString("Can't find variable: ", ident.ustring()), line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL());
- exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
- exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
- exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete);
+ UString message(makeString("Can't find variable: ", ident.ustring()));
+ JSObject* exception = addErrorInfo(exec, createReferenceError(exec, message), line, codeBlock->ownerExecutable()->source(), divotPoint, startOffset, endOffset);
return exception;
}
@@ -133,10 +121,7 @@ JSObject* createInvalidParamError(ExecState* exec, const char* op, JSValue value
int divotPoint = 0;
int line = codeBlock->expressionRangeForBytecodeOffset(exec, bytecodeOffset, divotPoint, startOffset, endOffset);
UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint, divotPoint + endOffset, value, makeString("not a valid argument for '", op, "'"));
- JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL());
- exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
- exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
- exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete);
+ JSObject* exception = addErrorInfo(exec, createTypeError(exec, errorMessage), line, codeBlock->ownerExecutable()->source(), divotPoint, startOffset, endOffset);
return exception;
}
@@ -154,10 +139,7 @@ JSObject* createNotAConstructorError(ExecState* exec, JSValue value, unsigned by
startPoint++;
UString errorMessage = createErrorMessage(exec, codeBlock, line, startPoint, divotPoint, value, "not a constructor");
- JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL());
- exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
- exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
- exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete);
+ JSObject* exception = addErrorInfo(exec, createTypeError(exec, errorMessage), line, codeBlock->ownerExecutable()->source(), divotPoint, startOffset, endOffset);
return exception;
}
@@ -168,10 +150,7 @@ JSValue createNotAFunctionError(ExecState* exec, JSValue value, unsigned bytecod
int divotPoint = 0;
int line = codeBlock->expressionRangeForBytecodeOffset(exec, bytecodeOffset, divotPoint, startOffset, endOffset);
UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint - startOffset, divotPoint, value, "not a function");
- JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL());
- exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
- exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
- exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete);
+ JSObject* exception = addErrorInfo(exec, createTypeError(exec, errorMessage), line, codeBlock->ownerExecutable()->source(), divotPoint, startOffset, endOffset);
return exception;
}
@@ -198,16 +177,13 @@ JSObject* createNotAnObjectError(ExecState* exec, JSNotAnObjectErrorStub* error,
int divotPoint = 0;
int line = codeBlock->expressionRangeForBytecodeOffset(exec, bytecodeOffset, divotPoint, startOffset, endOffset);
UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint - startOffset, divotPoint, error->isNull() ? jsNull() : jsUndefined(), "not an object");
- JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL());
- exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
- exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
- exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete);
+ JSObject* exception = addErrorInfo(exec, createTypeError(exec, errorMessage), line, codeBlock->ownerExecutable()->source(), divotPoint, startOffset, endOffset);
return exception;
}
JSValue throwOutOfMemoryError(ExecState* exec)
{
- return throwError(exec, GeneralError, "Out of memory");
+ return throwError(exec, createError(exec, "Out of memory"));
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/ExceptionHelpers.h b/JavaScriptCore/runtime/ExceptionHelpers.h
index b152439..906465f 100644
--- a/JavaScriptCore/runtime/ExceptionHelpers.h
+++ b/JavaScriptCore/runtime/ExceptionHelpers.h
@@ -29,6 +29,7 @@
#ifndef ExceptionHelpers_h
#define ExceptionHelpers_h
+#include "JSValue.h"
namespace JSC {
@@ -38,14 +39,12 @@ namespace JSC {
class JSGlobalData;
class JSNotAnObjectErrorStub;
class JSObject;
- class JSValue;
class Node;
struct Instruction;
JSValue createInterruptedExecutionException(JSGlobalData*);
JSValue createTerminatedExecutionException(JSGlobalData*);
- JSValue createStackOverflowError(ExecState*);
- JSValue createTypeError(ExecState*, const char* message);
+ JSObject* createStackOverflowError(ExecState*);
JSValue createUndefinedVariableError(ExecState*, const Identifier&, unsigned bytecodeOffset, CodeBlock*);
JSNotAnObjectErrorStub* createNotAnObjectErrorStub(ExecState*, bool isNull);
JSObject* createInvalidParamError(ExecState*, const char* op, JSValue, unsigned bytecodeOffset, CodeBlock*);
diff --git a/JavaScriptCore/runtime/Executable.cpp b/JavaScriptCore/runtime/Executable.cpp
index 2176e36..a18e80c 100644
--- a/JavaScriptCore/runtime/Executable.cpp
+++ b/JavaScriptCore/runtime/Executable.cpp
@@ -65,9 +65,11 @@ JSObject* EvalExecutable::compile(ExecState* exec, ScopeChainNode* scopeChainNod
{
int errLine;
UString errMsg;
- RefPtr<EvalNode> evalNode = exec->globalData().parser->parse<EvalNode>(&exec->globalData(), exec->lexicalGlobalObject()->debugger(), exec, m_source, &errLine, &errMsg);
+ JSGlobalData* globalData = &exec->globalData();
+ JSGlobalObject* lexicalGlobalObject = exec->lexicalGlobalObject();
+ RefPtr<EvalNode> evalNode = globalData->parser->parse<EvalNode>(globalData, lexicalGlobalObject->debugger(), exec, m_source, &errLine, &errMsg);
if (!evalNode)
- return Error::create(exec, SyntaxError, errMsg, errLine, m_source.provider()->asID(), m_source.provider()->url());
+ return addErrorInfo(globalData, createSyntaxError(lexicalGlobalObject, errMsg), errLine, m_source);
recordParse(evalNode->features(), evalNode->lineNo(), evalNode->lastLine());
ScopeChain scopeChain(scopeChainNode);
@@ -86,9 +88,11 @@ JSObject* ProgramExecutable::checkSyntax(ExecState* exec)
{
int errLine;
UString errMsg;
- RefPtr<ProgramNode> programNode = exec->globalData().parser->parse<ProgramNode>(&exec->globalData(), exec->lexicalGlobalObject()->debugger(), exec, m_source, &errLine, &errMsg);
+ JSGlobalData* globalData = &exec->globalData();
+ JSGlobalObject* lexicalGlobalObject = exec->lexicalGlobalObject();
+ RefPtr<ProgramNode> programNode = globalData->parser->parse<ProgramNode>(globalData, lexicalGlobalObject->debugger(), exec, m_source, &errLine, &errMsg);
if (!programNode)
- return Error::create(exec, SyntaxError, errMsg, errLine, m_source.provider()->asID(), m_source.provider()->url());
+ return addErrorInfo(globalData, createSyntaxError(lexicalGlobalObject, errMsg), errLine, m_source);
return 0;
}
@@ -96,9 +100,11 @@ JSObject* ProgramExecutable::compile(ExecState* exec, ScopeChainNode* scopeChain
{
int errLine;
UString errMsg;
- RefPtr<ProgramNode> programNode = exec->globalData().parser->parse<ProgramNode>(&exec->globalData(), exec->lexicalGlobalObject()->debugger(), exec, m_source, &errLine, &errMsg);
+ JSGlobalData* globalData = &exec->globalData();
+ JSGlobalObject* lexicalGlobalObject = exec->lexicalGlobalObject();
+ RefPtr<ProgramNode> programNode = globalData->parser->parse<ProgramNode>(globalData, lexicalGlobalObject->debugger(), exec, m_source, &errLine, &errMsg);
if (!programNode)
- return Error::create(exec, SyntaxError, errMsg, errLine, m_source.provider()->asID(), m_source.provider()->url());
+ return addErrorInfo(globalData, createSyntaxError(lexicalGlobalObject, errMsg), errLine, m_source);
recordParse(programNode->features(), programNode->lineNo(), programNode->lastLine());
ScopeChain scopeChain(scopeChainNode);
diff --git a/JavaScriptCore/runtime/FunctionConstructor.cpp b/JavaScriptCore/runtime/FunctionConstructor.cpp
index de9fff1..a5ff28c 100644
--- a/JavaScriptCore/runtime/FunctionConstructor.cpp
+++ b/JavaScriptCore/runtime/FunctionConstructor.cpp
@@ -22,6 +22,7 @@
#include "FunctionConstructor.h"
#include "Debugger.h"
+#include "ExceptionHelpers.h"
#include "FunctionPrototype.h"
#include "JSFunction.h"
#include "JSGlobalObject.h"
@@ -44,9 +45,10 @@ FunctionConstructor::FunctionConstructor(ExecState* exec, JSGlobalObject* global
putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontDelete | DontEnum);
}
-static JSObject* constructWithFunctionConstructor(ExecState* exec, JSObject*, const ArgList& args)
+static EncodedJSValue JSC_HOST_CALL constructWithFunctionConstructor(ExecState* exec)
{
- return constructFunction(exec, args);
+ ArgList args(exec);
+ return JSValue::encode(constructFunction(exec, args));
}
ConstructType FunctionConstructor::getConstructData(ConstructData& constructData)
@@ -55,10 +57,10 @@ ConstructType FunctionConstructor::getConstructData(ConstructData& constructData
return ConstructTypeHost;
}
-static JSValue JSC_HOST_CALL callFunctionConstructor(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callFunctionConstructor(ExecState* exec)
{
ArgList args(exec);
- return constructFunction(exec, args);
+ return JSValue::encode(constructFunction(exec, args));
}
// ECMA 15.3.1 The Function Constructor Called as a Function
@@ -95,13 +97,14 @@ JSObject* constructFunction(ExecState* exec, const ArgList& args, const Identifi
int errLine;
UString errMsg;
+ JSGlobalObject* globalObject = exec->lexicalGlobalObject();
+ JSGlobalData* globalData = globalObject->globalData();
SourceCode source = makeSource(program, sourceURL, lineNumber);
RefPtr<FunctionExecutable> function = FunctionExecutable::fromGlobalCode(functionName, exec, exec->dynamicGlobalObject()->debugger(), source, &errLine, &errMsg);
if (!function)
- return throwError(exec, SyntaxError, errMsg, errLine, source.provider()->asID(), source.provider()->url());
+ return throwError(exec, addErrorInfo(globalData, createSyntaxError(globalObject, errMsg), errLine, source));
- JSGlobalObject* globalObject = exec->lexicalGlobalObject();
- ScopeChain scopeChain(globalObject, globalObject->globalData(), globalObject, exec->globalThisValue());
+ ScopeChain scopeChain(globalObject, globalData, globalObject, exec->globalThisValue());
return new (exec) JSFunction(exec, function, scopeChain.node());
}
diff --git a/JavaScriptCore/runtime/FunctionPrototype.cpp b/JavaScriptCore/runtime/FunctionPrototype.cpp
index 15392cf..fb2f627 100644
--- a/JavaScriptCore/runtime/FunctionPrototype.cpp
+++ b/JavaScriptCore/runtime/FunctionPrototype.cpp
@@ -34,9 +34,9 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(FunctionPrototype);
-static JSValue JSC_HOST_CALL functionProtoFuncToString(ExecState*);
-static JSValue JSC_HOST_CALL functionProtoFuncApply(ExecState*);
-static JSValue JSC_HOST_CALL functionProtoFuncCall(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionProtoFuncToString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionProtoFuncApply(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionProtoFuncCall(ExecState*);
FunctionPrototype::FunctionPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure)
: InternalFunction(&exec->globalData(), globalObject, structure, exec->propertyNames().nullIdentifier)
@@ -53,9 +53,9 @@ void FunctionPrototype::addFunctionProperties(ExecState* exec, JSGlobalObject* g
putDirectFunctionWithoutTransition(exec, *callFunction, DontEnum);
}
-static JSValue JSC_HOST_CALL callFunctionPrototype(ExecState*)
+static EncodedJSValue JSC_HOST_CALL callFunctionPrototype(ExecState*)
{
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
// ECMA 15.3.4
@@ -83,41 +83,41 @@ static inline void insertSemicolonIfNeeded(UString& functionBody)
}
}
-JSValue JSC_HOST_CALL functionProtoFuncToString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL functionProtoFuncToString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (thisValue.inherits(&JSFunction::info)) {
JSFunction* function = asFunction(thisValue);
if (function->isHostFunction())
- return jsMakeNontrivialString(exec, "function ", function->name(exec), "() {\n [native code]\n}");
+ return JSValue::encode(jsMakeNontrivialString(exec, "function ", function->name(exec), "() {\n [native code]\n}"));
FunctionExecutable* executable = function->jsExecutable();
UString sourceString = executable->source().toString();
insertSemicolonIfNeeded(sourceString);
- return jsMakeNontrivialString(exec, "function ", function->name(exec), "(", executable->paramString(), ") ", sourceString);
+ return JSValue::encode(jsMakeNontrivialString(exec, "function ", function->name(exec), "(", executable->paramString(), ") ", sourceString));
}
if (thisValue.inherits(&InternalFunction::info)) {
InternalFunction* function = asInternalFunction(thisValue);
- return jsMakeNontrivialString(exec, "function ", function->name(exec), "() {\n [native code]\n}");
+ return JSValue::encode(jsMakeNontrivialString(exec, "function ", function->name(exec), "() {\n [native code]\n}"));
}
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
}
-JSValue JSC_HOST_CALL functionProtoFuncApply(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL functionProtoFuncApply(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
CallData callData;
- CallType callType = thisValue.getCallData(callData);
+ CallType callType = getCallData(thisValue, callData);
if (callType == CallTypeNone)
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSValue array = exec->argument(1);
MarkedArgumentBuffer applyArgs;
if (!array.isUndefinedOrNull()) {
if (!array.isObject())
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
if (asObject(array)->classInfo() == &Arguments::info)
asArguments(array)->fillArgList(exec, applyArgs);
else if (isJSArray(&exec->globalData(), array))
@@ -127,24 +127,24 @@ JSValue JSC_HOST_CALL functionProtoFuncApply(ExecState* exec)
for (unsigned i = 0; i < length; ++i)
applyArgs.append(asArray(array)->get(exec, i));
} else
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
}
- return call(exec, thisValue, callType, callData, exec->argument(0), applyArgs);
+ return JSValue::encode(call(exec, thisValue, callType, callData, exec->argument(0), applyArgs));
}
-JSValue JSC_HOST_CALL functionProtoFuncCall(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL functionProtoFuncCall(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
CallData callData;
- CallType callType = thisValue.getCallData(callData);
+ CallType callType = getCallData(thisValue, callData);
if (callType == CallTypeNone)
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
ArgList args(exec);
ArgList callArgs;
args.getSlice(1, callArgs);
- return call(exec, thisValue, callType, callData, exec->argument(0), callArgs);
+ return JSValue::encode(call(exec, thisValue, callType, callData, exec->argument(0), callArgs));
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/Identifier.cpp b/JavaScriptCore/runtime/Identifier.cpp
index f2642a9..46772d0 100644
--- a/JavaScriptCore/runtime/Identifier.cpp
+++ b/JavaScriptCore/runtime/Identifier.cpp
@@ -228,6 +228,21 @@ Identifier Identifier::from(ExecState* exec, double value)
return Identifier(exec, exec->globalData().numericStrings.add(value));
}
+Identifier Identifier::from(JSGlobalData* globalData, unsigned value)
+{
+ return Identifier(globalData, globalData->numericStrings.add(value));
+}
+
+Identifier Identifier::from(JSGlobalData* globalData, int value)
+{
+ return Identifier(globalData, globalData->numericStrings.add(value));
+}
+
+Identifier Identifier::from(JSGlobalData* globalData, double value)
+{
+ return Identifier(globalData, globalData->numericStrings.add(value));
+}
+
#ifndef NDEBUG
void Identifier::checkCurrentIdentifierTable(JSGlobalData* globalData)
diff --git a/JavaScriptCore/runtime/Identifier.h b/JavaScriptCore/runtime/Identifier.h
index 2f16bbf..2db0716 100644
--- a/JavaScriptCore/runtime/Identifier.h
+++ b/JavaScriptCore/runtime/Identifier.h
@@ -57,6 +57,9 @@ namespace JSC {
static Identifier from(ExecState* exec, unsigned y);
static Identifier from(ExecState* exec, int y);
static Identifier from(ExecState* exec, double y);
+ static Identifier from(JSGlobalData*, unsigned y);
+ static Identifier from(JSGlobalData*, int y);
+ static Identifier from(JSGlobalData*, double y);
bool isNull() const { return _ustring.isNull(); }
bool isEmpty() const { return _ustring.isEmpty(); }
diff --git a/JavaScriptCore/runtime/JSArray.cpp b/JavaScriptCore/runtime/JSArray.cpp
index cf32e07..05623f5 100644
--- a/JavaScriptCore/runtime/JSArray.cpp
+++ b/JavaScriptCore/runtime/JSArray.cpp
@@ -283,7 +283,7 @@ void JSArray::put(ExecState* exec, const Identifier& propertyName, JSValue value
if (propertyName == exec->propertyNames().length) {
unsigned newLength = value.toUInt32(exec);
if (value.toNumber(exec) != static_cast<double>(newLength)) {
- throwError(exec, RangeError, "Invalid array length.");
+ throwError(exec, createRangeError(exec, "Invalid array length."));
return;
}
setLength(newLength);
diff --git a/JavaScriptCore/runtime/JSCell.h b/JavaScriptCore/runtime/JSCell.h
index c083825..72f81df 100644
--- a/JavaScriptCore/runtime/JSCell.h
+++ b/JavaScriptCore/runtime/JSCell.h
@@ -23,6 +23,8 @@
#ifndef JSCell_h
#define JSCell_h
+#include "CallData.h"
+#include "ConstructData.h"
#include "Collector.h"
#include "JSImmediate.h"
#include "JSValue.h"
@@ -205,17 +207,17 @@ namespace JSC {
return isCell() ? asCell()->getObject() : 0;
}
- inline CallType JSValue::getCallData(CallData& callData)
+ inline CallType getCallData(JSValue value, CallData& callData)
{
- CallType result = isCell() ? asCell()->getCallData(callData) : CallTypeNone;
- ASSERT(result == CallTypeNone || isValidCallee());
+ CallType result = value.isCell() ? asCell(value)->getCallData(callData) : CallTypeNone;
+ ASSERT(result == CallTypeNone || value.isValidCallee());
return result;
}
- inline ConstructType JSValue::getConstructData(ConstructData& constructData)
+ inline ConstructType getConstructData(JSValue value, ConstructData& constructData)
{
- ConstructType result = isCell() ? asCell()->getConstructData(constructData) : ConstructTypeNone;
- ASSERT(result == ConstructTypeNone || isValidCallee());
+ ConstructType result = value.isCell() ? asCell(value)->getConstructData(constructData) : ConstructTypeNone;
+ ASSERT(result == ConstructTypeNone || value.isValidCallee());
return result;
}
diff --git a/JavaScriptCore/runtime/JSFunction.cpp b/JavaScriptCore/runtime/JSFunction.cpp
index f44ca2f..7fcd037 100644
--- a/JavaScriptCore/runtime/JSFunction.cpp
+++ b/JavaScriptCore/runtime/JSFunction.cpp
@@ -43,12 +43,11 @@ using namespace Unicode;
namespace JSC {
-JSValue JSC_HOST_CALL callHostFunctionAsConstructor(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL callHostFunctionAsConstructor(ExecState* exec)
{
CodeBlock* codeBlock = exec->callerFrame()->codeBlock();
unsigned vPCIndex = codeBlock->bytecodeOffset(exec, exec->returnPC());
- exec->setException(createNotAConstructorError(exec, exec->callee(), vPCIndex, codeBlock));
- return JSValue();
+ return throwVMError(exec, createNotAConstructorError(exec, exec->callee(), vPCIndex, codeBlock));
}
ASSERT_CLASS_FITS_IN_CELL(JSFunction);
diff --git a/JavaScriptCore/runtime/JSFunction.h b/JavaScriptCore/runtime/JSFunction.h
index a906b2e..3a2fe30 100644
--- a/JavaScriptCore/runtime/JSFunction.h
+++ b/JavaScriptCore/runtime/JSFunction.h
@@ -35,7 +35,7 @@ namespace JSC {
class JSGlobalObject;
class NativeExecutable;
- JSValue JSC_HOST_CALL callHostFunctionAsConstructor(ExecState*);
+ EncodedJSValue JSC_HOST_CALL callHostFunctionAsConstructor(ExecState*);
class JSFunction : public JSObjectWithGlobalObject {
friend class JIT;
diff --git a/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp b/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
index 21d06b7..04cb7cf 100644
--- a/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
+++ b/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
@@ -56,7 +56,7 @@ static JSValue encode(ExecState* exec, const char* doNotEscape)
UString str = exec->argument(0).toString(exec);
CString cstr = str.UTF8String(true);
if (!cstr.data())
- return throwError(exec, URIError, "String contained an illegal UTF-16 sequence.");
+ return throwError(exec, createURIError(exec, "String contained an illegal UTF-16 sequence."));
JSStringBuilder builder;
const char* p = cstr.data();
@@ -118,7 +118,7 @@ static JSValue decode(ExecState* exec, const char* doNotUnescape, bool strict)
}
if (charLen == 0) {
if (strict)
- return throwError(exec, URIError);
+ return throwError(exec, createURIError(exec, "URI error"));
// The only case where we don't use "strict" mode is the "unescape" function.
// For that, it's good to support the wonky "%u" syntax for compatibility with WinIE.
if (k <= len - 6 && p[1] == 'u'
@@ -272,84 +272,84 @@ static double parseFloat(const UString& s)
return s.toDouble(true /*tolerant*/, false /* NaN for empty string */);
}
-JSValue JSC_HOST_CALL globalFuncEval(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL globalFuncEval(ExecState* exec)
{
JSObject* thisObject = exec->hostThisValue().toThisObject(exec);
JSObject* unwrappedObject = thisObject->unwrappedObject();
if (!unwrappedObject->isGlobalObject() || static_cast<JSGlobalObject*>(unwrappedObject)->evalFunction() != exec->callee())
- return throwError(exec, EvalError, "The \"this\" value passed to eval must be the global object from which eval originated");
+ return throwVMError(exec, createEvalError(exec, "The \"this\" value passed to eval must be the global object from which eval originated"));
JSValue x = exec->argument(0);
if (!x.isString())
- return x;
+ return JSValue::encode(x);
UString s = x.toString(exec);
LiteralParser preparser(exec, s, LiteralParser::NonStrictJSON);
if (JSValue parsedObject = preparser.tryLiteralParse())
- return parsedObject;
+ return JSValue::encode(parsedObject);
RefPtr<EvalExecutable> eval = EvalExecutable::create(exec, makeSource(s));
JSObject* error = eval->compile(exec, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node());
if (error)
- return throwError(exec, error);
+ return throwVMError(exec, error);
- return exec->interpreter()->execute(eval.get(), exec, thisObject, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node(), exec->exceptionSlot());
+ return JSValue::encode(exec->interpreter()->execute(eval.get(), exec, thisObject, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node(), exec->exceptionSlot()));
}
-JSValue JSC_HOST_CALL globalFuncParseInt(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL globalFuncParseInt(ExecState* exec)
{
JSValue value = exec->argument(0);
int32_t radix = exec->argument(1).toInt32(exec);
if (radix != 0 && radix != 10)
- return jsNumber(exec, parseInt(value.toString(exec), radix));
+ return JSValue::encode(jsNumber(exec, parseInt(value.toString(exec), radix)));
if (value.isInt32())
- return value;
+ return JSValue::encode(value);
if (value.isDouble()) {
double d = value.asDouble();
if (isfinite(d))
- return jsNumber(exec, (d > 0) ? floor(d) : ceil(d));
+ return JSValue::encode(jsNumber(exec, (d > 0) ? floor(d) : ceil(d)));
if (isnan(d) || isinf(d))
- return jsNaN(exec);
- return jsNumber(exec, 0);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, 0));
}
- return jsNumber(exec, parseInt(value.toString(exec), radix));
+ return JSValue::encode(jsNumber(exec, parseInt(value.toString(exec), radix)));
}
-JSValue JSC_HOST_CALL globalFuncParseFloat(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL globalFuncParseFloat(ExecState* exec)
{
- return jsNumber(exec, parseFloat(exec->argument(0).toString(exec)));
+ return JSValue::encode(jsNumber(exec, parseFloat(exec->argument(0).toString(exec))));
}
-JSValue JSC_HOST_CALL globalFuncIsNaN(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL globalFuncIsNaN(ExecState* exec)
{
- return jsBoolean(isnan(exec->argument(0).toNumber(exec)));
+ return JSValue::encode(jsBoolean(isnan(exec->argument(0).toNumber(exec))));
}
-JSValue JSC_HOST_CALL globalFuncIsFinite(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL globalFuncIsFinite(ExecState* exec)
{
double n = exec->argument(0).toNumber(exec);
- return jsBoolean(!isnan(n) && !isinf(n));
+ return JSValue::encode(jsBoolean(!isnan(n) && !isinf(n)));
}
-JSValue JSC_HOST_CALL globalFuncDecodeURI(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL globalFuncDecodeURI(ExecState* exec)
{
static const char do_not_unescape_when_decoding_URI[] =
"#$&+,/:;=?@";
- return decode(exec, do_not_unescape_when_decoding_URI, true);
+ return JSValue::encode(decode(exec, do_not_unescape_when_decoding_URI, true));
}
-JSValue JSC_HOST_CALL globalFuncDecodeURIComponent(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL globalFuncDecodeURIComponent(ExecState* exec)
{
- return decode(exec, "", true);
+ return JSValue::encode(decode(exec, "", true));
}
-JSValue JSC_HOST_CALL globalFuncEncodeURI(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL globalFuncEncodeURI(ExecState* exec)
{
static const char do_not_escape_when_encoding_URI[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
@@ -357,10 +357,10 @@ JSValue JSC_HOST_CALL globalFuncEncodeURI(ExecState* exec)
"0123456789"
"!#$&'()*+,-./:;=?@_~";
- return encode(exec, do_not_escape_when_encoding_URI);
+ return JSValue::encode(encode(exec, do_not_escape_when_encoding_URI));
}
-JSValue JSC_HOST_CALL globalFuncEncodeURIComponent(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL globalFuncEncodeURIComponent(ExecState* exec)
{
static const char do_not_escape_when_encoding_URI_component[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
@@ -368,10 +368,10 @@ JSValue JSC_HOST_CALL globalFuncEncodeURIComponent(ExecState* exec)
"0123456789"
"!'()*-._~";
- return encode(exec, do_not_escape_when_encoding_URI_component);
+ return JSValue::encode(encode(exec, do_not_escape_when_encoding_URI_component));
}
-JSValue JSC_HOST_CALL globalFuncEscape(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL globalFuncEscape(ExecState* exec)
{
static const char do_not_escape[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
@@ -397,10 +397,10 @@ JSValue JSC_HOST_CALL globalFuncEscape(ExecState* exec)
}
}
- return builder.build(exec);
+ return JSValue::encode(builder.build(exec));
}
-JSValue JSC_HOST_CALL globalFuncUnescape(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL globalFuncUnescape(ExecState* exec)
{
StringBuilder builder;
UString str = exec->argument(0).toString(exec);
@@ -424,15 +424,15 @@ JSValue JSC_HOST_CALL globalFuncUnescape(ExecState* exec)
builder.append(*c);
}
- return jsString(exec, builder.build());
+ return JSValue::encode(jsString(exec, builder.build()));
}
#ifndef NDEBUG
-JSValue JSC_HOST_CALL globalFuncJSCPrint(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL globalFuncJSCPrint(ExecState* exec)
{
CString string = exec->argument(0).toString(exec).UTF8String();
puts(string.data());
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
#endif
diff --git a/JavaScriptCore/runtime/JSGlobalObjectFunctions.h b/JavaScriptCore/runtime/JSGlobalObjectFunctions.h
index b1dada4..91dfca8 100644
--- a/JavaScriptCore/runtime/JSGlobalObjectFunctions.h
+++ b/JavaScriptCore/runtime/JSGlobalObjectFunctions.h
@@ -24,6 +24,7 @@
#ifndef JSGlobalObjectFunctions_h
#define JSGlobalObjectFunctions_h
+#include "JSValue.h"
#include <wtf/unicode/Unicode.h>
namespace JSC {
@@ -31,24 +32,23 @@ namespace JSC {
class ArgList;
class ExecState;
class JSObject;
- class JSValue;
// FIXME: These functions should really be in JSGlobalObject.cpp, but putting them there
// is a 0.5% reduction.
- JSValue JSC_HOST_CALL globalFuncEval(ExecState*);
- JSValue JSC_HOST_CALL globalFuncParseInt(ExecState*);
- JSValue JSC_HOST_CALL globalFuncParseFloat(ExecState*);
- JSValue JSC_HOST_CALL globalFuncIsNaN(ExecState*);
- JSValue JSC_HOST_CALL globalFuncIsFinite(ExecState*);
- JSValue JSC_HOST_CALL globalFuncDecodeURI(ExecState*);
- JSValue JSC_HOST_CALL globalFuncDecodeURIComponent(ExecState*);
- JSValue JSC_HOST_CALL globalFuncEncodeURI(ExecState*);
- JSValue JSC_HOST_CALL globalFuncEncodeURIComponent(ExecState*);
- JSValue JSC_HOST_CALL globalFuncEscape(ExecState*);
- JSValue JSC_HOST_CALL globalFuncUnescape(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncEval(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncParseInt(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncParseFloat(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncIsNaN(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncIsFinite(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncDecodeURI(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncDecodeURIComponent(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncEncodeURI(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncEncodeURIComponent(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncEscape(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncUnescape(ExecState*);
#ifndef NDEBUG
- JSValue JSC_HOST_CALL globalFuncJSCPrint(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncJSCPrint(ExecState*);
#endif
static const double mantissaOverflowLowerBound = 9007199254740992.0;
diff --git a/JavaScriptCore/runtime/JSONObject.cpp b/JavaScriptCore/runtime/JSONObject.cpp
index 86604d8..ccfd43a 100644
--- a/JavaScriptCore/runtime/JSONObject.cpp
+++ b/JavaScriptCore/runtime/JSONObject.cpp
@@ -41,8 +41,8 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(JSONObject);
-static JSValue JSC_HOST_CALL JSONProtoFuncParse(ExecState*);
-static JSValue JSC_HOST_CALL JSONProtoFuncStringify(ExecState*);
+static EncodedJSValue JSC_HOST_CALL JSONProtoFuncParse(ExecState*);
+static EncodedJSValue JSC_HOST_CALL JSONProtoFuncStringify(ExecState*);
}
@@ -425,7 +425,7 @@ Stringifier::StringifyResult Stringifier::appendStringifiedValue(StringBuilder&
// Handle cycle detection, and put the holder on the stack.
if (!m_holderCycleDetector.add(object).second) {
- throwError(m_exec, TypeError, "JSON.stringify cannot serialize cyclic structures.");
+ throwError(m_exec, createTypeError(m_exec, "JSON.stringify cannot serialize cyclic structures."));
return StringifyFailed;
}
bool holderStackWasEmpty = m_holderStack.isEmpty();
@@ -443,7 +443,7 @@ Stringifier::StringifyResult Stringifier::appendStringifiedValue(StringBuilder&
return StringifyFailed;
if (!--tickCount) {
if (localTimeoutChecker.didTimeOut(m_exec)) {
- m_exec->setException(createInterruptedExecutionException(&m_exec->globalData()));
+ throwError(m_exec, createInterruptedExecutionException(&m_exec->globalData()));
return StringifyFailed;
}
tickCount = localTimeoutChecker.ticksUntilNextCheck();
@@ -679,10 +679,8 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered)
case ArrayStartState: {
ASSERT(inValue.isObject());
ASSERT(isJSArray(&m_exec->globalData(), asObject(inValue)) || asObject(inValue)->inherits(&JSArray::info));
- if (objectStack.size() + arrayStack.size() > maximumFilterRecursion) {
- m_exec->setException(createStackOverflowError(m_exec));
- return jsUndefined();
- }
+ if (objectStack.size() + arrayStack.size() > maximumFilterRecursion)
+ return throwError(m_exec, createStackOverflowError(m_exec));
JSArray* array = asArray(inValue);
arrayStack.append(array);
@@ -692,10 +690,8 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered)
arrayStartVisitMember:
case ArrayStartVisitMember: {
if (!--tickCount) {
- if (localTimeoutChecker.didTimeOut(m_exec)) {
- m_exec->setException(createInterruptedExecutionException(&m_exec->globalData()));
- return jsUndefined();
- }
+ if (localTimeoutChecker.didTimeOut(m_exec))
+ return throwError(m_exec, createInterruptedExecutionException(&m_exec->globalData()));
tickCount = localTimeoutChecker.ticksUntilNextCheck();
}
@@ -744,10 +740,8 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered)
case ObjectStartState: {
ASSERT(inValue.isObject());
ASSERT(!isJSArray(&m_exec->globalData(), asObject(inValue)) && !asObject(inValue)->inherits(&JSArray::info));
- if (objectStack.size() + arrayStack.size() > maximumFilterRecursion) {
- m_exec->setException(createStackOverflowError(m_exec));
- return jsUndefined();
- }
+ if (objectStack.size() + arrayStack.size() > maximumFilterRecursion)
+ return throwError(m_exec, createStackOverflowError(m_exec));
JSObject* object = asObject(inValue);
objectStack.append(object);
@@ -759,10 +753,8 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered)
objectStartVisitMember:
case ObjectStartVisitMember: {
if (!--tickCount) {
- if (localTimeoutChecker.didTimeOut(m_exec)) {
- m_exec->setException(createInterruptedExecutionException(&m_exec->globalData()));
- return jsUndefined();
- }
+ if (localTimeoutChecker.didTimeOut(m_exec))
+ return throwError(m_exec, createInterruptedExecutionException(&m_exec->globalData()));
tickCount = localTimeoutChecker.ticksUntilNextCheck();
}
@@ -825,10 +817,8 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered)
stateStack.removeLast();
if (!--tickCount) {
- if (localTimeoutChecker.didTimeOut(m_exec)) {
- m_exec->setException(createInterruptedExecutionException(&m_exec->globalData()));
- return jsUndefined();
- }
+ if (localTimeoutChecker.didTimeOut(m_exec))
+ return throwError(m_exec, createInterruptedExecutionException(&m_exec->globalData()));
tickCount = localTimeoutChecker.ticksUntilNextCheck();
}
}
@@ -839,40 +829,40 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered)
}
// ECMA-262 v5 15.12.2
-JSValue JSC_HOST_CALL JSONProtoFuncParse(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL JSONProtoFuncParse(ExecState* exec)
{
if (!exec->argumentCount())
- return throwError(exec, GeneralError, "JSON.parse requires at least one parameter");
+ return throwVMError(exec, createError(exec, "JSON.parse requires at least one parameter"));
JSValue value = exec->argument(0);
UString source = value.toString(exec);
if (exec->hadException())
- return jsNull();
+ return JSValue::encode(jsNull());
LiteralParser jsonParser(exec, source, LiteralParser::StrictJSON);
JSValue unfiltered = jsonParser.tryLiteralParse();
if (!unfiltered)
- return throwError(exec, SyntaxError, "Unable to parse JSON string");
+ return throwVMError(exec, createSyntaxError(exec, "Unable to parse JSON string"));
if (exec->argumentCount() < 2)
- return unfiltered;
+ return JSValue::encode(unfiltered);
JSValue function = exec->argument(1);
CallData callData;
- CallType callType = function.getCallData(callData);
+ CallType callType = getCallData(function, callData);
if (callType == CallTypeNone)
- return unfiltered;
- return Walker(exec, asObject(function), callType, callData).walk(unfiltered);
+ return JSValue::encode(unfiltered);
+ return JSValue::encode(Walker(exec, asObject(function), callType, callData).walk(unfiltered));
}
// ECMA-262 v5 15.12.3
-JSValue JSC_HOST_CALL JSONProtoFuncStringify(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL JSONProtoFuncStringify(ExecState* exec)
{
if (!exec->argumentCount())
- return throwError(exec, GeneralError, "No input to stringify");
+ return throwVMError(exec, createError(exec, "No input to stringify"));
JSValue value = exec->argument(0);
JSValue replacer = exec->argument(1);
JSValue space = exec->argument(2);
- return Stringifier(exec, replacer, space).stringify(value);
+ return JSValue::encode(Stringifier(exec, replacer, space).stringify(value));
}
UString JSONStringify(ExecState* exec, JSValue value, unsigned indent)
diff --git a/JavaScriptCore/runtime/JSObject.cpp b/JavaScriptCore/runtime/JSObject.cpp
index 5cff4fa..cabc428 100644
--- a/JavaScriptCore/runtime/JSObject.cpp
+++ b/JavaScriptCore/runtime/JSObject.cpp
@@ -91,7 +91,7 @@ bool JSObject::getOwnPropertySlot(ExecState* exec, unsigned propertyName, Proper
static void throwSetterError(ExecState* exec)
{
- throwError(exec, TypeError, "setting a property that has only a getter");
+ throwError(exec, createTypeError(exec, "setting a property that has only a getter"));
}
// ECMA 8.6.2.2
@@ -105,7 +105,7 @@ void JSObject::put(ExecState* exec, const Identifier& propertyName, JSValue valu
if (!value.isObject() && !value.isNull())
return;
if (!setPrototypeWithCycleCheck(value))
- throwError(exec, GeneralError, "cyclic __proto__ value");
+ throwError(exec, createError(exec, "cyclic __proto__ value"));
return;
}
@@ -161,6 +161,21 @@ void JSObject::put(ExecState* exec, unsigned propertyName, JSValue value)
put(exec, Identifier::from(exec, propertyName), value, slot);
}
+void JSObject::putWithAttributes(JSGlobalData* globalData, const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot)
+{
+ putDirectInternal(*globalData, propertyName, value, attributes, checkReadOnly, slot);
+}
+
+void JSObject::putWithAttributes(JSGlobalData* globalData, const Identifier& propertyName, JSValue value, unsigned attributes)
+{
+ putDirectInternal(*globalData, propertyName, value, attributes);
+}
+
+void JSObject::putWithAttributes(JSGlobalData* globalData, unsigned propertyName, JSValue value, unsigned attributes)
+{
+ putWithAttributes(globalData, Identifier::from(globalData, propertyName), value, attributes);
+}
+
void JSObject::putWithAttributes(ExecState* exec, const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot)
{
putDirectInternal(exec->globalData(), propertyName, value, attributes, checkReadOnly, slot);
@@ -224,7 +239,7 @@ static ALWAYS_INLINE JSValue callDefaultValueFunction(ExecState* exec, const JSO
{
JSValue function = object->get(exec, propertyName);
CallData callData;
- CallType callType = function.getCallData(callData);
+ CallType callType = getCallData(function, callData);
if (callType == CallTypeNone)
return exec->exception();
@@ -271,7 +286,7 @@ JSValue JSObject::defaultValue(ExecState* exec, PreferredPrimitiveType hint) con
ASSERT(!exec->hadException());
- return throwError(exec, TypeError, "No default value");
+ return throwError(exec, createTypeError(exec, "No default value"));
}
const HashEntry* JSObject::findPropertyHashEntry(ExecState* exec, const Identifier& propertyName) const
@@ -383,7 +398,7 @@ bool JSObject::hasInstance(ExecState* exec, JSValue value, JSValue proto)
return false;
if (!proto.isObject()) {
- throwError(exec, TypeError, "instanceof called on an object with an invalid prototype property.");
+ throwError(exec, createTypeError(exec, "instanceof called on an object with an invalid prototype property."));
return false;
}
@@ -594,12 +609,12 @@ bool JSObject::defineOwnProperty(ExecState* exec, const Identifier& propertyName
if (!current.configurable()) {
if (descriptor.configurable()) {
if (throwException)
- throwError(exec, TypeError, "Attempting to configurable attribute of unconfigurable property.");
+ throwError(exec, createTypeError(exec, "Attempting to configurable attribute of unconfigurable property."));
return false;
}
if (descriptor.enumerablePresent() && descriptor.enumerable() != current.enumerable()) {
if (throwException)
- throwError(exec, TypeError, "Attempting to change enumerable attribute of unconfigurable property.");
+ throwError(exec, createTypeError(exec, "Attempting to change enumerable attribute of unconfigurable property."));
return false;
}
}
@@ -617,7 +632,7 @@ bool JSObject::defineOwnProperty(ExecState* exec, const Identifier& propertyName
if (descriptor.isDataDescriptor() != current.isDataDescriptor()) {
if (!current.configurable()) {
if (throwException)
- throwError(exec, TypeError, "Attempting to change access mechanism for an unconfigurable property.");
+ throwError(exec, createTypeError(exec, "Attempting to change access mechanism for an unconfigurable property."));
return false;
}
deleteProperty(exec, propertyName);
@@ -629,13 +644,13 @@ bool JSObject::defineOwnProperty(ExecState* exec, const Identifier& propertyName
if (!current.configurable()) {
if (!current.writable() && descriptor.writable()) {
if (throwException)
- throwError(exec, TypeError, "Attempting to change writable attribute of unconfigurable property.");
+ throwError(exec, createTypeError(exec, "Attempting to change writable attribute of unconfigurable property."));
return false;
}
if (!current.writable()) {
if (descriptor.value() || !JSValue::strictEqual(exec, current.value(), descriptor.value())) {
if (throwException)
- throwError(exec, TypeError, "Attempting to change value of a readonly property.");
+ throwError(exec, createTypeError(exec, "Attempting to change value of a readonly property."));
return false;
}
}
@@ -657,12 +672,12 @@ bool JSObject::defineOwnProperty(ExecState* exec, const Identifier& propertyName
if (!current.configurable()) {
if (descriptor.setterPresent() && !(current.setter() && JSValue::strictEqual(exec, current.setter(), descriptor.setter()))) {
if (throwException)
- throwError(exec, TypeError, "Attempting to change the setter of an unconfigurable property.");
+ throwError(exec, createTypeError(exec, "Attempting to change the setter of an unconfigurable property."));
return false;
}
if (descriptor.getterPresent() && !(current.getter() && JSValue::strictEqual(exec, current.getter(), descriptor.getter()))) {
if (throwException)
- throwError(exec, TypeError, "Attempting to change the getter of an unconfigurable property.");
+ throwError(exec, createTypeError(exec, "Attempting to change the getter of an unconfigurable property."));
return false;
}
}
diff --git a/JavaScriptCore/runtime/JSObject.h b/JavaScriptCore/runtime/JSObject.h
index 0738d60..edd376c 100644
--- a/JavaScriptCore/runtime/JSObject.h
+++ b/JavaScriptCore/runtime/JSObject.h
@@ -109,6 +109,9 @@ namespace JSC {
virtual void put(ExecState*, const Identifier& propertyName, JSValue value, PutPropertySlot&);
virtual void put(ExecState*, unsigned propertyName, JSValue value);
+ virtual void putWithAttributes(JSGlobalData*, const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot);
+ virtual void putWithAttributes(JSGlobalData*, const Identifier& propertyName, JSValue value, unsigned attributes);
+ virtual void putWithAttributes(JSGlobalData*, unsigned propertyName, JSValue value, unsigned attributes);
virtual void putWithAttributes(ExecState*, const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot);
virtual void putWithAttributes(ExecState*, const Identifier& propertyName, JSValue value, unsigned attributes);
virtual void putWithAttributes(ExecState*, unsigned propertyName, JSValue value, unsigned attributes);
diff --git a/JavaScriptCore/runtime/JSValue.cpp b/JavaScriptCore/runtime/JSValue.cpp
index 3a2d713..728cbcf 100644
--- a/JavaScriptCore/runtime/JSValue.cpp
+++ b/JavaScriptCore/runtime/JSValue.cpp
@@ -25,6 +25,7 @@
#include "BooleanConstructor.h"
#include "BooleanPrototype.h"
+#include "Error.h"
#include "ExceptionHelpers.h"
#include "JSGlobalObject.h"
#include "JSFunction.h"
@@ -63,7 +64,7 @@ JSObject* JSValue::toObjectSlowCase(ExecState* exec) const
return constructBooleanFromImmediateBoolean(exec, asValue());
ASSERT(isUndefinedOrNull());
JSNotAnObjectErrorStub* exception = createNotAnObjectErrorStub(exec, isNull());
- exec->setException(exception);
+ throwError(exec, exception);
return new (exec) JSNotAnObject(exec, exception);
}
@@ -88,7 +89,7 @@ JSObject* JSValue::synthesizeObject(ExecState* exec) const
return constructBooleanFromImmediateBoolean(exec, asValue());
JSNotAnObjectErrorStub* exception = createNotAnObjectErrorStub(exec, isNull());
- exec->setException(exception);
+ throwError(exec, exception);
return new (exec) JSNotAnObject(exec, exception);
}
@@ -101,7 +102,7 @@ JSObject* JSValue::synthesizePrototype(ExecState* exec) const
return exec->lexicalGlobalObject()->booleanPrototype();
JSNotAnObjectErrorStub* exception = createNotAnObjectErrorStub(exec, isNull());
- exec->setException(exception);
+ throwError(exec, exception);
return new (exec) JSNotAnObject(exec, exception);
}
diff --git a/JavaScriptCore/runtime/JSValue.h b/JavaScriptCore/runtime/JSValue.h
index 914e2d5..9190f70 100644
--- a/JavaScriptCore/runtime/JSValue.h
+++ b/JavaScriptCore/runtime/JSValue.h
@@ -23,8 +23,6 @@
#ifndef JSValue_h
#define JSValue_h
-#include "CallData.h"
-#include "ConstructData.h"
#include <math.h>
#include <stddef.h> // for size_t
#include <stdint.h>
@@ -35,6 +33,7 @@
namespace JSC {
+ class ExecState;
class Identifier;
class JSCell;
class JSGlobalData;
@@ -143,9 +142,6 @@ namespace JSC {
UString getString(ExecState* exec) const; // null string if not a string
JSObject* getObject() const; // 0 if not an object
- CallType getCallData(CallData&);
- ConstructType getConstructData(ConstructData&);
-
// Extracting integer values.
bool getUInt32(uint32_t&) const;
diff --git a/JavaScriptCore/runtime/MathObject.cpp b/JavaScriptCore/runtime/MathObject.cpp
index 28997db..cfbaab2 100644
--- a/JavaScriptCore/runtime/MathObject.cpp
+++ b/JavaScriptCore/runtime/MathObject.cpp
@@ -34,24 +34,24 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(MathObject);
-static JSValue JSC_HOST_CALL mathProtoFuncAbs(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncACos(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncASin(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncATan(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncATan2(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncCeil(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncCos(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncExp(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncFloor(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncLog(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncMax(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncMin(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncPow(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncRandom(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncRound(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncSin(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncSqrt(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncTan(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncAbs(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncACos(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncASin(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncATan(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncATan2(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncCeil(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncCos(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncExp(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncFloor(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncLog(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncMax(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncMin(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncPow(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncRandom(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncRound(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncSin(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncSqrt(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncTan(ExecState*);
}
@@ -113,57 +113,57 @@ bool MathObject::getOwnPropertyDescriptor(ExecState* exec, const Identifier& pro
// ------------------------------ Functions --------------------------------
-JSValue JSC_HOST_CALL mathProtoFuncAbs(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncAbs(ExecState* exec)
{
- return jsNumber(exec, fabs(exec->argument(0).toNumber(exec)));
+ return JSValue::encode(jsNumber(exec, fabs(exec->argument(0).toNumber(exec))));
}
-JSValue JSC_HOST_CALL mathProtoFuncACos(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncACos(ExecState* exec)
{
- return jsDoubleNumber(exec, acos(exec->argument(0).toNumber(exec)));
+ return JSValue::encode(jsDoubleNumber(exec, acos(exec->argument(0).toNumber(exec))));
}
-JSValue JSC_HOST_CALL mathProtoFuncASin(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncASin(ExecState* exec)
{
- return jsDoubleNumber(exec, asin(exec->argument(0).toNumber(exec)));
+ return JSValue::encode(jsDoubleNumber(exec, asin(exec->argument(0).toNumber(exec))));
}
-JSValue JSC_HOST_CALL mathProtoFuncATan(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncATan(ExecState* exec)
{
- return jsDoubleNumber(exec, atan(exec->argument(0).toNumber(exec)));
+ return JSValue::encode(jsDoubleNumber(exec, atan(exec->argument(0).toNumber(exec))));
}
-JSValue JSC_HOST_CALL mathProtoFuncATan2(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncATan2(ExecState* exec)
{
- return jsDoubleNumber(exec, atan2(exec->argument(0).toNumber(exec), exec->argument(1).toNumber(exec)));
+ return JSValue::encode(jsDoubleNumber(exec, atan2(exec->argument(0).toNumber(exec), exec->argument(1).toNumber(exec))));
}
-JSValue JSC_HOST_CALL mathProtoFuncCeil(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncCeil(ExecState* exec)
{
- return jsNumber(exec, ceil(exec->argument(0).toNumber(exec)));
+ return JSValue::encode(jsNumber(exec, ceil(exec->argument(0).toNumber(exec))));
}
-JSValue JSC_HOST_CALL mathProtoFuncCos(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncCos(ExecState* exec)
{
- return jsDoubleNumber(exec, cos(exec->argument(0).toNumber(exec)));
+ return JSValue::encode(jsDoubleNumber(exec, cos(exec->argument(0).toNumber(exec))));
}
-JSValue JSC_HOST_CALL mathProtoFuncExp(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncExp(ExecState* exec)
{
- return jsDoubleNumber(exec, exp(exec->argument(0).toNumber(exec)));
+ return JSValue::encode(jsDoubleNumber(exec, exp(exec->argument(0).toNumber(exec))));
}
-JSValue JSC_HOST_CALL mathProtoFuncFloor(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncFloor(ExecState* exec)
{
- return jsNumber(exec, floor(exec->argument(0).toNumber(exec)));
+ return JSValue::encode(jsNumber(exec, floor(exec->argument(0).toNumber(exec))));
}
-JSValue JSC_HOST_CALL mathProtoFuncLog(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncLog(ExecState* exec)
{
- return jsDoubleNumber(exec, log(exec->argument(0).toNumber(exec)));
+ return JSValue::encode(jsDoubleNumber(exec, log(exec->argument(0).toNumber(exec))));
}
-JSValue JSC_HOST_CALL mathProtoFuncMax(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncMax(ExecState* exec)
{
unsigned argsCount = exec->argumentCount();
double result = -Inf;
@@ -176,10 +176,10 @@ JSValue JSC_HOST_CALL mathProtoFuncMax(ExecState* exec)
if (val > result || (val == 0 && result == 0 && !signbit(val)))
result = val;
}
- return jsNumber(exec, result);
+ return JSValue::encode(jsNumber(exec, result));
}
-JSValue JSC_HOST_CALL mathProtoFuncMin(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncMin(ExecState* exec)
{
unsigned argsCount = exec->argumentCount();
double result = +Inf;
@@ -192,10 +192,10 @@ JSValue JSC_HOST_CALL mathProtoFuncMin(ExecState* exec)
if (val < result || (val == 0 && result == 0 && signbit(val)))
result = val;
}
- return jsNumber(exec, result);
+ return JSValue::encode(jsNumber(exec, result));
}
-JSValue JSC_HOST_CALL mathProtoFuncPow(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncPow(ExecState* exec)
{
// ECMA 15.8.2.1.13
@@ -203,37 +203,37 @@ JSValue JSC_HOST_CALL mathProtoFuncPow(ExecState* exec)
double arg2 = exec->argument(1).toNumber(exec);
if (isnan(arg2))
- return jsNaN(exec);
+ return JSValue::encode(jsNaN(exec));
if (isinf(arg2) && fabs(arg) == 1)
- return jsNaN(exec);
- return jsNumber(exec, pow(arg, arg2));
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, pow(arg, arg2)));
}
-JSValue JSC_HOST_CALL mathProtoFuncRandom(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncRandom(ExecState* exec)
{
- return jsDoubleNumber(exec, exec->globalData().weakRandom.get());
+ return JSValue::encode(jsDoubleNumber(exec, exec->globalData().weakRandom.get()));
}
-JSValue JSC_HOST_CALL mathProtoFuncRound(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncRound(ExecState* exec)
{
double arg = exec->argument(0).toNumber(exec);
double integer = ceil(arg);
- return jsNumber(exec, integer - (integer - arg > 0.5));
+ return JSValue::encode(jsNumber(exec, integer - (integer - arg > 0.5)));
}
-JSValue JSC_HOST_CALL mathProtoFuncSin(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncSin(ExecState* exec)
{
- return exec->globalData().cachedSin(exec, exec->argument(0).toNumber(exec));
+ return JSValue::encode(exec->globalData().cachedSin(exec, exec->argument(0).toNumber(exec)));
}
-JSValue JSC_HOST_CALL mathProtoFuncSqrt(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncSqrt(ExecState* exec)
{
- return jsDoubleNumber(exec, sqrt(exec->argument(0).toNumber(exec)));
+ return JSValue::encode(jsDoubleNumber(exec, sqrt(exec->argument(0).toNumber(exec))));
}
-JSValue JSC_HOST_CALL mathProtoFuncTan(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncTan(ExecState* exec)
{
- return jsDoubleNumber(exec, tan(exec->argument(0).toNumber(exec)));
+ return JSValue::encode(jsDoubleNumber(exec, tan(exec->argument(0).toNumber(exec))));
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/NativeErrorConstructor.cpp b/JavaScriptCore/runtime/NativeErrorConstructor.cpp
index 32ae6b8..31f9bc3 100644
--- a/JavaScriptCore/runtime/NativeErrorConstructor.cpp
+++ b/JavaScriptCore/runtime/NativeErrorConstructor.cpp
@@ -42,18 +42,11 @@ NativeErrorConstructor::NativeErrorConstructor(ExecState* exec, JSGlobalObject*
m_errorStructure = ErrorInstance::createStructure(prototype);
}
-
-ErrorInstance* NativeErrorConstructor::construct(ExecState* exec, const ArgList& args)
-{
- ErrorInstance* object = new (exec) ErrorInstance(m_errorStructure);
- if (!args.at(0).isUndefined())
- object->putDirect(exec->propertyNames().message, jsString(exec, args.at(0).toString(exec)));
- return object;
-}
-
-static JSObject* constructWithNativeErrorConstructor(ExecState* exec, JSObject* constructor, const ArgList& args)
+static EncodedJSValue JSC_HOST_CALL constructWithNativeErrorConstructor(ExecState* exec)
{
- return static_cast<NativeErrorConstructor*>(constructor)->construct(exec, args);
+ JSValue message = exec->argumentCount() ? exec->argument(0) : jsUndefined();
+ Structure* errorStructure = static_cast<NativeErrorConstructor*>(exec->callee())->errorStructure();
+ return JSValue::encode(ErrorInstance::create(exec, errorStructure, message));
}
ConstructType NativeErrorConstructor::getConstructData(ConstructData& constructData)
@@ -62,10 +55,11 @@ ConstructType NativeErrorConstructor::getConstructData(ConstructData& constructD
return ConstructTypeHost;
}
-static JSValue JSC_HOST_CALL callNativeErrorConstructor(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callNativeErrorConstructor(ExecState* exec)
{
- ArgList args(exec);
- return static_cast<NativeErrorConstructor*>(exec->callee())->construct(exec, args);
+ JSValue message = exec->argumentCount() ? exec->argument(0) : jsUndefined();
+ Structure* errorStructure = static_cast<NativeErrorConstructor*>(exec->callee())->errorStructure();
+ return JSValue::encode(ErrorInstance::create(exec, errorStructure, message));
}
CallType NativeErrorConstructor::getCallData(CallData& callData)
diff --git a/JavaScriptCore/runtime/NativeErrorConstructor.h b/JavaScriptCore/runtime/NativeErrorConstructor.h
index 0153309..1ff8207 100644
--- a/JavaScriptCore/runtime/NativeErrorConstructor.h
+++ b/JavaScriptCore/runtime/NativeErrorConstructor.h
@@ -35,7 +35,7 @@ namespace JSC {
static const ClassInfo info;
- ErrorInstance* construct(ExecState*, const ArgList&);
+ Structure* errorStructure() { return m_errorStructure.get(); }
private:
virtual ConstructType getConstructData(ConstructData&);
diff --git a/JavaScriptCore/runtime/NumberConstructor.cpp b/JavaScriptCore/runtime/NumberConstructor.cpp
index fe91f2e..a197952 100644
--- a/JavaScriptCore/runtime/NumberConstructor.cpp
+++ b/JavaScriptCore/runtime/NumberConstructor.cpp
@@ -100,12 +100,12 @@ static JSValue numberConstructorMinValue(ExecState* exec, JSValue, const Identif
}
// ECMA 15.7.1
-static JSObject* constructWithNumberConstructor(ExecState* exec, JSObject*, const ArgList& args)
+static EncodedJSValue JSC_HOST_CALL constructWithNumberConstructor(ExecState* exec)
{
NumberObject* object = new (exec) NumberObject(exec->lexicalGlobalObject()->numberObjectStructure());
- double n = args.isEmpty() ? 0 : args.at(0).toNumber(exec);
+ double n = exec->argumentCount() ? exec->argument(0).toNumber(exec) : 0;
object->setInternalValue(jsNumber(exec, n));
- return object;
+ return JSValue::encode(object);
}
ConstructType NumberConstructor::getConstructData(ConstructData& constructData)
@@ -115,9 +115,9 @@ ConstructType NumberConstructor::getConstructData(ConstructData& constructData)
}
// ECMA 15.7.2
-static JSValue JSC_HOST_CALL callNumberConstructor(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callNumberConstructor(ExecState* exec)
{
- return jsNumber(exec, !exec->argumentCount() ? 0 : exec->argument(0).toNumber(exec));
+ return JSValue::encode(jsNumber(exec, !exec->argumentCount() ? 0 : exec->argument(0).toNumber(exec)));
}
CallType NumberConstructor::getCallData(CallData& callData)
diff --git a/JavaScriptCore/runtime/NumberPrototype.cpp b/JavaScriptCore/runtime/NumberPrototype.cpp
index 0f1590c..e338d7c 100644
--- a/JavaScriptCore/runtime/NumberPrototype.cpp
+++ b/JavaScriptCore/runtime/NumberPrototype.cpp
@@ -38,12 +38,12 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(NumberPrototype);
-static JSValue JSC_HOST_CALL numberProtoFuncToString(ExecState*);
-static JSValue JSC_HOST_CALL numberProtoFuncToLocaleString(ExecState*);
-static JSValue JSC_HOST_CALL numberProtoFuncValueOf(ExecState*);
-static JSValue JSC_HOST_CALL numberProtoFuncToFixed(ExecState*);
-static JSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState*);
-static JSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState*);
+static EncodedJSValue JSC_HOST_CALL numberProtoFuncToString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL numberProtoFuncToLocaleString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL numberProtoFuncValueOf(ExecState*);
+static EncodedJSValue JSC_HOST_CALL numberProtoFuncToFixed(ExecState*);
+static EncodedJSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState*);
+static EncodedJSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState*);
// ECMA 15.7.4
@@ -137,12 +137,12 @@ static double intPow10(int e)
return static_cast<double>(result);
}
-JSValue JSC_HOST_CALL numberProtoFuncToString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL numberProtoFuncToString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSValue v = thisValue.getJSNumber();
if (!v)
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSValue radixValue = exec->argument(0);
int radix;
@@ -154,7 +154,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToString(ExecState* exec)
radix = static_cast<int>(radixValue.toInteger(exec)); // nan -> 0
if (radix == 10)
- return jsString(exec, v.toString(exec));
+ return JSValue::encode(jsString(exec, v.toString(exec)));
static const char* const digits = "0123456789abcdefghijklmnopqrstuvwxyz";
@@ -164,13 +164,13 @@ JSValue JSC_HOST_CALL numberProtoFuncToString(ExecState* exec)
int x = v.asInt32();
if (static_cast<unsigned>(x) < 36) { // Exclude negatives
JSGlobalData* globalData = &exec->globalData();
- return globalData->smallStrings.singleCharacterString(globalData, digits[x]);
+ return JSValue::encode(globalData->smallStrings.singleCharacterString(globalData, digits[x]));
}
}
}
if (radix < 2 || radix > 36)
- return throwError(exec, RangeError, "toString() radix argument must be between 2 and 36");
+ return throwVMError(exec, createRangeError(exec, "toString() radix argument must be between 2 and 36"));
// INT_MAX results in 1024 characters left of the dot with radix 2
// give the same space on the right side. safety checks are in place
@@ -179,7 +179,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToString(ExecState* exec)
const char* lastCharInString = s + sizeof(s) - 1;
double x = v.uncheckedGetNumber();
if (isnan(x) || isinf(x))
- return jsString(exec, UString::from(x));
+ return JSValue::encode(jsString(exec, UString::from(x)));
bool isNegative = x < 0.0;
if (isNegative)
@@ -218,47 +218,47 @@ JSValue JSC_HOST_CALL numberProtoFuncToString(ExecState* exec)
*p = '\0';
ASSERT(p < s + sizeof(s));
- return jsString(exec, startOfResultString);
+ return JSValue::encode(jsString(exec, startOfResultString));
}
-JSValue JSC_HOST_CALL numberProtoFuncToLocaleString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL numberProtoFuncToLocaleString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
// FIXME: Not implemented yet.
JSValue v = thisValue.getJSNumber();
if (!v)
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
- return jsString(exec, v.toString(exec));
+ return JSValue::encode(jsString(exec, v.toString(exec)));
}
-JSValue JSC_HOST_CALL numberProtoFuncValueOf(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL numberProtoFuncValueOf(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSValue v = thisValue.getJSNumber();
if (!v)
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
- return v;
+ return JSValue::encode(v);
}
-JSValue JSC_HOST_CALL numberProtoFuncToFixed(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL numberProtoFuncToFixed(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSValue v = thisValue.getJSNumber();
if (!v)
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSValue fractionDigits = exec->argument(0);
double df = fractionDigits.toInteger(exec);
if (!(df >= 0 && df <= 20))
- return throwError(exec, RangeError, "toFixed() digits argument must be between 0 and 20");
+ return throwVMError(exec, createRangeError(exec, "toFixed() digits argument must be between 0 and 20"));
int f = static_cast<int>(df);
double x = v.uncheckedGetNumber();
if (isnan(x))
- return jsNontrivialString(exec, "NaN");
+ return JSValue::encode(jsNontrivialString(exec, "NaN"));
UString s;
if (x < 0) {
@@ -271,7 +271,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToFixed(ExecState* exec)
}
if (x >= pow(10.0, 21.0))
- return jsString(exec, makeString(s, UString::from(x)));
+ return JSValue::encode(jsString(exec, makeString(s, UString::from(x))));
const double tenToTheF = pow(10.0, f);
double n = floor(x * tenToTheF);
@@ -293,8 +293,8 @@ JSValue JSC_HOST_CALL numberProtoFuncToFixed(ExecState* exec)
int kMinusf = k - f;
if (kMinusf < static_cast<int>(m.size()))
- return jsString(exec, makeString(s, m.substr(0, kMinusf), ".", m.substr(kMinusf)));
- return jsString(exec, makeString(s, m.substr(0, kMinusf)));
+ return JSValue::encode(jsString(exec, makeString(s, m.substr(0, kMinusf), ".", m.substr(kMinusf))));
+ return JSValue::encode(jsString(exec, makeString(s, m.substr(0, kMinusf))));
}
static void fractionalPartToString(char* buf, int& i, const char* result, int resultLength, int fractionalDigits)
@@ -335,22 +335,22 @@ static void exponentialPartToString(char* buf, int& i, int decimalPoint)
buf[i++] = static_cast<char>('0' + exponential % 10);
}
-JSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSValue v = thisValue.getJSNumber();
if (!v)
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
double x = v.uncheckedGetNumber();
if (isnan(x) || isinf(x))
- return jsString(exec, UString::from(x));
+ return JSValue::encode(jsString(exec, UString::from(x)));
JSValue fractionalDigitsValue = exec->argument(0);
double df = fractionalDigitsValue.toInteger(exec);
if (!(df >= 0 && df <= 20))
- return throwError(exec, RangeError, "toExponential() argument must between 0 and 20");
+ return throwVMError(exec, createRangeError(exec, "toExponential() argument must between 0 and 20"));
int fractionalDigits = static_cast<int>(df);
bool includeAllDigits = fractionalDigitsValue.isUndefined();
@@ -371,7 +371,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState* exec)
}
if (isnan(x))
- return jsNontrivialString(exec, "NaN");
+ return JSValue::encode(jsNontrivialString(exec, "NaN"));
if (x == -0.0) // (-0.0).toExponential() should print as 0 instead of -0
x = 0;
@@ -405,20 +405,20 @@ JSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState* exec)
}
ASSERT(i <= 80);
- return jsString(exec, buf);
+ return JSValue::encode(jsString(exec, buf));
}
-JSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSValue v = thisValue.getJSNumber();
if (!v)
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
double doublePrecision = exec->argument(0).toIntegerPreserveNaN(exec);
double x = v.uncheckedGetNumber();
if (exec->argument(0).isUndefined() || isnan(x) || isinf(x))
- return jsString(exec, v.toString(exec));
+ return JSValue::encode(jsString(exec, v.toString(exec)));
UString s;
if (x < 0) {
@@ -428,7 +428,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState* exec)
s = "";
if (!(doublePrecision >= 1 && doublePrecision <= 21)) // true for NaN
- return throwError(exec, RangeError, "toPrecision() argument must be between 1 and 21");
+ return throwVMError(exec, createRangeError(exec, "toPrecision() argument must be between 1 and 21"));
int precision = static_cast<int>(doublePrecision);
int e = 0;
@@ -458,8 +458,8 @@ JSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState* exec)
if (m.size() > 1)
m = makeString(m.substr(0, 1), ".", m.substr(1));
if (e >= 0)
- return jsMakeNontrivialString(exec, s, m, "e+", UString::from(e));
- return jsMakeNontrivialString(exec, s, m, "e-", UString::from(-e));
+ return JSValue::encode(jsMakeNontrivialString(exec, s, m, "e+", UString::from(e)));
+ return JSValue::encode(jsMakeNontrivialString(exec, s, m, "e-", UString::from(-e)));
}
} else {
m = charSequence('0', precision);
@@ -467,13 +467,13 @@ JSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState* exec)
}
if (e == precision - 1)
- return jsString(exec, makeString(s, m));
+ return JSValue::encode(jsString(exec, makeString(s, m)));
if (e >= 0) {
if (e + 1 < static_cast<int>(m.size()))
- return jsString(exec, makeString(s, m.substr(0, e + 1), ".", m.substr(e + 1)));
- return jsString(exec, makeString(s, m));
+ return JSValue::encode(jsString(exec, makeString(s, m.substr(0, e + 1), ".", m.substr(e + 1))));
+ return JSValue::encode(jsString(exec, makeString(s, m)));
}
- return jsMakeNontrivialString(exec, s, "0.", charSequence('0', -(e + 1)), m);
+ return JSValue::encode(jsMakeNontrivialString(exec, s, "0.", charSequence('0', -(e + 1)), m));
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/ObjectConstructor.cpp b/JavaScriptCore/runtime/ObjectConstructor.cpp
index c373f87..b1f9d70 100644
--- a/JavaScriptCore/runtime/ObjectConstructor.cpp
+++ b/JavaScriptCore/runtime/ObjectConstructor.cpp
@@ -22,6 +22,7 @@
#include "ObjectConstructor.h"
#include "Error.h"
+#include "ExceptionHelpers.h"
#include "JSFunction.h"
#include "JSArray.h"
#include "JSGlobalObject.h"
@@ -34,13 +35,13 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(ObjectConstructor);
-static JSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState*);
-static JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState*);
-static JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState*);
-static JSValue JSC_HOST_CALL objectConstructorKeys(ExecState*);
-static JSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState*);
-static JSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState*);
-static JSValue JSC_HOST_CALL objectConstructorCreate(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorKeys(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorCreate(ExecState*);
ObjectConstructor::ObjectConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, ObjectPrototype* objectPrototype, Structure* prototypeFunctionStructure)
: InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, "Object"))
@@ -69,9 +70,10 @@ static ALWAYS_INLINE JSObject* constructObject(ExecState* exec, const ArgList& a
return arg.toObject(exec);
}
-static JSObject* constructWithObjectConstructor(ExecState* exec, JSObject*, const ArgList& args)
+static EncodedJSValue JSC_HOST_CALL constructWithObjectConstructor(ExecState* exec)
{
- return constructObject(exec, args);
+ ArgList args(exec);
+ return JSValue::encode(constructObject(exec, args));
}
ConstructType ObjectConstructor::getConstructData(ConstructData& constructData)
@@ -80,10 +82,10 @@ ConstructType ObjectConstructor::getConstructData(ConstructData& constructData)
return ConstructTypeHost;
}
-static JSValue JSC_HOST_CALL callObjectConstructor(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callObjectConstructor(ExecState* exec)
{
ArgList args(exec);
- return constructObject(exec, args);
+ return JSValue::encode(constructObject(exec, args));
}
CallType ObjectConstructor::getCallData(CallData& callData)
@@ -92,26 +94,26 @@ CallType ObjectConstructor::getCallData(CallData& callData)
return CallTypeHost;
}
-JSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState* exec)
{
if (!exec->argument(0).isObject())
- return throwError(exec, TypeError, "Requested prototype of a value that is not an object.");
- return asObject(exec->argument(0))->prototype();
+ return throwVMError(exec, createTypeError(exec, "Requested prototype of a value that is not an object."));
+ return JSValue::encode(asObject(exec->argument(0))->prototype());
}
-JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState* exec)
{
if (!exec->argument(0).isObject())
- return throwError(exec, TypeError, "Requested property descriptor of a value that is not an object.");
+ return throwVMError(exec, createTypeError(exec, "Requested property descriptor of a value that is not an object."));
UString propertyName = exec->argument(1).toString(exec);
if (exec->hadException())
- return jsNull();
+ return JSValue::encode(jsNull());
JSObject* object = asObject(exec->argument(0));
PropertyDescriptor descriptor;
if (!object->getOwnPropertyDescriptor(exec, Identifier(exec, propertyName), descriptor))
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
if (exec->hadException())
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
JSObject* description = constructEmptyObject(exec);
if (!descriptor.isAccessorDescriptor()) {
@@ -125,42 +127,42 @@ JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState* exec)
description->putDirect(exec->propertyNames().enumerable, jsBoolean(descriptor.enumerable()), 0);
description->putDirect(exec->propertyNames().configurable, jsBoolean(descriptor.configurable()), 0);
- return description;
+ return JSValue::encode(description);
}
// FIXME: Use the enumeration cache.
-JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState* exec)
{
if (!exec->argument(0).isObject())
- return throwError(exec, TypeError, "Requested property names of a value that is not an object.");
+ return throwVMError(exec, createTypeError(exec, "Requested property names of a value that is not an object."));
PropertyNameArray properties(exec);
asObject(exec->argument(0))->getOwnPropertyNames(exec, properties, IncludeDontEnumProperties);
JSArray* names = constructEmptyArray(exec);
size_t numProperties = properties.size();
for (size_t i = 0; i < numProperties; i++)
names->push(exec, jsOwnedString(exec, properties[i].ustring()));
- return names;
+ return JSValue::encode(names);
}
// FIXME: Use the enumeration cache.
-JSValue JSC_HOST_CALL objectConstructorKeys(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectConstructorKeys(ExecState* exec)
{
if (!exec->argument(0).isObject())
- return throwError(exec, TypeError, "Requested keys of a value that is not an object.");
+ return throwVMError(exec, createTypeError(exec, "Requested keys of a value that is not an object."));
PropertyNameArray properties(exec);
asObject(exec->argument(0))->getOwnPropertyNames(exec, properties);
JSArray* keys = constructEmptyArray(exec);
size_t numProperties = properties.size();
for (size_t i = 0; i < numProperties; i++)
keys->push(exec, jsOwnedString(exec, properties[i].ustring()));
- return keys;
+ return JSValue::encode(keys);
}
// ES5 8.10.5 ToPropertyDescriptor
static bool toPropertyDescriptor(ExecState* exec, JSValue in, PropertyDescriptor& desc)
{
if (!in.isObject()) {
- throwError(exec, TypeError, "Property description must be an object.");
+ throwError(exec, createTypeError(exec, "Property description must be an object."));
return false;
}
JSObject* description = asObject(in);
@@ -201,8 +203,8 @@ static bool toPropertyDescriptor(ExecState* exec, JSValue in, PropertyDescriptor
return false;
if (!get.isUndefined()) {
CallData callData;
- if (get.getCallData(callData) == CallTypeNone) {
- throwError(exec, TypeError, "Getter must be a function.");
+ if (getCallData(get, callData) == CallTypeNone) {
+ throwError(exec, createTypeError(exec, "Getter must be a function."));
return false;
}
} else
@@ -217,8 +219,8 @@ static bool toPropertyDescriptor(ExecState* exec, JSValue in, PropertyDescriptor
return false;
if (!set.isUndefined()) {
CallData callData;
- if (set.getCallData(callData) == CallTypeNone) {
- throwError(exec, TypeError, "Setter must be a function.");
+ if (getCallData(set, callData) == CallTypeNone) {
+ throwError(exec, createTypeError(exec, "Setter must be a function."));
return false;
}
} else
@@ -231,32 +233,32 @@ static bool toPropertyDescriptor(ExecState* exec, JSValue in, PropertyDescriptor
return true;
if (desc.value()) {
- throwError(exec, TypeError, "Invalid property. 'value' present on property with getter or setter.");
+ throwError(exec, createTypeError(exec, "Invalid property. 'value' present on property with getter or setter."));
return false;
}
if (desc.writablePresent()) {
- throwError(exec, TypeError, "Invalid property. 'writable' present on property with getter or setter.");
+ throwError(exec, createTypeError(exec, "Invalid property. 'writable' present on property with getter or setter."));
return false;
}
return true;
}
-JSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState* exec)
{
if (!exec->argument(0).isObject())
- return throwError(exec, TypeError, "Properties can only be defined on Objects.");
+ return throwVMError(exec, createTypeError(exec, "Properties can only be defined on Objects."));
JSObject* O = asObject(exec->argument(0));
UString propertyName = exec->argument(1).toString(exec);
if (exec->hadException())
- return jsNull();
+ return JSValue::encode(jsNull());
PropertyDescriptor descriptor;
if (!toPropertyDescriptor(exec, exec->argument(2), descriptor))
- return jsNull();
+ return JSValue::encode(jsNull());
ASSERT((descriptor.attributes() & (Getter | Setter)) || (!descriptor.isAccessorDescriptor()));
ASSERT(!exec->hadException());
O->defineOwnProperty(exec, Identifier(exec, propertyName), descriptor, true);
- return O;
+ return JSValue::encode(O);
}
static JSValue defineProperties(ExecState* exec, JSObject* object, JSObject* properties)
@@ -293,26 +295,26 @@ static JSValue defineProperties(ExecState* exec, JSObject* object, JSObject* pro
return object;
}
-JSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState* exec)
{
if (!exec->argument(0).isObject())
- return throwError(exec, TypeError, "Properties can only be defined on Objects.");
+ return throwVMError(exec, createTypeError(exec, "Properties can only be defined on Objects."));
if (!exec->argument(1).isObject())
- return throwError(exec, TypeError, "Property descriptor list must be an Object.");
- return defineProperties(exec, asObject(exec->argument(0)), asObject(exec->argument(1)));
+ return throwVMError(exec, createTypeError(exec, "Property descriptor list must be an Object."));
+ return JSValue::encode(defineProperties(exec, asObject(exec->argument(0)), asObject(exec->argument(1))));
}
-JSValue JSC_HOST_CALL objectConstructorCreate(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectConstructorCreate(ExecState* exec)
{
if (!exec->argument(0).isObject() && !exec->argument(0).isNull())
- return throwError(exec, TypeError, "Object prototype may only be an Object or null.");
+ return throwVMError(exec, createTypeError(exec, "Object prototype may only be an Object or null."));
JSObject* newObject = constructEmptyObject(exec);
newObject->setPrototype(exec->argument(0));
if (exec->argument(1).isUndefined())
- return newObject;
+ return JSValue::encode(newObject);
if (!exec->argument(1).isObject())
- return throwError(exec, TypeError, "Property descriptor list must be an Object.");
- return defineProperties(exec, newObject, asObject(exec->argument(1)));
+ return throwVMError(exec, createTypeError(exec, "Property descriptor list must be an Object."));
+ return JSValue::encode(defineProperties(exec, newObject, asObject(exec->argument(1))));
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/ObjectPrototype.cpp b/JavaScriptCore/runtime/ObjectPrototype.cpp
index 87212da..6197f75 100644
--- a/JavaScriptCore/runtime/ObjectPrototype.cpp
+++ b/JavaScriptCore/runtime/ObjectPrototype.cpp
@@ -31,15 +31,15 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(ObjectPrototype);
-static JSValue JSC_HOST_CALL objectProtoFuncValueOf(ExecState*);
-static JSValue JSC_HOST_CALL objectProtoFuncHasOwnProperty(ExecState*);
-static JSValue JSC_HOST_CALL objectProtoFuncIsPrototypeOf(ExecState*);
-static JSValue JSC_HOST_CALL objectProtoFuncDefineGetter(ExecState*);
-static JSValue JSC_HOST_CALL objectProtoFuncDefineSetter(ExecState*);
-static JSValue JSC_HOST_CALL objectProtoFuncLookupGetter(ExecState*);
-static JSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState*);
-static JSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState*);
-static JSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncValueOf(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncHasOwnProperty(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncIsPrototypeOf(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncDefineGetter(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncDefineSetter(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupGetter(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState*);
ObjectPrototype::ObjectPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> stucture, Structure* prototypeFunctionStructure)
: JSObject(stucture)
@@ -81,85 +81,85 @@ bool ObjectPrototype::getOwnPropertySlot(ExecState* exec, unsigned propertyName,
// ECMA 15.2.4.2, 15.2.4.4, 15.2.4.5, 15.2.4.7
-JSValue JSC_HOST_CALL objectProtoFuncValueOf(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectProtoFuncValueOf(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
- return thisValue.toThisObject(exec);
+ return JSValue::encode(thisValue.toThisObject(exec));
}
-JSValue JSC_HOST_CALL objectProtoFuncHasOwnProperty(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectProtoFuncHasOwnProperty(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
- return jsBoolean(thisValue.toThisObject(exec)->hasOwnProperty(exec, Identifier(exec, exec->argument(0).toString(exec))));
+ return JSValue::encode(jsBoolean(thisValue.toThisObject(exec)->hasOwnProperty(exec, Identifier(exec, exec->argument(0).toString(exec)))));
}
-JSValue JSC_HOST_CALL objectProtoFuncIsPrototypeOf(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectProtoFuncIsPrototypeOf(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
if (!exec->argument(0).isObject())
- return jsBoolean(false);
+ return JSValue::encode(jsBoolean(false));
JSValue v = asObject(exec->argument(0))->prototype();
while (true) {
if (!v.isObject())
- return jsBoolean(false);
+ return JSValue::encode(jsBoolean(false));
if (v == thisObj)
- return jsBoolean(true);
+ return JSValue::encode(jsBoolean(true));
v = asObject(v)->prototype();
}
}
-JSValue JSC_HOST_CALL objectProtoFuncDefineGetter(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectProtoFuncDefineGetter(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
CallData callData;
- if (exec->argument(1).getCallData(callData) == CallTypeNone)
- return throwError(exec, SyntaxError, "invalid getter usage");
+ if (getCallData(exec->argument(1), callData) == CallTypeNone)
+ return throwVMError(exec, createSyntaxError(exec, "invalid getter usage"));
thisValue.toThisObject(exec)->defineGetter(exec, Identifier(exec, exec->argument(0).toString(exec)), asObject(exec->argument(1)));
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL objectProtoFuncDefineSetter(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectProtoFuncDefineSetter(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
CallData callData;
- if (exec->argument(1).getCallData(callData) == CallTypeNone)
- return throwError(exec, SyntaxError, "invalid setter usage");
+ if (getCallData(exec->argument(1), callData) == CallTypeNone)
+ return throwVMError(exec, createSyntaxError(exec, "invalid setter usage"));
thisValue.toThisObject(exec)->defineSetter(exec, Identifier(exec, exec->argument(0).toString(exec)), asObject(exec->argument(1)));
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL objectProtoFuncLookupGetter(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupGetter(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
- return thisValue.toThisObject(exec)->lookupGetter(exec, Identifier(exec, exec->argument(0).toString(exec)));
+ return JSValue::encode(thisValue.toThisObject(exec)->lookupGetter(exec, Identifier(exec, exec->argument(0).toString(exec))));
}
-JSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
- return thisValue.toThisObject(exec)->lookupSetter(exec, Identifier(exec, exec->argument(0).toString(exec)));
+ return JSValue::encode(thisValue.toThisObject(exec)->lookupSetter(exec, Identifier(exec, exec->argument(0).toString(exec))));
}
-JSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
- return jsBoolean(thisValue.toThisObject(exec)->propertyIsEnumerable(exec, Identifier(exec, exec->argument(0).toString(exec))));
+ return JSValue::encode(jsBoolean(thisValue.toThisObject(exec)->propertyIsEnumerable(exec, Identifier(exec, exec->argument(0).toString(exec)))));
}
-JSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
- return thisValue.toThisJSString(exec);
+ return JSValue::encode(thisValue.toThisJSString(exec));
}
-JSValue JSC_HOST_CALL objectProtoFuncToString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectProtoFuncToString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
- return jsMakeNontrivialString(exec, "[object ", thisValue.toThisObject(exec)->className(), "]");
+ return JSValue::encode(jsMakeNontrivialString(exec, "[object ", thisValue.toThisObject(exec)->className(), "]"));
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/ObjectPrototype.h b/JavaScriptCore/runtime/ObjectPrototype.h
index 8865d6b..0382ae4 100644
--- a/JavaScriptCore/runtime/ObjectPrototype.h
+++ b/JavaScriptCore/runtime/ObjectPrototype.h
@@ -36,7 +36,7 @@ namespace JSC {
bool m_hasNoPropertiesWithUInt32Names;
};
- JSValue JSC_HOST_CALL objectProtoFuncToString(ExecState*);
+ EncodedJSValue JSC_HOST_CALL objectProtoFuncToString(ExecState*);
} // namespace JSC
diff --git a/JavaScriptCore/runtime/RegExpConstructor.cpp b/JavaScriptCore/runtime/RegExpConstructor.cpp
index c79d5f8..24476d6 100644
--- a/JavaScriptCore/runtime/RegExpConstructor.cpp
+++ b/JavaScriptCore/runtime/RegExpConstructor.cpp
@@ -24,6 +24,7 @@
#include "ArrayPrototype.h"
#include "Error.h"
+#include "ExceptionHelpers.h"
#include "JSArray.h"
#include "JSFunction.h"
#include "JSString.h"
@@ -294,7 +295,7 @@ JSObject* constructRegExp(ExecState* exec, const ArgList& args)
if (arg0.inherits(&RegExpObject::info)) {
if (!arg1.isUndefined())
- return throwError(exec, TypeError, "Cannot supply flags when constructing one RegExp from another.");
+ return throwError(exec, createTypeError(exec, "Cannot supply flags when constructing one RegExp from another."));
return asObject(arg0);
}
@@ -303,13 +304,14 @@ JSObject* constructRegExp(ExecState* exec, const ArgList& args)
RefPtr<RegExp> regExp = RegExp::create(&exec->globalData(), pattern, flags);
if (!regExp->isValid())
- return throwError(exec, SyntaxError, makeString("Invalid regular expression: ", regExp->errorMessage()));
+ return throwError(exec, createSyntaxError(exec, makeString("Invalid regular expression: ", regExp->errorMessage())));
return new (exec) RegExpObject(exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->regExpStructure(), regExp.release());
}
-static JSObject* constructWithRegExpConstructor(ExecState* exec, JSObject*, const ArgList& args)
+static EncodedJSValue JSC_HOST_CALL constructWithRegExpConstructor(ExecState* exec)
{
- return constructRegExp(exec, args);
+ ArgList args(exec);
+ return JSValue::encode(constructRegExp(exec, args));
}
ConstructType RegExpConstructor::getConstructData(ConstructData& constructData)
@@ -319,10 +321,10 @@ ConstructType RegExpConstructor::getConstructData(ConstructData& constructData)
}
// ECMA 15.10.3
-static JSValue JSC_HOST_CALL callRegExpConstructor(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callRegExpConstructor(ExecState* exec)
{
ArgList args(exec);
- return constructRegExp(exec, args);
+ return JSValue::encode(constructRegExp(exec, args));
}
CallType RegExpConstructor::getCallData(CallData& callData)
diff --git a/JavaScriptCore/runtime/RegExpObject.cpp b/JavaScriptCore/runtime/RegExpObject.cpp
index acec966..4824944 100644
--- a/JavaScriptCore/runtime/RegExpObject.cpp
+++ b/JavaScriptCore/runtime/RegExpObject.cpp
@@ -22,6 +22,7 @@
#include "RegExpObject.h"
#include "Error.h"
+#include "ExceptionHelpers.h"
#include "JSArray.h"
#include "JSGlobalObject.h"
#include "JSString.h"
@@ -125,9 +126,9 @@ JSValue RegExpObject::exec(ExecState* exec)
return jsNull();
}
-static JSValue JSC_HOST_CALL callRegExpObject(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callRegExpObject(ExecState* exec)
{
- return asRegExpObject(exec->callee())->exec(exec);
+ return JSValue::encode(asRegExpObject(exec->callee())->exec(exec));
}
CallType RegExpObject::getCallData(CallData& callData)
@@ -143,7 +144,7 @@ bool RegExpObject::match(ExecState* exec)
UString input = !exec->argumentCount() ? regExpConstructor->input() : exec->argument(0).toString(exec);
if (input.isNull()) {
- throwError(exec, GeneralError, makeString("No input to ", toString(exec), "."));
+ throwError(exec, createError(exec, makeString("No input to ", toString(exec), ".")));
return false;
}
diff --git a/JavaScriptCore/runtime/RegExpPrototype.cpp b/JavaScriptCore/runtime/RegExpPrototype.cpp
index 0a531ac..9d78f59 100644
--- a/JavaScriptCore/runtime/RegExpPrototype.cpp
+++ b/JavaScriptCore/runtime/RegExpPrototype.cpp
@@ -38,10 +38,10 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(RegExpPrototype);
-static JSValue JSC_HOST_CALL regExpProtoFuncTest(ExecState*);
-static JSValue JSC_HOST_CALL regExpProtoFuncExec(ExecState*);
-static JSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState*);
-static JSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL regExpProtoFuncTest(ExecState*);
+static EncodedJSValue JSC_HOST_CALL regExpProtoFuncExec(ExecState*);
+static EncodedJSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState*);
+static EncodedJSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState*);
// ECMA 15.10.5
@@ -57,28 +57,28 @@ RegExpPrototype::RegExpPrototype(ExecState* exec, JSGlobalObject* globalObject,
}
// ------------------------------ Functions ---------------------------
-
-JSValue JSC_HOST_CALL regExpProtoFuncTest(ExecState* exec)
+
+EncodedJSValue JSC_HOST_CALL regExpProtoFuncTest(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&RegExpObject::info))
- return throwError(exec, TypeError);
- return asRegExpObject(thisValue)->test(exec);
+ return throwVMTypeError(exec);
+ return JSValue::encode(asRegExpObject(thisValue)->test(exec));
}
-JSValue JSC_HOST_CALL regExpProtoFuncExec(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL regExpProtoFuncExec(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&RegExpObject::info))
- return throwError(exec, TypeError);
- return asRegExpObject(thisValue)->exec(exec);
+ return throwVMTypeError(exec);
+ return JSValue::encode(asRegExpObject(thisValue)->exec(exec));
}
-JSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&RegExpObject::info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
RefPtr<RegExp> regExp;
JSValue arg0 = exec->argument(0);
@@ -86,7 +86,7 @@ JSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState* exec)
if (arg0.inherits(&RegExpObject::info)) {
if (!arg1.isUndefined())
- return throwError(exec, TypeError, "Cannot supply flags when constructing one RegExp from another.");
+ return throwVMError(exec, createTypeError(exec, "Cannot supply flags when constructing one RegExp from another."));
regExp = asRegExpObject(arg0)->regExp();
} else {
UString pattern = !exec->argumentCount() ? UString("") : arg0.toString(exec);
@@ -95,20 +95,20 @@ JSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState* exec)
}
if (!regExp->isValid())
- return throwError(exec, SyntaxError, makeString("Invalid regular expression: ", regExp->errorMessage()));
+ return throwVMError(exec, createSyntaxError(exec, makeString("Invalid regular expression: ", regExp->errorMessage())));
asRegExpObject(thisValue)->setRegExp(regExp.release());
asRegExpObject(thisValue)->setLastIndex(0);
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&RegExpObject::info)) {
if (thisValue.inherits(&RegExpPrototype::info))
- return jsNontrivialString(exec, "//");
- return throwError(exec, TypeError);
+ return JSValue::encode(jsNontrivialString(exec, "//"));
+ return throwVMTypeError(exec);
}
char postfix[5] = { '/', 0, 0, 0, 0 };
@@ -121,7 +121,7 @@ JSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState* exec)
postfix[index] = 'm';
UString source = asRegExpObject(thisValue)->get(exec, exec->propertyNames().source).toString(exec);
// If source is empty, use "/(?:)/" to avoid colliding with comment syntax
- return jsMakeNontrivialString(exec, "/", source.size() ? source : UString("(?:)"), postfix);
+ return JSValue::encode(jsMakeNontrivialString(exec, "/", source.size() ? source : UString("(?:)"), postfix));
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/StringConstructor.cpp b/JavaScriptCore/runtime/StringConstructor.cpp
index c1484c5..f02ab09 100644
--- a/JavaScriptCore/runtime/StringConstructor.cpp
+++ b/JavaScriptCore/runtime/StringConstructor.cpp
@@ -40,11 +40,11 @@ static NEVER_INLINE JSValue stringFromCharCodeSlowCase(ExecState* exec)
return jsString(exec, impl);
}
-static JSValue JSC_HOST_CALL stringFromCharCode(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL stringFromCharCode(ExecState* exec)
{
if (LIKELY(exec->argumentCount() == 1))
- return jsSingleCharacterString(exec, exec->argument(0).toUInt32(exec));
- return stringFromCharCodeSlowCase(exec);
+ return JSValue::encode(jsSingleCharacterString(exec, exec->argument(0).toUInt32(exec)));
+ return JSValue::encode(stringFromCharCodeSlowCase(exec));
}
ASSERT_CLASS_FITS_IN_CELL(StringConstructor);
@@ -66,11 +66,11 @@ StringConstructor::StringConstructor(ExecState* exec, JSGlobalObject* globalObje
}
// ECMA 15.5.2
-static JSObject* constructWithStringConstructor(ExecState* exec, JSObject*, const ArgList& args)
+static EncodedJSValue JSC_HOST_CALL constructWithStringConstructor(ExecState* exec)
{
- if (args.isEmpty())
- return new (exec) StringObject(exec, exec->lexicalGlobalObject()->stringObjectStructure());
- return new (exec) StringObject(exec, exec->lexicalGlobalObject()->stringObjectStructure(), args.at(0).toString(exec));
+ if (!exec->argumentCount())
+ return JSValue::encode(new (exec) StringObject(exec, exec->lexicalGlobalObject()->stringObjectStructure()));
+ return JSValue::encode(new (exec) StringObject(exec, exec->lexicalGlobalObject()->stringObjectStructure(), exec->argument(0).toString(exec)));
}
ConstructType StringConstructor::getConstructData(ConstructData& constructData)
@@ -80,11 +80,11 @@ ConstructType StringConstructor::getConstructData(ConstructData& constructData)
}
// ECMA 15.5.1
-static JSValue JSC_HOST_CALL callStringConstructor(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callStringConstructor(ExecState* exec)
{
if (!exec->argumentCount())
- return jsEmptyString(exec);
- return jsString(exec, exec->argument(0).toString(exec));
+ return JSValue::encode(jsEmptyString(exec));
+ return JSValue::encode(jsString(exec, exec->argument(0).toString(exec)));
}
CallType StringConstructor::getCallData(CallData& callData)
diff --git a/JavaScriptCore/runtime/StringPrototype.cpp b/JavaScriptCore/runtime/StringPrototype.cpp
index f90d908..5b90456 100644
--- a/JavaScriptCore/runtime/StringPrototype.cpp
+++ b/JavaScriptCore/runtime/StringPrototype.cpp
@@ -45,38 +45,38 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(StringPrototype);
-static JSValue JSC_HOST_CALL stringProtoFuncToString(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncCharAt(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncCharCodeAt(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncConcat(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncIndexOf(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncLastIndexOf(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncSearch(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncSlice(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncSplit(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncSubstr(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncSubstring(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncToLowerCase(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncToUpperCase(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncLocaleCompare(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncBig(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncSmall(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncBlink(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncBold(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncFixed(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncItalics(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncStrike(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncSub(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncSup(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncFontcolor(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncAnchor(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncLink(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncTrim(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncTrimLeft(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncTrimRight(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncToString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncCharAt(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncCharCodeAt(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncConcat(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncIndexOf(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncLastIndexOf(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncSearch(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncSlice(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncSplit(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncSubstr(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncSubstring(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncToLowerCase(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncToUpperCase(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncLocaleCompare(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncBig(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncSmall(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncBlink(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncBold(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncFixed(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncItalics(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncStrike(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncSub(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncSup(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncFontcolor(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncAnchor(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncLink(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncTrim(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncTrimLeft(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncTrimRight(ExecState*);
}
@@ -286,7 +286,7 @@ static ALWAYS_INLINE JSValue jsSpliceSubstringsWithSeparators(ExecState* exec, J
return jsString(exec, impl);
}
-JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSString* sourceVal = thisValue.toThisJSString(exec);
@@ -295,14 +295,14 @@ JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec)
UString replacementString;
CallData callData;
- CallType callType = replacement.getCallData(callData);
+ CallType callType = getCallData(replacement, callData);
if (callType == CallTypeNone)
replacementString = replacement.toString(exec);
if (pattern.inherits(&RegExpObject::info)) {
const UString& source = sourceVal->value(exec);
if (exec->hadException())
- return JSValue();
+ return JSValue::encode(JSValue());
RegExp* reg = asRegExpObject(pattern)->regExp();
bool global = reg->global();
@@ -321,7 +321,7 @@ JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec)
JSFunction* func = asFunction(replacement);
CachedCall cachedCall(exec, func, argCount, exec->exceptionSlot());
if (exec->hadException())
- return jsNull();
+ return JSValue::encode(jsNull());
while (true) {
int matchIndex;
int matchLen = 0;
@@ -413,25 +413,25 @@ JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec)
}
if (!lastIndex && replacements.isEmpty())
- return sourceVal;
+ return JSValue::encode(sourceVal);
if (static_cast<unsigned>(lastIndex) < source.size())
sourceRanges.append(StringRange(lastIndex, source.size() - lastIndex));
- return jsSpliceSubstringsWithSeparators(exec, sourceVal, source, sourceRanges.data(), sourceRanges.size(), replacements.data(), replacements.size());
+ return JSValue::encode(jsSpliceSubstringsWithSeparators(exec, sourceVal, source, sourceRanges.data(), sourceRanges.size(), replacements.data(), replacements.size()));
}
// Not a regular expression, so treat the pattern as a string.
UString patternString = pattern.toString(exec);
if (patternString.size() == 1 && callType == CallTypeNone)
- return sourceVal->replaceCharacter(exec, patternString[0], replacementString);
+ return JSValue::encode(sourceVal->replaceCharacter(exec, patternString[0], replacementString));
const UString& source = sourceVal->value(exec);
unsigned matchPos = source.find(patternString);
if (matchPos == UString::NotFound)
- return sourceVal;
+ return JSValue::encode(sourceVal);
int matchLen = patternString.size();
if (callType != CallTypeNone) {
@@ -445,24 +445,24 @@ JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec)
size_t matchEnd = matchPos + matchLen;
int ovector[2] = { matchPos, matchEnd };
- return jsString(exec, source.substr(0, matchPos), substituteBackreferences(replacementString, source, ovector, 0), source.substr(matchEnd));
+ return JSValue::encode(jsString(exec, source.substr(0, matchPos), substituteBackreferences(replacementString, source, ovector, 0), source.substr(matchEnd)));
}
-JSValue JSC_HOST_CALL stringProtoFuncToString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncToString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
// Also used for valueOf.
if (thisValue.isString())
- return thisValue;
+ return JSValue::encode(thisValue);
if (thisValue.inherits(&StringObject::info))
- return asStringObject(thisValue)->internalValue();
+ return JSValue::encode(asStringObject(thisValue)->internalValue());
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
}
-JSValue JSC_HOST_CALL stringProtoFuncCharAt(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncCharAt(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
@@ -471,16 +471,16 @@ JSValue JSC_HOST_CALL stringProtoFuncCharAt(ExecState* exec)
if (a0.isUInt32()) {
uint32_t i = a0.asUInt32();
if (i < len)
- return jsSingleCharacterSubstring(exec, s, i);
- return jsEmptyString(exec);
+ return JSValue::encode(jsSingleCharacterSubstring(exec, s, i));
+ return JSValue::encode(jsEmptyString(exec));
}
double dpos = a0.toInteger(exec);
if (dpos >= 0 && dpos < len)
- return jsSingleCharacterSubstring(exec, s, static_cast<unsigned>(dpos));
- return jsEmptyString(exec);
+ return JSValue::encode(jsSingleCharacterSubstring(exec, s, static_cast<unsigned>(dpos)));
+ return JSValue::encode(jsEmptyString(exec));
}
-JSValue JSC_HOST_CALL stringProtoFuncCharCodeAt(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncCharCodeAt(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
@@ -489,29 +489,29 @@ JSValue JSC_HOST_CALL stringProtoFuncCharCodeAt(ExecState* exec)
if (a0.isUInt32()) {
uint32_t i = a0.asUInt32();
if (i < len)
- return jsNumber(exec, s.data()[i]);
- return jsNaN(exec);
+ return JSValue::encode(jsNumber(exec, s.data()[i]));
+ return JSValue::encode(jsNaN(exec));
}
double dpos = a0.toInteger(exec);
if (dpos >= 0 && dpos < len)
- return jsNumber(exec, s[static_cast<int>(dpos)]);
- return jsNaN(exec);
+ return JSValue::encode(jsNumber(exec, s[static_cast<int>(dpos)]));
+ return JSValue::encode(jsNaN(exec));
}
-JSValue JSC_HOST_CALL stringProtoFuncConcat(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncConcat(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (thisValue.isString() && (exec->argumentCount() == 1)) {
JSValue v = exec->argument(0);
- return v.isString()
+ return JSValue::encode(v.isString()
? jsString(exec, asString(thisValue), asString(v))
- : jsString(exec, asString(thisValue), v.toString(exec));
+ : jsString(exec, asString(thisValue), v.toString(exec)));
}
- return jsString(exec, thisValue);
+ return JSValue::encode(jsString(exec, thisValue));
}
-JSValue JSC_HOST_CALL stringProtoFuncIndexOf(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncIndexOf(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
@@ -536,11 +536,11 @@ JSValue JSC_HOST_CALL stringProtoFuncIndexOf(ExecState* exec)
unsigned result = s.find(u2, pos);
if (result == UString::NotFound)
- return jsNumber(exec, -1);
- return jsNumber(exec, result);
+ return JSValue::encode(jsNumber(exec, -1));
+ return JSValue::encode(jsNumber(exec, result));
}
-JSValue JSC_HOST_CALL stringProtoFuncLastIndexOf(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncLastIndexOf(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
@@ -563,11 +563,11 @@ JSValue JSC_HOST_CALL stringProtoFuncLastIndexOf(ExecState* exec)
unsigned result = s.rfind(u2, static_cast<unsigned>(dpos));
if (result == UString::NotFound)
- return jsNumber(exec, -1);
- return jsNumber(exec, result);
+ return JSValue::encode(jsNumber(exec, -1));
+ return JSValue::encode(jsNumber(exec, result));
}
-JSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
@@ -594,8 +594,8 @@ JSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState* exec)
if (!(reg->global())) {
// case without 'g' flag is handled like RegExp.prototype.exec
if (pos < 0)
- return jsNull();
- return regExpConstructor->arrayOfMatches(exec);
+ return JSValue::encode(jsNull());
+ return JSValue::encode(regExpConstructor->arrayOfMatches(exec));
}
// return array of matches
@@ -613,13 +613,13 @@ JSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState* exec)
// if there are no matches at all, it's important to return
// Null instead of an empty array, because this matches
// other browsers and because Null is a false value.
- return jsNull();
+ return JSValue::encode(jsNull());
}
- return constructArray(exec, list);
+ return JSValue::encode(constructArray(exec, list));
}
-JSValue JSC_HOST_CALL stringProtoFuncSearch(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncSearch(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
@@ -642,10 +642,10 @@ JSValue JSC_HOST_CALL stringProtoFuncSearch(ExecState* exec)
int pos;
int matchLength = 0;
regExpConstructor->performMatch(reg.get(), u, 0, pos, matchLength);
- return jsNumber(exec, pos);
+ return JSValue::encode(jsNumber(exec, pos));
}
-JSValue JSC_HOST_CALL stringProtoFuncSlice(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncSlice(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
@@ -664,13 +664,13 @@ JSValue JSC_HOST_CALL stringProtoFuncSlice(ExecState* exec)
from = 0;
if (to > len)
to = len;
- return jsSubstring(exec, s, static_cast<unsigned>(from), static_cast<unsigned>(to) - static_cast<unsigned>(from));
+ return JSValue::encode(jsSubstring(exec, s, static_cast<unsigned>(from), static_cast<unsigned>(to) - static_cast<unsigned>(from)));
}
- return jsEmptyString(exec);
+ return JSValue::encode(jsEmptyString(exec));
}
-JSValue JSC_HOST_CALL stringProtoFuncSplit(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncSplit(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
@@ -686,7 +686,7 @@ JSValue JSC_HOST_CALL stringProtoFuncSplit(ExecState* exec)
RegExp* reg = asRegExpObject(a0)->regExp();
if (s.isEmpty() && reg->match(s, 0) >= 0) {
// empty string matched by regexp -> empty array
- return result;
+ return JSValue::encode(result);
}
unsigned pos = 0;
while (i != limit && pos < s.size()) {
@@ -713,7 +713,7 @@ JSValue JSC_HOST_CALL stringProtoFuncSplit(ExecState* exec)
if (u2.isEmpty()) {
if (s.isEmpty()) {
// empty separator matches empty string -> empty array
- return result;
+ return JSValue::encode(result);
}
while (i != limit && p0 < s.size() - 1)
result->put(exec, i++, jsSingleCharacterSubstring(exec, s, p0++));
@@ -731,10 +731,10 @@ JSValue JSC_HOST_CALL stringProtoFuncSplit(ExecState* exec)
if (i != limit)
result->put(exec, i++, jsSubstring(exec, s, p0, s.size() - p0));
- return result;
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL stringProtoFuncSubstr(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncSubstr(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
@@ -746,7 +746,7 @@ JSValue JSC_HOST_CALL stringProtoFuncSubstr(ExecState* exec)
double start = a0.toInteger(exec);
double length = a1.isUndefined() ? len : a1.toInteger(exec);
if (start >= len || length <= 0)
- return jsEmptyString(exec);
+ return JSValue::encode(jsEmptyString(exec));
if (start < 0) {
start += len;
if (start < 0)
@@ -754,10 +754,10 @@ JSValue JSC_HOST_CALL stringProtoFuncSubstr(ExecState* exec)
}
if (start + length > len)
length = len - start;
- return jsSubstring(exec, s, static_cast<unsigned>(start), static_cast<unsigned>(length));
+ return JSValue::encode(jsSubstring(exec, s, static_cast<unsigned>(start), static_cast<unsigned>(length)));
}
-JSValue JSC_HOST_CALL stringProtoFuncSubstring(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncSubstring(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
@@ -786,10 +786,10 @@ JSValue JSC_HOST_CALL stringProtoFuncSubstring(ExecState* exec)
end = start;
start = temp;
}
- return jsSubstring(exec, s, static_cast<unsigned>(start), static_cast<unsigned>(end) - static_cast<unsigned>(start));
+ return JSValue::encode(jsSubstring(exec, s, static_cast<unsigned>(start), static_cast<unsigned>(end) - static_cast<unsigned>(start)));
}
-JSValue JSC_HOST_CALL stringProtoFuncToLowerCase(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncToLowerCase(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSString* sVal = thisValue.toThisJSString(exec);
@@ -797,7 +797,7 @@ JSValue JSC_HOST_CALL stringProtoFuncToLowerCase(ExecState* exec)
int sSize = s.size();
if (!sSize)
- return sVal;
+ return JSValue::encode(sVal);
const UChar* sData = s.data();
Vector<UChar> buffer(sSize);
@@ -809,7 +809,7 @@ JSValue JSC_HOST_CALL stringProtoFuncToLowerCase(ExecState* exec)
buffer[i] = toASCIILower(c);
}
if (!(ored & ~0x7f))
- return jsString(exec, UString::adopt(buffer));
+ return JSValue::encode(jsString(exec, UString::adopt(buffer)));
bool error;
int length = Unicode::toLower(buffer.data(), sSize, sData, sSize, &error);
@@ -817,17 +817,17 @@ JSValue JSC_HOST_CALL stringProtoFuncToLowerCase(ExecState* exec)
buffer.resize(length);
length = Unicode::toLower(buffer.data(), length, sData, sSize, &error);
if (error)
- return sVal;
+ return JSValue::encode(sVal);
}
if (length == sSize) {
if (memcmp(buffer.data(), sData, length * sizeof(UChar)) == 0)
- return sVal;
+ return JSValue::encode(sVal);
} else
buffer.resize(length);
- return jsString(exec, UString::adopt(buffer));
+ return JSValue::encode(jsString(exec, UString::adopt(buffer)));
}
-JSValue JSC_HOST_CALL stringProtoFuncToUpperCase(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncToUpperCase(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSString* sVal = thisValue.toThisJSString(exec);
@@ -835,7 +835,7 @@ JSValue JSC_HOST_CALL stringProtoFuncToUpperCase(ExecState* exec)
int sSize = s.size();
if (!sSize)
- return sVal;
+ return JSValue::encode(sVal);
const UChar* sData = s.data();
Vector<UChar> buffer(sSize);
@@ -847,7 +847,7 @@ JSValue JSC_HOST_CALL stringProtoFuncToUpperCase(ExecState* exec)
buffer[i] = toASCIIUpper(c);
}
if (!(ored & ~0x7f))
- return jsString(exec, UString::adopt(buffer));
+ return JSValue::encode(jsString(exec, UString::adopt(buffer)));
bool error;
int length = Unicode::toUpper(buffer.data(), sSize, sData, sSize, &error);
@@ -855,99 +855,99 @@ JSValue JSC_HOST_CALL stringProtoFuncToUpperCase(ExecState* exec)
buffer.resize(length);
length = Unicode::toUpper(buffer.data(), length, sData, sSize, &error);
if (error)
- return sVal;
+ return JSValue::encode(sVal);
}
if (length == sSize) {
if (memcmp(buffer.data(), sData, length * sizeof(UChar)) == 0)
- return sVal;
+ return JSValue::encode(sVal);
} else
buffer.resize(length);
- return jsString(exec, UString::adopt(buffer));
+ return JSValue::encode(jsString(exec, UString::adopt(buffer)));
}
-JSValue JSC_HOST_CALL stringProtoFuncLocaleCompare(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncLocaleCompare(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (exec->argumentCount() < 1)
- return jsNumber(exec, 0);
+ return JSValue::encode(jsNumber(exec, 0));
UString s = thisValue.toThisString(exec);
JSValue a0 = exec->argument(0);
- return jsNumber(exec, localeCompare(s, a0.toString(exec)));
+ return JSValue::encode(jsNumber(exec, localeCompare(s, a0.toString(exec))));
}
-JSValue JSC_HOST_CALL stringProtoFuncBig(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncBig(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<big>", s, "</big>");
+ return JSValue::encode(jsMakeNontrivialString(exec, "<big>", s, "</big>"));
}
-JSValue JSC_HOST_CALL stringProtoFuncSmall(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncSmall(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<small>", s, "</small>");
+ return JSValue::encode(jsMakeNontrivialString(exec, "<small>", s, "</small>"));
}
-JSValue JSC_HOST_CALL stringProtoFuncBlink(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncBlink(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<blink>", s, "</blink>");
+ return JSValue::encode(jsMakeNontrivialString(exec, "<blink>", s, "</blink>"));
}
-JSValue JSC_HOST_CALL stringProtoFuncBold(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncBold(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<b>", s, "</b>");
+ return JSValue::encode(jsMakeNontrivialString(exec, "<b>", s, "</b>"));
}
-JSValue JSC_HOST_CALL stringProtoFuncFixed(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncFixed(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<tt>", s, "</tt>");
+ return JSValue::encode(jsMakeNontrivialString(exec, "<tt>", s, "</tt>"));
}
-JSValue JSC_HOST_CALL stringProtoFuncItalics(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncItalics(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<i>", s, "</i>");
+ return JSValue::encode(jsMakeNontrivialString(exec, "<i>", s, "</i>"));
}
-JSValue JSC_HOST_CALL stringProtoFuncStrike(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncStrike(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<strike>", s, "</strike>");
+ return JSValue::encode(jsMakeNontrivialString(exec, "<strike>", s, "</strike>"));
}
-JSValue JSC_HOST_CALL stringProtoFuncSub(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncSub(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<sub>", s, "</sub>");
+ return JSValue::encode(jsMakeNontrivialString(exec, "<sub>", s, "</sub>"));
}
-JSValue JSC_HOST_CALL stringProtoFuncSup(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncSup(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<sup>", s, "</sup>");
+ return JSValue::encode(jsMakeNontrivialString(exec, "<sup>", s, "</sup>"));
}
-JSValue JSC_HOST_CALL stringProtoFuncFontcolor(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncFontcolor(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
JSValue a0 = exec->argument(0);
- return jsMakeNontrivialString(exec, "<font color=\"", a0.toString(exec), "\">", s, "</font>");
+ return JSValue::encode(jsMakeNontrivialString(exec, "<font color=\"", a0.toString(exec), "\">", s, "</font>"));
}
-JSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
@@ -960,7 +960,7 @@ JSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState* exec)
UChar* buffer;
PassRefPtr<UStringImpl> impl = UStringImpl::tryCreateUninitialized(bufferSize, buffer);
if (!impl)
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
buffer[0] = '<';
buffer[1] = 'f';
buffer[2] = 'o';
@@ -984,21 +984,21 @@ JSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState* exec)
buffer[19 + stringSize] = 'n';
buffer[20 + stringSize] = 't';
buffer[21 + stringSize] = '>';
- return jsNontrivialString(exec, impl);
+ return JSValue::encode(jsNontrivialString(exec, impl));
}
- return jsMakeNontrivialString(exec, "<font size=\"", a0.toString(exec), "\">", s, "</font>");
+ return JSValue::encode(jsMakeNontrivialString(exec, "<font size=\"", a0.toString(exec), "\">", s, "</font>"));
}
-JSValue JSC_HOST_CALL stringProtoFuncAnchor(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncAnchor(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
JSValue a0 = exec->argument(0);
- return jsMakeNontrivialString(exec, "<a name=\"", a0.toString(exec), "\">", s, "</a>");
+ return JSValue::encode(jsMakeNontrivialString(exec, "<a name=\"", a0.toString(exec), "\">", s, "</a>"));
}
-JSValue JSC_HOST_CALL stringProtoFuncLink(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncLink(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
@@ -1011,7 +1011,7 @@ JSValue JSC_HOST_CALL stringProtoFuncLink(ExecState* exec)
UChar* buffer;
PassRefPtr<UStringImpl> impl = UStringImpl::tryCreateUninitialized(bufferSize, buffer);
if (!impl)
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
buffer[0] = '<';
buffer[1] = 'a';
buffer[2] = ' ';
@@ -1029,7 +1029,7 @@ JSValue JSC_HOST_CALL stringProtoFuncLink(ExecState* exec)
buffer[12 + linkTextSize + stringSize] = '/';
buffer[13 + linkTextSize + stringSize] = 'a';
buffer[14 + linkTextSize + stringSize] = '>';
- return jsNontrivialString(exec, impl);
+ return JSValue::encode(jsNontrivialString(exec, impl));
}
enum {
@@ -1063,22 +1063,22 @@ static inline JSValue trimString(ExecState* exec, JSValue thisValue, int trimKin
return jsString(exec, str.substr(left, right - left));
}
-JSValue JSC_HOST_CALL stringProtoFuncTrim(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncTrim(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
- return trimString(exec, thisValue, TrimLeft | TrimRight);
+ return JSValue::encode(trimString(exec, thisValue, TrimLeft | TrimRight));
}
-JSValue JSC_HOST_CALL stringProtoFuncTrimLeft(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncTrimLeft(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
- return trimString(exec, thisValue, TrimLeft);
+ return JSValue::encode(trimString(exec, thisValue, TrimLeft));
}
-JSValue JSC_HOST_CALL stringProtoFuncTrimRight(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncTrimRight(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
- return trimString(exec, thisValue, TrimRight);
+ return JSValue::encode(trimString(exec, thisValue, TrimRight));
}
diff --git a/JavaScriptCore/wtf/CMakeLists.txt b/JavaScriptCore/wtf/CMakeLists.txt
index f4d90ce..db69117 100644
--- a/JavaScriptCore/wtf/CMakeLists.txt
+++ b/JavaScriptCore/wtf/CMakeLists.txt
@@ -39,3 +39,7 @@ ADD_LIBRARY(${WTF_LIBRARY_NAME} ${WTF_LIBRARY_TYPE} ${WTF_SOURCES})
TARGET_LINK_LIBRARIES(${WTF_LIBRARY_NAME} ${WTF_LIBRARIES})
ADD_TARGET_PROPERTIES(${WTF_LIBRARY_NAME} LINK_FLAGS ${WTF_LINK_FLAGS})
+
+IF (SHARED_CORE)
+ INSTALL(TARGETS ${WTF_LIBRARY_NAME} DESTINATION lib)
+ENDIF ()
diff --git a/JavaScriptCore/wtf/Deque.h b/JavaScriptCore/wtf/Deque.h
index 3c3d378..745e0b6 100644
--- a/JavaScriptCore/wtf/Deque.h
+++ b/JavaScriptCore/wtf/Deque.h
@@ -72,6 +72,7 @@ namespace WTF {
T& first() { ASSERT(m_start != m_end); return m_buffer.buffer()[m_start]; }
const T& first() const { ASSERT(m_start != m_end); return m_buffer.buffer()[m_start]; }
+ T takeFirst();
template<typename U> void append(const U&);
template<typename U> void prepend(const U&);
@@ -427,6 +428,14 @@ namespace WTF {
checkValidity();
}
+ template<typename T>
+ inline T Deque<T>::takeFirst()
+ {
+ T oldFirst = first();
+ removeFirst();
+ return oldFirst;
+ }
+
template<typename T> template<typename U>
inline void Deque<T>::append(const U& value)
{
diff --git a/JavaScriptCore/wtf/MainThread.cpp b/JavaScriptCore/wtf/MainThread.cpp
index 6178420..a5f2346 100644
--- a/JavaScriptCore/wtf/MainThread.cpp
+++ b/JavaScriptCore/wtf/MainThread.cpp
@@ -149,8 +149,7 @@ void dispatchFunctionsFromMainThread()
MutexLocker locker(mainThreadFunctionQueueMutex());
if (!functionQueue().size())
break;
- invocation = functionQueue().first();
- functionQueue().removeFirst();
+ invocation = functionQueue().takeFirst();
}
invocation.function(invocation.context);
diff --git a/JavaScriptCore/wtf/MathExtras.h b/JavaScriptCore/wtf/MathExtras.h
index 1f77b61..0222a10 100644
--- a/JavaScriptCore/wtf/MathExtras.h
+++ b/JavaScriptCore/wtf/MathExtras.h
@@ -190,7 +190,7 @@ inline float deg2turn(float d) { return d / 360.0f; }
inline float rad2grad(float r) { return r * 200.0f / piFloat; }
inline float grad2rad(float g) { return g * piFloat / 200.0f; }
-#if !COMPILER(MSVC) && !COMPILER(WINSCW) && !(COMPILER(RVCT) && OS(SYMBIAN))
+#if !COMPILER(MSVC) && !COMPILER(WINSCW) && !(COMPILER(RVCT) && (OS(SYMBIAN) || PLATFORM(BREWMP)))
using std::isfinite;
using std::isinf;
using std::isnan;
diff --git a/JavaScriptCore/wtf/MessageQueue.h b/JavaScriptCore/wtf/MessageQueue.h
index 48bd10a..13ce1e8 100644
--- a/JavaScriptCore/wtf/MessageQueue.h
+++ b/JavaScriptCore/wtf/MessageQueue.h
@@ -163,9 +163,7 @@ namespace WTF {
if (m_queue.isEmpty())
return 0;
- DataType* message = m_queue.first();
- m_queue.removeFirst();
- return message;
+ return m_queue.takeFirst();
}
template<typename DataType>
diff --git a/JavaScriptCore/wtf/OwnPtrCommon.h b/JavaScriptCore/wtf/OwnPtrCommon.h
index c59fdc5..37c135d 100644
--- a/JavaScriptCore/wtf/OwnPtrCommon.h
+++ b/JavaScriptCore/wtf/OwnPtrCommon.h
@@ -41,9 +41,11 @@ typedef struct HRGN__* HRGN;
#if PLATFORM(BREWMP)
// Forward delcarations at this point avoid the need to include BREW includes
// in WTF headers.
+typedef struct _ISocket ISocket;
typedef struct _IFileMgr IFileMgr;
typedef struct _IFile IFile;
typedef struct IBitmap IBitmap;
+typedef struct ISSL ISSL;
#endif
namespace WTF {
@@ -69,6 +71,8 @@ namespace WTF {
void deleteOwnedPtr(IFileMgr*);
void deleteOwnedPtr(IFile*);
void deleteOwnedPtr(IBitmap*);
+ void deleteOwnedPtr(ISSL*);
+ void deleteOwnedPtr(ISocket*);
#endif
} // namespace WTF
diff --git a/JavaScriptCore/wtf/Platform.h b/JavaScriptCore/wtf/Platform.h
index 4321943..8c125c1 100644
--- a/JavaScriptCore/wtf/Platform.h
+++ b/JavaScriptCore/wtf/Platform.h
@@ -713,11 +713,11 @@
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TIMEB_H 1
-#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+#if !defined(TARGETING_TIGER) && !defined(TARGETING_LEOPARD)
#define HAVE_DISPATCH_H 1
-#if !PLATFORM(IPHONE) && !PLATFORM(QT)
+#if !PLATFORM(IPHONE)
#define HAVE_MADV_FREE_REUSE 1
#define HAVE_MADV_FREE 1
#define HAVE_PTHREAD_SETNAME_NP 1
@@ -982,15 +982,16 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */
#define ENABLE_JIT_OPTIMIZE_MOD 1
#endif
#endif
+#if (CPU(X86) && USE(JSVALUE32_64)) || (CPU(X86_64) && USE(JSVALUE64))
+#define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 1
+#endif
#if ENABLE(JIT)
#ifndef ENABLE_JIT_OPTIMIZE_CALL
#define ENABLE_JIT_OPTIMIZE_CALL 1
#endif
#ifndef ENABLE_JIT_OPTIMIZE_NATIVE_CALL
-#if PLATFORM(MAC)
-#define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 1
-#endif
+#define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 0
#endif
#ifndef ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS
#define ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS 1
@@ -1046,17 +1047,13 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */
#define ENABLE_PAN_SCROLLING 1
#endif
-/* Use the QXmlStreamReader implementation for XMLTokenizer */
+/* Use the QXmlStreamReader implementation for XMLDocumentParser */
/* Use the QXmlQuery implementation for XSLTProcessor */
#if PLATFORM(QT)
#define WTF_USE_QXMLSTREAM 1
#define WTF_USE_QXMLQUERY 1
#endif
-#if !PLATFORM(QT)
-#define WTF_USE_FONT_FAST_PATH 1
-#endif
-
/* Accelerated compositing */
#if PLATFORM(MAC)
#if !defined(BUILDING_ON_TIGER)
diff --git a/JavaScriptCore/wtf/RandomNumber.cpp b/JavaScriptCore/wtf/RandomNumber.cpp
index fc48263..b20652b 100644
--- a/JavaScriptCore/wtf/RandomNumber.cpp
+++ b/JavaScriptCore/wtf/RandomNumber.cpp
@@ -48,20 +48,6 @@ extern "C" {
namespace WTF {
-double weakRandomNumber()
-{
-#if COMPILER(MSVC) && defined(_CRT_RAND_S)
- // rand_s is incredibly slow on windows so we fall back on rand for Math.random
- return (rand() + (rand() / (RAND_MAX + 1.0))) / (RAND_MAX + 1.0);
-#elif PLATFORM(BREWMP)
- uint32_t bits;
- GETRAND(reinterpret_cast<byte*>(&bits), sizeof(uint32_t));
- return static_cast<double>(bits) / (static_cast<double>(std::numeric_limits<uint32_t>::max()) + 1.0);
-#else
- return randomNumber();
-#endif
-}
-
double randomNumber()
{
#if !ENABLE(JSC_MULTIPLE_THREADS)
diff --git a/JavaScriptCore/wtf/RandomNumber.h b/JavaScriptCore/wtf/RandomNumber.h
index e54e9ae..f2e7e8f 100644
--- a/JavaScriptCore/wtf/RandomNumber.h
+++ b/JavaScriptCore/wtf/RandomNumber.h
@@ -32,14 +32,8 @@ namespace WTF {
// cryptographically secure if possible on the target platform
double randomNumber();
- // Returns a pseudo-random number in the range [0, 1), attempts to
- // produce a reasonable "random" number fast.
- // We only need this because rand_s is so slow on windows.
- double weakRandomNumber();
-
}
using WTF::randomNumber;
-using WTF::weakRandomNumber;
#endif
diff --git a/JavaScriptCore/wtf/ThreadingPthreads.cpp b/JavaScriptCore/wtf/ThreadingPthreads.cpp
index 7ff9266..d01cc4a 100644
--- a/JavaScriptCore/wtf/ThreadingPthreads.cpp
+++ b/JavaScriptCore/wtf/ThreadingPthreads.cpp
@@ -235,7 +235,21 @@ ThreadIdentifier currentThread()
Mutex::Mutex()
{
- pthread_mutex_init(&m_mutex, NULL);
+#if PTHREAD_MUTEX_NORMAL == PTHREAD_MUTEX_DEFAULT
+
+ pthread_mutex_init(&m_mutex, 0);
+
+#else
+
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_init(&attr);
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
+
+ pthread_mutex_init(&m_mutex, &attr);
+
+ pthread_mutexattr_destroy(&attr);
+
+#endif
}
Mutex::~Mutex()
diff --git a/JavaScriptCore/wtf/Vector.h b/JavaScriptCore/wtf/Vector.h
index 4d9ea61..b653001 100644
--- a/JavaScriptCore/wtf/Vector.h
+++ b/JavaScriptCore/wtf/Vector.h
@@ -699,13 +699,17 @@ namespace WTF {
return *this;
}
+ inline bool typelessPointersAreEqual(const void* a, const void* b) { return a == b; }
+
template<typename T, size_t inlineCapacity>
template<size_t otherCapacity>
Vector<T, inlineCapacity>& Vector<T, inlineCapacity>::operator=(const Vector<T, otherCapacity>& other)
{
- if (&other == this)
- return *this;
-
+ // If the inline capacities match, we should call the more specific
+ // template. If the inline capacities don't match, the two objects
+ // shouldn't be allocated the same address.
+ ASSERT(!typelessPointersAreEqual(&other, this));
+
if (size() > other.size())
shrink(other.size());
else if (other.size() > capacity()) {
diff --git a/JavaScriptCore/wtf/brew/OwnPtrBrew.cpp b/JavaScriptCore/wtf/brew/OwnPtrBrew.cpp
index c8384e1..28046bd 100644
--- a/JavaScriptCore/wtf/brew/OwnPtrBrew.cpp
+++ b/JavaScriptCore/wtf/brew/OwnPtrBrew.cpp
@@ -28,6 +28,8 @@
#include <AEEBitmap.h>
#include <AEEFile.h>
+#include <AEENet.h>
+#include <AEESSL.h>
#include <AEEStdLib.h>
namespace WTF {
@@ -50,4 +52,16 @@ void deleteOwnedPtr(IBitmap* ptr)
IBitmap_Release(ptr);
}
+void deleteOwnedPtr(ISSL* ptr)
+{
+ if (ptr)
+ ISSL_Release(ptr);
+}
+
+void deleteOwnedPtr(ISocket* ptr)
+{
+ if (ptr)
+ ISOCKET_Release(ptr);
+}
+
}
diff --git a/JavaScriptCore/wtf/gtk/ThreadingGtk.cpp b/JavaScriptCore/wtf/gtk/ThreadingGtk.cpp
index 0c5cf0c..981eacb 100644
--- a/JavaScriptCore/wtf/gtk/ThreadingGtk.cpp
+++ b/JavaScriptCore/wtf/gtk/ThreadingGtk.cpp
@@ -36,17 +36,20 @@
#include "HashMap.h"
#include "MainThread.h"
#include "RandomNumberSeed.h"
+#include <wtf/StdLibExtras.h>
#include <glib.h>
#include <limits.h>
namespace WTF {
+typedef HashMap<ThreadIdentifier, GThread*> ThreadMap;
+
static Mutex* atomicallyInitializedStaticMutex;
static Mutex& threadMapMutex()
{
- static Mutex mutex;
+ DEFINE_STATIC_LOCAL(Mutex, mutex, ());
return mutex;
}
@@ -74,9 +77,9 @@ void unlockAtomicallyInitializedStaticMutex()
atomicallyInitializedStaticMutex->unlock();
}
-static HashMap<ThreadIdentifier, GThread*>& threadMap()
+static ThreadMap& threadMap()
{
- static HashMap<ThreadIdentifier, GThread*> map;
+ DEFINE_STATIC_LOCAL(ThreadMap, map, ());
return map;
}
@@ -84,7 +87,7 @@ static ThreadIdentifier identifierByGthreadHandle(GThread*& thread)
{
MutexLocker locker(threadMapMutex());
- HashMap<ThreadIdentifier, GThread*>::iterator i = threadMap().begin();
+ ThreadMap::iterator i = threadMap().begin();
for (; i != threadMap().end(); ++i) {
if (i->second == thread)
return i->first;
diff --git a/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h b/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h
index 97c42b7..aa203a2 100644
--- a/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h
+++ b/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h
@@ -73,6 +73,7 @@ typedef uint32_t UChar32;
#define U16_LEAD(supplementary) (UChar)(((supplementary)>>10)+0xd7c0)
#define U16_TRAIL(supplementary) (UChar)(((supplementary)&0x3ff)|0xdc00)
+#define U16_LENGTH(c) ((uint32_t)(c) <= 0xffff ? 1 : 2)
#define U_IS_SURROGATE(c) (((c)&0xfffff800)==0xd800)
#define U16_IS_SINGLE(c) !U_IS_SURROGATE(c)
diff --git a/JavaScriptCore/wtf/unicode/wince/UnicodeWince.h b/JavaScriptCore/wtf/unicode/wince/UnicodeWince.h
index db656ec..5bed9e8 100644
--- a/JavaScriptCore/wtf/unicode/wince/UnicodeWince.h
+++ b/JavaScriptCore/wtf/unicode/wince/UnicodeWince.h
@@ -38,6 +38,7 @@
#define U16_LEAD(supplementary) (UChar)(((supplementary) >> 10) + 0xd7c0)
#define U16_TRAIL(supplementary) (UChar)(((supplementary) & 0x3ff) | 0xdc00)
+#define U16_LENGTH(c) ((uint32_t)(c) <= 0xffff ? 1 : 2)
#define U_IS_SURROGATE(c) (((c) & 0xfffff800) == 0xd800)
#define U16_IS_SURROGATE(c) U_IS_SURROGATE(c)