}
-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,
}
-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,
}
-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,
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;
}
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;
}
}
-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,
V(StringCharAt) \
V(StringFromCharCode) \
V(MathFloor) \
- V(MathAbs) \
- V(ArrayCode)
-
-
-#define SITE_SPECIFIC_CALL_GENERATORS(V) \
- V(ArrayCode)
+ V(MathAbs)
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
}
-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,
// 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
// 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