| Index: src/x64/stub-cache-x64.cc
|
| ===================================================================
|
| --- src/x64/stub-cache-x64.cc (revision 4205)
|
| +++ src/x64/stub-cache-x64.cc (working copy)
|
| @@ -655,6 +655,118 @@
|
| #define __ ACCESS_MASM((masm()))
|
|
|
|
|
| +Object* CallStubCompiler::CompileArrayPushCall(Object* object,
|
| + JSObject* holder,
|
| + JSFunction* function,
|
| + String* name,
|
| + CheckType check) {
|
| + // ----------- S t a t e -------------
|
| + // rcx : function name
|
| + // rsp[0] : return address
|
| + // rsp[8] : argument argc
|
| + // rsp[16] : argument argc - 1
|
| + // ...
|
| + // rsp[argc * 8] : argument 1
|
| + // rsp[(argc + 1) * 8] : argument 0 = receiver
|
| + // -----------------------------------
|
| +
|
| + // TODO(639): faster implementation.
|
| + ASSERT(check == RECEIVER_MAP_CHECK);
|
| +
|
| + Label miss;
|
| +
|
| + // Get the receiver from the stack.
|
| + const int argc = arguments().immediate();
|
| + __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize));
|
| +
|
| + // Check that the receiver isn't a smi.
|
| + __ JumpIfSmi(rdx, &miss);
|
| +
|
| + // Check that the maps haven't changed.
|
| + CheckPrototypes(JSObject::cast(object), rdx, holder,
|
| + rbx, rax, name, &miss);
|
| +
|
| + // Patch the receiver on the stack with the global proxy if
|
| + // necessary.
|
| + if (object->IsGlobalObject()) {
|
| + __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset));
|
| + __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx);
|
| + }
|
| +
|
| + __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush),
|
| + argc + 1,
|
| + 1);
|
| +
|
| + // Handle call cache miss.
|
| + __ bind(&miss);
|
| + Handle<Code> ic = ComputeCallMiss(arguments().immediate());
|
| + __ Jump(ic, RelocInfo::CODE_TARGET);
|
| +
|
| + // Return the generated code.
|
| + String* function_name = NULL;
|
| + if (function->shared()->name()->IsString()) {
|
| + function_name = String::cast(function->shared()->name());
|
| + }
|
| + return GetCode(CONSTANT_FUNCTION, function_name);
|
| +}
|
| +
|
| +
|
| +Object* CallStubCompiler::CompileArrayPopCall(Object* object,
|
| + JSObject* holder,
|
| + JSFunction* function,
|
| + String* name,
|
| + CheckType check) {
|
| + // ----------- S t a t e -------------
|
| + // rcx : function name
|
| + // rsp[0] : return address
|
| + // rsp[8] : argument argc
|
| + // rsp[16] : argument argc - 1
|
| + // ...
|
| + // rsp[argc * 8] : argument 1
|
| + // rsp[(argc + 1) * 8] : argument 0 = receiver
|
| + // -----------------------------------
|
| +
|
| + // TODO(642): faster implementation.
|
| + ASSERT(check == RECEIVER_MAP_CHECK);
|
| +
|
| + Label miss;
|
| +
|
| + // Get the receiver from the stack.
|
| + const int argc = arguments().immediate();
|
| + __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize));
|
| +
|
| + // Check that the receiver isn't a smi.
|
| + __ JumpIfSmi(rdx, &miss);
|
| +
|
| + // Check that the maps haven't changed.
|
| + CheckPrototypes(JSObject::cast(object), rdx, holder,
|
| + rbx, rax, name, &miss);
|
| +
|
| + // Patch the receiver on the stack with the global proxy if
|
| + // necessary.
|
| + if (object->IsGlobalObject()) {
|
| + __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset));
|
| + __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx);
|
| + }
|
| +
|
| + __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop),
|
| + argc + 1,
|
| + 1);
|
| +
|
| + // Handle call cache miss.
|
| + __ bind(&miss);
|
| + Handle<Code> ic = ComputeCallMiss(arguments().immediate());
|
| + __ Jump(ic, RelocInfo::CODE_TARGET);
|
| +
|
| + // Return the generated code.
|
| + String* function_name = NULL;
|
| + if (function->shared()->name()->IsString()) {
|
| + function_name = String::cast(function->shared()->name());
|
| + }
|
| + return GetCode(CONSTANT_FUNCTION, function_name);
|
| +}
|
| +
|
| +
|
| Object* CallStubCompiler::CompileCallConstant(Object* object,
|
| JSObject* holder,
|
| JSFunction* function,
|
| @@ -670,6 +782,13 @@
|
| // rsp[(argc + 1) * 8] : argument 0 = receiver
|
| // -----------------------------------
|
|
|
| + SharedFunctionInfo* function_info = function->shared();
|
| + if (false && function_info->HasCustomCallGenerator()) {
|
| + CustomCallGenerator generator =
|
| + ToCData<CustomCallGenerator>(function_info->function_data());
|
| + return generator(this, object, holder, function, name, check);
|
| + }
|
| +
|
| Label miss;
|
|
|
| // Get the receiver from the stack.
|
| @@ -759,18 +878,6 @@
|
| break;
|
| }
|
|
|
| - case JSARRAY_HAS_FAST_ELEMENTS_CHECK:
|
| - CheckPrototypes(JSObject::cast(object), rdx, holder,
|
| - rbx, rax, name, &miss);
|
| - // Make sure object->HasFastElements().
|
| - // Get the elements array of the object.
|
| - __ movq(rbx, FieldOperand(rdx, JSObject::kElementsOffset));
|
| - // Check that the object is in fast mode (not dictionary).
|
| - __ Cmp(FieldOperand(rbx, HeapObject::kMapOffset),
|
| - Factory::fixed_array_map());
|
| - __ j(not_equal, &miss);
|
| - break;
|
| -
|
| default:
|
| UNREACHABLE();
|
| }
|
|
|