Chromium Code Reviews| Index: src/ia32/stub-cache-ia32.cc |
| diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc |
| index ab62764e640f313a6803de69d2dcbd771a3ee8a6..c6ab1472d11a2ebb5d771799df8920085bf8c816 100644 |
| --- a/src/ia32/stub-cache-ia32.cc |
| +++ b/src/ia32/stub-cache-ia32.cc |
| @@ -1456,6 +1456,10 @@ MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object, |
| __ cmp(eax, Operand(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); |
| @@ -1463,17 +1467,27 @@ MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object, |
| __ lea(edx, FieldOperand(ebx, |
| eax, times_half_pointer_size, |
| FixedArray::kHeaderSize - argc * kPointerSize)); |
| - __ mov(ecx, Operand(esp, argc * kPointerSize)); |
| __ mov(Operand(edx, 0), ecx); |
| - // Check if value is a smi. |
| - __ JumpIfNotSmi(ecx, &with_write_barrier); |
| - |
| __ bind(&exit); |
| __ ret((argc + 1) * kPointerSize); |
| __ bind(&with_write_barrier); |
| + if (FLAG_smi_only_arrays) { |
| + __ mov(edi, FieldOperand(edx, HeapObject::kMapOffset)); |
| + __ CheckFastObjectElements(edi, &call_builtin, Label::kFar); |
| + } |
| + |
| + // Save new length. |
| + __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax); |
| + |
| + // Push the element. |
| + __ lea(edx, FieldOperand(ebx, |
| + eax, times_half_pointer_size, |
| + FixedArray::kHeaderSize - argc * kPointerSize)); |
| + __ mov(Operand(edx, 0), ecx); |
| + |
| __ InNewSpace(ebx, ecx, equal, &exit); |
| __ RecordWriteHelper(ebx, edx, ecx); |
| @@ -1484,6 +1498,16 @@ MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object, |
| __ jmp(&call_builtin); |
| } |
| + __ mov(edi, Operand(esp, argc * kPointerSize)); |
| + |
| + if (FLAG_smi_only_arrays) { |
| + Label no_fast_elements_check; |
| + __ JumpIfSmi(edi, &no_fast_elements_check); |
| + __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); |
| + __ CheckFastObjectElements(ebx, &call_builtin, Label::kNear); |
| + __ bind(&no_fast_elements_check); |
| + } |
| + |
| ExternalReference new_space_allocation_top = |
| ExternalReference::new_space_allocation_top_address(isolate()); |
| ExternalReference new_space_allocation_limit = |
| @@ -1505,10 +1529,9 @@ MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object, |
| // We fit and could grow elements. |
| __ mov(Operand::StaticVariable(new_space_allocation_top), ecx); |
| - __ mov(ecx, Operand(esp, argc * kPointerSize)); |
| // Push the argument... |
| - __ mov(Operand(edx, 0), ecx); |
| + __ mov(Operand(edx, 0), edi); |
| // ... and fill the rest with holes. |
| for (int i = 1; i < kAllocationDelta; i++) { |
| __ mov(Operand(edx, i * kPointerSize), |
| @@ -3838,8 +3861,10 @@ void KeyedLoadStubCompiler::GenerateLoadFastDoubleElement( |
| } |
| -void KeyedStoreStubCompiler::GenerateStoreFastElement(MacroAssembler* masm, |
| - bool is_js_array) { |
| +void KeyedStoreStubCompiler::GenerateStoreFastElement( |
| + MacroAssembler* masm, |
| + bool is_js_array, |
| + StoreObjectAction store_objet_action) { |
|
Jakob Kummerow
2011/09/16 16:30:34
Here's the missing 'c' again
danno
2011/09/21 14:32:04
Done.
|
| // ----------- S t a t e ------------- |
| // -- eax : value |
| // -- ecx : key |
| @@ -3872,9 +3897,15 @@ void KeyedStoreStubCompiler::GenerateStoreFastElement(MacroAssembler* masm, |
| // Do the store and update the write barrier. Make sure to preserve |
|
Jakob Kummerow
2011/09/16 16:30:34
This comment belongs in the 'else' block below.
danno
2011/09/21 14:32:04
Done.
|
| // the value in register eax. |
| - __ mov(edx, Operand(eax)); |
| - __ mov(FieldOperand(edi, ecx, times_2, FixedArray::kHeaderSize), eax); |
| - __ RecordWrite(edi, 0, edx, ecx); |
| + if (store_objet_action == kObjectStoreForcesGeneric) { |
|
Jakob Kummerow
2011/09/16 16:30:34
And here +='c' too.
danno
2011/09/21 14:32:04
Done.
|
| + __ JumpIfNotSmi(eax, &miss_force_generic); |
| + __ mov(FieldOperand(edi, ecx, times_2, FixedArray::kHeaderSize), eax); |
| + } else { |
| + ASSERT(store_objet_action == kObjectStoreCausesWriteBarrier); |
|
Jakob Kummerow
2011/09/16 16:30:34
And once more.
danno
2011/09/21 14:32:04
Done.
|
| + __ mov(edx, Operand(eax)); |
| + __ mov(FieldOperand(edi, ecx, times_2, FixedArray::kHeaderSize), eax); |
| + __ RecordWrite(edi, 0, edx, ecx); |
| + } |
| // Done. |
| __ ret(0); |