| Index: src/ia32/stub-cache-ia32.cc
|
| diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc
|
| index e76bfb5f3bf87569557897cad25d486e29818070..92b2f9356cb6da87b2d613cb2d596ebe5c6aa468 100644
|
| --- a/src/ia32/stub-cache-ia32.cc
|
| +++ b/src/ia32/stub-cache-ia32.cc
|
| @@ -1616,6 +1616,76 @@ Handle<Code> CallStubCompiler::CompileCallField(Handle<JSObject> object,
|
| }
|
|
|
|
|
| +Handle<Code> CallStubCompiler::CompileArrayPopCall(
|
| + Handle<Object> object,
|
| + Handle<JSObject> holder,
|
| + Handle<Cell> cell,
|
| + Handle<JSFunction> function,
|
| + Handle<String> name,
|
| + Code::StubType type) {
|
| + // If object is not an array or is observed or sealed, bail out to regular
|
| + // call.
|
| + if (!object->IsJSArray() ||
|
| + !cell.is_null() ||
|
| + Handle<JSArray>::cast(object)->map()->is_observed() ||
|
| + !Handle<JSArray>::cast(object)->map()->is_extensible()) {
|
| + return Handle<Code>::null();
|
| + }
|
| +
|
| + Label miss, return_undefined, call_builtin;
|
| +
|
| + HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss);
|
| +
|
| + // Get the elements array of the object.
|
| + __ mov(ebx, FieldOperand(edx, JSArray::kElementsOffset));
|
| +
|
| + // Check that the elements are in fast mode and writable.
|
| + __ cmp(FieldOperand(ebx, HeapObject::kMapOffset),
|
| + Immediate(factory()->fixed_array_map()));
|
| + __ j(not_equal, &call_builtin);
|
| +
|
| + // Get the array's length into ecx and calculate new length.
|
| + __ mov(ecx, FieldOperand(edx, JSArray::kLengthOffset));
|
| + __ sub(ecx, Immediate(Smi::FromInt(1)));
|
| + __ j(negative, &return_undefined);
|
| +
|
| + // Get the last element.
|
| + STATIC_ASSERT(kSmiTagSize == 1);
|
| + STATIC_ASSERT(kSmiTag == 0);
|
| + __ mov(eax, FieldOperand(ebx,
|
| + ecx, times_half_pointer_size,
|
| + FixedArray::kHeaderSize));
|
| + __ cmp(eax, Immediate(factory()->the_hole_value()));
|
| + __ j(equal, &call_builtin);
|
| +
|
| + // Set the array's length.
|
| + __ mov(FieldOperand(edx, JSArray::kLengthOffset), ecx);
|
| +
|
| + // Fill with the hole.
|
| + __ mov(FieldOperand(ebx,
|
| + ecx, times_half_pointer_size,
|
| + FixedArray::kHeaderSize),
|
| + Immediate(factory()->the_hole_value()));
|
| + const int argc = arguments().immediate();
|
| + __ ret((argc + 1) * kPointerSize);
|
| +
|
| + __ bind(&return_undefined);
|
| + __ mov(eax, Immediate(factory()->undefined_value()));
|
| + __ ret((argc + 1) * kPointerSize);
|
| +
|
| + __ bind(&call_builtin);
|
| + __ TailCallExternalReference(
|
| + ExternalReference(Builtins::c_ArrayPop, isolate()),
|
| + argc + 1,
|
| + 1);
|
| +
|
| + HandlerFrontendFooter(&miss);
|
| +
|
| + // Return the generated code.
|
| + return GetCode(type, name);
|
| +}
|
| +
|
| +
|
| Handle<Code> CallStubCompiler::CompileFastApiCall(
|
| const CallOptimization& optimization,
|
| Handle<Object> object,
|
|
|