From a909c6727978e077bfbfa7808d4ead09005bfe0b Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Tue, 15 May 2012 10:58:22 +0200 Subject: [PATCH] Remove String::get() --- qmljs_objects.cpp | 7 +------ qmljs_objects.h | 2 -- qmljs_runtime.cpp | 4 ++-- qv4ecmaobjects.cpp | 2 +- qv4isel.cpp | 2 +- 5 files changed, 5 insertions(+), 12 deletions(-) diff --git a/qmljs_objects.cpp b/qmljs_objects.cpp index 2e77b4d..3439ae7 100644 --- a/qmljs_objects.cpp +++ b/qmljs_objects.cpp @@ -7,11 +7,6 @@ using namespace QQmlJS::VM; -String *String::get(Context *ctx, const QString &s) -{ - return ctx->engine->newString(s); -} - Object::~Object() { delete members; @@ -196,7 +191,7 @@ ExecutionEngine::ExecutionEngine() stringCtor = StringCtor::create(this); numberCtor = NumberCtor::create(this); - String *prototype = String::get(rootContext, QLatin1String("prototype")); + String *prototype = identifier(QLatin1String("prototype")); objectCtor.objectValue->get(prototype, &objectPrototype); stringCtor.objectValue->get(prototype, &stringPrototype); diff --git a/qmljs_objects.h b/qmljs_objects.h index 9326e9a..ae4efab 100644 --- a/qmljs_objects.h +++ b/qmljs_objects.h @@ -41,8 +41,6 @@ struct String { return _hashValue; } - static String *get(Context *ctx, const QString &s); - private: QString _text; mutable unsigned _hashValue; diff --git a/qmljs_runtime.cpp b/qmljs_runtime.cpp index 8054a60..2c28359 100644 --- a/qmljs_runtime.cpp +++ b/qmljs_runtime.cpp @@ -169,7 +169,7 @@ double __qmljs_string_to_number(Context *, String *string) void __qmljs_string_from_number(Context *ctx, Value *result, double number) { - String *string = String::get(ctx, QString::number(number, 'g', 16)); + String *string = ctx->engine->newString(QString::number(number, 'g', 16)); __qmljs_init_string(result, string); } @@ -187,7 +187,7 @@ bool __qmljs_string_equal(Context *, String *left, String *right) String *__qmljs_string_concat(Context *ctx, String *first, String *second) { - return String::get(ctx, first->toQString() + second->toQString()); + return ctx->engine->newString(first->toQString() + second->toQString()); } bool __qmljs_is_function(Context *, const Value *value) diff --git a/qv4ecmaobjects.cpp b/qv4ecmaobjects.cpp index 74d1484..4e215ef 100644 --- a/qv4ecmaobjects.cpp +++ b/qv4ecmaobjects.cpp @@ -69,7 +69,7 @@ void StringCtor::call(Context *ctx) { const Value arg = ctx->argument(0); if (arg.is(UNDEFINED_TYPE)) - __qmljs_init_string(&ctx->result, String::get(ctx, QString())); + __qmljs_init_string(&ctx->result, ctx->engine->newString(QString())); else __qmljs_to_string(ctx, &ctx->result, &arg); } diff --git a/qv4isel.cpp b/qv4isel.cpp index d99bfc2..3e8d27a 100644 --- a/qv4isel.cpp +++ b/qv4isel.cpp @@ -635,7 +635,7 @@ void InstructionSelection::visitMove(IR::Move *s) amd64_mov_reg_reg(_codePtr, AMD64_RDI, AMD64_R14, 8); loadTempAddress(AMD64_RSI, base); amd64_mov_reg_imm(_codePtr, AMD64_RDX, identifier(*m->name)); - amd64_mov_reg_imm(_codePtr, AMD64_RCX, VM::String::get(_engine->rootContext, *str->value)); + amd64_mov_reg_imm(_codePtr, AMD64_RCX, _engine->newString(*str->value)); amd64_call_code(_codePtr, __qmljs_set_property_string); return; } else if (IR::Temp *t = s->source->asTemp()) { -- 2.7.4