Title: [115604] branches/dfgopt/Source/_javascript_Core
Revision
115604
Author
fpi...@apple.com
Date
2012-04-29 19:51:18 -0700 (Sun, 29 Apr 2012)

Log Message

Predicted types should know about arguments
https://bugs.webkit.org/show_bug.cgi?id=85165

Reviewed by Oliver Hunt.

* bytecode/PredictedType.cpp:
(JSC::predictionToString):
(JSC::predictionToAbbreviatedString):
(JSC::predictionFromClassInfo):
* bytecode/PredictedType.h:
(JSC):
(JSC::isMyArgumentsPrediction):
(JSC::isArgumentsPrediction):

Modified Paths

Diff

Modified: branches/dfgopt/Source/_javascript_Core/ChangeLog (115603 => 115604)


--- branches/dfgopt/Source/_javascript_Core/ChangeLog	2012-04-30 02:24:22 UTC (rev 115603)
+++ branches/dfgopt/Source/_javascript_Core/ChangeLog	2012-04-30 02:51:18 UTC (rev 115604)
@@ -1,3 +1,19 @@
+2012-04-29  Filip Pizlo  <fpi...@apple.com>
+
+        Predicted types should know about arguments
+        https://bugs.webkit.org/show_bug.cgi?id=85165
+
+        Reviewed by Oliver Hunt.
+
+        * bytecode/PredictedType.cpp:
+        (JSC::predictionToString):
+        (JSC::predictionToAbbreviatedString):
+        (JSC::predictionFromClassInfo):
+        * bytecode/PredictedType.h:
+        (JSC):
+        (JSC::isMyArgumentsPrediction):
+        (JSC::isArgumentsPrediction):
+
 2012-04-28  Filip Pizlo  <fpi...@apple.com>
 
         Bytecompiler should emit trivially fewer jumps in loops

Modified: branches/dfgopt/Source/_javascript_Core/bytecode/PredictedType.cpp (115603 => 115604)


--- branches/dfgopt/Source/_javascript_Core/bytecode/PredictedType.cpp	2012-04-30 02:24:22 UTC (rev 115603)
+++ branches/dfgopt/Source/_javascript_Core/bytecode/PredictedType.cpp	2012-04-30 02:51:18 UTC (rev 115604)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -29,6 +29,7 @@
 #include "config.h"
 #include "PredictedType.h"
 
+#include "Arguments.h"
 #include "JSArray.h"
 #include "JSByteArray.h"
 #include "JSFunction.h"
@@ -123,6 +124,16 @@
     else
         isTop = false;
     
+    if (value & PredictMyArguments)
+        ptr.strcat("Myarguments");
+    else
+        isTop = false;
+    
+    if (value & PredictForeignArguments)
+        ptr.strcat("Foreignarguments");
+    else
+        isTop = false;
+    
     if (value & PredictString)
         ptr.strcat("String");
     else
@@ -194,6 +205,10 @@
         return "<Float32array>";
     if (isFloat64ArrayPrediction(prediction))
         return "<Float64array>";
+    if (isMyArgumentsPrediction(prediction))
+        return "<Myarguments>";
+    if (isArgumentsPrediction(prediction))
+        return "<Arguments>";
     if (isObjectPrediction(prediction))
         return "<Object>";
     if (isCellPrediction(prediction))
@@ -222,6 +237,9 @@
     if (classInfo == &JSString::s_info)
         return PredictString;
     
+    if (classInfo == &Arguments::s_info)
+        return PredictArguments; // Cannot distinguish between MyArguments and ForeignArguments at this stage. That happens in the flow analysis.
+    
     if (classInfo->isSubClassOf(&JSFunction::s_info))
         return PredictFunction;
 

Modified: branches/dfgopt/Source/_javascript_Core/bytecode/PredictedType.h (115603 => 115604)


--- branches/dfgopt/Source/_javascript_Core/bytecode/PredictedType.h	2012-04-30 02:24:22 UTC (rev 115603)
+++ branches/dfgopt/Source/_javascript_Core/bytecode/PredictedType.h	2012-04-30 02:51:18 UTC (rev 115604)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -50,17 +50,20 @@
 static const PredictedType PredictUint32Array       = 0x00000400; // It's definitely an Uint32Array or one of its subclasses.
 static const PredictedType PredictFloat32Array      = 0x00000800; // It's definitely an Uint16Array or one of its subclasses.
 static const PredictedType PredictFloat64Array      = 0x00001000; // It's definitely an Uint16Array or one of its subclasses.
-static const PredictedType PredictObjectOther       = 0x00002000; // It's definitely an object but not JSFinalObject, JSArray, JSByteArray, or JSFunction.
-static const PredictedType PredictObjectMask        = 0x00003fff; // Bitmask used for testing for any kind of object prediction.
-static const PredictedType PredictString            = 0x00004000; // It's definitely a JSString.
-static const PredictedType PredictCellOther         = 0x00008000; // It's definitely a JSCell but not a subclass of JSObject and definitely not a JSString.
-static const PredictedType PredictCell              = 0x0000ffff; // It's definitely a JSCell.
-static const PredictedType PredictInt32             = 0x00010000; // It's definitely an Int32.
-static const PredictedType PredictDoubleReal        = 0x00020000; // It's definitely a non-NaN double.
-static const PredictedType PredictDoubleNaN         = 0x00040000; // It's definitely a NaN.
-static const PredictedType PredictDouble            = 0x00060000; // It's either a non-NaN or a NaN double.
-static const PredictedType PredictNumber            = 0x00070000; // It's either an Int32 or a Double.
-static const PredictedType PredictBoolean           = 0x00080000; // It's definitely a Boolean.
+static const PredictedType PredictMyArguments       = 0x00002000; // It's definitely an Arguments object, and it's definitely the one for my current frame.
+static const PredictedType PredictForeignArguments  = 0x00004000; // It's definitely an Arguments object, and it's definitely not mine.
+static const PredictedType PredictArguments         = 0x00006000; // It's definitely an Arguments object.
+static const PredictedType PredictObjectOther       = 0x00008000; // It's definitely an object but not JSFinalObject, JSArray, JSByteArray, or JSFunction.
+static const PredictedType PredictObjectMask        = 0x0000ffff; // Bitmask used for testing for any kind of object prediction.
+static const PredictedType PredictString            = 0x00010000; // It's definitely a JSString.
+static const PredictedType PredictCellOther         = 0x00020000; // It's definitely a JSCell but not a subclass of JSObject and definitely not a JSString.
+static const PredictedType PredictCell              = 0x0003ffff; // It's definitely a JSCell.
+static const PredictedType PredictInt32             = 0x00800000; // It's definitely an Int32.
+static const PredictedType PredictDoubleReal        = 0x01000000; // It's definitely a non-NaN double.
+static const PredictedType PredictDoubleNaN         = 0x02000000; // It's definitely a NaN.
+static const PredictedType PredictDouble            = 0x03000000; // It's either a non-NaN or a NaN double.
+static const PredictedType PredictNumber            = 0x03800000; // It's either an Int32 or a Double.
+static const PredictedType PredictBoolean           = 0x04000000; // It's definitely a Boolean.
 static const PredictedType PredictOther             = 0x08000000; // It's definitely none of the above.
 static const PredictedType PredictTop               = 0x0fffffff; // It can be any of the above.
 static const PredictedType PredictEmpty             = 0x10000000; // It's definitely an empty value marker.
@@ -205,6 +208,16 @@
     return !!(value & (PredictArray | PredictOther)) && !(value & ~(PredictArray | PredictOther));
 }
 
+inline bool isMyArgumentsPrediction(PredictedType value)
+{
+    return value == PredictMyArguments;
+}
+
+inline bool isArgumentsPrediction(PredictedType value)
+{
+    return !!value && (value & PredictArguments) == value;
+}
+
 inline bool isInt32Prediction(PredictedType value)
 {
     return value == PredictInt32;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to