OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
10 #include "codegen.h" | 10 #include "codegen.h" |
(...skipping 5174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5185 ASSERT(!scratch1.is(scratch0)); | 5185 ASSERT(!scratch1.is(scratch0)); |
5186 Register current = scratch0; | 5186 Register current = scratch0; |
5187 Label loop_again; | 5187 Label loop_again; |
5188 | 5188 |
5189 movp(current, object); | 5189 movp(current, object); |
5190 | 5190 |
5191 // Loop based on the map going up the prototype chain. | 5191 // Loop based on the map going up the prototype chain. |
5192 bind(&loop_again); | 5192 bind(&loop_again); |
5193 movp(current, FieldOperand(current, HeapObject::kMapOffset)); | 5193 movp(current, FieldOperand(current, HeapObject::kMapOffset)); |
5194 movp(scratch1, FieldOperand(current, Map::kBitField2Offset)); | 5194 movp(scratch1, FieldOperand(current, Map::kBitField2Offset)); |
5195 andp(scratch1, Immediate(Map::kElementsKindMask)); | 5195 DecodeField<Map::ElementsKindBits>(scratch1); |
5196 shrp(scratch1, Immediate(Map::kElementsKindShift)); | |
5197 cmpp(scratch1, Immediate(DICTIONARY_ELEMENTS)); | 5196 cmpp(scratch1, Immediate(DICTIONARY_ELEMENTS)); |
5198 j(equal, found); | 5197 j(equal, found); |
5199 movp(current, FieldOperand(current, Map::kPrototypeOffset)); | 5198 movp(current, FieldOperand(current, Map::kPrototypeOffset)); |
5200 CompareRoot(current, Heap::kNullValueRootIndex); | 5199 CompareRoot(current, Heap::kNullValueRootIndex); |
5201 j(not_equal, &loop_again); | 5200 j(not_equal, &loop_again); |
5202 } | 5201 } |
5203 | 5202 |
5204 | 5203 |
5205 void MacroAssembler::TruncatingDiv(Register dividend, int32_t divisor) { | 5204 void MacroAssembler::TruncatingDiv(Register dividend, int32_t divisor) { |
5206 ASSERT(!dividend.is(rax)); | 5205 ASSERT(!dividend.is(rax)); |
5207 ASSERT(!dividend.is(rdx)); | 5206 ASSERT(!dividend.is(rdx)); |
5208 MultiplierAndShift ms(divisor); | 5207 MultiplierAndShift ms(divisor); |
5209 movl(rax, Immediate(ms.multiplier())); | 5208 movl(rax, Immediate(ms.multiplier())); |
5210 imull(dividend); | 5209 imull(dividend); |
5211 if (divisor > 0 && ms.multiplier() < 0) addl(rdx, dividend); | 5210 if (divisor > 0 && ms.multiplier() < 0) addl(rdx, dividend); |
5212 if (divisor < 0 && ms.multiplier() > 0) subl(rdx, dividend); | 5211 if (divisor < 0 && ms.multiplier() > 0) subl(rdx, dividend); |
5213 if (ms.shift() > 0) sarl(rdx, Immediate(ms.shift())); | 5212 if (ms.shift() > 0) sarl(rdx, Immediate(ms.shift())); |
5214 movl(rax, dividend); | 5213 movl(rax, dividend); |
5215 shrl(rax, Immediate(31)); | 5214 shrl(rax, Immediate(31)); |
5216 addl(rdx, rax); | 5215 addl(rdx, rax); |
5217 } | 5216 } |
5218 | 5217 |
5219 | 5218 |
5220 } } // namespace v8::internal | 5219 } } // namespace v8::internal |
5221 | 5220 |
5222 #endif // V8_TARGET_ARCH_X64 | 5221 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |