diff options
author | Robin Burchell <robin.burchell@viroteck.net> | 2015-06-24 14:44:26 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-06-24 19:24:42 +0000 |
commit | 29ecb180523869e746ff43a523a16eb4bae918f2 (patch) | |
tree | 45ac2f7db16626041564a3e114d437fb616d209c /tests/benchmarks/script/qjsvalue/tst_qjsvalue.cpp | |
parent | ac80efb8b9018d1bee05ed72f0c1653ad33d4b43 (diff) |
QJSValue: Remove no-longer-existent v8 from benchmark.
Change-Id: Ie83a4ec1d3eb20297bbb5a4a6a400091d9568a1f
Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
Diffstat (limited to 'tests/benchmarks/script/qjsvalue/tst_qjsvalue.cpp')
-rw-r--r-- | tests/benchmarks/script/qjsvalue/tst_qjsvalue.cpp | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/tests/benchmarks/script/qjsvalue/tst_qjsvalue.cpp b/tests/benchmarks/script/qjsvalue/tst_qjsvalue.cpp index a8e99b5cf9..b5147dbf01 100644 --- a/tests/benchmarks/script/qjsvalue/tst_qjsvalue.cpp +++ b/tests/benchmarks/script/qjsvalue/tst_qjsvalue.cpp @@ -34,12 +34,6 @@ #include <qtest.h> #include <QJSEngine> #include <QJSValue> -#include <private/v8.h> - -QT_BEGIN_NAMESPACE -extern Q_QML_EXPORT v8::Local<v8::Context> qt_QJSEngineV8Context(QJSEngine *); -extern Q_QML_EXPORT v8::Local<v8::Value> qt_QJSValueV8Value(const QJSValue &); -QT_END_NAMESPACE class tst_QJSValue : public QObject { @@ -49,16 +43,12 @@ public: private slots: void fillArray(); - void fillArray_V8(); void property(); - void property_V8(); void setProperty(); - void setProperty_V8(); void call(); - void call_V8(); }; void tst_QJSValue::fillArray() @@ -72,20 +62,6 @@ void tst_QJSValue::fillArray() } } -void tst_QJSValue::fillArray_V8() -{ - QJSEngine eng; - static const int ArrayLength = 10000; - QJSValue array = eng.newArray(ArrayLength); - - v8::HandleScope handleScope; - v8::Local<v8::Array> v8array = qt_QJSValueV8Value(array).As<v8::Array>(); - QBENCHMARK { - for (int i = 0; i < ArrayLength; ++i) - v8array->Set(i, v8::Number::New(i)); - } -} - void tst_QJSValue::property() { QJSEngine eng; @@ -98,23 +74,6 @@ void tst_QJSValue::property() } } -void tst_QJSValue::property_V8() -{ - QJSEngine eng; - QJSValue object = eng.newObject(); - QString propertyName = QString::fromLatin1("foo"); - object.setProperty(propertyName, 123); - QVERIFY(object.property(propertyName).isNumber()); - - v8::HandleScope handleScope; - v8::Local<v8::Object> v8object = qt_QJSValueV8Value(object).As<v8::Object>(); - v8::Local<v8::String> v8propertyName = v8::String::New("foo"); - QVERIFY(v8object->Get(v8propertyName)->IsNumber()); - QBENCHMARK { - v8object->Get(v8propertyName); - } -} - void tst_QJSValue::setProperty() { QJSEngine eng; @@ -126,24 +85,6 @@ void tst_QJSValue::setProperty() } } -void tst_QJSValue::setProperty_V8() -{ - QJSEngine eng; - QJSValue object = eng.newObject(); - - v8::HandleScope handleScope; - // A context scope is needed for v8::Object::Set(), otherwise we crash. - v8::Local<v8::Context> context = qt_QJSEngineV8Context(&eng); - v8::Context::Scope contextScope(context); - - v8::Local<v8::Object> v8object = qt_QJSValueV8Value(object).As<v8::Object>(); - v8::Local<v8::String> v8propertyName = v8::String::New("foo"); - v8::Local<v8::Value> v8value = v8::Number::New(123); - QBENCHMARK { - v8object->Set(v8propertyName, v8value); - } -} - #define TEST_FUNCTION_SOURCE "(function() { return 123; })" void tst_QJSValue::call() @@ -158,24 +99,6 @@ void tst_QJSValue::call() } } -void tst_QJSValue::call_V8() -{ - QJSEngine eng; - QJSValue fun = eng.evaluate(TEST_FUNCTION_SOURCE); - QVERIFY(fun.isCallable()); - - v8::HandleScope handleScope; - v8::Local<v8::Context> context = qt_QJSEngineV8Context(&eng); - v8::Context::Scope contextScope(context); - - v8::Local<v8::Function> v8fun = qt_QJSValueV8Value(fun).As<v8::Function>(); - v8::Local<v8::Object> v8thisObject = v8::Object::New(); - QVERIFY(v8fun->Call(v8thisObject, /*argc=*/0, /*argv=*/0)->IsNumber()); - QBENCHMARK { - v8fun->Call(v8thisObject, /*argc=*/0, /*argv=*/0); - } -} - QTEST_MAIN(tst_QJSValue) #include "tst_qjsvalue.moc" |