OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 | 366 |
367 void Heap::RecordWrites(Address address, int start, int len) { | 367 void Heap::RecordWrites(Address address, int start, int len) { |
368 if (!InNewSpace(address)) { | 368 if (!InNewSpace(address)) { |
369 for (int i = 0; i < len; i++) { | 369 for (int i = 0; i < len; i++) { |
370 store_buffer_.Mark(address + start + i * kPointerSize); | 370 store_buffer_.Mark(address + start + i * kPointerSize); |
371 } | 371 } |
372 } | 372 } |
373 } | 373 } |
374 | 374 |
375 | 375 |
| 376 STATIC_ASSERT((FixedDoubleArray::kHeaderSize & kDoubleAlignmentMask) == 0); |
| 377 STATIC_ASSERT((ConstantPoolArray::kHeaderSize & kDoubleAlignmentMask) == 0); |
| 378 |
| 379 |
| 380 HeapObject* Heap::EnsureDoubleAligned(HeapObject* object, int size) { |
| 381 if ((OffsetFrom(object->address()) & kDoubleAlignmentMask) != 0) { |
| 382 CreateFillerObjectAt(object->address(), kPointerSize); |
| 383 return HeapObject::FromAddress(object->address() + kPointerSize); |
| 384 } else { |
| 385 CreateFillerObjectAt(object->address() + size - kPointerSize, |
| 386 kPointerSize); |
| 387 return object; |
| 388 } |
| 389 } |
| 390 |
| 391 |
| 392 bool Heap::MustBeDoubleAligned(HeapObject* object) { |
| 393 return object->IsFixedDoubleArray() && |
| 394 (kObjectAlignment != kDoubleAlignment); |
| 395 } |
| 396 |
| 397 |
376 OldSpace* Heap::TargetSpace(HeapObject* object) { | 398 OldSpace* Heap::TargetSpace(HeapObject* object) { |
377 InstanceType type = object->map()->instance_type(); | 399 InstanceType type = object->map()->instance_type(); |
378 AllocationSpace space = TargetSpaceId(type); | 400 AllocationSpace space = TargetSpaceId(type); |
379 return (space == OLD_POINTER_SPACE) | 401 return (space == OLD_POINTER_SPACE) |
380 ? old_pointer_space_ | 402 ? old_pointer_space_ |
381 : old_data_space_; | 403 : old_data_space_; |
382 } | 404 } |
383 | 405 |
384 | 406 |
385 AllocationSpace Heap::TargetSpaceId(InstanceType type) { | 407 AllocationSpace Heap::TargetSpaceId(InstanceType type) { |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 #ifdef DEBUG | 881 #ifdef DEBUG |
860 Isolate* isolate = Isolate::Current(); | 882 Isolate* isolate = Isolate::Current(); |
861 isolate->heap()->disallow_allocation_failure_ = old_state_; | 883 isolate->heap()->disallow_allocation_failure_ = old_state_; |
862 #endif | 884 #endif |
863 } | 885 } |
864 | 886 |
865 | 887 |
866 } } // namespace v8::internal | 888 } } // namespace v8::internal |
867 | 889 |
868 #endif // V8_HEAP_INL_H_ | 890 #endif // V8_HEAP_INL_H_ |
OLD | NEW |