Index: src/ia32/full-codegen-ia32.cc |
=================================================================== |
--- src/ia32/full-codegen-ia32.cc (revision 11587) |
+++ src/ia32/full-codegen-ia32.cc (working copy) |
@@ -3405,99 +3405,6 @@ |
} |
-void FullCodeGenerator::EmitSwapElements(CallRuntime* expr) { |
- ZoneList<Expression*>* args = expr->arguments(); |
- ASSERT(args->length() == 3); |
- VisitForStackValue(args->at(0)); |
- VisitForStackValue(args->at(1)); |
- VisitForStackValue(args->at(2)); |
- Label done; |
- Label slow_case; |
- Register object = eax; |
- Register index_1 = ebx; |
- Register index_2 = ecx; |
- Register elements = edi; |
- Register temp = edx; |
- __ mov(object, Operand(esp, 2 * kPointerSize)); |
- // Fetch the map and check if array is in fast case. |
- // Check that object doesn't require security checks and |
- // has no indexed interceptor. |
- __ CmpObjectType(object, JS_ARRAY_TYPE, temp); |
- __ j(not_equal, &slow_case); |
- __ test_b(FieldOperand(temp, Map::kBitFieldOffset), |
- KeyedLoadIC::kSlowCaseBitFieldMask); |
- __ j(not_zero, &slow_case); |
- |
- // Check the object's elements are in fast case and writable. |
- __ mov(elements, FieldOperand(object, JSObject::kElementsOffset)); |
- __ cmp(FieldOperand(elements, HeapObject::kMapOffset), |
- Immediate(isolate()->factory()->fixed_array_map())); |
- __ j(not_equal, &slow_case); |
- |
- // Check that both indices are smis. |
- __ mov(index_1, Operand(esp, 1 * kPointerSize)); |
- __ mov(index_2, Operand(esp, 0)); |
- __ mov(temp, index_1); |
- __ or_(temp, index_2); |
- __ JumpIfNotSmi(temp, &slow_case); |
- |
- // Check that both indices are valid. |
- __ mov(temp, FieldOperand(object, JSArray::kLengthOffset)); |
- __ cmp(temp, index_1); |
- __ j(below_equal, &slow_case); |
- __ cmp(temp, index_2); |
- __ j(below_equal, &slow_case); |
- |
- // Bring addresses into index1 and index2. |
- __ lea(index_1, CodeGenerator::FixedArrayElementOperand(elements, index_1)); |
- __ lea(index_2, CodeGenerator::FixedArrayElementOperand(elements, index_2)); |
- |
- // Swap elements. Use object and temp as scratch registers. |
- __ mov(object, Operand(index_1, 0)); |
- __ mov(temp, Operand(index_2, 0)); |
- __ mov(Operand(index_2, 0), object); |
- __ mov(Operand(index_1, 0), temp); |
- |
- Label no_remembered_set; |
- __ CheckPageFlag(elements, |
- temp, |
- 1 << MemoryChunk::SCAN_ON_SCAVENGE, |
- not_zero, |
- &no_remembered_set, |
- Label::kNear); |
- // Possible optimization: do a check that both values are Smis |
- // (or them and test against Smi mask.) |
- |
- // We are swapping two objects in an array and the incremental marker never |
- // pauses in the middle of scanning a single object. Therefore the |
- // incremental marker is not disturbed, so we don't need to call the |
- // RecordWrite stub that notifies the incremental marker. |
- __ RememberedSetHelper(elements, |
- index_1, |
- temp, |
- kDontSaveFPRegs, |
- MacroAssembler::kFallThroughAtEnd); |
- __ RememberedSetHelper(elements, |
- index_2, |
- temp, |
- kDontSaveFPRegs, |
- MacroAssembler::kFallThroughAtEnd); |
- |
- __ bind(&no_remembered_set); |
- |
- // We are done. Drop elements from the stack, and return undefined. |
- __ add(esp, Immediate(3 * kPointerSize)); |
- __ mov(eax, isolate()->factory()->undefined_value()); |
- __ jmp(&done); |
- |
- __ bind(&slow_case); |
- __ CallRuntime(Runtime::kSwapElements, 3); |
- |
- __ bind(&done); |
- context()->Plug(eax); |
-} |
- |
- |
void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) { |
ZoneList<Expression*>* args = expr->arguments(); |
ASSERT_EQ(2, args->length()); |