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