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 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/division-by-constant.h" | 8 #include "src/base/division-by-constant.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 3309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3320 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset)); | 3320 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset)); |
3321 cmp(ecx, isolate()->factory()->null_value()); | 3321 cmp(ecx, isolate()->factory()->null_value()); |
3322 j(not_equal, &next); | 3322 j(not_equal, &next); |
3323 } | 3323 } |
3324 | 3324 |
3325 | 3325 |
3326 void MacroAssembler::TestJSArrayForAllocationMemento( | 3326 void MacroAssembler::TestJSArrayForAllocationMemento( |
3327 Register receiver_reg, | 3327 Register receiver_reg, |
3328 Register scratch_reg, | 3328 Register scratch_reg, |
3329 Label* no_memento_found) { | 3329 Label* no_memento_found) { |
3330 ExternalReference new_space_start = | 3330 Label map_check; |
3331 ExternalReference::new_space_start(isolate()); | |
3332 ExternalReference new_space_allocation_top = | 3331 ExternalReference new_space_allocation_top = |
3333 ExternalReference::new_space_allocation_top_address(isolate()); | 3332 ExternalReference::new_space_allocation_top_address(isolate()); |
| 3333 const int kMementoMapOffset = JSArray::kSize - kHeapObjectTag; |
| 3334 const int kMementoEndOffset = kMementoMapOffset + AllocationMemento::kSize; |
3334 | 3335 |
3335 lea(scratch_reg, Operand(receiver_reg, | 3336 // Bail out if the object sits on the page boundary as no memento can follow |
3336 JSArray::kSize + AllocationMemento::kSize - kHeapObjectTag)); | 3337 // and we cannot touch the memory following it. |
3337 cmp(scratch_reg, Immediate(new_space_start)); | 3338 lea(scratch_reg, Operand(receiver_reg, kMementoEndOffset)); |
3338 j(less, no_memento_found); | 3339 xor_(scratch_reg, receiver_reg); |
| 3340 cmp(scratch_reg, Immediate(Page::kPageSize)); |
| 3341 j(greater, no_memento_found); |
| 3342 // Bail out if the object is not in new space. |
| 3343 lea(scratch_reg, Operand(receiver_reg, kMementoEndOffset)); |
| 3344 JumpIfNotInNewSpace(scratch_reg, scratch_reg, no_memento_found); |
| 3345 // If the object is in new space, we need to check whether it is on the same |
| 3346 // page as the current top. |
| 3347 lea(scratch_reg, Operand(receiver_reg, kMementoEndOffset)); |
| 3348 xor_(scratch_reg, Operand::StaticVariable(new_space_allocation_top)); |
| 3349 test(scratch_reg, Immediate(~Page::kPageAlignmentMask)); |
| 3350 // If top is not on the same page as the current object, we can just continue |
| 3351 // with the map check. |
| 3352 j(not_zero, &map_check); |
| 3353 // Otherwise, we have to check whether we are still below top, to ensure that |
| 3354 // we are not checking against a stale memento. |
| 3355 lea(scratch_reg, Operand(receiver_reg, kMementoEndOffset)); |
3339 cmp(scratch_reg, Operand::StaticVariable(new_space_allocation_top)); | 3356 cmp(scratch_reg, Operand::StaticVariable(new_space_allocation_top)); |
3340 j(greater, no_memento_found); | 3357 j(greater, no_memento_found); |
3341 cmp(MemOperand(scratch_reg, -AllocationMemento::kSize), | 3358 bind(&map_check); |
3342 Immediate(isolate()->factory()->allocation_memento_map())); | 3359 mov(scratch_reg, Operand(receiver_reg, kMementoMapOffset)); |
| 3360 cmp(scratch_reg, Immediate(isolate()->factory()->allocation_memento_map())); |
3343 } | 3361 } |
3344 | 3362 |
3345 | 3363 |
3346 void MacroAssembler::JumpIfDictionaryInPrototypeChain( | 3364 void MacroAssembler::JumpIfDictionaryInPrototypeChain( |
3347 Register object, | 3365 Register object, |
3348 Register scratch0, | 3366 Register scratch0, |
3349 Register scratch1, | 3367 Register scratch1, |
3350 Label* found) { | 3368 Label* found) { |
3351 DCHECK(!scratch1.is(scratch0)); | 3369 DCHECK(!scratch1.is(scratch0)); |
3352 Factory* factory = isolate()->factory(); | 3370 Factory* factory = isolate()->factory(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3393 mov(eax, dividend); | 3411 mov(eax, dividend); |
3394 shr(eax, 31); | 3412 shr(eax, 31); |
3395 add(edx, eax); | 3413 add(edx, eax); |
3396 } | 3414 } |
3397 | 3415 |
3398 | 3416 |
3399 } // namespace internal | 3417 } // namespace internal |
3400 } // namespace v8 | 3418 } // namespace v8 |
3401 | 3419 |
3402 #endif // V8_TARGET_ARCH_IA32 | 3420 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |