| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // remembered set. | 72 // remembered set. |
| 73 masm->sub(Operand(addr), Immediate(Page::kPageSize / kPointerSize)); | 73 masm->sub(Operand(addr), Immediate(Page::kPageSize / kPointerSize)); |
| 74 // Load the array length into 'scratch' and multiply by four to get the | 74 // Load the array length into 'scratch' and multiply by four to get the |
| 75 // size in bytes of the elements. | 75 // size in bytes of the elements. |
| 76 masm->mov(scratch, Operand(object, Page::kObjectStartOffset | 76 masm->mov(scratch, Operand(object, Page::kObjectStartOffset |
| 77 + FixedArray::kLengthOffset)); | 77 + FixedArray::kLengthOffset)); |
| 78 masm->shl(scratch, kObjectAlignmentBits); | 78 masm->shl(scratch, kObjectAlignmentBits); |
| 79 // Add the page header, array header, and array body size to the page | 79 // Add the page header, array header, and array body size to the page |
| 80 // address. | 80 // address. |
| 81 masm->add(Operand(object), Immediate(Page::kObjectStartOffset | 81 masm->add(Operand(object), Immediate(Page::kObjectStartOffset |
| 82 + Array::kHeaderSize)); | 82 + FixedArray::kHeaderSize)); |
| 83 masm->add(object, Operand(scratch)); | 83 masm->add(object, Operand(scratch)); |
| 84 | 84 |
| 85 | 85 |
| 86 // NOTE: For now, we use the bit-test-and-set (bts) x86 instruction | 86 // NOTE: For now, we use the bit-test-and-set (bts) x86 instruction |
| 87 // to limit code size. We should probably evaluate this decision by | 87 // to limit code size. We should probably evaluate this decision by |
| 88 // measuring the performance of an equivalent implementation using | 88 // measuring the performance of an equivalent implementation using |
| 89 // "simpler" instructions | 89 // "simpler" instructions |
| 90 masm->bind(&fast); | 90 masm->bind(&fast); |
| 91 masm->bts(Operand(object, 0), addr); | 91 masm->bts(Operand(object, 0), addr); |
| 92 } | 92 } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 // to limit code size. We should probably evaluate this decision by | 192 // to limit code size. We should probably evaluate this decision by |
| 193 // measuring the performance of an equivalent implementation using | 193 // measuring the performance of an equivalent implementation using |
| 194 // "simpler" instructions | 194 // "simpler" instructions |
| 195 bts(Operand(object, 0), value); | 195 bts(Operand(object, 0), value); |
| 196 } else { | 196 } else { |
| 197 Register dst = scratch; | 197 Register dst = scratch; |
| 198 if (offset != 0) { | 198 if (offset != 0) { |
| 199 lea(dst, Operand(object, offset)); | 199 lea(dst, Operand(object, offset)); |
| 200 } else { | 200 } else { |
| 201 // array access: calculate the destination address in the same manner as | 201 // array access: calculate the destination address in the same manner as |
| 202 // KeyedStoreIC::GenerateGeneric | 202 // KeyedStoreIC::GenerateGeneric. Multiply a smi by 2 to get an offset |
| 203 lea(dst, | 203 // into an array of words. |
| 204 Operand(object, dst, times_2, Array::kHeaderSize - kHeapObjectTag)); | 204 lea(dst, Operand(object, dst, times_2, |
| 205 FixedArray::kHeaderSize - kHeapObjectTag)); |
| 205 } | 206 } |
| 206 // If we are already generating a shared stub, not inlining the | 207 // If we are already generating a shared stub, not inlining the |
| 207 // record write code isn't going to save us any memory. | 208 // record write code isn't going to save us any memory. |
| 208 if (generating_stub()) { | 209 if (generating_stub()) { |
| 209 RecordWriteHelper(this, object, dst, value); | 210 RecordWriteHelper(this, object, dst, value); |
| 210 } else { | 211 } else { |
| 211 RecordWriteStub stub(object, dst, value); | 212 RecordWriteStub stub(object, dst, value); |
| 212 CallStub(&stub); | 213 CallStub(&stub); |
| 213 } | 214 } |
| 214 } | 215 } |
| (...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 // Indicate that code has changed. | 1040 // Indicate that code has changed. |
| 1040 CPU::FlushICache(address_, size_); | 1041 CPU::FlushICache(address_, size_); |
| 1041 | 1042 |
| 1042 // Check that the code was patched as expected. | 1043 // Check that the code was patched as expected. |
| 1043 ASSERT(masm_.pc_ == address_ + size_); | 1044 ASSERT(masm_.pc_ == address_ + size_); |
| 1044 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1045 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
| 1045 } | 1046 } |
| 1046 | 1047 |
| 1047 | 1048 |
| 1048 } } // namespace v8::internal | 1049 } } // namespace v8::internal |
| OLD | NEW |