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 #ifndef V8_HEAP_INL_H_ | 5 #ifndef V8_HEAP_INL_H_ |
6 #define V8_HEAP_INL_H_ | 6 #define V8_HEAP_INL_H_ |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "heap.h" | 10 #include "heap.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 ASSERT_EQ(size, answer->Size()); | 154 ASSERT_EQ(size, answer->Size()); |
155 | 155 |
156 // Fill in the characters. | 156 // Fill in the characters. |
157 OS::MemCopy(answer->address() + SeqTwoByteString::kHeaderSize, | 157 OS::MemCopy(answer->address() + SeqTwoByteString::kHeaderSize, |
158 str.start(), str.length() * kUC16Size); | 158 str.start(), str.length() * kUC16Size); |
159 | 159 |
160 return answer; | 160 return answer; |
161 } | 161 } |
162 | 162 |
163 MaybeObject* Heap::CopyFixedArray(FixedArray* src) { | 163 MaybeObject* Heap::CopyFixedArray(FixedArray* src) { |
| 164 if (src->length() == 0) return src; |
164 return CopyFixedArrayWithMap(src, src->map()); | 165 return CopyFixedArrayWithMap(src, src->map()); |
165 } | 166 } |
166 | 167 |
167 | 168 |
168 MaybeObject* Heap::CopyFixedDoubleArray(FixedDoubleArray* src) { | 169 MaybeObject* Heap::CopyFixedDoubleArray(FixedDoubleArray* src) { |
| 170 if (src->length() == 0) return src; |
169 return CopyFixedDoubleArrayWithMap(src, src->map()); | 171 return CopyFixedDoubleArrayWithMap(src, src->map()); |
170 } | 172 } |
171 | 173 |
172 | 174 |
173 MaybeObject* Heap::CopyConstantPoolArray(ConstantPoolArray* src) { | 175 MaybeObject* Heap::CopyConstantPoolArray(ConstantPoolArray* src) { |
| 176 if (src->length() == 0) return src; |
174 return CopyConstantPoolArrayWithMap(src, src->map()); | 177 return CopyConstantPoolArrayWithMap(src, src->map()); |
175 } | 178 } |
176 | 179 |
177 | 180 |
178 MaybeObject* Heap::AllocateRaw(int size_in_bytes, | 181 MaybeObject* Heap::AllocateRaw(int size_in_bytes, |
179 AllocationSpace space, | 182 AllocationSpace space, |
180 AllocationSpace retry_space) { | 183 AllocationSpace retry_space) { |
181 ASSERT(AllowHandleAllocation::IsAllowed()); | 184 ASSERT(AllowHandleAllocation::IsAllowed()); |
182 ASSERT(AllowHeapAllocation::IsAllowed()); | 185 ASSERT(AllowHeapAllocation::IsAllowed()); |
183 ASSERT(gc_state_ == NOT_IN_GC); | 186 ASSERT(gc_state_ == NOT_IN_GC); |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 | 777 |
775 | 778 |
776 double GCTracer::SizeOfHeapObjects() { | 779 double GCTracer::SizeOfHeapObjects() { |
777 return (static_cast<double>(heap_->SizeOfObjects())) / MB; | 780 return (static_cast<double>(heap_->SizeOfObjects())) / MB; |
778 } | 781 } |
779 | 782 |
780 | 783 |
781 } } // namespace v8::internal | 784 } } // namespace v8::internal |
782 | 785 |
783 #endif // V8_HEAP_INL_H_ | 786 #endif // V8_HEAP_INL_H_ |
OLD | NEW |