Title: [178928] trunk
Revision
178928
Author
commit-qu...@webkit.org
Date
2015-01-22 11:34:34 -0800 (Thu, 22 Jan 2015)

Log Message

Unreviewed, rolling out r178894.
https://bugs.webkit.org/show_bug.cgi?id=140775

Broke JSC and bindings tests (Requested by ap_ on #webkit).

Reverted changeset:

"put_by_val_direct need to check the property is index or not
for using putDirect / putDirectIndex"
https://bugs.webkit.org/show_bug.cgi?id=140426
http://trac.webkit.org/changeset/178894

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (178927 => 178928)


--- trunk/LayoutTests/ChangeLog	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/LayoutTests/ChangeLog	2015-01-22 19:34:34 UTC (rev 178928)
@@ -1,3 +1,17 @@
+2015-01-22  Commit Queue  <commit-qu...@webkit.org>
+
+        Unreviewed, rolling out r178894.
+        https://bugs.webkit.org/show_bug.cgi?id=140775
+
+        Broke JSC and bindings tests (Requested by ap_ on #webkit).
+
+        Reverted changeset:
+
+        "put_by_val_direct need to check the property is index or not
+        for using putDirect / putDirectIndex"
+        https://bugs.webkit.org/show_bug.cgi?id=140426
+        http://trac.webkit.org/changeset/178894
+
 2015-01-22  Mark Lam  <mark....@apple.com>
 
         BytecodeGenerator::initializeCapturedVariable() sets a misleading value for the 5th operand of op_put_to_scope.

Deleted: trunk/LayoutTests/js/dfg-put-by-val-direct-with-edge-numbers-expected.txt (178927 => 178928)


--- trunk/LayoutTests/js/dfg-put-by-val-direct-with-edge-numbers-expected.txt	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/LayoutTests/js/dfg-put-by-val-direct-with-edge-numbers-expected.txt	2015-01-22 19:34:34 UTC (rev 178928)
@@ -1,60 +0,0 @@
-Test that a object accepts DFG PutByValueDirect operation with edge numbers.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS lookupWithKey(-0x80000001) is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey(-0x80000000) is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey(-1) is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey(0) is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey(1) is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey(0x7fffffff) is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey(0x80000000) is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey(0xfffffffd) is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey(0xfffffffe) is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey(0xffffffff) is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey(0x100000000) is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey("-2147483649") is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey("-2147483648") is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey("-1") is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey("0") is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey("1") is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey("2147483647") is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey("2147483648") is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey("4294967293") is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey("4294967294") is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey("4294967295") is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey("4294967296") is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey(Number.MIN_VALUE) is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey(Number.MAX_VALUE) is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey(Number.MIN_SAFE_INTEGER) is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey(Number.MAX_SAFE_INTEGER) is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey(Number.POSITIVE_INFINITY) is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey(Number.NEGATIVE_INFINITY) is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey(Number.NaN) is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey(Number.EPSILON) is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey(+0.0) is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey(-0.0) is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey(0.1) is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey(-0.1) is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey(4.2) is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey(-4.2) is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey("5e-324") is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey("1.7976931348623157e+308") is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey("-9007199254740991") is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey("9007199254740991") is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey("Infinity") is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey("-Infinity") is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey("NaN") is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey("2.220446049250313e-16") is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey("+0.0") is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey("-0.0") is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey("0.1") is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey("-0.1") is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey("4.2") is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey("-4.2") is 42 on all iterations including after DFG tier-up.
-PASS lookupWithKey2(toStringThrowsError) threw exception 'Error: ng' on all iterations including after DFG tier-up.
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/js/dfg-put-by-val-direct-with-edge-numbers.html (178927 => 178928)


--- trunk/LayoutTests/js/dfg-put-by-val-direct-with-edge-numbers.html	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/LayoutTests/js/dfg-put-by-val-direct-with-edge-numbers.html	2015-01-22 19:34:34 UTC (rev 178928)
@@ -1,10 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src=""
-</head>
-<body>
-<script src=""
-<script src=""
-</body>
-</html>

Deleted: trunk/LayoutTests/js/script-tests/dfg-put-by-val-direct-with-edge-numbers.js (178927 => 178928)


--- trunk/LayoutTests/js/script-tests/dfg-put-by-val-direct-with-edge-numbers.js	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/LayoutTests/js/script-tests/dfg-put-by-val-direct-with-edge-numbers.js	2015-01-22 19:34:34 UTC (rev 178928)
@@ -1,134 +0,0 @@
-description(
-"Test that a object accepts DFG PutByValueDirect operation with edge numbers."
-);
-
-function lookupWithKey(key) {
-    var object = {
-        [key]: 42
-    };
-    return object[key];
-}
-
-[
-    // integers
-    '-0x80000001',  // out of int32_t
-    '-0x80000000',  // int32_t min
-    '-1',           // negative
-    '0',            // zero
-    '1',            // positive
-    '0x7fffffff',   // int32_t max
-    '0x80000000',   // out of int32_t
-    '0xfffffffd',   // less than array max in JSObject
-    '0xfffffffe',   // array max in JSObject
-    '0xffffffff',   // uint32_t max, PropertyName::NotAnIndex
-    '0x100000000',  // out of uint32_t
-
-    // stringified integers
-    '"' + (-0x80000001).toString() + '"',  // out of int32_t
-    '"' + (-0x80000000).toString() + '"',  // int32_t min
-    '"' + (-1).toString() + '"',           // negative
-    '"' + (0).toString() + '"',            // zero
-    '"' + (1).toString() + '"',            // positive
-    '"' + (0x7fffffff).toString() + '"',   // int32_t max
-    '"' + (0x80000000).toString() + '"',   // out of int32_t
-    '"' + (0xfffffffd).toString() + '"',   // less than array max in JSObject
-    '"' + (0xfffffffe).toString() + '"',   // array max in JSObject
-    '"' + (0xffffffff).toString() + '"',   // uint32_t max).toString() PropertyName::NotAnIndex
-    '"' + (0x100000000).toString() + '"',  // out of uint32_t
-
-    // doubles
-    'Number.MIN_VALUE',
-    'Number.MAX_VALUE',
-    'Number.MIN_SAFE_INTEGER',
-    'Number.MAX_SAFE_INTEGER',
-    'Number.POSITIVE_INFINITY',
-    'Number.NEGATIVE_INFINITY',
-    'Number.NaN',
-    'Number.EPSILON',
-    '+0.0',
-    '-0.0',
-    '0.1',
-    '-0.1',
-    '4.2',
-    '-4.2',
-
-    // stringified doules
-    '"' + (Number.MIN_VALUE).toString() + '"',
-    '"' + (Number.MAX_VALUE).toString() + '"',
-    '"' + (Number.MIN_SAFE_INTEGER).toString() + '"',
-    '"' + (Number.MAX_SAFE_INTEGER).toString() + '"',
-    '"' + (Number.POSITIVE_INFINITY).toString() + '"',
-    '"' + (Number.NEGATIVE_INFINITY).toString() + '"',
-    '"NaN"',
-    '"' + (Number.EPSILON).toString() + '"',
-    '"+0.0"',
-    '"-0.0"',
-    '"0.1"',
-    '"-0.1"',
-    '"4.2"',
-    '"-4.2"',
-].forEach(function (key) {
-    dfgShouldBe(lookupWithKey, "lookupWithKey("+ key + ")", "42");
-});
-
-function dfgShouldThrow(theFunction, _a, _e)
-{
-  if (typeof theFunction != "function" || typeof _a != "string" || typeof _e != "string")
-    debug("WARN: dfgShouldThrow() expects a function and two strings");
-  noInline(theFunction);
-  var values = [], _av = undefined, notThrow = false;
-
-  // Defend against tests that muck with numeric properties on array.prototype.
-  values.__proto__ = null;
-  values.push = Array.prototype.push;
-
-  while (!dfgCompiled({f:theFunction})) {
-    try {
-        _av = eval(_a);
-        notThrow = true;
-    } catch (exception) {
-        values.push(exception);
-    }
-  }
-  try {
-    _av = eval(_a);
-    notThrow = true;
-  } catch (exception) {
-    values.push(exception);
-  }
-
-  var _ev = eval(_e);
-  if (notThrow) {
-    if (typeof _av == "undefined")
-      testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was undefined.");
-    else
-      testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was " + _av + ".");
-  } else {
-    var allPassed = true;
-    for (var i = 0; i < values.length; ++i) {
-      var _av = values[i];
-      if (typeof _e == "undefined" || _av == _ev)
-        continue;
-      testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Threw exception " + _av + ".");
-      allPassed = false;
-    }
-    if (allPassed)
-      testPassed(_a + " threw exception " + _e + " on all iterations including after DFG tier-up.");
-  }
-
-  return values.length;
-}
-
-function lookupWithKey2(key) {
-    var object = {
-        [key]: 42
-    };
-    return object[key];
-}
-
-var toStringThrowsError = {
-    toString: function () {
-        throw new Error('ng');
-    }
-};
-dfgShouldThrow(lookupWithKey2, "lookupWithKey2(toStringThrowsError)", "'Error: ng'");

Modified: trunk/Source/_javascript_Core/ChangeLog (178927 => 178928)


--- trunk/Source/_javascript_Core/ChangeLog	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-01-22 19:34:34 UTC (rev 178928)
@@ -1,3 +1,17 @@
+2015-01-22  Commit Queue  <commit-qu...@webkit.org>
+
+        Unreviewed, rolling out r178894.
+        https://bugs.webkit.org/show_bug.cgi?id=140775
+
+        Broke JSC and bindings tests (Requested by ap_ on #webkit).
+
+        Reverted changeset:
+
+        "put_by_val_direct need to check the property is index or not
+        for using putDirect / putDirectIndex"
+        https://bugs.webkit.org/show_bug.cgi?id=140426
+        http://trac.webkit.org/changeset/178894
+
 2015-01-22  Mark Lam  <mark....@apple.com>
 
         BytecodeGenerator::initializeCapturedVariable() sets a misleading value for the 5th operand of op_put_to_scope.

Modified: trunk/Source/_javascript_Core/bytecode/GetByIdStatus.cpp (178927 => 178928)


--- trunk/Source/_javascript_Core/bytecode/GetByIdStatus.cpp	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/_javascript_Core/bytecode/GetByIdStatus.cpp	2015-01-22 19:34:34 UTC (rev 178928)
@@ -270,7 +270,7 @@
     if (set.isEmpty())
         return GetByIdStatus();
 
-    if (toUInt32FromStringImpl(uid))
+    if (toUInt32FromStringImpl(uid) != PropertyName::NotAnIndex)
         return GetByIdStatus(TakesSlowPath);
     
     GetByIdStatus result;

Modified: trunk/Source/_javascript_Core/bytecode/PutByIdStatus.cpp (178927 => 178928)


--- trunk/Source/_javascript_Core/bytecode/PutByIdStatus.cpp	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/_javascript_Core/bytecode/PutByIdStatus.cpp	2015-01-22 19:34:34 UTC (rev 178928)
@@ -310,7 +310,7 @@
 
 PutByIdStatus PutByIdStatus::computeFor(JSGlobalObject* globalObject, const StructureSet& set, AtomicStringImpl* uid, bool isDirect)
 {
-    if (toUInt32FromStringImpl(uid))
+    if (toUInt32FromStringImpl(uid) != PropertyName::NotAnIndex)
         return PutByIdStatus(TakesSlowPath);
 
     if (set.isEmpty())

Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (178927 => 178928)


--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2015-01-22 19:34:34 UTC (rev 178928)
@@ -1501,7 +1501,9 @@
     instructions().append(0);
     instructions().append(0);
     instructions().append(0);
-    instructions().append(property != m_vm->propertyNames->underscoreProto && !PropertyName(property).asIndex());
+    instructions().append(
+        property != m_vm->propertyNames->underscoreProto
+        && PropertyName(property).asIndex() == PropertyName::NotAnIndex);
     return value;
 }
 

Modified: trunk/Source/_javascript_Core/dfg/DFGOperations.cpp (178927 => 178928)


--- trunk/Source/_javascript_Core/dfg/DFGOperations.cpp	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/_javascript_Core/dfg/DFGOperations.cpp	2015-01-22 19:34:34 UTC (rev 178928)
@@ -97,16 +97,14 @@
     JSValue value = JSValue::decode(encodedValue);
 
     if (LIKELY(property.isUInt32())) {
-        uint32_t index = property.asUInt32();
-        ASSERT_WITH_MESSAGE(index != PropertyName::NotAnIndex, "Since JSValue::isUInt32 returns true only when the boxed value is int32_t and positive, it doesn't return true for uint32_t max value that is PropertyName::NotAnIndex.");
-        putByVal<strict, direct>(exec, baseValue, index, value);
+        putByVal<strict, direct>(exec, baseValue, property.asUInt32(), value);
         return;
     }
 
     if (property.isDouble()) {
         double propertyAsDouble = property.asDouble();
         uint32_t propertyAsUInt32 = static_cast<uint32_t>(propertyAsDouble);
-        if (propertyAsDouble == propertyAsUInt32 && propertyAsUInt32 != PropertyName::NotAnIndex) {
+        if (propertyAsDouble == propertyAsUInt32) {
             putByVal<strict, direct>(exec, baseValue, propertyAsUInt32, value);
             return;
         }
@@ -124,19 +122,14 @@
 
     // Don't put to an object if toString throws an exception.
     Identifier ident = property.toString(exec)->toIdentifier(exec);
-    if (vm->exception())
-        return;
-
-    PutPropertySlot slot(baseValue, strict);
-    if (direct) {
-        PropertyName propertyName(ident);
-        RELEASE_ASSERT(baseValue.isObject());
-        if (Optional<uint32_t> index = propertyName.asIndex())
-            asObject(baseValue)->putDirectIndex(exec, index.value(), value, 0, strict ? PutDirectIndexShouldThrow : PutDirectIndexShouldNotThrow);
-        else
-            asObject(baseValue)->putDirect(*vm, propertyName, value, slot);
-    } else
-        baseValue.put(exec, ident, value, slot);
+    if (!vm->exception()) {
+        PutPropertySlot slot(baseValue, strict);
+        if (direct) {
+            RELEASE_ASSERT(baseValue.isObject());
+            asObject(baseValue)->putDirect(*vm, ident, value, slot);
+        } else
+            baseValue.put(exec, ident, value, slot);
+    }
 }
 
 template<typename ViewClass>

Modified: trunk/Source/_javascript_Core/jit/JITOperations.cpp (178927 => 178928)


--- trunk/Source/_javascript_Core/jit/JITOperations.cpp	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/_javascript_Core/jit/JITOperations.cpp	2015-01-22 19:34:34 UTC (rev 178928)
@@ -51,7 +51,6 @@
 #include "JSWithScope.h"
 #include "LegacyProfiler.h"
 #include "ObjectConstructor.h"
-#include "PropertyName.h"
 #include "Repatch.h"
 #include "RepatchBuffer.h"
 #include "TestRunnerUtils.h"
@@ -481,41 +480,19 @@
 
 static void directPutByVal(CallFrame* callFrame, JSObject* baseObject, JSValue subscript, JSValue value)
 {
-    bool isStrictMode = callFrame->codeBlock()->isStrictMode();
     if (LIKELY(subscript.isUInt32())) {
-        uint32_t index = subscript.asUInt32();
-        ASSERT_WITH_MESSAGE(index != PropertyName::NotAnIndex, "Since JSValue::isUInt32 returns true only when the boxed value is int32_t and positive, it doesn't return true for uint32_t max value that is PropertyName::NotAnIndex.");
-        baseObject->putDirectIndex(callFrame, index, value, 0, isStrictMode ? PutDirectIndexShouldThrow : PutDirectIndexShouldNotThrow);
-        return;
-    }
-
-    if (subscript.isDouble()) {
-        double subscriptAsDouble = subscript.asDouble();
-        uint32_t subscriptAsUInt32 = static_cast<uint32_t>(subscriptAsDouble);
-        if (subscriptAsDouble == subscriptAsUInt32 && subscriptAsUInt32 != PropertyName::NotAnIndex) {
-            baseObject->putDirectIndex(callFrame, subscriptAsUInt32, value, 0, isStrictMode ? PutDirectIndexShouldThrow : PutDirectIndexShouldNotThrow);
-            return;
+        uint32_t i = subscript.asUInt32();
+        baseObject->putDirectIndex(callFrame, i, value);
+    } else if (isName(subscript)) {
+        PutPropertySlot slot(baseObject, callFrame->codeBlock()->isStrictMode());
+        baseObject->putDirect(callFrame->vm(), jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot);
+    } else {
+        Identifier property = subscript.toString(callFrame)->toIdentifier(callFrame);
+        if (!callFrame->vm().exception()) { // Don't put to an object if toString threw an exception.
+            PutPropertySlot slot(baseObject, callFrame->codeBlock()->isStrictMode());
+            baseObject->putDirect(callFrame->vm(), property, value, slot);
         }
     }
-
-    if (isName(subscript)) {
-        PutPropertySlot slot(baseObject, isStrictMode);
-        baseObject->putDirect(callFrame->vm(), jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot);
-        return;
-    }
-
-    // Don't put to an object if toString throws an exception.
-    Identifier property = subscript.toString(callFrame)->toIdentifier(callFrame);
-    if (callFrame->vm().exception())
-        return;
-
-    PropertyName propertyName(property);
-    if (Optional<uint32_t> index = propertyName.asIndex())
-        baseObject->putDirectIndex(callFrame, index.value(), value, 0, isStrictMode ? PutDirectIndexShouldThrow : PutDirectIndexShouldNotThrow);
-    else {
-        PutPropertySlot slot(baseObject, isStrictMode);
-        baseObject->putDirect(callFrame->vm(), propertyName, value, slot);
-    }
 }
 void JIT_OPERATION operationPutByVal(ExecState* exec, EncodedJSValue encodedBaseValue, EncodedJSValue encodedSubscript, EncodedJSValue encodedValue)
 {

Modified: trunk/Source/_javascript_Core/jit/Repatch.cpp (178927 => 178928)


--- trunk/Source/_javascript_Core/jit/Repatch.cpp	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/_javascript_Core/jit/Repatch.cpp	2015-01-22 19:34:34 UTC (rev 178928)
@@ -982,7 +982,7 @@
 {
     PropertyName pname(ident);
     Structure* oldStructure = structure;
-    if (!oldStructure->isObject() || oldStructure->isDictionary() || pname.asIndex())
+    if (!oldStructure->isObject() || oldStructure->isDictionary() || pname.asIndex() != PropertyName::NotAnIndex)
         return nullptr;
 
     PropertyOffset propertyOffset;

Modified: trunk/Source/_javascript_Core/jsc.cpp (178927 => 178928)


--- trunk/Source/_javascript_Core/jsc.cpp	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/_javascript_Core/jsc.cpp	2015-01-22 19:34:34 UTC (rev 178928)
@@ -334,9 +334,10 @@
             return true;
         }
 
-        Optional<uint32_t> index = propertyName.asIndex();
-        if (index && index.value() < thisObject->getLength()) {
-            slot.setValue(thisObject, DontDelete | DontEnum, jsNumber(thisObject->m_vector[index.value()]));
+        unsigned index = propertyName.asIndex();
+        if (index < thisObject->getLength()) {
+            ASSERT(index != PropertyName::NotAnIndex);
+            slot.setValue(thisObject, DontDelete | DontEnum, jsNumber(thisObject->m_vector[index]));
             return true;
         }
 

Modified: trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp (178927 => 178928)


--- trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2015-01-22 19:34:34 UTC (rev 178928)
@@ -819,42 +819,19 @@
     JSValue value = LLINT_OP_C(3).jsValue();
     RELEASE_ASSERT(baseValue.isObject());
     JSObject* baseObject = asObject(baseValue);
-    bool isStrictMode = exec->codeBlock()->isStrictMode();
     if (LIKELY(subscript.isUInt32())) {
-        uint32_t index = subscript.asUInt32();
-        ASSERT_WITH_MESSAGE(index != PropertyName::NotAnIndex, "Since JSValue::isUInt32 returns true only when the boxed value is int32_t and positive, it doesn't return true for uint32_t max value that is PropertyName::NotAnIndex.");
-        baseObject->putDirectIndex(exec, index, value, 0, isStrictMode ? PutDirectIndexShouldThrow : PutDirectIndexShouldNotThrow);
-        LLINT_END();
-    }
-
-
-    if (subscript.isDouble()) {
-        double subscriptAsDouble = subscript.asDouble();
-        uint32_t subscriptAsUInt32 = static_cast<uint32_t>(subscriptAsDouble);
-        if (subscriptAsDouble == subscriptAsUInt32 && subscriptAsUInt32 != PropertyName::NotAnIndex) {
-            baseObject->putDirectIndex(exec, subscriptAsUInt32, value, 0, isStrictMode ? PutDirectIndexShouldThrow : PutDirectIndexShouldNotThrow);
-            LLINT_END();
+        uint32_t i = subscript.asUInt32();
+        baseObject->putDirectIndex(exec, i, value);
+    } else if (isName(subscript)) {
+        PutPropertySlot slot(baseObject, exec->codeBlock()->isStrictMode());
+        baseObject->putDirect(exec->vm(), jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot);
+    } else {
+        Identifier property = subscript.toString(exec)->toIdentifier(exec);
+        if (!exec->vm().exception()) { // Don't put to an object if toString threw an exception.
+            PutPropertySlot slot(baseObject, exec->codeBlock()->isStrictMode());
+            baseObject->putDirect(exec->vm(), property, value, slot);
         }
     }
-
-    if (isName(subscript)) {
-        PutPropertySlot slot(baseObject, isStrictMode);
-        baseObject->putDirect(exec->vm(), jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot);
-        LLINT_END();
-    }
-
-    // Don't put to an object if toString throws an exception.
-    Identifier property = subscript.toString(exec)->toIdentifier(exec);
-    if (exec->vm().exception())
-        LLINT_END();
-
-    PropertyName propertyName(property);
-    if (Optional<uint32_t> index = propertyName.asIndex())
-        baseObject->putDirectIndex(exec, index.value(), value, 0, isStrictMode ? PutDirectIndexShouldThrow : PutDirectIndexShouldNotThrow);
-    else {
-        PutPropertySlot slot(baseObject, isStrictMode);
-        baseObject->putDirect(exec->vm(), propertyName, value, slot);
-    }
     LLINT_END();
 }
 

Modified: trunk/Source/_javascript_Core/runtime/Arguments.cpp (178927 => 178928)


--- trunk/Source/_javascript_Core/runtime/Arguments.cpp	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/_javascript_Core/runtime/Arguments.cpp	2015-01-22 19:34:34 UTC (rev 178928)
@@ -161,11 +161,11 @@
 bool Arguments::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
 {
     Arguments* thisObject = jsCast<Arguments*>(object);
-    if (Optional<uint32_t> index = propertyName.asIndex()) {
-        if (JSValue value = thisObject->tryGetArgument(index.value())) {
-            slot.setValue(thisObject, None, value);
-            return true;
-        }
+    unsigned i = propertyName.asIndex();
+    if (JSValue value = thisObject->tryGetArgument(i)) {
+        RELEASE_ASSERT(i < PropertyName::NotAnIndex);
+        slot.setValue(thisObject, None, value);
+        return true;
     }
 
     if (propertyName == exec->propertyNames().length && LIKELY(!thisObject->m_overrodeLength)) {
@@ -224,8 +224,8 @@
 void Arguments::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
 {
     Arguments* thisObject = jsCast<Arguments*>(cell);
-    Optional<uint32_t> index = propertyName.asIndex();
-    if (index && thisObject->trySetArgument(exec->vm(), index.value(), value))
+    unsigned i = propertyName.asIndex();
+    if (thisObject->trySetArgument(exec->vm(), i, value))
         return;
 
     if (propertyName == exec->propertyNames().length && !thisObject->m_overrodeLength) {
@@ -267,11 +267,12 @@
         return Base::deleteProperty(cell, exec, propertyName);
 
     Arguments* thisObject = jsCast<Arguments*>(cell);
-    Optional<uint32_t> index = propertyName.asIndex();
-    if (index && index.value() < thisObject->m_numArguments) {
+    unsigned i = propertyName.asIndex();
+    if (i < thisObject->m_numArguments) {
+        RELEASE_ASSERT(i < PropertyName::NotAnIndex);
         if (!Base::deleteProperty(cell, exec, propertyName))
             return false;
-        if (thisObject->tryDeleteArgument(exec->vm(), index.value()))
+        if (thisObject->tryDeleteArgument(exec->vm(), i))
             return true;
     }
 
@@ -297,13 +298,13 @@
 bool Arguments::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, const PropertyDescriptor& descriptor, bool shouldThrow)
 {
     Arguments* thisObject = jsCast<Arguments*>(object);
-    Optional<uint32_t> optionalIndex = propertyName.asIndex();
-    if (optionalIndex && optionalIndex.value() < thisObject->m_numArguments) {
+    unsigned i = propertyName.asIndex();
+    if (i < thisObject->m_numArguments) {
+        RELEASE_ASSERT(i < PropertyName::NotAnIndex);
         // If the property is not yet present on the object, and is not yet marked as deleted, then add it now.
-        uint32_t index = optionalIndex.value();
         PropertySlot slot(thisObject);
-        if (!thisObject->isDeletedArgument(index) && !JSObject::getOwnPropertySlot(thisObject, exec, propertyName, slot)) {
-            JSValue value = thisObject->tryGetArgument(index);
+        if (!thisObject->isDeletedArgument(i) && !JSObject::getOwnPropertySlot(thisObject, exec, propertyName, slot)) {
+            JSValue value = thisObject->tryGetArgument(i);
             ASSERT(value);
             object->putDirectMayBeIndex(exec, propertyName, value);
         }
@@ -312,20 +313,20 @@
 
         // From ES 5.1, 10.6 Arguments Object
         // 5. If the value of isMapped is not undefined, then
-        if (thisObject->isArgument(index)) {
+        if (thisObject->isArgument(i)) {
             // a. If IsAccessorDescriptor(Desc) is true, then
             if (descriptor.isAccessorDescriptor()) {
                 // i. Call the [[Delete]] internal method of map passing P, and false as the arguments.
-                thisObject->tryDeleteArgument(exec->vm(), index);
+                thisObject->tryDeleteArgument(exec->vm(), i);
             } else { // b. Else
                 // i. If Desc.[[Value]] is present, then
                 // 1. Call the [[Put]] internal method of map passing P, Desc.[[Value]], and Throw as the arguments.
                 if (descriptor.value())
-                    thisObject->trySetArgument(exec->vm(), index, descriptor.value());
+                    thisObject->trySetArgument(exec->vm(), i, descriptor.value());
                 // ii. If Desc.[[Writable]] is present and its value is false, then
                 // 1. Call the [[Delete]] internal method of map passing P and false as arguments.
                 if (descriptor.writablePresent() && !descriptor.writable())
-                    thisObject->tryDeleteArgument(exec->vm(), index);
+                    thisObject->tryDeleteArgument(exec->vm(), i);
             }
         }
         return true;

Modified: trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp (178927 => 178928)


--- trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp	2015-01-22 19:34:34 UTC (rev 178928)
@@ -742,11 +742,10 @@
     Vector<uint32_t, 0, UnsafeVectorOverflow> keys;
     for (size_t i = 0; i < nameArray.size(); ++i) {
         PropertyName name = nameArray[i];
-        Optional<uint32_t> optionalIndex = name.asIndex();
-        if (!optionalIndex)
+        uint32_t index = name.asIndex();
+        if (index == PropertyName::NotAnIndex)
             continue;
-
-        uint32_t index = optionalIndex.value();
+        
         JSValue value = getOrHole(thisObj, exec, index);
         if (exec->hadException())
             return JSValue::encode(jsUndefined());

Modified: trunk/Source/_javascript_Core/runtime/JSArray.cpp (178927 => 178928)


--- trunk/Source/_javascript_Core/runtime/JSArray.cpp	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/_javascript_Core/runtime/JSArray.cpp	2015-01-22 19:34:34 UTC (rev 178928)
@@ -158,9 +158,9 @@
 
     // 4. Else if P is an array index (15.4), then
     // a. Let index be ToUint32(P).
-    if (Optional<uint32_t> optionalIndex = propertyName.asIndex()) {
+    unsigned index = propertyName.asIndex();
+    if (index != PropertyName::NotAnIndex) {
         // b. Reject if index >= oldLen and oldLenDesc.[[Writable]] is false.
-        uint32_t index = optionalIndex.value();
         if (index >= array->length() && !array->isLengthWritable())
             return reject(exec, throwException, "Attempting to define numeric property on array with non-writable length property.");
         // c. Let succeeded be the result of calling the default [[DefineOwnProperty]] internal method (8.12.9) on A passing P, Desc, and false as arguments.

Modified: trunk/Source/_javascript_Core/runtime/JSCJSValue.cpp (178927 => 178928)


--- trunk/Source/_javascript_Core/runtime/JSCJSValue.cpp	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/_javascript_Core/runtime/JSCJSValue.cpp	2015-01-22 19:34:34 UTC (rev 178928)
@@ -119,8 +119,9 @@
 {
     VM& vm = exec->vm();
 
-    if (Optional<uint32_t> index = propertyName.asIndex()) {
-        putToPrimitiveByIndex(exec, index.value(), value, slot.isStrictMode());
+    unsigned index = propertyName.asIndex();
+    if (index != PropertyName::NotAnIndex) {
+        putToPrimitiveByIndex(exec, index, value, slot.isStrictMode());
         return;
     }
 

Modified: trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewInlines.h (178927 => 178928)


--- trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewInlines.h	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewInlines.h	2015-01-22 19:34:34 UTC (rev 178928)
@@ -302,9 +302,9 @@
         return true;
     }
     
-    Optional<uint32_t> index = propertyName.asIndex();
-    if (index && thisObject->canGetIndexQuickly(index.value())) {
-        slot.setValue(thisObject, DontDelete | ReadOnly, thisObject->getIndexQuickly(index.value()));
+    unsigned index = propertyName.asIndex();
+    if (index != PropertyName::NotAnIndex && thisObject->canGetIndexQuickly(index)) {
+        slot.setValue(thisObject, DontDelete | ReadOnly, thisObject->getIndexQuickly(index));
         return true;
     }
     
@@ -324,8 +324,9 @@
         return;
     }
     
-    if (Optional<uint32_t> index = propertyName.asIndex()) {
-        putByIndex(thisObject, exec, index.value(), value, slot.isStrictMode());
+    unsigned index = propertyName.asIndex();
+    if (index != PropertyName::NotAnIndex) {
+        putByIndex(thisObject, exec, index, value, slot.isStrictMode());
         return;
     }
     
@@ -342,7 +343,8 @@
     // This is matching Firefox behavior. In particular, it rejects all attempts to
     // defineOwnProperty for indexed properties on typed arrays, even if they're out
     // of bounds.
-    if (propertyName == exec->propertyNames().length || propertyName.asIndex())
+    if (propertyName == exec->propertyNames().length
+        || propertyName.asIndex() != PropertyName::NotAnIndex)
         return reject(exec, shouldThrow, "Attempting to write to a read-only typed array property.");
     
     return Base::defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow);
@@ -354,7 +356,8 @@
 {
     JSGenericTypedArrayView* thisObject = jsCast<JSGenericTypedArrayView*>(cell);
     
-    if (propertyName == exec->propertyNames().length || propertyName.asIndex())
+    if (propertyName == exec->propertyNames().length
+        || propertyName.asIndex() != PropertyName::NotAnIndex)
         return false;
     
     return Base::deleteProperty(thisObject, exec, propertyName);

Modified: trunk/Source/_javascript_Core/runtime/JSObject.cpp (178927 => 178928)


--- trunk/Source/_javascript_Core/runtime/JSObject.cpp	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/_javascript_Core/runtime/JSObject.cpp	2015-01-22 19:34:34 UTC (rev 178928)
@@ -339,8 +339,9 @@
     
     // Try indexed put first. This is required for correctness, since loads on property names that appear like
     // valid indices will never look in the named property storage.
-    if (Optional<uint32_t> index = propertyName.asIndex()) {
-        putByIndex(thisObject, exec, index.value(), value, slot.isStrictMode());
+    unsigned i = propertyName.asIndex();
+    if (i != PropertyName::NotAnIndex) {
+        putByIndex(thisObject, exec, i, value, slot.isStrictMode());
         return;
     }
     
@@ -1197,8 +1198,9 @@
 {
     ASSERT(value.isGetterSetter() && (attributes & Accessor));
 
-    if (Optional<uint32_t> index = propertyName.asIndex()) {
-        putDirectIndex(exec, index.value(), value, attributes, PutDirectIndexLikePutDirect);
+    unsigned index = propertyName.asIndex();
+    if (index != PropertyName::NotAnIndex) {
+        putDirectIndex(exec, index, value, attributes, PutDirectIndexLikePutDirect);
         return;
     }
 
@@ -1207,7 +1209,7 @@
 
 void JSObject::putDirectCustomAccessor(VM& vm, PropertyName propertyName, JSValue value, unsigned attributes)
 {
-    ASSERT(!propertyName.asIndex());
+    ASSERT(propertyName.asIndex() == PropertyName::NotAnIndex);
 
     PutPropertySlot slot(this);
     putDirectInternal<PutModeDefineOwnProperty>(vm, propertyName, value, attributes, slot);
@@ -1255,8 +1257,9 @@
 {
     JSObject* thisObject = jsCast<JSObject*>(cell);
     
-    if (Optional<uint32_t> index = propertyName.asIndex())
-        return thisObject->methodTable(exec->vm())->deletePropertyByIndex(thisObject, exec, index.value());
+    unsigned i = propertyName.asIndex();
+    if (i != PropertyName::NotAnIndex)
+        return thisObject->methodTable(exec->vm())->deletePropertyByIndex(thisObject, exec, i);
 
     if (!thisObject->staticFunctionsReified())
         thisObject->reifyStaticFunctionsForDelete(exec);
@@ -2499,10 +2502,11 @@
 
 void JSObject::putDirectMayBeIndex(ExecState* exec, PropertyName propertyName, JSValue value)
 {
-    if (Optional<uint32_t> index = propertyName.asIndex())
-        putDirectIndex(exec, index.value(), value);
+    unsigned asIndex = propertyName.asIndex();
+    if (asIndex == PropertyName::NotAnIndex)
+        putDirect(exec->vm(), propertyName, value);
     else
-        putDirect(exec->vm(), propertyName, value);
+        putDirectIndex(exec, asIndex, value);
 }
 
 class DefineOwnPropertyScope {
@@ -2655,14 +2659,15 @@
 bool JSObject::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, const PropertyDescriptor& descriptor, bool throwException)
 {
     // If it's an array index, then use the indexed property storage.
-    if (Optional<uint32_t> index = propertyName.asIndex()) {
+    unsigned index = propertyName.asIndex();
+    if (index != PropertyName::NotAnIndex) {
         // c. Let succeeded be the result of calling the default [[DefineOwnProperty]] internal method (8.12.9) on A passing P, Desc, and false as arguments.
         // d. Reject if succeeded is false.
         // e. If index >= oldLen
         // e.i. Set oldLenDesc.[[Value]] to index + 1.
         // e.ii. Call the default [[DefineOwnProperty]] internal method (8.12.9) on A passing "length", oldLenDesc, and false as arguments. This call will always return true.
         // f. Return true.
-        return object->defineOwnIndexedProperty(exec, index.value(), descriptor, throwException);
+        return object->defineOwnIndexedProperty(exec, index, descriptor, throwException);
     }
     
     return object->defineOwnNonIndexProperty(exec, propertyName, descriptor, throwException);

Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (178927 => 178928)


--- trunk/Source/_javascript_Core/runtime/JSObject.h	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h	2015-01-22 19:34:34 UTC (rev 178928)
@@ -1244,8 +1244,9 @@
     Structure& structure = *object->structure(vm);
     if (object->inlineGetOwnPropertySlot(vm, structure, propertyName, slot))
         return true;
-    if (Optional<uint32_t> index = propertyName.asIndex())
-        return getOwnPropertySlotByIndex(object, exec, index.value(), slot);
+    unsigned index = propertyName.asIndex();
+    if (index != PropertyName::NotAnIndex)
+        return getOwnPropertySlotByIndex(object, exec, index, slot);
     return false;
 }
 
@@ -1273,8 +1274,9 @@
         object = asObject(prototype);
     }
 
-    if (Optional<uint32_t> index = propertyName.asIndex())
-        return getPropertySlot(exec, index.value(), slot);
+    unsigned index = propertyName.asIndex();
+    if (index != PropertyName::NotAnIndex)
+        return getPropertySlot(exec, index, slot);
     return false;
 }
 
@@ -1318,7 +1320,7 @@
     ASSERT(value);
     ASSERT(value.isGetterSetter() == !!(attributes & Accessor));
     ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
-    ASSERT(!propertyName.asIndex());
+    ASSERT(propertyName.asIndex() == PropertyName::NotAnIndex);
 
     Structure* structure = this->structure(vm);
     if (structure->isDictionary()) {

Modified: trunk/Source/_javascript_Core/runtime/JSString.cpp (178927 => 178928)


--- trunk/Source/_javascript_Core/runtime/JSString.cpp	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/_javascript_Core/runtime/JSString.cpp	2015-01-22 19:34:34 UTC (rev 178928)
@@ -425,9 +425,10 @@
         return true;
     }
     
-    Optional<uint32_t> index = propertyName.asIndex();
-    if (index && index.value() < m_length) {
-        descriptor.setDescriptor(getIndex(exec, index.value()), DontDelete | ReadOnly);
+    unsigned i = propertyName.asIndex();
+    if (i < m_length) {
+        ASSERT(i != PropertyName::NotAnIndex); // No need for an explicit check, the above test would always fail!
+        descriptor.setDescriptor(getIndex(exec, i), DontDelete | ReadOnly);
         return true;
     }
     

Modified: trunk/Source/_javascript_Core/runtime/JSString.h (178927 => 178928)


--- trunk/Source/_javascript_Core/runtime/JSString.h	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/_javascript_Core/runtime/JSString.h	2015-01-22 19:34:34 UTC (rev 178928)
@@ -626,9 +626,10 @@
         return true;
     }
 
-    Optional<uint32_t> index = propertyName.asIndex();
-    if (index && index.value() < m_length) {
-        slot.setValue(this, DontDelete | ReadOnly, getIndex(exec, index.value()));
+    unsigned i = propertyName.asIndex();
+    if (i < m_length) {
+        ASSERT(i != PropertyName::NotAnIndex); // No need for an explicit check, the above test would always fail!
+        slot.setValue(this, DontDelete | ReadOnly, getIndex(exec, i));
         return true;
     }
 

Modified: trunk/Source/_javascript_Core/runtime/LiteralParser.cpp (178927 => 178928)


--- trunk/Source/_javascript_Core/runtime/LiteralParser.cpp	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/_javascript_Core/runtime/LiteralParser.cpp	2015-01-22 19:34:34 UTC (rev 178928)
@@ -649,8 +649,9 @@
             {
                 JSObject* object = asObject(objectStack.last());
                 PropertyName ident = identifierStack.last();
-                if (Optional<uint32_t> index = ident.asIndex())
-                    object->putDirectIndex(m_exec, index.value(), lastValue);
+                unsigned i = ident.asIndex();
+                if (i != PropertyName::NotAnIndex)
+                    object->putDirectIndex(m_exec, i, lastValue);
                 else
                     object->putDirect(m_exec->vm(), ident, lastValue);
                 identifierStack.removeLast();

Modified: trunk/Source/_javascript_Core/runtime/PropertyName.h (178927 => 178928)


--- trunk/Source/_javascript_Core/runtime/PropertyName.h	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/_javascript_Core/runtime/PropertyName.h	2015-01-22 19:34:34 UTC (rev 178928)
@@ -28,51 +28,48 @@
 
 #include "Identifier.h"
 #include "PrivateName.h"
-#include <wtf/Optional.h>
 
 namespace JSC {
 
 template <typename CharType>
-ALWAYS_INLINE Optional<uint32_t> toUInt32FromCharacters(const CharType* characters, unsigned length)
+ALWAYS_INLINE uint32_t toUInt32FromCharacters(const CharType* characters, unsigned length)
 {
     // An empty string is not a number.
     if (!length)
-        return Nullopt;
+        return UINT_MAX;
 
     // Get the first character, turning it into a digit.
     uint32_t value = characters[0] - '0';
     if (value > 9)
-        return Nullopt;
+        return UINT_MAX;
     
     // Check for leading zeros. If the first characher is 0, then the
     // length of the string must be one - e.g. "042" is not equal to "42".
     if (!value && length > 1)
-        return Nullopt;
+        return UINT_MAX;
     
     while (--length) {
         // Multiply value by 10, checking for overflow out of 32 bits.
         if (value > 0xFFFFFFFFU / 10)
-            return Nullopt;
+            return UINT_MAX;
         value *= 10;
         
         // Get the next character, turning it into a digit.
         uint32_t newValue = *(++characters) - '0';
         if (newValue > 9)
-            return Nullopt;
+            return UINT_MAX;
         
         // Add in the old value, checking for overflow out of 32 bits.
         newValue += value;
         if (newValue < value)
-            return Nullopt;
+            return UINT_MAX;
         value = newValue;
     }
-
-    if (value == UINT_MAX)
-        return Nullopt;
+    
     return value;
 }
 
-ALWAYS_INLINE Optional<uint32_t> toUInt32FromStringImpl(StringImpl* impl)
+ALWAYS_INLINE uint32_t toUInt32FromStringImpl(StringImpl* impl)
 {
     if (impl->is8Bit())
         return toUInt32FromCharacters(impl->characters8(), impl->length());
@@ -112,11 +109,11 @@
 
     static const uint32_t NotAnIndex = UINT_MAX;
 
-    Optional<uint32_t> asIndex()
+    uint32_t asIndex()
     {
-        return m_impl ? toUInt32FromStringImpl(m_impl) : Nullopt;
+        return m_impl ? toUInt32FromStringImpl(m_impl) : NotAnIndex;
     }
-
+    
     void dump(PrintStream& out) const
     {
         if (m_impl)

Modified: trunk/Source/_javascript_Core/runtime/PropertyNameArray.cpp (178927 => 178928)


--- trunk/Source/_javascript_Core/runtime/PropertyNameArray.cpp	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/_javascript_Core/runtime/PropertyNameArray.cpp	2015-01-22 19:34:34 UTC (rev 178928)
@@ -33,8 +33,8 @@
 {
     ASSERT(!identifier || identifier == StringImpl::empty() || identifier->isAtomic());
     if (!ASSERT_DISABLED) {
-        Optional<uint32_t> index = PropertyName(Identifier(m_vm, identifier)).asIndex();
-        ASSERT_UNUSED(index, !index || index.value() >= m_previouslyEnumeratedLength);
+        uint32_t index = PropertyName(Identifier(m_vm, identifier)).asIndex();
+        ASSERT_UNUSED(index, index == PropertyName::NotAnIndex || index >= m_previouslyEnumeratedLength);
     }
 
     if (m_alternateSet && m_alternateSet->contains(identifier))

Modified: trunk/Source/_javascript_Core/runtime/StringObject.cpp (178927 => 178928)


--- trunk/Source/_javascript_Core/runtime/StringObject.cpp	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/_javascript_Core/runtime/StringObject.cpp	2015-01-22 19:34:34 UTC (rev 178928)
@@ -128,8 +128,9 @@
     StringObject* thisObject = jsCast<StringObject*>(cell);
     if (propertyName == exec->propertyNames().length)
         return false;
-    Optional<uint32_t> index = propertyName.asIndex();
-    if (index && thisObject->internalValue()->canGetIndex(index.value())) {
+    unsigned i = propertyName.asIndex();
+    if (thisObject->internalValue()->canGetIndex(i)) {
+        ASSERT(i != PropertyName::NotAnIndex); // No need for an explicit check, the above test would always fail!
         return false;
     }
     return JSObject::deleteProperty(thisObject, exec, propertyName);

Modified: trunk/Source/_javascript_Core/runtime/Structure.cpp (178927 => 178928)


--- trunk/Source/_javascript_Core/runtime/Structure.cpp	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/_javascript_Core/runtime/Structure.cpp	2015-01-22 19:34:34 UTC (rev 178928)
@@ -1010,7 +1010,8 @@
 
 bool Structure::prototypeChainMayInterceptStoreTo(VM& vm, PropertyName propertyName)
 {
-    if (propertyName.asIndex())
+    unsigned i = propertyName.asIndex();
+    if (i != PropertyName::NotAnIndex)
         return anyObjectInChainMayInterceptIndexedAccesses();
     
     for (Structure* current = this; ;) {

Modified: trunk/Source/WebCore/ChangeLog (178927 => 178928)


--- trunk/Source/WebCore/ChangeLog	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/WebCore/ChangeLog	2015-01-22 19:34:34 UTC (rev 178928)
@@ -1,3 +1,17 @@
+2015-01-22  Commit Queue  <commit-qu...@webkit.org>
+
+        Unreviewed, rolling out r178894.
+        https://bugs.webkit.org/show_bug.cgi?id=140775
+
+        Broke JSC and bindings tests (Requested by ap_ on #webkit).
+
+        Reverted changeset:
+
+        "put_by_val_direct need to check the property is index or not
+        for using putDirect / putDirectIndex"
+        https://bugs.webkit.org/show_bug.cgi?id=140426
+        http://trac.webkit.org/changeset/178894
+
 2015-01-22  David Kilzer  <ddkil...@apple.com>
 
         [iOS] Fix iphoneos SDK builds for ios-ews queue

Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp (178927 => 178928)


--- trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp	2015-01-22 19:34:34 UTC (rev 178928)
@@ -214,10 +214,11 @@
     // We need to test the correct priority order.
 
     // allow window[1] or parent[1] etc. (#56983)
-    Optional<uint32_t> index = propertyName.asIndex();
-    if (index && index.value() < thisObject->impl().frame()->tree().scopedChildCount()) {
+    unsigned i = propertyName.asIndex();
+    if (i < thisObject->impl().frame()->tree().scopedChildCount()) {
+        ASSERT(i != PropertyName::NotAnIndex);
         slot.setValue(thisObject, ReadOnly | DontDelete | DontEnum,
-            toJS(exec, thisObject->impl().frame()->tree().scopedChild(index.value())->document()->domWindow()));
+            toJS(exec, thisObject->impl().frame()->tree().scopedChild(i)->document()->domWindow()));
         return true;
     }
 

Modified: trunk/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp (178927 => 178928)


--- trunk/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp	2015-01-22 19:34:34 UTC (rev 178928)
@@ -65,8 +65,9 @@
     if (exec->argumentCount() == 1) {
         // Support for document.all(<index>) etc.
         String string = exec->argument(0).toString(exec)->value(exec);
-        if (Optional<uint32_t> index = toUInt32FromStringImpl(string.impl()))
-            return JSValue::encode(toJS(exec, jsCollection->globalObject(), collection.item(index.value())));
+        unsigned index = toUInt32FromStringImpl(string.impl());
+        if (index != PropertyName::NotAnIndex)
+            return JSValue::encode(toJS(exec, jsCollection->globalObject(), collection.item(index)));
 
         // Support for document.images('<name>') etc.
         return JSValue::encode(namedItems(exec, jsCollection, Identifier(exec, string)));
@@ -74,8 +75,9 @@
 
     // The second arg, if set, is the index of the item we want
     String string = exec->argument(0).toString(exec)->value(exec);
-    if (Optional<uint32_t> index = toUInt32FromStringImpl(exec->argument(1).toWTFString(exec).impl())) {
-        if (auto* item = collection.namedItemWithIndex(string, index.value()))
+    unsigned index = toUInt32FromStringImpl(exec->argument(1).toWTFString(exec).impl());
+    if (index != PropertyName::NotAnIndex) {
+        if (auto* item = collection.namedItemWithIndex(string, index))
             return JSValue::encode(toJS(exec, jsCollection->globalObject(), item));
     }
 
@@ -101,8 +103,9 @@
 
 JSValue JSHTMLAllCollection::item(ExecState* exec)
 {
-    if (Optional<uint32_t> index = toUInt32FromStringImpl(exec->argument(0).toString(exec)->value(exec).impl()))
-        return toJS(exec, globalObject(), impl().item(index.value()));
+    uint32_t index = toUInt32FromStringImpl(exec->argument(0).toString(exec)->value(exec).impl());
+    if (index != PropertyName::NotAnIndex)
+        return toJS(exec, globalObject(), impl().item(index));
     return namedItems(exec, this, Identifier(exec, exec->argument(0).toString(exec)->value(exec)));
 }
 

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (178927 => 178928)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2015-01-22 19:34:34 UTC (rev 178928)
@@ -360,16 +360,15 @@
     }
 
     if ($indexedGetterFunction) {
-        push(@getOwnPropertySlotImpl, "    Optional<uint32_t> optionalIndex = propertyName.asIndex();\n");
+        push(@getOwnPropertySlotImpl, "    unsigned index = propertyName.asIndex();\n");
 
         # If the item function returns a string then we let the TreatReturnedNullStringAs handle the cases
         # where the index is out of range.
         if ($indexedGetterFunction->signature->type eq "DOMString") {
-            push(@getOwnPropertySlotImpl, "    if (optionalIndex) {\n");
+            push(@getOwnPropertySlotImpl, "    if (index != PropertyName::NotAnIndex) {\n");
         } else {
-            push(@getOwnPropertySlotImpl, "    if (optionalIndex && optionalIndex.value() < thisObject->impl().length()) {\n");
+            push(@getOwnPropertySlotImpl, "    if (index != PropertyName::NotAnIndex && index < thisObject->impl().length()) {\n");
         }
-        push(@getOwnPropertySlotImpl, "        unsigned index = optionalIndex.value();\n");
         # Assume that if there's a setter, the index will be writable
         if ($interface->extendedAttributes->{"CustomIndexedSetter"}) {
             push(@getOwnPropertySlotImpl, "        unsigned attributes = ${namespaceMaybe}DontDelete;\n");
@@ -2449,8 +2448,9 @@
             push(@implContent, "    ${className}* thisObject = jsCast<${className}*>(cell);\n");
             push(@implContent, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n");
             if ($interface->extendedAttributes->{"CustomIndexedSetter"}) {
-                push(@implContent, "    if (Optional<uint32_t> index = propertyName.asIndex()) {\n");
-                push(@implContent, "        thisObject->indexSetter(exec, index.value(), value);\n");
+                push(@implContent, "    unsigned index = propertyName.asIndex();\n");
+                push(@implContent, "    if (index != PropertyName::NotAnIndex) {\n");
+                push(@implContent, "        thisObject->indexSetter(exec, index, value);\n");
                 push(@implContent, "        return;\n");
                 push(@implContent, "    }\n");
             }

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSFloat64Array.cpp (178927 => 178928)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSFloat64Array.cpp	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSFloat64Array.cpp	2015-01-22 19:34:34 UTC (rev 178928)
@@ -174,9 +174,9 @@
 {
     JSFloat64Array* thisObject = jsCast<JSFloat64Array*>(object);
     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
-    Optional<uint32_t> index = propertyName.asIndex();
-    if (index && index.value() < static_cast<Float64Array*>(thisObject->impl())->length()) {
-        slot.setValue(thisObject, thisObject->getByIndex(exec, index.value()));
+    unsigned index = propertyName.asIndex();
+    if (index != PropertyName::NotAnIndex && index < static_cast<Float64Array*>(thisObject->impl())->length()) {
+        slot.setValue(thisObject, thisObject->getByIndex(exec, index));
         return true;
     }
     return getStaticValueSlot<JSFloat64Array, Base>(exec, getJSFloat64ArrayTable(exec), thisObject, propertyName, slot);
@@ -186,9 +186,9 @@
 {
     JSFloat64Array* thisObject = jsCast<JSFloat64Array*>(object);
     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
-    Optional<uint32_t> index = propertyName.asIndex();
-    if (index && index.value() < static_cast<Float64Array*>(thisObject->impl())->length()) {
-        descriptor.setDescriptor(thisObject->getByIndex(exec, index.value()), DontDelete);
+    unsigned index = propertyName.asIndex();
+    if (index != PropertyName::NotAnIndex && index < static_cast<Float64Array*>(thisObject->impl())->length()) {
+        descriptor.setDescriptor(thisObject->getByIndex(exec, index), DontDelete);
         return true;
     }
     return getStaticValueDescriptor<JSFloat64Array, Base>(exec, getJSFloat64ArrayTable(exec), thisObject, propertyName, descriptor);
@@ -215,8 +215,9 @@
 {
     JSFloat64Array* thisObject = jsCast<JSFloat64Array*>(cell);
     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
-    if (Optional<uint32_t> index = propertyName.asIndex()) {
-        thisObject->indexSetter(exec, index.value(), value);
+    unsigned index = propertyName.asIndex();
+    if (index != PropertyName::NotAnIndex) {
+        thisObject->indexSetter(exec, index, value);
         return;
     }
     Base::put(thisObject, exec, propertyName, value, slot);

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp (178927 => 178928)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp	2015-01-22 19:34:34 UTC (rev 178928)
@@ -180,10 +180,10 @@
         slot.setCacheableCustom(thisObject, entry->attributes(), entry->propertyGetter());
         return true;
     }
-    Optional<uint32_t> index = propertyName.asIndex();
-    if (index && index.value() < thisObject->impl().length()) {
+    unsigned index = propertyName.asIndex();
+    if (index != PropertyName::NotAnIndex && index < thisObject->impl().length()) {
         unsigned attributes = DontDelete | ReadOnly;
-        slot.setValue(thisObject, attributes, toJS(exec, thisObject->globalObject(), thisObject->impl().item(index.value())));
+        slot.setValue(thisObject, attributes, toJS(exec, thisObject->globalObject(), thisObject->impl().item(index)));
         return true;
     }
     if (canGetItemsForName(exec, &thisObject->impl(), propertyName)) {

Modified: trunk/Source/WebCore/bridge/runtime_array.cpp (178927 => 178928)


--- trunk/Source/WebCore/bridge/runtime_array.cpp	2015-01-22 19:27:25 UTC (rev 178927)
+++ trunk/Source/WebCore/bridge/runtime_array.cpp	2015-01-22 19:34:34 UTC (rev 178928)
@@ -89,10 +89,11 @@
         return true;
     }
     
-    Optional<uint32_t> index = propertyName.asIndex();
-    if (index && index.value() < thisObject->getLength()) {
+    unsigned index = propertyName.asIndex();
+    if (index < thisObject->getLength()) {
+        ASSERT(index != PropertyName::NotAnIndex);
         slot.setValue(thisObject, DontDelete | DontEnum,
-            thisObject->getConcreteArray()->valueAt(exec, index.value()));
+            thisObject->getConcreteArray()->valueAt(exec, index));
         return true;
     }
     
@@ -119,8 +120,9 @@
         return;
     }
     
-    if (Optional<uint32_t> index = propertyName.asIndex()) {
-        thisObject->getConcreteArray()->setValueAt(exec, index.value(), value);
+    unsigned index = propertyName.asIndex();
+    if (index != PropertyName::NotAnIndex) {
+        thisObject->getConcreteArray()->setValueAt(exec, index, value);
         return;
     }
     
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to