From: verwaest@chromium.org Date: Fri, 17 Jan 2014 11:24:36 +0000 (+0000) Subject: Remove special ArrayCode CallIC. X-Git-Tag: upstream/4.7.83~11115 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ef52aeb7015add69601f68e08e6e949db5c14b7f;p=platform%2Fupstream%2Fv8.git Remove special ArrayCode CallIC. 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 --- diff --git a/src/arm/stub-cache-arm.cc b/src/arm/stub-cache-arm.cc index 0fddbed..a8c268a 100644 --- a/src/arm/stub-cache-arm.cc +++ b/src/arm/stub-cache-arm.cc @@ -1571,39 +1571,6 @@ Handle CallStubCompiler::CompileCallField(Handle object, } -Handle CallStubCompiler::CompileArrayCodeCall( - Handle object, - Handle holder, - Handle cell, - Handle function, - Handle 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 site = isolate()->factory()->NewAllocationSite(); - site->SetElementsKind(GetInitialFastElementsKind()); - Handle 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 CallStubCompiler::CompileArrayPushCall( Handle object, Handle holder, diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc index 800add8..3ce69e0 100644 --- a/src/ia32/stub-cache-ia32.cc +++ b/src/ia32/stub-cache-ia32.cc @@ -1666,39 +1666,6 @@ Handle CallStubCompiler::CompileCallField(Handle object, } -Handle CallStubCompiler::CompileArrayCodeCall( - Handle object, - Handle holder, - Handle cell, - Handle function, - Handle 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 site = isolate()->factory()->NewAllocationSite(); - site->SetElementsKind(GetInitialFastElementsKind()); - Handle 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 CallStubCompiler::CompileArrayPushCall( Handle object, Handle holder, diff --git a/src/mips/stub-cache-mips.cc b/src/mips/stub-cache-mips.cc index 3fb322b..12d9053 100644 --- a/src/mips/stub-cache-mips.cc +++ b/src/mips/stub-cache-mips.cc @@ -1556,39 +1556,6 @@ Handle CallStubCompiler::CompileCallField(Handle object, } -Handle CallStubCompiler::CompileArrayCodeCall( - Handle object, - Handle holder, - Handle cell, - Handle function, - Handle 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 site = isolate()->factory()->NewAllocationSite(); - site->SetElementsKind(GetInitialFastElementsKind()); - Handle 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 CallStubCompiler::CompileArrayPushCall( Handle object, Handle holder, diff --git a/src/stub-cache.cc b/src/stub-cache.cc index fa0a04c..414e1ec 100644 --- a/src/stub-cache.cc +++ b/src/stub-cache.cc @@ -297,9 +297,7 @@ Handle 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 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 function) { } -bool CallStubCompiler::CanBeCached(Handle 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 CallStubCompiler::CompileCustomCall( Handle object, Handle holder, diff --git a/src/stub-cache.h b/src/stub-cache.h index 2e89a51..e12167a 100644 --- a/src/stub-cache.h +++ b/src/stub-cache.h @@ -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); static bool HasCustomCallGenerator(Handle function); - static bool CanBeCached(Handle function); private: // Compiles a custom call constant/global IC. For constant calls cell is diff --git a/src/x64/stub-cache-x64.cc b/src/x64/stub-cache-x64.cc index f7dc2cb..2232ecf 100644 --- a/src/x64/stub-cache-x64.cc +++ b/src/x64/stub-cache-x64.cc @@ -1593,39 +1593,6 @@ Handle CallStubCompiler::CompileCallField(Handle object, } -Handle CallStubCompiler::CompileArrayCodeCall( - Handle object, - Handle holder, - Handle cell, - Handle function, - Handle 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 site = isolate()->factory()->NewAllocationSite(); - site->SetElementsKind(GetInitialFastElementsKind()); - Handle 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 CallStubCompiler::CompileArrayPushCall( Handle object, Handle holder, diff --git a/test/mjsunit/array-feedback.js b/test/mjsunit/array-feedback.js index 3901564..0471f65 100644 --- a/test/mjsunit/array-feedback.js +++ b/test/mjsunit/array-feedback.js @@ -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