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_X87 | 7 #if V8_TARGET_ARCH_X87 |
8 | 8 |
9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
10 #include "codegen.h" | 10 #include "codegen.h" |
(...skipping 3286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3297 Register current = scratch0; | 3297 Register current = scratch0; |
3298 Label loop_again; | 3298 Label loop_again; |
3299 | 3299 |
3300 // scratch contained elements pointer. | 3300 // scratch contained elements pointer. |
3301 mov(current, object); | 3301 mov(current, object); |
3302 | 3302 |
3303 // Loop based on the map going up the prototype chain. | 3303 // Loop based on the map going up the prototype chain. |
3304 bind(&loop_again); | 3304 bind(&loop_again); |
3305 mov(current, FieldOperand(current, HeapObject::kMapOffset)); | 3305 mov(current, FieldOperand(current, HeapObject::kMapOffset)); |
3306 mov(scratch1, FieldOperand(current, Map::kBitField2Offset)); | 3306 mov(scratch1, FieldOperand(current, Map::kBitField2Offset)); |
3307 and_(scratch1, Map::kElementsKindMask); | 3307 DecodeField<Map::ElementsKindBits>(scratch1); |
3308 shr(scratch1, Map::kElementsKindShift); | |
3309 cmp(scratch1, Immediate(DICTIONARY_ELEMENTS)); | 3308 cmp(scratch1, Immediate(DICTIONARY_ELEMENTS)); |
3310 j(equal, found); | 3309 j(equal, found); |
3311 mov(current, FieldOperand(current, Map::kPrototypeOffset)); | 3310 mov(current, FieldOperand(current, Map::kPrototypeOffset)); |
3312 cmp(current, Immediate(factory->null_value())); | 3311 cmp(current, Immediate(factory->null_value())); |
3313 j(not_equal, &loop_again); | 3312 j(not_equal, &loop_again); |
3314 } | 3313 } |
3315 | 3314 |
3316 | 3315 |
3317 void MacroAssembler::TruncatingDiv(Register dividend, int32_t divisor) { | 3316 void MacroAssembler::TruncatingDiv(Register dividend, int32_t divisor) { |
3318 ASSERT(!dividend.is(eax)); | 3317 ASSERT(!dividend.is(eax)); |
3319 ASSERT(!dividend.is(edx)); | 3318 ASSERT(!dividend.is(edx)); |
3320 MultiplierAndShift ms(divisor); | 3319 MultiplierAndShift ms(divisor); |
3321 mov(eax, Immediate(ms.multiplier())); | 3320 mov(eax, Immediate(ms.multiplier())); |
3322 imul(dividend); | 3321 imul(dividend); |
3323 if (divisor > 0 && ms.multiplier() < 0) add(edx, dividend); | 3322 if (divisor > 0 && ms.multiplier() < 0) add(edx, dividend); |
3324 if (divisor < 0 && ms.multiplier() > 0) sub(edx, dividend); | 3323 if (divisor < 0 && ms.multiplier() > 0) sub(edx, dividend); |
3325 if (ms.shift() > 0) sar(edx, ms.shift()); | 3324 if (ms.shift() > 0) sar(edx, ms.shift()); |
3326 mov(eax, dividend); | 3325 mov(eax, dividend); |
3327 shr(eax, 31); | 3326 shr(eax, 31); |
3328 add(edx, eax); | 3327 add(edx, eax); |
3329 } | 3328 } |
3330 | 3329 |
3331 | 3330 |
3332 } } // namespace v8::internal | 3331 } } // namespace v8::internal |
3333 | 3332 |
3334 #endif // V8_TARGET_ARCH_X87 | 3333 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |