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 14 matching lines...) Expand all Loading... | |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #if defined(V8_TARGET_ARCH_IA32) | 30 #if defined(V8_TARGET_ARCH_IA32) |
| 31 | 31 |
| 32 #include "code-stubs.h" | 32 #include "code-stubs.h" |
| 33 #include "bootstrapper.h" | 33 #include "bootstrapper.h" |
| 34 #include "jsregexp.h" | 34 #include "jsregexp.h" |
| 35 #include "macro-assembler-ia32-inl.h" | |
| 35 #include "regexp-macro-assembler.h" | 36 #include "regexp-macro-assembler.h" |
| 36 | 37 |
| 37 namespace v8 { | 38 namespace v8 { |
| 38 namespace internal { | 39 namespace internal { |
| 39 | 40 |
| 40 #define __ ACCESS_MASM(masm) | 41 #define __ ACCESS_MASM(masm) |
| 41 | 42 |
| 42 void ToNumberStub::Generate(MacroAssembler* masm) { | 43 void ToNumberStub::Generate(MacroAssembler* masm) { |
| 43 // The ToNumber stub takes one argument in eax. | 44 // The ToNumber stub takes one argument in eax. |
| 44 NearLabel check_heap_number, call_builtin; | 45 NearLabel check_heap_number, call_builtin; |
| (...skipping 3993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4038 // ebx: last_match_info backing store (FixedArray) | 4039 // ebx: last_match_info backing store (FixedArray) |
| 4039 // edx: number of capture registers | 4040 // edx: number of capture registers |
| 4040 // Store the capture count. | 4041 // Store the capture count. |
| 4041 __ SmiTag(edx); // Number of capture registers to smi. | 4042 __ SmiTag(edx); // Number of capture registers to smi. |
| 4042 __ mov(FieldOperand(ebx, RegExpImpl::kLastCaptureCountOffset), edx); | 4043 __ mov(FieldOperand(ebx, RegExpImpl::kLastCaptureCountOffset), edx); |
| 4043 __ SmiUntag(edx); // Number of capture registers back from smi. | 4044 __ SmiUntag(edx); // Number of capture registers back from smi. |
| 4044 // Store last subject and last input. | 4045 // Store last subject and last input. |
| 4045 __ mov(eax, Operand(esp, kSubjectOffset)); | 4046 __ mov(eax, Operand(esp, kSubjectOffset)); |
| 4046 __ mov(FieldOperand(ebx, RegExpImpl::kLastSubjectOffset), eax); | 4047 __ mov(FieldOperand(ebx, RegExpImpl::kLastSubjectOffset), eax); |
| 4047 __ mov(ecx, ebx); | 4048 __ mov(ecx, ebx); |
| 4048 __ RecordWrite(ecx, | 4049 __ RecordWriteField(ecx, |
| 4049 RegExpImpl::kLastSubjectOffset, | 4050 RegExpImpl::kLastSubjectOffset, |
| 4050 eax, | 4051 eax, |
| 4051 edi, | 4052 edi, |
| 4052 kDontSaveFPRegs); | 4053 kDontSaveFPRegs); |
| 4053 __ mov(eax, Operand(esp, kSubjectOffset)); | 4054 __ mov(eax, Operand(esp, kSubjectOffset)); |
| 4054 __ mov(FieldOperand(ebx, RegExpImpl::kLastInputOffset), eax); | 4055 __ mov(FieldOperand(ebx, RegExpImpl::kLastInputOffset), eax); |
| 4055 __ mov(ecx, ebx); | 4056 __ mov(ecx, ebx); |
| 4056 __ RecordWrite(ecx, RegExpImpl::kLastInputOffset, eax, edi, kDontSaveFPRegs); | 4057 __ RecordWriteField(ecx, |
| 4058 RegExpImpl::kLastInputOffset, | |
| 4059 eax, | |
| 4060 edi, | |
| 4061 kDontSaveFPRegs); | |
| 4057 | 4062 |
| 4058 // Get the static offsets vector filled by the native regexp code. | 4063 // Get the static offsets vector filled by the native regexp code. |
| 4059 ExternalReference address_of_static_offsets_vector = | 4064 ExternalReference address_of_static_offsets_vector = |
| 4060 ExternalReference::address_of_static_offsets_vector(); | 4065 ExternalReference::address_of_static_offsets_vector(); |
| 4061 __ mov(ecx, Immediate(address_of_static_offsets_vector)); | 4066 __ mov(ecx, Immediate(address_of_static_offsets_vector)); |
| 4062 | 4067 |
| 4063 // ebx: last_match_info backing store (FixedArray) | 4068 // ebx: last_match_info backing store (FixedArray) |
| 4064 // ecx: offsets vector | 4069 // ecx: offsets vector |
| 4065 // edx: number of capture registers | 4070 // edx: number of capture registers |
| 4066 NearLabel next_capture, done; | 4071 NearLabel next_capture, done; |
| (...skipping 2401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6468 __ pop(ecx); | 6473 __ pop(ecx); |
| 6469 __ pop(eax); | 6474 __ pop(eax); |
| 6470 __ pop(edx); | 6475 __ pop(edx); |
| 6471 __ push(ecx); | 6476 __ push(ecx); |
| 6472 | 6477 |
| 6473 // Do a tail call to the rewritten stub. | 6478 // Do a tail call to the rewritten stub. |
| 6474 __ jmp(Operand(edi)); | 6479 __ jmp(Operand(edi)); |
| 6475 } | 6480 } |
| 6476 | 6481 |
| 6477 | 6482 |
| 6483 // This is a helper class for freeing up 3 scratch registers, where the third | |
| 6484 // is always ecx (needed for shift operations). The input is two registers | |
| 6485 // that must be preserved and one scratch register provided by the caller. | |
| 6486 class ThreeScratchRegisters { | |
| 6487 public: | |
| 6488 ThreeScratchRegisters(MacroAssembler* masm, | |
| 6489 Register object, | |
| 6490 Register address, | |
| 6491 Register scratch0) | |
| 6492 : masm_(masm), | |
| 6493 object_orig_(object), | |
| 6494 address_orig_(address), | |
| 6495 scratch0_orig_(scratch0), | |
| 6496 object_(object), | |
| 6497 address_(address), | |
| 6498 scratch0_(scratch0) { | |
| 6499 ASSERT(!Aliasing(scratch0, object, address, no_reg)); | |
| 6500 if (object.is(ecx)) { | |
| 6501 object_ = GetRegThatIsNotEcxOr(address_, scratch0_, no_reg); | |
| 6502 } | |
| 6503 if (address.is(ecx)) { | |
| 6504 address_ = GetRegThatIsNotEcxOr(object_, scratch0_, no_reg); | |
| 6505 } | |
| 6506 if (scratch0.is(ecx)) { | |
| 6507 scratch0_ = GetRegThatIsNotEcxOr(object_, address_, no_reg); | |
| 6508 } | |
| 6509 ASSERT(!Aliasing(scratch0_, object_, address_, ecx)); | |
| 6510 scratch1_ = GetRegThatIsNotEcxOr(object_, address_, scratch0_); | |
| 6511 } | |
| 6512 | |
| 6513 void Save() { | |
| 6514 // We don't have to save scratch0_orig_ because it was given to us as | |
| 6515 // a scratch register. But if we had to switch to a different reg then | |
| 6516 // we should save the new scratch0_. | |
| 6517 if (!scratch0_.is(scratch0_orig_)) masm_->push(scratch0_); | |
| 6518 masm_->push(scratch1_); | |
| 6519 ASSERT(!address_orig_.is(object_)); | |
| 6520 ASSERT(object_.is(object_orig_) || address_.is(address_orig_)); | |
| 6521 masm_->Move(object_, object_orig_); | |
| 6522 masm_->Move(address_, address_orig_); | |
| 6523 // We have to save ecx, because we are going to need it for the bit | |
| 6524 // twiddling, but if we were given ecx as scratch0_orig_ then we don't | |
| 6525 // need to save it because the caller is expecting it to be trashed. | |
| 6526 if (!ecx.is(scratch0_orig_)) masm_->push(ecx); | |
| 6527 } | |
| 6528 | |
| 6529 void Restore() { | |
| 6530 // Do this first because ecx may be one of the orig_ registers. | |
| 6531 if (!ecx.is(scratch0_orig_)) masm_->pop(ecx); | |
| 6532 // These will have been preserved the entire time, so we just need to move | |
| 6533 // them back. Only in one case is the orig_ reg different from the plain | |
| 6534 // one, since only one of them can alias with ecx. | |
| 6535 ASSERT(object_.is(object_orig_) || address_.is(address_orig_)); | |
| 6536 masm_->Move(address_orig_, address_); | |
| 6537 masm_->Move(object_orig_, object_); | |
| 6538 ASSERT(!Aliasing(object_, address_, scratch1_, scratch0_)); | |
| 6539 ASSERT(!Aliasing(object_orig_, address_, scratch1_, scratch0_)); | |
| 6540 ASSERT(!Aliasing(object_, address_orig_, scratch1_, scratch0_)); | |
| 6541 masm_->pop(scratch1_); | |
| 6542 if (!scratch0_.is(scratch0_orig_)) masm_->pop(scratch0_); | |
| 6543 } | |
| 6544 | |
| 6545 // If we have to call into C then we need to save and restore all registers | |
| 6546 // that were not already preserved. The three scratch registers will be | |
| 6547 // restored by other means so we don't bother pushing them here. | |
| 6548 void SaveTheRest() { | |
|
Vyacheslav Egorov (Chromium)
2011/04/16 17:50:36
When calling into C you need to save only eax, ecx
Erik Corry
2011/04/23 17:00:11
Done.
| |
| 6549 for (int i = 0; i < Register::kNumRegisters; i++) { | |
| 6550 Register candidate = Register::from_code(i); | |
| 6551 if (candidate.is(ecx)) continue; | |
| 6552 if (candidate.is(esp)) continue; | |
| 6553 if (candidate.is(scratch0_)) continue; | |
| 6554 if (candidate.is(scratch1_)) continue; | |
| 6555 masm_->push(candidate); | |
| 6556 } | |
| 6557 } | |
| 6558 | |
| 6559 void RestoreTheRest() { | |
| 6560 for (int i = Register::kNumRegisters - 1; i >= 0; i--) { | |
| 6561 Register candidate = Register::from_code(i); | |
| 6562 if (candidate.is(ecx)) continue; | |
| 6563 if (candidate.is(esp)) continue; | |
| 6564 if (candidate.is(scratch0_)) continue; | |
| 6565 if (candidate.is(scratch1_)) continue; | |
| 6566 masm_->pop(candidate); | |
| 6567 } | |
| 6568 } | |
| 6569 | |
| 6570 Register object() { return object_; } | |
| 6571 Register address() { return address_; } | |
| 6572 Register scratch0() { return scratch0_; } | |
| 6573 Register scratch1() { return scratch1_; } | |
| 6574 | |
| 6575 private: | |
| 6576 MacroAssembler* masm_; | |
| 6577 Register object_orig_; | |
| 6578 Register address_orig_; | |
| 6579 Register scratch0_orig_; | |
| 6580 Register object_; | |
| 6581 Register address_; | |
| 6582 Register scratch0_; | |
| 6583 Register scratch1_; | |
| 6584 // Third scratch register is always ecx. | |
| 6585 | |
| 6586 Register GetRegThatIsNotEcxOr(Register r1, | |
| 6587 Register r2, | |
| 6588 Register r3) { | |
| 6589 for (int i = 0; i < Register::kNumAllocatableRegisters; i++) { | |
| 6590 Register candidate = Register::FromAllocationIndex(i); | |
| 6591 if (candidate.is(ecx)) continue; | |
| 6592 if (candidate.is(r1)) continue; | |
| 6593 if (candidate.is(r2)) continue; | |
| 6594 if (candidate.is(r3)) continue; | |
| 6595 return candidate; | |
| 6596 } | |
| 6597 UNREACHABLE(); | |
| 6598 return no_reg; | |
| 6599 } | |
| 6600 }; | |
| 6601 | |
| 6602 | |
| 6603 // Takes the input in 3 registers: address_ value_ and object_. A pointer to | |
| 6604 // the value has just been written into the object, now this stub makes sure | |
| 6605 // we keep the GC informed. The word in the object where the value has been | |
| 6606 // written is in the address register. | |
| 6478 void RecordWriteStub::Generate(MacroAssembler* masm) { | 6607 void RecordWriteStub::Generate(MacroAssembler* masm) { |
| 6479 NearLabel skip_incremental_part; | 6608 NearLabel skip_non_incremental_part; |
| 6480 __ jmp(&skip_incremental_part); | 6609 __ jmp(&skip_non_incremental_part); |
| 6481 if (!IncrementalMarking::IsStopped()) { | 6610 if (IncrementalMarking::IsStopped()) { |
| 6482 ASSERT(masm->get_opcode(-2) == kSkipIncrementalPartInstruction); | 6611 ASSERT(masm->get_opcode(-2) == kSkipNonIncrementalPartInstruction); |
| 6483 masm->set_opcode(-2, kTwoByteNopInstruction); | 6612 masm->set_opcode(-2, kTwoByteNopInstruction); |
| 6484 } | 6613 } |
| 6485 | 6614 |
| 6486 // If we are also emitting the remembered set code in this stub then we have | 6615 if (emit_remembered_set_ == EMIT_REMEMBERED_SET) { |
| 6487 // the object we are writing into in the 'object' register and the slot in | 6616 NearLabel skip; |
| 6488 // the 'address' register. We insert a primitive test here to ensure that | 6617 __ InNewSpace(address_, value_, equal, &skip); |
| 6489 // this is the case. Otherwise the 'address' register is merely a scratch | 6618 __ HasScanOnScavenge(object_, value_, &skip); |
| 6490 // register. | 6619 __ RememberedSetHelper(address_, value_, save_fp_regs_mode_); |
| 6491 if (FLAG_debug_code && emit_remembered_set_ == EMIT_REMEMBERED_SET) { | 6620 __ bind(&skip); |
| 6621 } | |
| 6622 __ ret(0); | |
| 6623 | |
| 6624 __ bind(&skip_non_incremental_part); | |
| 6625 | |
| 6626 ThreeScratchRegisters regs(masm, | |
| 6627 object_, // An input reg. | |
| 6628 address_, // An input reg. | |
| 6629 value_); // One scratch reg. | |
| 6630 if (FLAG_debug_code) { | |
| 6492 NearLabel ok; | 6631 NearLabel ok; |
| 6493 __ cmp(address_, Operand(object_)); | 6632 __ cmp(value_, Operand(address_, 0)); |
| 6494 __ j(above_equal, &ok); | 6633 __ j(equal, &ok); |
| 6495 __ int3(); | 6634 __ int3(); |
| 6496 __ bind(&ok); | 6635 __ bind(&ok); |
| 6497 } | 6636 } |
| 6498 | 6637 |
| 6499 __ IncrementalMarkingRecordWriteHelper(object_, value_, address_); | 6638 regs.Save(); |
| 6500 | 6639 |
| 6501 __ bind(&skip_incremental_part); | 6640 NearLabel scan_on_scavenge, must_inform_both, value_in_old_space_and_white; |
| 6502 | 6641 NearLabel pop_object_then_must_inform_incremental_marker; |
| 6642 Label object_is_black_remembered_set_needed; | |
| 6643 Label value_in_old_space, both_in_new_space, must_inform_incremental_marker; | |
| 6644 NearLabel value_in_old_space_and_white_object_in_new_space; | |
| 6645 Label object_is_black_remembered_set_not_needed; | |
| 6646 NearLabel near_object_is_black_remembered_set_not_needed; | |
| 6647 | |
| 6648 __ InNewSpace(value_, regs.scratch0(), not_equal, &value_in_old_space); | |
| 6649 | |
| 6650 // After this point the value_ register may have been overwritten since it is | |
| 6651 // also one of the scratch registers. | |
| 6652 | |
| 6653 // The value is in new space. Check the object. | |
| 6654 __ InNewSpace(regs.object(), regs.scratch0(), equal, &both_in_new_space); | |
| 6655 | |
| 6656 // Value is in new space, object is in old space. Could we be lucky and find | |
| 6657 // the scan_on_scavenge flag on the object's page? | |
| 6503 if (emit_remembered_set_ == EMIT_REMEMBERED_SET) { | 6658 if (emit_remembered_set_ == EMIT_REMEMBERED_SET) { |
| 6504 Register scratch = value_; | 6659 __ HasScanOnScavenge(object_, value_, &scan_on_scavenge); |
|
Vyacheslav Egorov (Chromium)
2011/04/16 17:50:36
I think it is uber confusing that sometimes regs.o
Erik Corry
2011/04/23 17:00:11
No they are not always the same register.
Vyacheslav Egorov (Chromium)
2011/04/24 12:16:47
If they are not the same it does not matter in thi
| |
| 6505 NearLabel done; | 6660 } else { |
| 6506 __ InNewSpace(object_, scratch, equal, &done); | 6661 __ jmp(&scan_on_scavenge); |
| 6507 __ RememberedSetHelper(object_, address_, scratch, save_fp_regs_mode_); | 6662 } |
| 6508 __ bind(&done); | 6663 |
| 6509 } | 6664 // There's no getting around the fact that we need to record something because |
| 6665 // of the remembered set, and we will also record the data for the incremental | |
| 6666 // marker. Lets look at the colour of the object: If it is not black we | |
| 6667 // don't have to inform the incremental marker. | |
| 6668 __ InOldSpaceIsBlack(regs.object(), regs.scratch0(), regs.scratch1(), | |
|
Vyacheslav Egorov (Chromium)
2011/04/16 17:50:36
argument per line
Erik Corry
2011/04/23 17:00:11
Done.
| |
| 6669 &object_is_black_remembered_set_needed); | |
| 6670 regs.Restore(); | |
| 6671 if (emit_remembered_set_ == EMIT_REMEMBERED_SET) { | |
| 6672 // We know the address is in old space and the value is in new space. | |
| 6673 __ RememberedSetHelper(address_, value_, save_fp_regs_mode_); | |
| 6674 } | |
| 6675 __ ret(0); | |
| 6676 | |
| 6677 // Object in old space, value in new space, but we don't need to maintain the | |
| 6678 // remembered set for this page. | |
| 6679 __ bind(&scan_on_scavenge); | |
| 6680 __ InOldSpaceIsBlack(regs.object(), regs.scratch0(), regs.scratch1(), | |
|
Vyacheslav Egorov (Chromium)
2011/04/16 17:50:36
argument per line
Erik Corry
2011/04/23 17:00:11
Done.
| |
| 6681 &near_object_is_black_remembered_set_not_needed); | |
| 6682 regs.Restore(); | |
| 6683 __ ret(0); | |
| 6684 | |
| 6685 // Value in new, object is black, no need to record write for remembered set. | |
| 6686 __ bind(&object_is_black_remembered_set_not_needed); | |
| 6687 __ bind(&near_object_is_black_remembered_set_not_needed); | |
| 6688 | |
| 6689 // Reload the value from the word in the object. | |
| 6690 __ mov(regs.scratch0(), Operand(regs.address(), 0)); | |
| 6691 | |
| 6692 // We need one more scratch register in this case. Use the object register. | |
| 6693 __ push(regs.object()); | |
| 6694 | |
| 6695 // Make sure the object is not white. If we can't do that, jump to the label. | |
| 6696 __ MarkBlack(regs.scratch0(), // The value. | |
|
Vyacheslav Egorov (Chromium)
2011/04/16 17:50:36
MarkBlack is a confusing name for the function tha
Erik Corry
2011/04/23 17:00:11
Changed to EnsureNotWhite
| |
| 6697 regs.scratch1(), // Scratch. | |
| 6698 regs.object(), // Scratch. | |
| 6699 &pop_object_then_must_inform_incremental_marker, | |
| 6700 true); // In new space. | |
| 6701 __ pop(regs.object()); | |
| 6702 regs.Restore(); | |
| 6703 __ ret(0); | |
| 6704 | |
| 6705 __ bind(&pop_object_then_must_inform_incremental_marker); | |
| 6706 __ pop(regs.object()); | |
| 6707 | |
| 6708 // Inform the incremental marker, but don't bother with the remembered set. | |
| 6709 __ bind(&must_inform_incremental_marker); | |
| 6710 regs.SaveTheRest(); | |
| 6711 // TODO(gc) we are assuming that xmm registers are not modified by | |
| 6712 // the C function we are calling. | |
| 6713 __ PrepareCallCFunction(2, regs.scratch0()); | |
| 6714 __ mov(Operand(esp, 0 * kPointerSize), regs.object()); | |
| 6715 __ mov(regs.scratch0(), Operand(regs.address(), 0)); | |
| 6716 __ mov(Operand(esp, 1 * kPointerSize), regs.scratch0()); // Value. | |
| 6717 __ CallCFunction( | |
| 6718 ExternalReference::incremental_marking_record_write_function(), 2); | |
|
Vyacheslav Egorov (Chromium)
2011/04/16 17:50:36
you can have stripped version of C function that d
Erik Corry
2011/04/23 17:00:11
TODO added for this
| |
| 6719 regs.RestoreTheRest(); | |
| 6720 regs.Restore(); | |
| 6721 __ ret(0); | |
| 6722 | |
| 6723 __ bind(&object_is_black_remembered_set_needed); | |
| 6724 | |
| 6725 __ mov(regs.scratch0(), Operand(regs.address(), 0)); | |
| 6726 __ push(regs.object()); | |
| 6727 __ MarkBlack(regs.scratch0(), // The value. | |
| 6728 regs.scratch1(), // Scratch. | |
| 6729 regs.object(), // Scratch. | |
| 6730 &must_inform_both, | |
| 6731 true); // In new space. | |
| 6732 __ pop(regs.object()); | |
| 6733 regs.Restore(); | |
| 6734 __ RememberedSetHelper(address_, value_, save_fp_regs_mode_); | |
| 6735 __ ret(0); | |
| 6736 | |
| 6737 __ bind(&must_inform_both); | |
| 6738 // Both the incremental marker and the the remembered set have to be informed. | |
| 6739 __ pop(regs.object()); | |
| 6740 regs.SaveTheRest(); | |
| 6741 // TODO(gc) we are assuming that xmm registers are not modified by | |
| 6742 // the C function we are calling. | |
| 6743 __ PrepareCallCFunction(2, regs.scratch0()); | |
| 6744 __ mov(Operand(esp, 0 * kPointerSize), regs.object()); | |
| 6745 __ mov(regs.scratch0(), Operand(regs.address(), 0)); | |
| 6746 __ mov(Operand(esp, 1 * kPointerSize), regs.scratch0()); // Value. | |
| 6747 __ CallCFunction( | |
| 6748 ExternalReference::incremental_marking_record_write_function(), 2); | |
| 6749 regs.RestoreTheRest(); | |
| 6750 regs.Restore(); | |
| 6751 __ RememberedSetHelper(address_, value_, save_fp_regs_mode_); | |
| 6752 __ ret(0); | |
| 6753 | |
| 6754 __ bind(&both_in_new_space); | |
| 6755 // Both are in new space. If we can avoid recording the incremental marking | |
| 6756 // info then we don't have to record anything at all, since the remembered set | |
| 6757 // doesn't care. Given that we are in new space and we lost the value we | |
| 6758 // will start by checking the object. If it is not black we don't need to do | |
| 6759 // anything. | |
| 6760 __ InNewSpaceIsBlack(regs.object(), | |
| 6761 regs.scratch0(), | |
| 6762 regs.scratch1(), | |
| 6763 &object_is_black_remembered_set_not_needed); | |
| 6764 regs.Restore(); | |
| 6765 __ ret(0); | |
| 6766 | |
| 6767 __ bind(&value_in_old_space); | |
| 6768 // If the value is in old space then the remembered set doesn't care. We may | |
| 6769 // be able to avoid logging anything if the incremental marker doesn't care | |
| 6770 // either. | |
| 6771 __ mov(regs.scratch0(), Operand(regs.address(), 0)); | |
| 6772 __ push(regs.object()); | |
| 6773 __ MarkBlack(regs.scratch0(), // The value. | |
| 6774 regs.scratch1(), // Scratch. | |
| 6775 regs.object(), // Scratch. | |
| 6776 &value_in_old_space_and_white, | |
| 6777 false); // In old space. | |
| 6778 __ pop(regs.object()); | |
| 6779 regs.Restore(); | |
| 6780 __ ret(0); | |
| 6781 | |
| 6782 // The value is in old space and white. We have to find out which space the | |
| 6783 // object is in in order to find its colour. | |
| 6784 __ bind(&value_in_old_space_and_white); | |
| 6785 __ pop(regs.object()); | |
| 6786 __ InNewSpace(regs.object(), | |
| 6787 regs.scratch0(), | |
| 6788 equal, | |
| 6789 &value_in_old_space_and_white_object_in_new_space); | |
| 6790 | |
| 6791 // Both in old space, value is white and can't be marked. | |
| 6792 __ InOldSpaceIsBlack(regs.object(), regs.scratch0(), regs.scratch1(), | |
| 6793 &must_inform_incremental_marker); | |
| 6794 regs.Restore(); | |
| 6795 __ ret(0); | |
| 6796 | |
| 6797 // Object in new space, value in old space and white and can't be marked. | |
| 6798 __ bind(&value_in_old_space_and_white_object_in_new_space); | |
| 6799 __ InNewSpaceIsBlack(regs.object(), regs.scratch0(), regs.scratch1(), | |
| 6800 &must_inform_incremental_marker); | |
| 6801 regs.Restore(); | |
| 6510 __ ret(0); | 6802 __ ret(0); |
| 6511 } | 6803 } |
| 6512 | 6804 |
| 6513 | 6805 |
| 6514 #undef __ | 6806 #undef __ |
| 6515 | 6807 |
| 6516 } } // namespace v8::internal | 6808 } } // namespace v8::internal |
| 6517 | 6809 |
| 6518 #endif // V8_TARGET_ARCH_IA32 | 6810 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |