summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/dfg/DFGArrayMode.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-09-20 14:01:09 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-09-20 14:01:09 +0200
commit6dbcd09121fe266c7704a524b5cbd7f2754659c0 (patch)
tree5ae0d16cec0cc61f576d51c57b3a4613c7e91e22 /Source/JavaScriptCore/dfg/DFGArrayMode.h
parent6bbb7fbbac94d0f511a7bd0cbd50854ab643bfb2 (diff)
downloadqtwebkit-6dbcd09121fe266c7704a524b5cbd7f2754659c0.tar.gz
Imported WebKit commit 080af0beaa6f0ba8ff8f44cb8bd8b5dcf75ac0af (http://svn.webkit.org/repository/webkit/trunk@129119)
New snapshot with prospective build fix for incorrect QtWebKit master module header file creation
Diffstat (limited to 'Source/JavaScriptCore/dfg/DFGArrayMode.h')
-rw-r--r--Source/JavaScriptCore/dfg/DFGArrayMode.h80
1 files changed, 77 insertions, 3 deletions
diff --git a/Source/JavaScriptCore/dfg/DFGArrayMode.h b/Source/JavaScriptCore/dfg/DFGArrayMode.h
index cc8b1b809..d4be9c0eb 100644
--- a/Source/JavaScriptCore/dfg/DFGArrayMode.h
+++ b/Source/JavaScriptCore/dfg/DFGArrayMode.h
@@ -41,20 +41,36 @@ struct AbstractValue;
// that would otherwise occur, since we say things like "Int8Array" and "JSArray"
// in lots of other places, to mean subtly different things.
namespace Array {
+enum Action {
+ Read,
+ Write
+};
+
enum Mode {
Undecided, // Implies that we need predictions to decide. We will never get to the backend in this mode.
+ Unprofiled, // Implies that array profiling didn't see anything. But that could be because the operands didn't comply with basic type assumptions (base is cell, property is int). This either becomes Generic or ForceExit depending on value profiling.
ForceExit, // Implies that we have no idea how to execute this operation, so we should just give up.
Generic,
String,
+
+ // Modes of conventional indexed storage where the check is non side-effecting.
ArrayStorage,
+ ArrayStorageToHole,
SlowPutArrayStorage,
ArrayStorageOutOfBounds,
ArrayWithArrayStorage,
+ ArrayWithArrayStorageToHole,
ArrayWithSlowPutArrayStorage,
ArrayWithArrayStorageOutOfBounds,
PossiblyArrayWithArrayStorage,
+ PossiblyArrayWithArrayStorageToHole,
PossiblyArrayWithSlowPutArrayStorage,
PossiblyArrayWithArrayStorageOutOfBounds,
+
+ // Modes of conventional indexed storage where the check is side-effecting.
+ BlankToArrayStorage,
+ BlankToSlowPutArrayStorage,
+
Arguments,
Int8Array,
Int16Array,
@@ -71,22 +87,32 @@ enum Mode {
// Helpers for 'case' statements. For example, saying "case AllArrayStorageModes:"
// is the same as having multiple case statements listing off all of the modes that
// have the word "ArrayStorage" in them.
+
+// First: helpers for non-side-effecting checks.
#define NON_ARRAY_ARRAY_STORAGE_MODES \
Array::ArrayStorage: \
+ case Array::ArrayStorageToHole: \
case Array::SlowPutArrayStorage: \
case Array::ArrayStorageOutOfBounds: \
case Array::PossiblyArrayWithArrayStorage: \
+ case Array::PossiblyArrayWithArrayStorageToHole: \
case Array::PossiblyArrayWithSlowPutArrayStorage: \
case Array::PossiblyArrayWithArrayStorageOutOfBounds
#define ARRAY_WITH_ARRAY_STORAGE_MODES \
Array::ArrayWithArrayStorage: \
+ case Array::ArrayWithArrayStorageToHole: \
case Array::ArrayWithSlowPutArrayStorage: \
case Array::ArrayWithArrayStorageOutOfBounds
#define ALL_ARRAY_STORAGE_MODES \
NON_ARRAY_ARRAY_STORAGE_MODES: \
case ARRAY_WITH_ARRAY_STORAGE_MODES
+#define ARRAY_STORAGE_TO_HOLE_MODES \
+ Array::ArrayStorageToHole: \
+ case Array::ArrayWithArrayStorageToHole: \
+ case Array::PossiblyArrayWithArrayStorageToHole
#define IN_BOUNDS_ARRAY_STORAGE_MODES \
- Array::ArrayStorage: \
+ ARRAY_STORAGE_TO_HOLE_MODES: \
+ case Array::ArrayStorage: \
case Array::ArrayWithArrayStorage: \
case Array::PossiblyArrayWithArrayStorage
#define SLOW_PUT_ARRAY_STORAGE_MODES \
@@ -99,9 +125,16 @@ enum Mode {
case Array::ArrayWithArrayStorageOutOfBounds: \
case Array::PossiblyArrayWithArrayStorageOutOfBounds
-Array::Mode fromObserved(ArrayModes modes, bool makeSafe);
+// Next: helpers for side-effecting checks.
+#define EFFECTFUL_NON_ARRAY_ARRAY_STORAGE_MODES \
+ Array::BlankToArrayStorage: \
+ case Array::BlankToSlowPutArrayStorage
+#define ALL_EFFECTFUL_ARRAY_STORAGE_MODES \
+ EFFECTFUL_NON_ARRAY_ARRAY_STORAGE_MODES
+#define SLOW_PUT_EFFECTFUL_ARRAY_STORAGE_MODES \
+ Array::BlankToSlowPutArrayStorage
-Array::Mode fromStructure(Structure*, bool makeSafe);
+Array::Mode fromObserved(ArrayProfile*, Array::Action, bool makeSafe);
Array::Mode refineArrayMode(Array::Mode, SpeculatedType base, SpeculatedType index);
@@ -113,6 +146,7 @@ inline bool modeUsesButterfly(Array::Mode arrayMode)
{
switch (arrayMode) {
case ALL_ARRAY_STORAGE_MODES:
+ case ALL_EFFECTFUL_ARRAY_STORAGE_MODES:
return true;
default:
return false;
@@ -143,6 +177,19 @@ inline bool isSlowPutAccess(Array::Mode arrayMode)
{
switch (arrayMode) {
case SLOW_PUT_ARRAY_STORAGE_MODES:
+ case SLOW_PUT_EFFECTFUL_ARRAY_STORAGE_MODES:
+ return true;
+ default:
+ return false;
+ }
+}
+
+inline bool mayStoreToHole(Array::Mode arrayMode)
+{
+ switch (arrayMode) {
+ case ARRAY_STORAGE_TO_HOLE_MODES:
+ case OUT_OF_BOUNDS_ARRAY_STORAGE_MODES:
+ case ALL_EFFECTFUL_ARRAY_STORAGE_MODES:
return true;
default:
return false;
@@ -153,6 +200,7 @@ inline bool canCSEStorage(Array::Mode arrayMode)
{
switch (arrayMode) {
case Array::Undecided:
+ case Array::Unprofiled:
case Array::ForceExit:
case Array::Generic:
case Array::Arguments:
@@ -185,6 +233,7 @@ inline bool modeIsSpecific(Array::Mode mode)
{
switch (mode) {
case Array::Undecided:
+ case Array::Unprofiled:
case Array::ForceExit:
case Array::Generic:
return false;
@@ -197,6 +246,7 @@ inline bool modeSupportsLength(Array::Mode mode)
{
switch (mode) {
case Array::Undecided:
+ case Array::Unprofiled:
case Array::ForceExit:
case Array::Generic:
case NON_ARRAY_ARRAY_STORAGE_MODES:
@@ -206,6 +256,30 @@ inline bool modeSupportsLength(Array::Mode mode)
}
}
+inline bool benefitsFromStructureCheck(Array::Mode mode)
+{
+ switch (mode) {
+ case ALL_EFFECTFUL_ARRAY_STORAGE_MODES:
+ case Array::Undecided:
+ case Array::Unprofiled:
+ case Array::ForceExit:
+ case Array::Generic:
+ return false;
+ default:
+ return true;
+ }
+}
+
+inline bool isEffectful(Array::Mode mode)
+{
+ switch (mode) {
+ case ALL_EFFECTFUL_ARRAY_STORAGE_MODES:
+ return true;
+ default:
+ return false;
+ }
+}
+
} } // namespace JSC::DFG
#endif // ENABLE(DFG_JIT)