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

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

Issue 162001: Fix bug in X64 RSet code. Optimize IA32 version. (Closed)
Patch Set: Created 11 years, 4 months 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
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 masm->shr(addr, Immediate(kPointerSizeLog2)); 64 masm->shr(addr, Immediate(kPointerSizeLog2));
65 65
66 // If the bit offset lies beyond the normal remembered set range, it is in 66 // If the bit offset lies beyond the normal remembered set range, it is in
67 // the extra remembered set area of a large object. 67 // the extra remembered set area of a large object.
68 masm->cmpq(addr, Immediate(Page::kPageSize / kPointerSize)); 68 masm->cmpq(addr, Immediate(Page::kPageSize / kPointerSize));
69 masm->j(less, &fast); 69 masm->j(less, &fast);
70 70
71 // Adjust 'addr' to be relative to the start of the extra remembered set 71 // Adjust 'addr' to be relative to the start of the extra remembered set
72 // and the page address in 'object' to be the address of the extra 72 // and the page address in 'object' to be the address of the extra
73 // remembered set. 73 // remembered set.
74 masm->subq(addr, Immediate(Page::kPageSize / kPointerSize)); 74
75 // Load the array length into 'scratch'. 75 // Load the array length into 'scratch'.
76 masm->movl(scratch, 76 masm->movl(scratch,
77 Operand(object, 77 Operand(object,
78 Page::kObjectStartOffset + FixedArray::kLengthOffset)); 78 Page::kObjectStartOffset + FixedArray::kLengthOffset));
79 // Extra remembered set starts right after FixedArray. 79 // Extra remembered set starts right after FixedArray.
80 // Add the page header, array header, and array body size 80 // The RSet extension area lies after the FixedArray, i.e.,
81 // (length * pointer size) to the page address to find the extra remembered 81 // at
82 // set start. 82 // object + kObjectStartOffset + FixedArray::kHeaderSize + 8 * scratch
83 // Make object point to (size of normal RSet + kRSetOffset) before that,
84 // so that we can address the bit directly with addr.
83 masm->lea(object, 85 masm->lea(object,
84 Operand(object, scratch, times_pointer_size, 86 Operand(object, scratch, times_pointer_size,
85 Page::kObjectStartOffset + FixedArray::kHeaderSize)); 87 Page::kObjectStartOffset + FixedArray::kHeaderSize
88 - Page::kRSetEndOffset));
86 89
87 // NOTE: For now, we use the bit-test-and-set (bts) x86 instruction 90 // NOTE: For now, we use the bit-test-and-set (bts) x86 instruction
88 // to limit code size. We should probably evaluate this decision by 91 // to limit code size. We should probably evaluate this decision by
89 // measuring the performance of an equivalent implementation using 92 // measuring the performance of an equivalent implementation using
90 // "simpler" instructions 93 // "simpler" instructions
91 masm->bind(&fast); 94 masm->bind(&fast);
92 masm->bts(Operand(object, Page::kRSetOffset), addr); 95 masm->bts(Operand(object, Page::kRSetOffset), addr);
93 } 96 }
94 97
95 98
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // measuring the performance of an equivalent implementation using 177 // measuring the performance of an equivalent implementation using
175 // "simpler" instructions 178 // "simpler" instructions
176 bts(Operand(object, Page::kRSetOffset), value); 179 bts(Operand(object, Page::kRSetOffset), value);
177 } else { 180 } else {
178 Register dst = scratch; 181 Register dst = scratch;
179 if (offset != 0) { 182 if (offset != 0) {
180 lea(dst, Operand(object, offset)); 183 lea(dst, Operand(object, offset));
181 } else { 184 } else {
182 // array access: calculate the destination address in the same manner as 185 // array access: calculate the destination address in the same manner as
183 // KeyedStoreIC::GenerateGeneric. Multiply a smi by 4 to get an offset 186 // KeyedStoreIC::GenerateGeneric. Multiply a smi by 4 to get an offset
184 // into an array of words. 187 // into an array of pointers.
185 lea(dst, Operand(object, dst, times_half_pointer_size, 188 lea(dst, Operand(object, dst, times_half_pointer_size,
186 FixedArray::kHeaderSize - kHeapObjectTag)); 189 FixedArray::kHeaderSize - kHeapObjectTag));
187 } 190 }
188 // If we are already generating a shared stub, not inlining the 191 // If we are already generating a shared stub, not inlining the
189 // record write code isn't going to save us any memory. 192 // record write code isn't going to save us any memory.
190 if (generating_stub()) { 193 if (generating_stub()) {
191 RecordWriteHelper(this, object, dst, value); 194 RecordWriteHelper(this, object, dst, value);
192 } else { 195 } else {
193 RecordWriteStub stub(object, dst, value); 196 RecordWriteStub stub(object, dst, value);
194 CallStub(&stub); 197 CallStub(&stub);
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 Context::SECURITY_TOKEN_INDEX * kPointerSize; 1194 Context::SECURITY_TOKEN_INDEX * kPointerSize;
1192 movq(scratch, FieldOperand(scratch, token_offset)); 1195 movq(scratch, FieldOperand(scratch, token_offset));
1193 cmpq(scratch, FieldOperand(kScratchRegister, token_offset)); 1196 cmpq(scratch, FieldOperand(kScratchRegister, token_offset));
1194 j(not_equal, miss); 1197 j(not_equal, miss);
1195 1198
1196 bind(&same_contexts); 1199 bind(&same_contexts);
1197 } 1200 }
1198 1201
1199 1202
1200 } } // namespace v8::internal 1203 } } // namespace v8::internal
OLDNEW
« src/spaces-inl.h ('K') | « src/spaces-inl.h ('k') | test/mozilla/mozilla.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698