Index: src/ia32/stub-cache-ia32.cc |
diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc |
index 83f616e47025bd33f714859ab2120bc1f1c3615f..2b734431416df05c1ffdd113b0309ec71c1d803a 100644 |
--- a/src/ia32/stub-cache-ia32.cc |
+++ b/src/ia32/stub-cache-ia32.cc |
@@ -1666,251 +1666,6 @@ Handle<Code> CallStubCompiler::CompileCallField(Handle<JSObject> object, |
} |
-Handle<Code> CallStubCompiler::CompileArrayPushCall( |
- 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; |
- |
- HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); |
- |
- const int argc = arguments().immediate(); |
- if (argc == 0) { |
- // Noop, return the length. |
- __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset)); |
- __ ret((argc + 1) * kPointerSize); |
- } else { |
- Label call_builtin; |
- |
- if (argc == 1) { // Otherwise fall through to call builtin. |
- Label attempt_to_grow_elements, with_write_barrier, check_double; |
- |
- // Get the elements array of the object. |
- __ mov(edi, FieldOperand(edx, JSArray::kElementsOffset)); |
- |
- // Check that the elements are in fast mode and writable. |
- __ cmp(FieldOperand(edi, HeapObject::kMapOffset), |
- Immediate(factory()->fixed_array_map())); |
- __ j(not_equal, &check_double); |
- |
- // Get the array's length into eax and calculate new length. |
- __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset)); |
- STATIC_ASSERT(kSmiTagSize == 1); |
- STATIC_ASSERT(kSmiTag == 0); |
- __ add(eax, Immediate(Smi::FromInt(argc))); |
- |
- // Get the elements' length into ecx. |
- __ mov(ecx, FieldOperand(edi, FixedArray::kLengthOffset)); |
- |
- // Check if we could survive without allocation. |
- __ cmp(eax, ecx); |
- __ j(greater, &attempt_to_grow_elements); |
- |
- // Check if value is a smi. |
- __ mov(ecx, Operand(esp, argc * kPointerSize)); |
- __ JumpIfNotSmi(ecx, &with_write_barrier); |
- |
- // Save new length. |
- __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax); |
- |
- // Store the value. |
- __ mov(FieldOperand(edi, |
- eax, |
- times_half_pointer_size, |
- FixedArray::kHeaderSize - argc * kPointerSize), |
- ecx); |
- |
- __ ret((argc + 1) * kPointerSize); |
- |
- __ bind(&check_double); |
- |
- |
- // Check that the elements are in double mode. |
- __ cmp(FieldOperand(edi, HeapObject::kMapOffset), |
- Immediate(factory()->fixed_double_array_map())); |
- __ j(not_equal, &call_builtin); |
- |
- // Get the array's length into eax and calculate new length. |
- __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset)); |
- STATIC_ASSERT(kSmiTagSize == 1); |
- STATIC_ASSERT(kSmiTag == 0); |
- __ add(eax, Immediate(Smi::FromInt(argc))); |
- |
- // Get the elements' length into ecx. |
- __ mov(ecx, FieldOperand(edi, FixedArray::kLengthOffset)); |
- |
- // Check if we could survive without allocation. |
- __ cmp(eax, ecx); |
- __ j(greater, &call_builtin); |
- |
- __ mov(ecx, Operand(esp, argc * kPointerSize)); |
- __ StoreNumberToDoubleElements( |
- ecx, edi, eax, ecx, xmm0, &call_builtin, true, argc * kDoubleSize); |
- |
- // Save new length. |
- __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax); |
- __ ret((argc + 1) * kPointerSize); |
- |
- __ bind(&with_write_barrier); |
- |
- __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); |
- |
- if (FLAG_smi_only_arrays && !FLAG_trace_elements_transitions) { |
- Label fast_object, not_fast_object; |
- __ CheckFastObjectElements(ebx, ¬_fast_object, Label::kNear); |
- __ jmp(&fast_object); |
- // In case of fast smi-only, convert to fast object, otherwise bail out. |
- __ bind(¬_fast_object); |
- __ CheckFastSmiElements(ebx, &call_builtin); |
- __ cmp(FieldOperand(ecx, HeapObject::kMapOffset), |
- Immediate(factory()->heap_number_map())); |
- __ j(equal, &call_builtin); |
- // edi: elements array |
- // edx: receiver |
- // ebx: map |
- Label try_holey_map; |
- __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS, |
- FAST_ELEMENTS, |
- ebx, |
- edi, |
- &try_holey_map); |
- |
- ElementsTransitionGenerator:: |
- GenerateMapChangeElementsTransition(masm(), |
- DONT_TRACK_ALLOCATION_SITE, |
- NULL); |
- // Restore edi. |
- __ mov(edi, FieldOperand(edx, JSArray::kElementsOffset)); |
- __ jmp(&fast_object); |
- |
- __ bind(&try_holey_map); |
- __ LoadTransitionedArrayMapConditional(FAST_HOLEY_SMI_ELEMENTS, |
- FAST_HOLEY_ELEMENTS, |
- ebx, |
- edi, |
- &call_builtin); |
- ElementsTransitionGenerator:: |
- GenerateMapChangeElementsTransition(masm(), |
- DONT_TRACK_ALLOCATION_SITE, |
- NULL); |
- // Restore edi. |
- __ mov(edi, FieldOperand(edx, JSArray::kElementsOffset)); |
- __ bind(&fast_object); |
- } else { |
- __ CheckFastObjectElements(ebx, &call_builtin); |
- } |
- |
- // Save new length. |
- __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax); |
- |
- // Store the value. |
- __ lea(edx, FieldOperand(edi, |
- eax, times_half_pointer_size, |
- FixedArray::kHeaderSize - argc * kPointerSize)); |
- __ mov(Operand(edx, 0), ecx); |
- |
- __ RecordWrite(edi, edx, ecx, kDontSaveFPRegs, EMIT_REMEMBERED_SET, |
- OMIT_SMI_CHECK); |
- |
- __ ret((argc + 1) * kPointerSize); |
- |
- __ bind(&attempt_to_grow_elements); |
- if (!FLAG_inline_new) { |
- __ jmp(&call_builtin); |
- } |
- |
- __ mov(ebx, Operand(esp, argc * kPointerSize)); |
- // Growing elements that are SMI-only requires special handling in case |
- // the new element is non-Smi. For now, delegate to the builtin. |
- Label no_fast_elements_check; |
- __ JumpIfSmi(ebx, &no_fast_elements_check); |
- __ mov(ecx, FieldOperand(edx, HeapObject::kMapOffset)); |
- __ CheckFastObjectElements(ecx, &call_builtin, Label::kFar); |
- __ bind(&no_fast_elements_check); |
- |
- // We could be lucky and the elements array could be at the top of |
- // new-space. In this case we can just grow it in place by moving the |
- // allocation pointer up. |
- |
- ExternalReference new_space_allocation_top = |
- ExternalReference::new_space_allocation_top_address(isolate()); |
- ExternalReference new_space_allocation_limit = |
- ExternalReference::new_space_allocation_limit_address(isolate()); |
- |
- const int kAllocationDelta = 4; |
- // Load top. |
- __ mov(ecx, Operand::StaticVariable(new_space_allocation_top)); |
- |
- // Check if it's the end of elements. |
- __ lea(edx, FieldOperand(edi, |
- eax, times_half_pointer_size, |
- FixedArray::kHeaderSize - argc * kPointerSize)); |
- __ cmp(edx, ecx); |
- __ j(not_equal, &call_builtin); |
- __ add(ecx, Immediate(kAllocationDelta * kPointerSize)); |
- __ cmp(ecx, Operand::StaticVariable(new_space_allocation_limit)); |
- __ j(above, &call_builtin); |
- |
- // We fit and could grow elements. |
- __ mov(Operand::StaticVariable(new_space_allocation_top), ecx); |
- |
- // Push the argument... |
- __ mov(Operand(edx, 0), ebx); |
- // ... and fill the rest with holes. |
- for (int i = 1; i < kAllocationDelta; i++) { |
- __ mov(Operand(edx, i * kPointerSize), |
- Immediate(factory()->the_hole_value())); |
- } |
- |
- // We know the elements array is in new space so we don't need the |
- // remembered set, but we just pushed a value onto it so we may have to |
- // tell the incremental marker to rescan the object that we just grew. We |
- // don't need to worry about the holes because they are in old space and |
- // already marked black. |
- __ RecordWrite(edi, edx, ebx, kDontSaveFPRegs, OMIT_REMEMBERED_SET); |
- |
- // Restore receiver to edx as finish sequence assumes it's here. |
- __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
- |
- // Increment element's and array's sizes. |
- __ add(FieldOperand(edi, FixedArray::kLengthOffset), |
- Immediate(Smi::FromInt(kAllocationDelta))); |
- |
- // NOTE: This only happen in new-space, where we don't |
- // care about the black-byte-count on pages. Otherwise we should |
- // update that too if the object is black. |
- |
- __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax); |
- |
- __ ret((argc + 1) * kPointerSize); |
- } |
- |
- __ bind(&call_builtin); |
- __ TailCallExternalReference( |
- ExternalReference(Builtins::c_ArrayPush, isolate()), |
- argc + 1, |
- 1); |
- } |
- |
- HandlerFrontendFooter(&miss); |
- |
- // Return the generated code. |
- return GetCode(type, name); |
-} |
- |
- |
Handle<Code> CallStubCompiler::CompileFastApiCall( |
const CallOptimization& optimization, |
Handle<Object> object, |