Index: src/ia32/code-stubs-ia32.cc |
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
index 9b77c50c05ea27edb693315f382234ec75d7fb96..1e1e3f8e6eb9124d4165689d324154f3dcd110b2 100644 |
--- a/src/ia32/code-stubs-ia32.cc |
+++ b/src/ia32/code-stubs-ia32.cc |
@@ -43,6 +43,18 @@ namespace v8 { |
namespace internal { |
+void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( |
+ Isolate* isolate, |
+ CodeStubInterfaceDescriptor* descriptor) { |
+ static Register registers[] = { eax, ebx, ecx }; |
+ descriptor->register_param_count_ = 3; |
+ descriptor->register_params_ = registers; |
+ descriptor->stack_parameter_count_ = NULL; |
+ descriptor->deoptimization_handler_ = |
+ Runtime::FunctionForId(Runtime::kCreateArrayLiteralShallow)->entry; |
+} |
+ |
+ |
void FastCloneShallowObjectStub::InitializeInterfaceDescriptor( |
Isolate* isolate, |
CodeStubInterfaceDescriptor* descriptor) { |
@@ -393,168 +405,6 @@ void FastNewBlockContextStub::Generate(MacroAssembler* masm) { |
} |
-static void GenerateFastCloneShallowArrayCommon( |
- MacroAssembler* masm, |
- int length, |
- FastCloneShallowArrayStub::Mode mode, |
- AllocationSiteMode allocation_site_mode, |
- Label* fail) { |
- // Registers on entry: |
- // |
- // ecx: boilerplate literal array. |
- ASSERT(mode != FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS); |
- |
- // All sizes here are multiples of kPointerSize. |
- int elements_size = 0; |
- if (length > 0) { |
- elements_size = mode == FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS |
- ? FixedDoubleArray::SizeFor(length) |
- : FixedArray::SizeFor(length); |
- } |
- int size = JSArray::kSize; |
- int allocation_info_start = size; |
- if (allocation_site_mode == TRACK_ALLOCATION_SITE) { |
- size += AllocationSiteInfo::kSize; |
- } |
- size += elements_size; |
- |
- // Allocate both the JS array and the elements array in one big |
- // allocation. This avoids multiple limit checks. |
- AllocationFlags flags = TAG_OBJECT; |
- if (mode == FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS) { |
- flags = static_cast<AllocationFlags>(DOUBLE_ALIGNMENT | flags); |
- } |
- __ Allocate(size, eax, ebx, edx, fail, flags); |
- |
- if (allocation_site_mode == TRACK_ALLOCATION_SITE) { |
- __ mov(FieldOperand(eax, allocation_info_start), |
- Immediate(Handle<Map>(masm->isolate()->heap()-> |
- allocation_site_info_map()))); |
- __ mov(FieldOperand(eax, allocation_info_start + kPointerSize), ecx); |
- } |
- |
- // Copy the JS array part. |
- for (int i = 0; i < JSArray::kSize; i += kPointerSize) { |
- if ((i != JSArray::kElementsOffset) || (length == 0)) { |
- __ mov(ebx, FieldOperand(ecx, i)); |
- __ mov(FieldOperand(eax, i), ebx); |
- } |
- } |
- |
- if (length > 0) { |
- // Get hold of the elements array of the boilerplate and setup the |
- // elements pointer in the resulting object. |
- __ mov(ecx, FieldOperand(ecx, JSArray::kElementsOffset)); |
- if (allocation_site_mode == TRACK_ALLOCATION_SITE) { |
- __ lea(edx, Operand(eax, JSArray::kSize + AllocationSiteInfo::kSize)); |
- } else { |
- __ lea(edx, Operand(eax, JSArray::kSize)); |
- } |
- __ mov(FieldOperand(eax, JSArray::kElementsOffset), edx); |
- |
- // Copy the elements array. |
- if (mode == FastCloneShallowArrayStub::CLONE_ELEMENTS) { |
- for (int i = 0; i < elements_size; i += kPointerSize) { |
- __ mov(ebx, FieldOperand(ecx, i)); |
- __ mov(FieldOperand(edx, i), ebx); |
- } |
- } else { |
- ASSERT(mode == FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS); |
- int i; |
- for (i = 0; i < FixedDoubleArray::kHeaderSize; i += kPointerSize) { |
- __ mov(ebx, FieldOperand(ecx, i)); |
- __ mov(FieldOperand(edx, i), ebx); |
- } |
- while (i < elements_size) { |
- __ fld_d(FieldOperand(ecx, i)); |
- __ fstp_d(FieldOperand(edx, i)); |
- i += kDoubleSize; |
- } |
- ASSERT(i == elements_size); |
- } |
- } |
-} |
- |
- |
-void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) { |
- // Stack layout on entry: |
- // |
- // [esp + kPointerSize]: constant elements. |
- // [esp + (2 * kPointerSize)]: literal index. |
- // [esp + (3 * kPointerSize)]: literals array. |
- |
- // Load boilerplate object into ecx and check if we need to create a |
- // boilerplate. |
- __ mov(ecx, Operand(esp, 3 * kPointerSize)); |
- __ mov(eax, Operand(esp, 2 * kPointerSize)); |
- STATIC_ASSERT(kPointerSize == 4); |
- STATIC_ASSERT(kSmiTagSize == 1); |
- STATIC_ASSERT(kSmiTag == 0); |
- __ mov(ecx, FieldOperand(ecx, eax, times_half_pointer_size, |
- FixedArray::kHeaderSize)); |
- Factory* factory = masm->isolate()->factory(); |
- __ cmp(ecx, factory->undefined_value()); |
- Label slow_case; |
- __ j(equal, &slow_case); |
- |
- FastCloneShallowArrayStub::Mode mode = mode_; |
- // ecx is boilerplate object. |
- if (mode == CLONE_ANY_ELEMENTS) { |
- Label double_elements, check_fast_elements; |
- __ mov(ebx, FieldOperand(ecx, JSArray::kElementsOffset)); |
- __ CheckMap(ebx, factory->fixed_cow_array_map(), |
- &check_fast_elements, DONT_DO_SMI_CHECK); |
- GenerateFastCloneShallowArrayCommon(masm, 0, COPY_ON_WRITE_ELEMENTS, |
- allocation_site_mode_, |
- &slow_case); |
- __ ret(3 * kPointerSize); |
- |
- __ bind(&check_fast_elements); |
- __ CheckMap(ebx, factory->fixed_array_map(), |
- &double_elements, DONT_DO_SMI_CHECK); |
- GenerateFastCloneShallowArrayCommon(masm, length_, CLONE_ELEMENTS, |
- allocation_site_mode_, |
- &slow_case); |
- __ ret(3 * kPointerSize); |
- |
- __ bind(&double_elements); |
- mode = CLONE_DOUBLE_ELEMENTS; |
- // Fall through to generate the code to handle double elements. |
- } |
- |
- if (FLAG_debug_code) { |
- const char* message; |
- Handle<Map> expected_map; |
- if (mode == CLONE_ELEMENTS) { |
- message = "Expected (writable) fixed array"; |
- expected_map = factory->fixed_array_map(); |
- } else if (mode == CLONE_DOUBLE_ELEMENTS) { |
- message = "Expected (writable) fixed double array"; |
- expected_map = factory->fixed_double_array_map(); |
- } else { |
- ASSERT(mode == COPY_ON_WRITE_ELEMENTS); |
- message = "Expected copy-on-write fixed array"; |
- expected_map = factory->fixed_cow_array_map(); |
- } |
- __ push(ecx); |
- __ mov(ecx, FieldOperand(ecx, JSArray::kElementsOffset)); |
- __ cmp(FieldOperand(ecx, HeapObject::kMapOffset), expected_map); |
- __ Assert(equal, message); |
- __ pop(ecx); |
- } |
- |
- GenerateFastCloneShallowArrayCommon(masm, length_, mode, |
- allocation_site_mode_, |
- &slow_case); |
- |
- // Return and remove the on-stack parameters. |
- __ ret(3 * kPointerSize); |
- |
- __ bind(&slow_case); |
- __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1); |
-} |
- |
- |
// The stub expects its argument on the stack and returns its result in tos_: |
// zero for false, and a non-zero value for true. |
void ToBooleanStub::Generate(MacroAssembler* masm) { |
@@ -5076,6 +4926,7 @@ bool CEntryStub::IsPregenerated() { |
void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { |
CEntryStub::GenerateAheadOfTime(isolate); |
StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); |
+ StubFailureTrampolineStub::GenerateAheadOfTime(isolate); |
// It is important that the store buffer overflow stubs are generated first. |
RecordWriteStub::GenerateFixedRegStubsAheadOfTime(isolate); |
} |
@@ -7786,9 +7637,7 @@ void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) { |
void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { |
- ASSERT(!Serializer::enabled()); |
- bool save_fp_regs = CpuFeatures::IsSupported(SSE2); |
- CEntryStub ces(1, save_fp_regs ? kSaveFPRegs : kDontSaveFPRegs); |
+ CEntryStub ces(1, fp_registers_ ? kSaveFPRegs : kDontSaveFPRegs); |
__ call(ces.GetCode(masm->isolate()), RelocInfo::CODE_TARGET); |
int parameter_count_offset = |
StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; |