Rename hasFastArrayStorage to be more appropriate
authordbatyai.u-szeged@partner.samsung.com <dbatyai.u-szeged@partner.samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Mar 2014 15:08:12 +0000 (15:08 +0000)
committerdbatyai.u-szeged@partner.samsung.com <dbatyai.u-szeged@partner.samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Mar 2014 15:08:12 +0000 (15:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=130773

Reviewed by Filip Pizlo.

* dfg/DFGArrayMode.cpp:
(JSC::DFG::ArrayMode::alreadyChecked):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGWatchpointCollectionPhase.cpp:
(JSC::DFG::WatchpointCollectionPhase::handle):
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::compileNewArray):
(JSC::FTL::LowerDFGToLLVM::compileNewArrayBuffer):
(JSC::FTL::LowerDFGToLLVM::compileNewArrayWithSize):
* runtime/ButterflyInlines.h:
(JSC::Butterfly::unshift):
(JSC::Butterfly::shift):
* runtime/IndexingHeaderInlines.h:
(JSC::IndexingHeader::preCapacity):
* runtime/IndexingType.h:
(JSC::hasArrayStorage):
(JSC::hasAnyArrayStorage):
(JSC::hasFastArrayStorage): Deleted.
* runtime/JSArray.cpp:
(JSC::JSArray::sortVector):
(JSC::JSArray::compactForSorting):
* runtime/JSArray.h:
(JSC::JSArray::create):
(JSC::JSArray::tryCreateUninitialized):
* runtime/JSGlobalObject.cpp:
* runtime/JSObject.cpp:
(JSC::JSObject::putDirectIndexBeyondVectorLengthWithArrayStorage):
* runtime/JSObject.h:
(JSC::JSObject::ensureArrayStorage):
(JSC::JSObject::arrayStorage):
* runtime/StructureTransitionTable.h:
(JSC::newIndexingType):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166292 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/dfg/DFGArrayMode.cpp
Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
Source/JavaScriptCore/dfg/DFGWatchpointCollectionPhase.cpp
Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp
Source/JavaScriptCore/runtime/ButterflyInlines.h
Source/JavaScriptCore/runtime/IndexingHeaderInlines.h
Source/JavaScriptCore/runtime/IndexingType.h
Source/JavaScriptCore/runtime/JSArray.cpp
Source/JavaScriptCore/runtime/JSArray.h
Source/JavaScriptCore/runtime/JSGlobalObject.cpp
Source/JavaScriptCore/runtime/JSObject.cpp
Source/JavaScriptCore/runtime/JSObject.h
Source/JavaScriptCore/runtime/StructureTransitionTable.h

index 2e6add9..e8cdb20 100644 (file)
@@ -1,3 +1,46 @@
+2014-03-26  Dániel Bátyai  <dbatyai.u-szeged@partner.samsung.com>
+
+        Rename hasFastArrayStorage to be more appropriate
+        https://bugs.webkit.org/show_bug.cgi?id=130773
+
+        Reviewed by Filip Pizlo.
+
+        * dfg/DFGArrayMode.cpp:
+        (JSC::DFG::ArrayMode::alreadyChecked):
+        * dfg/DFGSpeculativeJIT32_64.cpp:
+        (JSC::DFG::SpeculativeJIT::compile):
+        * dfg/DFGSpeculativeJIT64.cpp:
+        (JSC::DFG::SpeculativeJIT::compile):
+        * dfg/DFGWatchpointCollectionPhase.cpp:
+        (JSC::DFG::WatchpointCollectionPhase::handle):
+        * ftl/FTLLowerDFGToLLVM.cpp:
+        (JSC::FTL::LowerDFGToLLVM::compileNewArray):
+        (JSC::FTL::LowerDFGToLLVM::compileNewArrayBuffer):
+        (JSC::FTL::LowerDFGToLLVM::compileNewArrayWithSize):
+        * runtime/ButterflyInlines.h:
+        (JSC::Butterfly::unshift):
+        (JSC::Butterfly::shift):
+        * runtime/IndexingHeaderInlines.h:
+        (JSC::IndexingHeader::preCapacity):
+        * runtime/IndexingType.h:
+        (JSC::hasArrayStorage):
+        (JSC::hasAnyArrayStorage):
+        (JSC::hasFastArrayStorage): Deleted.
+        * runtime/JSArray.cpp:
+        (JSC::JSArray::sortVector):
+        (JSC::JSArray::compactForSorting):
+        * runtime/JSArray.h:
+        (JSC::JSArray::create):
+        (JSC::JSArray::tryCreateUninitialized):
+        * runtime/JSGlobalObject.cpp:
+        * runtime/JSObject.cpp:
+        (JSC::JSObject::putDirectIndexBeyondVectorLengthWithArrayStorage):
+        * runtime/JSObject.h:
+        (JSC::JSObject::ensureArrayStorage):
+        (JSC::JSObject::arrayStorage):
+        * runtime/StructureTransitionTable.h:
+        (JSC::newIndexingType):
+
 2014-03-26  Zan Dobersek  <zdobersek@igalia.com>
 
         Unreviewed. Removing the remaining Automake cruft.
index 9a93980..0cbdc7c 100644 (file)
@@ -344,14 +344,14 @@ bool ArrayMode::alreadyChecked(Graph& graph, Node* node, AbstractValue& value) c
             if (arrayModesAlreadyChecked(value.m_arrayModes, asArrayModes(ArrayWithArrayStorage) | asArrayModes(ArrayWithSlowPutArrayStorage)))
                 return true;
             return value.m_currentKnownStructure.hasSingleton()
-                && hasArrayStorage(value.m_currentKnownStructure.singleton()->indexingType())
+                && hasAnyArrayStorage(value.m_currentKnownStructure.singleton()->indexingType())
                 && (value.m_currentKnownStructure.singleton()->indexingType() & IsArray);
         
         default:
             if (arrayModesAlreadyChecked(value.m_arrayModes, asArrayModes(NonArrayWithArrayStorage) | asArrayModes(ArrayWithArrayStorage) | asArrayModes(NonArrayWithSlowPutArrayStorage) | asArrayModes(ArrayWithSlowPutArrayStorage)))
                 return true;
             return value.m_currentKnownStructure.hasSingleton()
-                && hasArrayStorage(value.m_currentKnownStructure.singleton()->indexingType());
+                && hasAnyArrayStorage(value.m_currentKnownStructure.singleton()->indexingType());
         }
         
     case Array::Arguments:
index d733bd0..39f83fd 100644 (file)
@@ -3163,7 +3163,7 @@ void SpeculativeJIT::compile(Node* node)
         
     case NewArray: {
         JSGlobalObject* globalObject = m_jit.graph().globalObjectFor(node->origin.semantic);
-        if (!globalObject->isHavingABadTime() && !hasArrayStorage(node->indexingType())) {
+        if (!globalObject->isHavingABadTime() && !hasAnyArrayStorage(node->indexingType())) {
             Structure* structure = globalObject->arrayStructureForIndexingTypeDuringAllocation(node->indexingType());
             ASSERT(structure->indexingType() == node->indexingType());
             ASSERT(
@@ -3331,7 +3331,7 @@ void SpeculativeJIT::compile(Node* node)
 
     case NewArrayWithSize: {
         JSGlobalObject* globalObject = m_jit.graph().globalObjectFor(node->origin.semantic);
-        if (!globalObject->isHavingABadTime() && !hasArrayStorage(node->indexingType())) {
+        if (!globalObject->isHavingABadTime() && !hasAnyArrayStorage(node->indexingType())) {
             SpeculateStrictInt32Operand size(this, node->child1());
             GPRTemporary result(this);
             GPRTemporary storage(this);
@@ -3405,7 +3405,7 @@ void SpeculativeJIT::compile(Node* node)
     case NewArrayBuffer: {
         JSGlobalObject* globalObject = m_jit.graph().globalObjectFor(node->origin.semantic);
         IndexingType indexingType = node->indexingType();
-        if (!globalObject->isHavingABadTime() && !hasArrayStorage(indexingType)) {
+        if (!globalObject->isHavingABadTime() && !hasAnyArrayStorage(indexingType)) {
             unsigned numElements = node->numConstants();
             
             GPRTemporary result(this);
index c581357..ddb25b1 100644 (file)
@@ -3485,7 +3485,7 @@ void SpeculativeJIT::compile(Node* node)
         
     case NewArray: {
         JSGlobalObject* globalObject = m_jit.graph().globalObjectFor(node->origin.semantic);
-        if (!globalObject->isHavingABadTime() && !hasArrayStorage(node->indexingType())) {
+        if (!globalObject->isHavingABadTime() && !hasAnyArrayStorage(node->indexingType())) {
             Structure* structure = globalObject->arrayStructureForIndexingTypeDuringAllocation(node->indexingType());
             RELEASE_ASSERT(structure->indexingType() == node->indexingType());
             ASSERT(
@@ -3656,7 +3656,7 @@ void SpeculativeJIT::compile(Node* node)
         
     case NewArrayWithSize: {
         JSGlobalObject* globalObject = m_jit.graph().globalObjectFor(node->origin.semantic);
-        if (!globalObject->isHavingABadTime() && !hasArrayStorage(node->indexingType())) {
+        if (!globalObject->isHavingABadTime() && !hasAnyArrayStorage(node->indexingType())) {
             SpeculateStrictInt32Operand size(this, node->child1());
             GPRTemporary result(this);
             GPRTemporary storage(this);
@@ -3727,7 +3727,7 @@ void SpeculativeJIT::compile(Node* node)
     case NewArrayBuffer: {
         JSGlobalObject* globalObject = m_jit.graph().globalObjectFor(node->origin.semantic);
         IndexingType indexingType = node->indexingType();
-        if (!globalObject->isHavingABadTime() && !hasArrayStorage(indexingType)) {
+        if (!globalObject->isHavingABadTime() && !hasAnyArrayStorage(indexingType)) {
             unsigned numElements = node->numConstants();
             
             GPRTemporary result(this);
index 1ac6d94..43e1b2d 100644 (file)
@@ -111,7 +111,7 @@ private:
         case NewArray:
         case NewArrayWithSize:
         case NewArrayBuffer:
-            if (!globalObject()->isHavingABadTime() && !hasArrayStorage(m_node->indexingType()))
+            if (!globalObject()->isHavingABadTime() && !hasAnyArrayStorage(m_node->indexingType()))
                 addLazily(globalObject()->havingABadTimeWatchpoint());
             break;
             
index 9ada4ce..d3e2985 100644 (file)
@@ -2503,7 +2503,7 @@ private:
         
         RELEASE_ASSERT(structure->indexingType() == m_node->indexingType());
         
-        if (!globalObject->isHavingABadTime() && !hasArrayStorage(m_node->indexingType())) {
+        if (!globalObject->isHavingABadTime() && !hasAnyArrayStorage(m_node->indexingType())) {
             unsigned numElements = m_node->numChildren();
             
             ArrayValues arrayValues = allocateJSArray(structure, numElements);
@@ -2580,7 +2580,7 @@ private:
         
         RELEASE_ASSERT(structure->indexingType() == m_node->indexingType());
         
-        if (!globalObject->isHavingABadTime() && !hasArrayStorage(m_node->indexingType())) {
+        if (!globalObject->isHavingABadTime() && !hasAnyArrayStorage(m_node->indexingType())) {
             unsigned numElements = m_node->numConstants();
             
             ArrayValues arrayValues = allocateJSArray(structure, numElements);
@@ -2617,7 +2617,7 @@ private:
         Structure* structure = globalObject->arrayStructureForIndexingTypeDuringAllocation(
             m_node->indexingType());
         
-        if (!globalObject->isHavingABadTime() && !hasArrayStorage(m_node->indexingType())) {
+        if (!globalObject->isHavingABadTime() && !hasAnyArrayStorage(m_node->indexingType())) {
             ASSERT(
                 hasUndecided(structure->indexingType())
                 || hasInt32(structure->indexingType())
index e50b542..3fd8dc1 100644 (file)
@@ -167,7 +167,7 @@ inline Butterfly* Butterfly::resizeArray(
 
 inline Butterfly* Butterfly::unshift(Structure* structure, size_t numberOfSlots)
 {
-    ASSERT(hasArrayStorage(structure->indexingType()));
+    ASSERT(hasAnyArrayStorage(structure->indexingType()));
     ASSERT(numberOfSlots <= indexingHeader()->preCapacity(structure));
     unsigned propertyCapacity = structure->outOfLineCapacity();
     // FIXME: It would probably be wise to rewrite this as a loop since (1) we know in which
@@ -186,7 +186,7 @@ inline Butterfly* Butterfly::unshift(Structure* structure, size_t numberOfSlots)
 
 inline Butterfly* Butterfly::shift(Structure* structure, size_t numberOfSlots)
 {
-    ASSERT(hasArrayStorage(structure->indexingType()));
+    ASSERT(hasAnyArrayStorage(structure->indexingType()));
     unsigned propertyCapacity = structure->outOfLineCapacity();
     // FIXME: See comment in unshift(), above.
     memmove(
index cfad1c8..b188741 100644 (file)
@@ -34,7 +34,7 @@ namespace JSC {
 
 inline size_t IndexingHeader::preCapacity(Structure* structure)
 {
-    if (LIKELY(!hasArrayStorage(structure->indexingType())))
+    if (LIKELY(!hasAnyArrayStorage(structure->indexingType())))
         return 0;
     
     return arrayStorage()->m_indexBias;
index 66a75f8..25d5a10 100644 (file)
@@ -121,14 +121,12 @@ static inline bool hasContiguous(IndexingType indexingType)
     return (indexingType & IndexingShapeMask) == ContiguousShape;
 }
 
-// FIXME: This is an awkward name. This should really be called hasArrayStorage()
-// and then next method down should be called hasAnyArrayStorage().
-static inline bool hasFastArrayStorage(IndexingType indexingType)
+static inline bool hasArrayStorage(IndexingType indexingType)
 {
     return (indexingType & IndexingShapeMask) == ArrayStorageShape;
 }
 
-static inline bool hasArrayStorage(IndexingType indexingType)
+static inline bool hasAnyArrayStorage(IndexingType indexingType)
 {
     return static_cast<uint8_t>((indexingType & IndexingShapeMask) - ArrayStorageShape) <= static_cast<uint8_t>(SlowPutArrayStorageShape - ArrayStorageShape);
 }
index be30d18..7e890f3 100644 (file)
@@ -1445,7 +1445,7 @@ void JSArray::sortVector(ExecState* exec, JSValue compareFunction, CallType call
             currentIndexingData()[i].clear();
     }
     
-    if (hasArrayStorage(indexingType()))
+    if (hasAnyArrayStorage(indexingType()))
         arrayStorage()->m_numValuesInVector = newUsedVectorLength;
 }
 
@@ -1665,7 +1665,7 @@ void JSArray::compactForSorting(unsigned& numDefined, unsigned& newRelevantLengt
         
     newRelevantLength = numDefined + numUndefined;
     
-    if (hasArrayStorage(arrayIndexingType))
+    if (hasAnyArrayStorage(arrayIndexingType))
         RELEASE_ASSERT(!arrayStorage()->m_sparseMap);
     
     switch (arrayIndexingType) {
@@ -1689,7 +1689,7 @@ void JSArray::compactForSorting(unsigned& numDefined, unsigned& newRelevantLengt
             indexingData<arrayIndexingType>()[i].clear();
     }
 
-    if (hasArrayStorage(arrayIndexingType))
+    if (hasAnyArrayStorage(arrayIndexingType))
         arrayStorage()->m_numValuesInVector = newRelevantLength;
 }
 
index fed91cf..4fc77dc 100644 (file)
@@ -208,7 +208,7 @@ Butterfly* createArrayButterflyInDictionaryIndexingMode(
 inline JSArray* JSArray::create(VM& vm, Structure* structure, unsigned initialLength)
 {
     Butterfly* butterfly;
-    if (LIKELY(!hasArrayStorage(structure->indexingType()))) {
+    if (LIKELY(!hasAnyArrayStorage(structure->indexingType()))) {
         ASSERT(
             hasUndecided(structure->indexingType())
             || hasInt32(structure->indexingType())
@@ -239,7 +239,7 @@ inline JSArray* JSArray::tryCreateUninitialized(VM& vm, Structure* structure, un
         return 0;
         
     Butterfly* butterfly;
-    if (LIKELY(!hasArrayStorage(structure->indexingType()))) {
+    if (LIKELY(!hasAnyArrayStorage(structure->indexingType()))) {
         ASSERT(
             hasUndecided(structure->indexingType())
             || hasInt32(structure->indexingType())
index fcb55ea..97401dd 100644 (file)
@@ -511,7 +511,7 @@ inline bool hasBrokenIndexing(JSObject* object)
     IndexingType type = object->structure()->indexingType();
     // This could be made obviously more efficient, but isn't made so right now, because
     // we expect this to be an unlikely slow path anyway.
-    return hasUndecided(type) || hasInt32(type) || hasDouble(type) || hasContiguous(type) || hasFastArrayStorage(type);
+    return hasUndecided(type) || hasInt32(type) || hasDouble(type) || hasContiguous(type) || hasArrayStorage(type);
 }
 
 void ObjectsWithBrokenIndexingFinder::operator()(JSCell* cell)
index 59c299e..60cd59f 100644 (file)
@@ -2073,7 +2073,7 @@ bool JSObject::putDirectIndexBeyondVectorLengthWithArrayStorage(ExecState* exec,
     VM& vm = exec->vm();
     
     // i should be a valid array index that is outside of the current vector.
-    ASSERT(hasArrayStorage(indexingType()));
+    ASSERT(hasAnyArrayStorage(indexingType()));
     ASSERT(arrayStorage() == storage);
     ASSERT(i >= storage->vectorLength() || attributes);
     ASSERT(i <= MAX_ARRAY_INDEX);
index 338d3db..2866fa5 100644 (file)
@@ -697,9 +697,9 @@ public:
     // already.
     ArrayStorage* ensureArrayStorage(VM& vm)
     {
-        if (LIKELY(hasArrayStorage(indexingType())))
+        if (LIKELY(hasAnyArrayStorage(indexingType())))
             return m_butterfly->arrayStorage();
-            
+
         return ensureArrayStorageSlow(vm);
     }
         
@@ -745,7 +745,7 @@ protected:
     // storage. This will assert otherwise.
     ArrayStorage* arrayStorage()
     {
-        ASSERT(hasArrayStorage(indexingType()));
+        ASSERT(hasAnyArrayStorage(indexingType()));
         return m_butterfly->arrayStorage();
     }
         
index 4ba64b5..27c0a79 100644 (file)
@@ -79,7 +79,7 @@ inline IndexingType newIndexingType(IndexingType oldType, NonPropertyTransition
         ASSERT(!hasIndexedProperties(oldType) || hasUndecided(oldType) || hasInt32(oldType) || hasDouble(oldType) || hasContiguous(oldType) || hasContiguous(oldType));
         return (oldType & ~IndexingShapeMask) | SlowPutArrayStorageShape;
     case SwitchToSlowPutArrayStorage:
-        ASSERT(hasFastArrayStorage(oldType));
+        ASSERT(hasArrayStorage(oldType));
         return (oldType & ~IndexingShapeMask) | SlowPutArrayStorageShape;
     case AddIndexedAccessors:
         return oldType | MayHaveIndexedAccessors;