summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/dfg/DFGArrayMode.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-10-15 16:08:57 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-10-15 16:08:57 +0200
commit5466563f4b5b6b86523e3f89bb7f77e5b5270c78 (patch)
tree8caccf7cd03a15207cde3ba282c88bf132482a91 /Source/JavaScriptCore/dfg/DFGArrayMode.cpp
parent33b26980cb24288b5a9f2590ccf32a949281bb79 (diff)
downloadqtwebkit-5466563f4b5b6b86523e3f89bb7f77e5b5270c78.tar.gz
Imported WebKit commit 0dc6cd75e1d4836eaffbb520be96fac4847cc9d2 (http://svn.webkit.org/repository/webkit/trunk@131300)
WebKit update which introduces the QtWebKitWidgets module that contains the WK1 widgets based API. (In fact it renames QtWebKit to QtWebKitWidgets while we're working on completing the entire split as part of https://bugs.webkit.org/show_bug.cgi?id=99314
Diffstat (limited to 'Source/JavaScriptCore/dfg/DFGArrayMode.cpp')
-rw-r--r--Source/JavaScriptCore/dfg/DFGArrayMode.cpp81
1 files changed, 69 insertions, 12 deletions
diff --git a/Source/JavaScriptCore/dfg/DFGArrayMode.cpp b/Source/JavaScriptCore/dfg/DFGArrayMode.cpp
index 12c9640c8..3985d769c 100644
--- a/Source/JavaScriptCore/dfg/DFGArrayMode.cpp
+++ b/Source/JavaScriptCore/dfg/DFGArrayMode.cpp
@@ -39,8 +39,14 @@ Array::Mode fromObserved(ArrayProfile* profile, Array::Action action, bool makeS
return Array::Unprofiled;
case asArrayModes(NonArray):
if (action == Array::Write && !profile->mayInterceptIndexedAccesses())
- return Array::BlankToArrayStorage; // FIXME: we don't know whether to go to slow put mode, or not. This is a decent guess.
+ return Array::ToContiguous; // FIXME: we don't know whether to go to contiguous or array storage. We're making a static guess here. In future we should use exit profiling for this.
return Array::Undecided;
+ case asArrayModes(NonArrayWithContiguous):
+ return makeSafe ? Array::ContiguousOutOfBounds : (profile->mayStoreToHole() ? Array::ContiguousToTail : Array::Contiguous);
+ case asArrayModes(ArrayWithContiguous):
+ return makeSafe ? Array::ArrayWithContiguousOutOfBounds : (profile->mayStoreToHole() ? Array::ArrayWithContiguousToTail : Array::ArrayWithContiguous);
+ case asArrayModes(NonArrayWithContiguous) | asArrayModes(ArrayWithContiguous):
+ return makeSafe ? Array::PossiblyArrayWithContiguousOutOfBounds : (profile->mayStoreToHole() ? Array::PossiblyArrayWithContiguousToTail : Array::PossiblyArrayWithContiguous);
case asArrayModes(NonArrayWithArrayStorage):
return makeSafe ? Array::ArrayStorageOutOfBounds : (profile->mayStoreToHole() ? Array::ArrayStorageToHole : Array::ArrayStorage);
case asArrayModes(NonArrayWithSlowPutArrayStorage):
@@ -56,14 +62,25 @@ Array::Mode fromObserved(ArrayProfile* profile, Array::Action action, bool makeS
case asArrayModes(NonArrayWithSlowPutArrayStorage) | asArrayModes(ArrayWithSlowPutArrayStorage):
case asArrayModes(NonArrayWithArrayStorage) | asArrayModes(ArrayWithArrayStorage) | asArrayModes(NonArrayWithSlowPutArrayStorage) | asArrayModes(ArrayWithSlowPutArrayStorage):
return Array::PossiblyArrayWithSlowPutArrayStorage;
+ case asArrayModes(NonArrayWithContiguous) | asArrayModes(NonArrayWithArrayStorage):
+ return Array::ToArrayStorage;
+ case asArrayModes(ArrayWithContiguous) | asArrayModes(ArrayWithArrayStorage):
+ return Array::ArrayToArrayStorage;
+ case asArrayModes(NonArrayWithContiguous) | asArrayModes(NonArrayWithArrayStorage) | asArrayModes(ArrayWithContiguous) | asArrayModes(ArrayWithArrayStorage):
+ return Array::PossiblyArrayToArrayStorage;
+ case asArrayModes(NonArray) | asArrayModes(NonArrayWithContiguous):
+ if (action == Array::Write && !profile->mayInterceptIndexedAccesses())
+ return Array::ToContiguous;
+ return Array::Undecided;
+ case asArrayModes(NonArray) | asArrayModes(NonArrayWithContiguous) | asArrayModes(NonArrayWithArrayStorage):
case asArrayModes(NonArray) | asArrayModes(NonArrayWithArrayStorage):
if (action == Array::Write && !profile->mayInterceptIndexedAccesses())
- return Array::BlankToArrayStorage;
+ return Array::ToArrayStorage;
return Array::Undecided;
case asArrayModes(NonArray) | asArrayModes(NonArrayWithSlowPutArrayStorage):
case asArrayModes(NonArray) | asArrayModes(NonArrayWithArrayStorage) | asArrayModes(NonArrayWithSlowPutArrayStorage):
if (action == Array::Write && !profile->mayInterceptIndexedAccesses())
- return Array::BlankToSlowPutArrayStorage;
+ return Array::ToSlowPutArrayStorage;
return Array::Undecided;
default:
// We know that this is possibly a kind of array for which, though there is no
@@ -144,6 +161,22 @@ bool modeAlreadyChecked(AbstractValue& value, Array::Mode arrayMode)
case Array::String:
return isStringSpeculation(value.m_type);
+ case Array::Contiguous:
+ case Array::ContiguousToTail:
+ case Array::ContiguousOutOfBounds:
+ case Array::PossiblyArrayWithContiguous:
+ case Array::PossiblyArrayWithContiguousToTail:
+ case Array::PossiblyArrayWithContiguousOutOfBounds:
+ return value.m_currentKnownStructure.hasSingleton()
+ && hasContiguous(value.m_currentKnownStructure.singleton()->indexingType());
+
+ case Array::ArrayWithContiguous:
+ case Array::ArrayWithContiguousToTail:
+ case Array::ArrayWithContiguousOutOfBounds:
+ return value.m_currentKnownStructure.hasSingleton()
+ && hasContiguous(value.m_currentKnownStructure.singleton()->indexingType())
+ && (value.m_currentKnownStructure.singleton()->indexingType() & IsArray);
+
case Array::ArrayStorage:
case Array::ArrayStorageToHole:
case Array::ArrayStorageOutOfBounds:
@@ -151,26 +184,26 @@ bool modeAlreadyChecked(AbstractValue& value, Array::Mode arrayMode)
case Array::PossiblyArrayWithArrayStorageToHole:
case Array::PossiblyArrayWithArrayStorageOutOfBounds:
return value.m_currentKnownStructure.hasSingleton()
- && (value.m_currentKnownStructure.singleton()->indexingType() & HasArrayStorage);
+ && hasFastArrayStorage(value.m_currentKnownStructure.singleton()->indexingType());
case Array::SlowPutArrayStorage:
case Array::PossiblyArrayWithSlowPutArrayStorage:
return value.m_currentKnownStructure.hasSingleton()
- && (value.m_currentKnownStructure.singleton()->indexingType() & (HasArrayStorage | HasSlowPutArrayStorage));
+ && hasArrayStorage(value.m_currentKnownStructure.singleton()->indexingType());
case Array::ArrayWithArrayStorage:
case Array::ArrayWithArrayStorageToHole:
case Array::ArrayWithArrayStorageOutOfBounds:
return value.m_currentKnownStructure.hasSingleton()
- && (value.m_currentKnownStructure.singleton()->indexingType() & HasArrayStorage)
+ && hasFastArrayStorage(value.m_currentKnownStructure.singleton()->indexingType())
&& (value.m_currentKnownStructure.singleton()->indexingType() & IsArray);
case Array::ArrayWithSlowPutArrayStorage:
return value.m_currentKnownStructure.hasSingleton()
- && (value.m_currentKnownStructure.singleton()->indexingType() & (HasArrayStorage | HasSlowPutArrayStorage))
+ && hasArrayStorage(value.m_currentKnownStructure.singleton()->indexingType())
&& (value.m_currentKnownStructure.singleton()->indexingType() & IsArray);
- case ALL_EFFECTFUL_ARRAY_STORAGE_MODES:
+ case ALL_EFFECTFUL_MODES:
return false;
case Array::Arguments:
@@ -225,6 +258,24 @@ const char* modeToString(Array::Mode mode)
return "ForceExit";
case Array::String:
return "String";
+ case Array::Contiguous:
+ return "Contiguous";
+ case Array::ContiguousToTail:
+ return "ContiguousToTail";
+ case Array::ContiguousOutOfBounds:
+ return "ContiguousOutOfBounds";
+ case Array::ArrayWithContiguous:
+ return "ArrayWithContiguous";
+ case Array::ArrayWithContiguousToTail:
+ return "ArrayWithContiguousToTail";
+ case Array::ArrayWithContiguousOutOfBounds:
+ return "ArrayWithContiguousOutOfBounds";
+ case Array::PossiblyArrayWithContiguous:
+ return "PossiblyArrayWithContiguous";
+ case Array::PossiblyArrayWithContiguousToTail:
+ return "PossiblyArrayWithContiguousToTail";
+ case Array::PossiblyArrayWithContiguousOutOfBounds:
+ return "PossiblyArrayWithContiguousOutOfBounds";
case Array::ArrayStorage:
return "ArrayStorage";
case Array::ArrayStorageToHole:
@@ -249,10 +300,16 @@ const char* modeToString(Array::Mode mode)
return "PossiblyArrayWithSlowPutArrayStorage";
case Array::PossiblyArrayWithArrayStorageOutOfBounds:
return "PossiblyArrayWithArrayStorageOutOfBounds";
- case Array::BlankToArrayStorage:
- return "BlankToArrayStorage";
- case Array::BlankToSlowPutArrayStorage:
- return "BlankToSlowPutArrayStorage";
+ case Array::ToContiguous:
+ return "ToContiguous";
+ case Array::ToArrayStorage:
+ return "ToArrayStorage";
+ case Array::ToSlowPutArrayStorage:
+ return "ToSlowPutArrayStorage";
+ case Array::ArrayToArrayStorage:
+ return "ArrayToArrayStorage";
+ case Array::PossiblyArrayToArrayStorage:
+ return "PossiblyArrayToArrayStorage";
case Array::Arguments:
return "Arguments";
case Array::Int8Array: