Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 3127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3138 FixedArray::kHeaderSize)); | 3138 FixedArray::kHeaderSize)); |
| 3139 __ lea(index_2, FieldOperand(elements, index_2, times_pointer_size, | 3139 __ lea(index_2, FieldOperand(elements, index_2, times_pointer_size, |
| 3140 FixedArray::kHeaderSize)); | 3140 FixedArray::kHeaderSize)); |
| 3141 | 3141 |
| 3142 // Swap elements. Use object and temp as scratch registers. | 3142 // Swap elements. Use object and temp as scratch registers. |
| 3143 __ movq(object, Operand(index_1, 0)); | 3143 __ movq(object, Operand(index_1, 0)); |
| 3144 __ movq(temp, Operand(index_2, 0)); | 3144 __ movq(temp, Operand(index_2, 0)); |
| 3145 __ movq(Operand(index_2, 0), object); | 3145 __ movq(Operand(index_2, 0), object); |
| 3146 __ movq(Operand(index_1, 0), temp); | 3146 __ movq(Operand(index_1, 0), temp); |
| 3147 | 3147 |
| 3148 Label new_space; | 3148 Label no_remembered_set; |
| 3149 __ InNewSpace(elements, temp, equal, &new_space); | 3149 __ CheckPageFlag(elements, |
| 3150 temp, | |
| 3151 MemoryChunk::SCAN_ON_SCAVENGE, | |
| 3152 not_zero, | |
| 3153 &no_remembered_set, | |
| 3154 Label::kNear); | |
| 3155 // Possible optimization: do a check that both values are Smis | |
| 3156 // (or them and test against Smi mask.) | |
|
Lasse Reichstein
2011/06/10 13:55:44
Use JumpIf[Not]BothSmi in X64.
Erik Corry
2011/06/10 21:57:29
JumpIfBothSmi doesn't exist. I'll do this if I se
| |
| 3150 | 3157 |
| 3151 // Since we are swapping two objects, the incremental marker is not disturbed, | 3158 // Since we are swapping two objects, the incremental marker is not disturbed, |
| 3152 // so we don't call the stub that handles this. | 3159 // so we don't call the stub that handles this. |
| 3153 __ RememberedSetHelper( | 3160 __ RememberedSetHelper( |
| 3154 index_1, temp, kDontSaveFPRegs, MacroAssembler::kFallThroughAtEnd); | 3161 index_1, temp, kDontSaveFPRegs, MacroAssembler::kFallThroughAtEnd); |
| 3155 __ RememberedSetHelper( | 3162 __ RememberedSetHelper( |
| 3156 index_2, temp, kDontSaveFPRegs, MacroAssembler::kFallThroughAtEnd); | 3163 index_2, temp, kDontSaveFPRegs, MacroAssembler::kFallThroughAtEnd); |
| 3157 | 3164 |
| 3158 __ bind(&new_space); | 3165 __ bind(&no_remembered_set); |
| 3166 | |
| 3159 // We are done. Drop elements from the stack, and return undefined. | 3167 // We are done. Drop elements from the stack, and return undefined. |
| 3160 __ addq(rsp, Immediate(3 * kPointerSize)); | 3168 __ addq(rsp, Immediate(3 * kPointerSize)); |
| 3161 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); | 3169 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); |
| 3162 __ jmp(&done); | 3170 __ jmp(&done); |
| 3163 | 3171 |
| 3164 __ bind(&slow_case); | 3172 __ bind(&slow_case); |
| 3165 __ CallRuntime(Runtime::kSwapElements, 3); | 3173 __ CallRuntime(Runtime::kSwapElements, 3); |
| 3166 | 3174 |
| 3167 __ bind(&done); | 3175 __ bind(&done); |
| 3168 context()->Plug(rax); | 3176 context()->Plug(rax); |
| (...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4318 __ ret(0); | 4326 __ ret(0); |
| 4319 } | 4327 } |
| 4320 | 4328 |
| 4321 | 4329 |
| 4322 #undef __ | 4330 #undef __ |
| 4323 | 4331 |
| 4324 | 4332 |
| 4325 } } // namespace v8::internal | 4333 } } // namespace v8::internal |
| 4326 | 4334 |
| 4327 #endif // V8_TARGET_ARCH_X64 | 4335 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |