Remove special ArrayCode CallIC.
authorverwaest@chromium.org <verwaest@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 17 Jan 2014 11:24:36 +0000 (11:24 +0000)
committerverwaest@chromium.org <verwaest@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 17 Jan 2014 11:24:36 +0000 (11:24 +0000)
Once Call ICs are replaced by LoadIC + CallFunctionStub, we'll need a new way
of tracking this information.

R=mvstanton@chromium.org

Review URL: https://codereview.chromium.org/141073006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18662 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/arm/stub-cache-arm.cc
src/ia32/stub-cache-ia32.cc
src/mips/stub-cache-mips.cc
src/stub-cache.cc
src/stub-cache.h
src/x64/stub-cache-x64.cc
test/mjsunit/array-feedback.js

index 0fddbed..a8c268a 100644 (file)
@@ -1571,39 +1571,6 @@ Handle<Code> CallStubCompiler::CompileCallField(Handle<JSObject> object,
 }
 
 
-Handle<Code> CallStubCompiler::CompileArrayCodeCall(
-    Handle<Object> object,
-    Handle<JSObject> holder,
-    Handle<Cell> cell,
-    Handle<JSFunction> function,
-    Handle<String> name,
-    Code::StubType type) {
-  Label miss;
-
-  HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss);
-  if (!cell.is_null()) {
-    ASSERT(cell->value() == *function);
-    GenerateLoadFunctionFromCell(cell, function, &miss);
-  }
-
-  Handle<AllocationSite> site = isolate()->factory()->NewAllocationSite();
-  site->SetElementsKind(GetInitialFastElementsKind());
-  Handle<Cell> site_feedback_cell = isolate()->factory()->NewCell(site);
-  const int argc = arguments().immediate();
-  __ mov(r0, Operand(argc));
-  __ mov(r2, Operand(site_feedback_cell));
-  __ mov(r1, Operand(function));
-
-  ArrayConstructorStub stub(isolate());
-  __ TailCallStub(&stub);
-
-  HandlerFrontendFooter(&miss);
-
-  // Return the generated code.
-  return GetCode(type, name);
-}
-
-
 Handle<Code> CallStubCompiler::CompileArrayPushCall(
     Handle<Object> object,
     Handle<JSObject> holder,
index 800add8..3ce69e0 100644 (file)
@@ -1666,39 +1666,6 @@ Handle<Code> CallStubCompiler::CompileCallField(Handle<JSObject> object,
 }
 
 
-Handle<Code> CallStubCompiler::CompileArrayCodeCall(
-    Handle<Object> object,
-    Handle<JSObject> holder,
-    Handle<Cell> cell,
-    Handle<JSFunction> function,
-    Handle<String> name,
-    Code::StubType type) {
-  Label miss;
-
-  HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss);
-  if (!cell.is_null()) {
-    ASSERT(cell->value() == *function);
-    GenerateLoadFunctionFromCell(cell, function, &miss);
-  }
-
-  Handle<AllocationSite> site = isolate()->factory()->NewAllocationSite();
-  site->SetElementsKind(GetInitialFastElementsKind());
-  Handle<Cell> site_feedback_cell = isolate()->factory()->NewCell(site);
-  const int argc = arguments().immediate();
-  __ mov(eax, Immediate(argc));
-  __ mov(ebx, site_feedback_cell);
-  __ mov(edi, function);
-
-  ArrayConstructorStub stub(isolate());
-  __ TailCallStub(&stub);
-
-  HandlerFrontendFooter(&miss);
-
-  // Return the generated code.
-  return GetCode(type, name);
-}
-
-
 Handle<Code> CallStubCompiler::CompileArrayPushCall(
     Handle<Object> object,
     Handle<JSObject> holder,
index 3fb322b..12d9053 100644 (file)
@@ -1556,39 +1556,6 @@ Handle<Code> CallStubCompiler::CompileCallField(Handle<JSObject> object,
 }
 
 
-Handle<Code> CallStubCompiler::CompileArrayCodeCall(
-    Handle<Object> object,
-    Handle<JSObject> holder,
-    Handle<Cell> cell,
-    Handle<JSFunction> function,
-    Handle<String> name,
-    Code::StubType type) {
-  Label miss;
-
-  HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss);
-  if (!cell.is_null()) {
-    ASSERT(cell->value() == *function);
-    GenerateLoadFunctionFromCell(cell, function, &miss);
-  }
-
-  Handle<AllocationSite> site = isolate()->factory()->NewAllocationSite();
-  site->SetElementsKind(GetInitialFastElementsKind());
-  Handle<Cell> site_feedback_cell = isolate()->factory()->NewCell(site);
-  const int argc = arguments().immediate();
-  __ li(a0, Operand(argc));
-  __ li(a2, Operand(site_feedback_cell));
-  __ li(a1, Operand(function));
-
-  ArrayConstructorStub stub(isolate());
-  __ TailCallStub(&stub);
-
-  HandlerFrontendFooter(&miss);
-
-  // Return the generated code.
-  return GetCode(type, name);
-}
-
-
 Handle<Code> CallStubCompiler::CompileArrayPushCall(
     Handle<Object> object,
     Handle<JSObject> holder,
index fa0a04c..414e1ec 100644 (file)
@@ -297,9 +297,7 @@ Handle<Code> StubCache::ComputeCallConstant(int argc,
           CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name));
   GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code));
 
-  if (CallStubCompiler::CanBeCached(function)) {
-    HeapObject::UpdateMapCodeCache(stub_holder, name, code);
-  }
+  HeapObject::UpdateMapCodeCache(stub_holder, name, code);
   return code;
 }
 
@@ -402,9 +400,7 @@ Handle<Code> StubCache::ComputeCallGlobal(int argc,
   PROFILE(isolate(),
           CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name));
   GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code));
-  if (CallStubCompiler::CanBeCached(function)) {
-    HeapObject::UpdateMapCodeCache(receiver, name, code);
-  }
+  HeapObject::UpdateMapCodeCache(receiver, name, code);
   return code;
 }
 
@@ -1898,18 +1894,6 @@ bool CallStubCompiler::HasCustomCallGenerator(Handle<JSFunction> function) {
 }
 
 
-bool CallStubCompiler::CanBeCached(Handle<JSFunction> function) {
-  if (function->shared()->HasBuiltinFunctionId()) {
-    BuiltinFunctionId id = function->shared()->builtin_function_id();
-#define CALL_GENERATOR_CASE(name) if (id == k##name) return false;
-    SITE_SPECIFIC_CALL_GENERATORS(CALL_GENERATOR_CASE)
-#undef CALL_GENERATOR_CASE
-  }
-
-  return true;
-}
-
-
 Handle<Code> CallStubCompiler::CompileCustomCall(
     Handle<Object> object,
     Handle<JSObject> holder,
index 2e89a51..e12167a 100644 (file)
@@ -907,12 +907,7 @@ class KeyedStoreStubCompiler: public StoreStubCompiler {
   V(StringCharAt)                               \
   V(StringFromCharCode)                         \
   V(MathFloor)                                  \
-  V(MathAbs)                                    \
-  V(ArrayCode)
-
-
-#define SITE_SPECIFIC_CALL_GENERATORS(V)        \
-  V(ArrayCode)
+  V(MathAbs)
 
 
 class CallStubCompiler: public StubCompiler {
@@ -969,7 +964,6 @@ class CallStubCompiler: public StubCompiler {
                                  Handle<Name> name);
 
   static bool HasCustomCallGenerator(Handle<JSFunction> function);
-  static bool CanBeCached(Handle<JSFunction> function);
 
  private:
   // Compiles a custom call constant/global IC.  For constant calls cell is
index f7dc2cb..2232ecf 100644 (file)
@@ -1593,39 +1593,6 @@ Handle<Code> CallStubCompiler::CompileCallField(Handle<JSObject> object,
 }
 
 
-Handle<Code> CallStubCompiler::CompileArrayCodeCall(
-    Handle<Object> object,
-    Handle<JSObject> holder,
-    Handle<Cell> cell,
-    Handle<JSFunction> function,
-    Handle<String> name,
-    Code::StubType type) {
-  Label miss;
-
-  HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss);
-  if (!cell.is_null()) {
-    ASSERT(cell->value() == *function);
-    GenerateLoadFunctionFromCell(cell, function, &miss);
-  }
-
-  Handle<AllocationSite> site = isolate()->factory()->NewAllocationSite();
-  site->SetElementsKind(GetInitialFastElementsKind());
-  Handle<Cell> site_feedback_cell = isolate()->factory()->NewCell(site);
-  const int argc = arguments().immediate();
-  __ movq(rax, Immediate(argc));
-  __ Move(rbx, site_feedback_cell);
-  __ Move(rdi, function);
-
-  ArrayConstructorStub stub(isolate());
-  __ TailCallStub(&stub);
-
-  HandlerFrontendFooter(&miss);
-
-  // Return the generated code.
-  return GetCode(type, name);
-}
-
-
 Handle<Code> CallStubCompiler::CompileArrayPushCall(
     Handle<Object> object,
     Handle<JSObject> holder,
index 3901564..0471f65 100644 (file)
@@ -90,66 +90,66 @@ if (support_smi_only_arrays) {
   // Verify that basic elements kind feedback works for non-constructor
   // array calls (as long as the call is made through an IC, and not
   // a CallStub).
-  (function (){
-    function create0() {
-      return Array();
-    }
-
-    // Calls through ICs need warm up through uninitialized, then
-    // premonomorphic first.
-    create0();
-    create0();
-    a = create0();
-    assertKind(elements_kind.fast_smi_only, a);
-    a[0] = 3.5;
-    b = create0();
-    assertKind(elements_kind.fast_double, b);
-
-    function create1(arg) {
-      return Array(arg);
-    }
-
-    create1(0);
-    create1(0);
-    a = create1(0);
-    assertFalse(isHoley(a));
-    assertKind(elements_kind.fast_smi_only, a);
-    a[0] = "hello";
-    b = create1(10);
-    assertTrue(isHoley(b));
-    assertKind(elements_kind.fast, b);
-
-    a = create1(100000);
-    assertKind(elements_kind.dictionary, a);
-
-    function create3(arg1, arg2, arg3) {
-      return Array(arg1, arg2, arg3);
-    }
-
-    create3();
-    create3();
-    a = create3(1,2,3);
-    a[0] = 3.5;
-    b = create3(1,2,3);
-    assertKind(elements_kind.fast_double, b);
-    assertFalse(isHoley(b));
-  })();
+  // (function (){
+  //   function create0() {
+  //     return Array();
+  //   }
+
+  //   // Calls through ICs need warm up through uninitialized, then
+  //   // premonomorphic first.
+  //   create0();
+  //   create0();
+  //   a = create0();
+  //   assertKind(elements_kind.fast_smi_only, a);
+  //   a[0] = 3.5;
+  //   b = create0();
+  //   assertKind(elements_kind.fast_double, b);
+
+  //   function create1(arg) {
+  //     return Array(arg);
+  //   }
+
+  //   create1(0);
+  //   create1(0);
+  //   a = create1(0);
+  //   assertFalse(isHoley(a));
+  //   assertKind(elements_kind.fast_smi_only, a);
+  //   a[0] = "hello";
+  //   b = create1(10);
+  //   assertTrue(isHoley(b));
+  //   assertKind(elements_kind.fast, b);
+
+  //   a = create1(100000);
+  //   assertKind(elements_kind.dictionary, a);
+
+  //   function create3(arg1, arg2, arg3) {
+  //     return Array(arg1, arg2, arg3);
+  //   }
+
+  //   create3();
+  //   create3();
+  //   a = create3(1,2,3);
+  //   a[0] = 3.5;
+  //   b = create3(1,2,3);
+  //   assertKind(elements_kind.fast_double, b);
+  //   assertFalse(isHoley(b));
+  // })();
 
 
   // Verify that keyed calls work
-  (function (){
-    function create0(name) {
-      return this[name]();
-    }
+  // (function (){
+  //   function create0(name) {
+  //     return this[name]();
+  //   }
 
-    name = "Array";
-    create0(name);
-    create0(name);
-    a = create0(name);
-    a[0] = 3.5;
-    b = create0(name);
-    assertKind(elements_kind.fast_double, b);
-  })();
+  //   name = "Array";
+  //   create0(name);
+  //   create0(name);
+  //   a = create0(name);
+  //   a[0] = 3.5;
+  //   b = create0(name);
+  //   assertKind(elements_kind.fast_double, b);
+  // })();
 
 
   // Verify that the IC can't be spoofed by patching
@@ -173,28 +173,28 @@ if (support_smi_only_arrays) {
   // though the type information is reset.
   // TODO(mvstanton): instead, consume the type feedback gathered up
   // until crankshaft time.
-  (function (){
-    function create0() {
-      return Array();
-    }
-
-    create0();
-    create0();
-    a = create0();
-    a[0] = 3.5;
-    %OptimizeFunctionOnNextCall(create0);
-    create0();
-    // This test only makes sense if crankshaft is allowed
-    if (4 != %GetOptimizationStatus(create0)) {
-      create0();
-      b = create0();
-      assertKind(elements_kind.fast_smi_only, b);
-      b[0] = 3.5;
-      c = create0();
-      assertKind(elements_kind.fast_double, c);
-      assertOptimized(create0);
-    }
-  })();
+  // (function (){
+  //   function create0() {
+  //     return Array();
+  //   }
+
+  //   create0();
+  //   create0();
+  //   a = create0();
+  //   a[0] = 3.5;
+  //   %OptimizeFunctionOnNextCall(create0);
+  //   create0();
+  //   // This test only makes sense if crankshaft is allowed
+  //   if (4 != %GetOptimizationStatus(create0)) {
+  //     create0();
+  //     b = create0();
+  //     assertKind(elements_kind.fast_smi_only, b);
+  //     b[0] = 3.5;
+  //     c = create0();
+  //     assertKind(elements_kind.fast_double, c);
+  //     assertOptimized(create0);
+  //   }
+  // })();
 
 
   // Verify that cross context calls work