Reviewers: Jakob,

Message:
PTAL

Description:
Tag stubs that rely on instance types as MEGAMORPHIC.


BUG=chromium:173974


Please review this at https://chromiumcodereview.appspot.com/12178017/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/builtins.h
  M src/code-stubs.h
  A + test/mjsunit/regress/regress-crbug-173974.js


Index: src/builtins.h
diff --git a/src/builtins.h b/src/builtins.h
index f13865b48570891dc2599a59d922b2cb9852125a..cb0c9c516cef5e7d6c226505fa8ce1c75c482a3a 100644
--- a/src/builtins.h
+++ b/src/builtins.h
@@ -145,7 +145,7 @@ enum BuiltinExtraArguments {
                                     Code::kNoExtraICState)              \
   V(KeyedLoadIC_Generic,            KEYED_LOAD_IC, GENERIC,             \
                                     Code::kNoExtraICState)              \
-  V(KeyedLoadIC_String,             KEYED_LOAD_IC, MONOMORPHIC,         \
+  V(KeyedLoadIC_String,             KEYED_LOAD_IC, MEGAMORPHIC,         \
                                     Code::kNoExtraICState)              \
   V(KeyedLoadIC_IndexedInterceptor, KEYED_LOAD_IC, MONOMORPHIC,         \
                                     Code::kNoExtraICState)              \
Index: src/code-stubs.h
diff --git a/src/code-stubs.h b/src/code-stubs.h
index bd572c2f26b93e6ab5cb2d9e247529c32ff2b18f..6a763a43648b9c3519446961ac56921c6a3135d3 100644
--- a/src/code-stubs.h
+++ b/src/code-stubs.h
@@ -548,7 +548,12 @@ class ICStub: public PlatformCodeStub {
  public:
   explicit ICStub(Code::Kind kind) : kind_(kind) { }
   virtual int GetCodeKind() { return kind_; }
-  virtual InlineCacheState GetICState() { return MONOMORPHIC; }
+ // Currently all IC stubs do not collect explicit type feedback but rather
+  // check the instance type.
+ // TODO(verwaest): These stubs should collect proper typefeedback, and should
+  // not check the instance type explictly (perhaps unless more than
+  // kMaxPolymorphism maps are recorded).
+  virtual InlineCacheState GetICState() { return MEGAMORPHIC; }

   bool Describes(Code* code) {
return GetMajorKey(code) == MajorKey() && code->stub_info() == MinorKey();
Index: test/mjsunit/regress/regress-crbug-173974.js
diff --git a/test/mjsunit/regress/regress-crbug-172345.js b/test/mjsunit/regress/regress-crbug-173974.js
similarity index 92%
copy from test/mjsunit/regress/regress-crbug-172345.js
copy to test/mjsunit/regress/regress-crbug-173974.js
index 711501caa791f2974635ac4dd894568a2e3fc982..905bd6058a0ad0fe2ebe10e4c7dafbe9945cbe3b 100644
--- a/test/mjsunit/regress/regress-crbug-172345.js
+++ b/test/mjsunit/regress/regress-crbug-173974.js
@@ -25,10 +25,12 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-function f(a,i) {
-  return a[i];
-}
+// Flags: --allow-natives-syntax

-f([1,2,3], "length");
-f([1,2,3], "length");
-f([1,2,3], 2);
+function f() {
+  var count = "";
+  count[0] --;
+}
+f();
+%OptimizeFunctionOnNextCall(f);
+f();


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to