Allow the compiler to inline
authorLars Knoll <lars.knoll@digia.com>
Mon, 17 Dec 2012 09:03:37 +0000 (10:03 +0100)
committerSimon Hausmann <simon.hausmann@digia.com>
Mon, 17 Dec 2012 09:45:45 +0000 (10:45 +0100)
use String::isEqualTo instead of qmljs_string_equal to
allow for inlining.

Change-Id: I55d41ab34f1e04cb0f752d8018e3ce9b11a90d1d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
qmljs_environment.cpp
qmljs_runtime.cpp
qmljs_value.cpp

index e2bae58..435257b 100644 (file)
@@ -84,11 +84,11 @@ bool ExecutionContext::hasBinding(String *name) const
         return false;
 
     for (unsigned int i = 0; i < function->varCount; ++i) {
-        if (__qmljs_string_equal(function->varList[i], name))
+        if (function->varList[i]->isEqualTo(name))
             return true;
     }
     for (unsigned int i = 0; i < function->formalParameterCount; ++i) {
-        if (__qmljs_string_equal(function->formalParameterList[i], name))
+        if (function->formalParameterList[i]->isEqualTo(name))
             return true;
     }
     if (activation)
@@ -116,13 +116,13 @@ bool ExecutionContext::setMutableBinding(ExecutionContext *scope, String *name,
 {
     // ### throw if scope->strict is true, and it would change an immutable binding
     for (unsigned int i = 0; i < variableCount(); ++i) {
-        if (__qmljs_string_equal(variables()[i], name)) {
+        if (variables()[i]->isEqualTo(name)) {
             locals[i] = value;
             return true;
         }
     }
     for (unsigned int i = 0; i < formalCount(); ++i) {
-        if (__qmljs_string_equal(formals()[i], name)) {
+        if (formals()[i]->isEqualTo(name)) {
             arguments[i] = value;
             return true;
         }
@@ -141,11 +141,11 @@ Value ExecutionContext::getBindingValue(ExecutionContext *scope, String *name, b
     assert(function);
 
     for (unsigned int i = 0; i < variableCount(); ++i) {
-        if (__qmljs_string_equal(variables()[i], name))
+        if (variables()[i]->isEqualTo(name))
             return locals[i];
     }
     for (unsigned int i = 0; i < formalCount(); ++i) {
-        if (__qmljs_string_equal(formals()[i], name))
+        if (formals()[i]->isEqualTo(name))
             return arguments[i];
     }
     if (activation) {
@@ -285,10 +285,10 @@ Value ExecutionContext::getProperty(String *name)
         }
 
         for (unsigned int i = 0; i < ctx->variableCount(); ++i)
-            if (__qmljs_string_equal(ctx->variables()[i], name))
+            if (ctx->variables()[i]->isEqualTo(name))
                 return ctx->locals[i];
         for (unsigned int i = 0; i < ctx->formalCount(); ++i)
-            if (__qmljs_string_equal(ctx->formals()[i], name))
+            if (ctx->formals()[i]->isEqualTo(name))
                 return ctx->arguments[i];
         if (ctx->activation) {
             bool hasProperty = false;
@@ -319,10 +319,10 @@ Value ExecutionContext::getPropertyNoThrow(String *name)
         }
 
         for (unsigned int i = 0; i < ctx->variableCount(); ++i)
-            if (__qmljs_string_equal(ctx->variables()[i], name))
+            if (ctx->variables()[i]->isEqualTo(name))
                 return ctx->locals[i];
         for (unsigned int i = 0; i < ctx->formalCount(); ++i)
-            if (__qmljs_string_equal(ctx->formals()[i], name))
+            if (ctx->formals()[i]->isEqualTo(name))
                 return ctx->arguments[i];
         if (ctx->activation) {
             bool hasProperty = false;
index 21aa1c2..17292d4 100644 (file)
@@ -660,7 +660,7 @@ uint __qmljs_equal(Value x, Value y, ExecutionContext *ctx)
         case Value::Integer_Type:
             return x.integerValue() == y.integerValue();
         case Value::String_Type:
-            return __qmljs_string_equal(x.stringValue(), y.stringValue());
+            return x.stringValue()->isEqualTo(y.stringValue());
         case Value::Object_Type:
             return x.objectValue() == y.objectValue();
         default: // double
index 32c0ca6..9ea4be1 100644 (file)
@@ -83,7 +83,7 @@ bool Value::sameValue(Value other) {
     if (val == other.val)
         return true;
     if (isString() && other.isString())
-        return __qmljs_string_equal(stringValue(), other.stringValue());
+        return stringValue()->isEqualTo(other.stringValue());
     return false;
 }