Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/ia32/macro-assembler-ia32.cc

Issue 5939003: Use near labels in write barrier code. (Closed)
Patch Set: Template version Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // Compute number of region covering addr. See Page::GetRegionNumberForAddress 67 // Compute number of region covering addr. See Page::GetRegionNumberForAddress
68 // method for more details. 68 // method for more details.
69 and_(addr, Page::kPageAlignmentMask); 69 and_(addr, Page::kPageAlignmentMask);
70 shr(addr, Page::kRegionSizeLog2); 70 shr(addr, Page::kRegionSizeLog2);
71 71
72 // Set dirty mark for region. 72 // Set dirty mark for region.
73 bts(Operand(object, Page::kDirtyFlagOffset), addr); 73 bts(Operand(object, Page::kDirtyFlagOffset), addr);
74 } 74 }
75 75
76 76
77 void MacroAssembler::InNewSpace(Register object,
78 Register scratch,
79 Condition cc,
80 Label* branch) {
81 ASSERT(cc == equal || cc == not_equal);
82 if (Serializer::enabled()) {
83 // Can't do arithmetic on external references if it might get serialized.
84 mov(scratch, Operand(object));
85 // The mask isn't really an address. We load it as an external reference in
86 // case the size of the new space is different between the snapshot maker
87 // and the running system.
88 and_(Operand(scratch), Immediate(ExternalReference::new_space_mask()));
89 cmp(Operand(scratch), Immediate(ExternalReference::new_space_start()));
90 j(cc, branch);
91 } else {
92 int32_t new_space_start = reinterpret_cast<int32_t>(
93 ExternalReference::new_space_start().address());
94 lea(scratch, Operand(object, -new_space_start));
95 and_(scratch, Heap::NewSpaceMask());
96 j(cc, branch);
97 }
98 }
99
100
101 void MacroAssembler::RecordWrite(Register object, 77 void MacroAssembler::RecordWrite(Register object,
102 int offset, 78 int offset,
103 Register value, 79 Register value,
104 Register scratch) { 80 Register scratch) {
105 // The compiled code assumes that record write doesn't change the 81 // The compiled code assumes that record write doesn't change the
106 // context register, so we check that none of the clobbered 82 // context register, so we check that none of the clobbered
107 // registers are esi. 83 // registers are esi.
108 ASSERT(!object.is(esi) && !value.is(esi) && !scratch.is(esi)); 84 ASSERT(!object.is(esi) && !value.is(esi) && !scratch.is(esi));
109 85
110 // First, check if a write barrier is even needed. The tests below 86 // First, check if a write barrier is even needed. The tests below
111 // catch stores of Smis and stores into young gen. 87 // catch stores of Smis and stores into young gen.
112 Label done; 88 NearLabel done;
113 89
114 // Skip barrier if writing a smi. 90 // Skip barrier if writing a smi.
115 ASSERT_EQ(0, kSmiTag); 91 ASSERT_EQ(0, kSmiTag);
116 test(value, Immediate(kSmiTagMask)); 92 test(value, Immediate(kSmiTagMask));
117 j(zero, &done); 93 j(zero, &done);
118 94
119 InNewSpace(object, value, equal, &done); 95 InNewSpace(object, value, equal, &done);
120 96
121 // The offset is relative to a tagged or untagged HeapObject pointer, 97 // The offset is relative to a tagged or untagged HeapObject pointer,
122 // so either offset or offset + kHeapObjectTag must be a 98 // so either offset or offset + kHeapObjectTag must be a
(...skipping 1792 matching lines...) Expand 10 before | Expand all | Expand 10 after
1915 1891
1916 // Check that the code was patched as expected. 1892 // Check that the code was patched as expected.
1917 ASSERT(masm_.pc_ == address_ + size_); 1893 ASSERT(masm_.pc_ == address_ + size_);
1918 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 1894 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
1919 } 1895 }
1920 1896
1921 1897
1922 } } // namespace v8::internal 1898 } } // namespace v8::internal
1923 1899
1924 #endif // V8_TARGET_ARCH_IA32 1900 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698