| 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 "src/v8.h" |     5 #include "src/v8.h" | 
|     6  |     6  | 
|     7 #if V8_TARGET_ARCH_IA32 |     7 #if V8_TARGET_ARCH_IA32 | 
|     8  |     8  | 
|     9 #include "src/base/bits.h" |     9 #include "src/base/bits.h" | 
|    10 #include "src/base/division-by-constant.h" |    10 #include "src/base/division-by-constant.h" | 
| (...skipping 3160 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3171  |  3171  | 
|  3172  |  3172  | 
|  3173 void MacroAssembler::JumpIfDictionaryInPrototypeChain( |  3173 void MacroAssembler::JumpIfDictionaryInPrototypeChain( | 
|  3174     Register object, |  3174     Register object, | 
|  3175     Register scratch0, |  3175     Register scratch0, | 
|  3176     Register scratch1, |  3176     Register scratch1, | 
|  3177     Label* found) { |  3177     Label* found) { | 
|  3178   DCHECK(!scratch1.is(scratch0)); |  3178   DCHECK(!scratch1.is(scratch0)); | 
|  3179   Factory* factory = isolate()->factory(); |  3179   Factory* factory = isolate()->factory(); | 
|  3180   Register current = scratch0; |  3180   Register current = scratch0; | 
|  3181   Label loop_again; |  3181   Label loop_again, end; | 
|  3182  |  3182  | 
|  3183   // scratch contained elements pointer. |  3183   // scratch contained elements pointer. | 
|  3184   mov(current, object); |  3184   mov(current, object); | 
 |  3185   mov(current, FieldOperand(current, HeapObject::kMapOffset)); | 
 |  3186   mov(current, FieldOperand(current, Map::kPrototypeOffset)); | 
 |  3187   cmp(current, Immediate(factory->null_value())); | 
 |  3188   j(equal, &end); | 
|  3185  |  3189  | 
|  3186   // Loop based on the map going up the prototype chain. |  3190   // Loop based on the map going up the prototype chain. | 
|  3187   bind(&loop_again); |  3191   bind(&loop_again); | 
|  3188   mov(current, FieldOperand(current, HeapObject::kMapOffset)); |  3192   mov(current, FieldOperand(current, HeapObject::kMapOffset)); | 
 |  3193   STATIC_ASSERT(JS_PROXY_TYPE < JS_OBJECT_TYPE); | 
 |  3194   STATIC_ASSERT(JS_VALUE_TYPE < JS_OBJECT_TYPE); | 
 |  3195   CmpInstanceType(current, JS_OBJECT_TYPE); | 
 |  3196   j(below, found); | 
|  3189   mov(scratch1, FieldOperand(current, Map::kBitField2Offset)); |  3197   mov(scratch1, FieldOperand(current, Map::kBitField2Offset)); | 
|  3190   DecodeField<Map::ElementsKindBits>(scratch1); |  3198   DecodeField<Map::ElementsKindBits>(scratch1); | 
|  3191   cmp(scratch1, Immediate(DICTIONARY_ELEMENTS)); |  3199   cmp(scratch1, Immediate(DICTIONARY_ELEMENTS)); | 
|  3192   j(equal, found); |  3200   j(equal, found); | 
|  3193   mov(current, FieldOperand(current, Map::kPrototypeOffset)); |  3201   mov(current, FieldOperand(current, Map::kPrototypeOffset)); | 
|  3194   cmp(current, Immediate(factory->null_value())); |  3202   cmp(current, Immediate(factory->null_value())); | 
|  3195   j(not_equal, &loop_again); |  3203   j(not_equal, &loop_again); | 
 |  3204  | 
 |  3205   bind(&end); | 
|  3196 } |  3206 } | 
|  3197  |  3207  | 
|  3198  |  3208  | 
|  3199 void MacroAssembler::TruncatingDiv(Register dividend, int32_t divisor) { |  3209 void MacroAssembler::TruncatingDiv(Register dividend, int32_t divisor) { | 
|  3200   DCHECK(!dividend.is(eax)); |  3210   DCHECK(!dividend.is(eax)); | 
|  3201   DCHECK(!dividend.is(edx)); |  3211   DCHECK(!dividend.is(edx)); | 
|  3202   base::MagicNumbersForDivision<uint32_t> mag = |  3212   base::MagicNumbersForDivision<uint32_t> mag = | 
|  3203       base::SignedDivisionByConstant(static_cast<uint32_t>(divisor)); |  3213       base::SignedDivisionByConstant(static_cast<uint32_t>(divisor)); | 
|  3204   mov(eax, Immediate(mag.multiplier)); |  3214   mov(eax, Immediate(mag.multiplier)); | 
|  3205   imul(dividend); |  3215   imul(dividend); | 
|  3206   bool neg = (mag.multiplier & (static_cast<uint32_t>(1) << 31)) != 0; |  3216   bool neg = (mag.multiplier & (static_cast<uint32_t>(1) << 31)) != 0; | 
|  3207   if (divisor > 0 && neg) add(edx, dividend); |  3217   if (divisor > 0 && neg) add(edx, dividend); | 
|  3208   if (divisor < 0 && !neg && mag.multiplier > 0) sub(edx, dividend); |  3218   if (divisor < 0 && !neg && mag.multiplier > 0) sub(edx, dividend); | 
|  3209   if (mag.shift > 0) sar(edx, mag.shift); |  3219   if (mag.shift > 0) sar(edx, mag.shift); | 
|  3210   mov(eax, dividend); |  3220   mov(eax, dividend); | 
|  3211   shr(eax, 31); |  3221   shr(eax, 31); | 
|  3212   add(edx, eax); |  3222   add(edx, eax); | 
|  3213 } |  3223 } | 
|  3214  |  3224  | 
|  3215  |  3225  | 
|  3216 }  // namespace internal |  3226 }  // namespace internal | 
|  3217 }  // namespace v8 |  3227 }  // namespace v8 | 
|  3218  |  3228  | 
|  3219 #endif  // V8_TARGET_ARCH_IA32 |  3229 #endif  // V8_TARGET_ARCH_IA32 | 
| OLD | NEW |