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 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 Object** write_back) { | 715 Object** write_back) { |
716 int size = source_->GetInt() << kObjectAlignmentBits; | 716 int size = source_->GetInt() << kObjectAlignmentBits; |
717 Address address = Allocate(space_number, space, size); | 717 Address address = Allocate(space_number, space, size); |
718 *write_back = HeapObject::FromAddress(address); | 718 *write_back = HeapObject::FromAddress(address); |
719 Object** current = reinterpret_cast<Object**>(address); | 719 Object** current = reinterpret_cast<Object**>(address); |
720 Object** limit = current + (size >> kPointerSizeLog2); | 720 Object** limit = current + (size >> kPointerSizeLog2); |
721 if (FLAG_log_snapshot_positions) { | 721 if (FLAG_log_snapshot_positions) { |
722 LOG(SnapshotPositionEvent(address, source_->position())); | 722 LOG(SnapshotPositionEvent(address, source_->position())); |
723 } | 723 } |
724 ReadChunk(current, limit, space_number, address); | 724 ReadChunk(current, limit, space_number, address); |
| 725 #ifdef DEBUG |
| 726 bool is_codespace = (space == Heap::code_space()) || |
| 727 ((space == Heap::lo_space()) && (space_number == kLargeCode)); |
| 728 ASSERT(HeapObject::FromAddress(address)->IsCode() == is_codespace); |
| 729 #endif |
725 } | 730 } |
726 | 731 |
727 | 732 |
728 // This macro is always used with a constant argument so it should all fold | 733 // This macro is always used with a constant argument so it should all fold |
729 // away to almost nothing in the generated code. It might be nicer to do this | 734 // away to almost nothing in the generated code. It might be nicer to do this |
730 // with the ternary operator but there are type issues with that. | 735 // with the ternary operator but there are type issues with that. |
731 #define ASSIGN_DEST_SPACE(space_number) \ | 736 #define ASSIGN_DEST_SPACE(space_number) \ |
732 Space* dest_space; \ | 737 Space* dest_space; \ |
733 if (space_number == NEW_SPACE) { \ | 738 if (space_number == NEW_SPACE) { \ |
734 dest_space = Heap::new_space(); \ | 739 dest_space = Heap::new_space(); \ |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 CASE_STATEMENT(where, how, within, MAP_SPACE) \ | 875 CASE_STATEMENT(where, how, within, MAP_SPACE) \ |
871 CASE_STATEMENT(where, how, within, kLargeData) \ | 876 CASE_STATEMENT(where, how, within, kLargeData) \ |
872 CASE_STATEMENT(where, how, within, kLargeCode) \ | 877 CASE_STATEMENT(where, how, within, kLargeCode) \ |
873 CASE_STATEMENT(where, how, within, kLargeFixedArray) \ | 878 CASE_STATEMENT(where, how, within, kLargeFixedArray) \ |
874 CASE_BODY(where, how, within, kAnyOldSpace, kUnknownOffsetFromStart) | 879 CASE_BODY(where, how, within, kAnyOldSpace, kUnknownOffsetFromStart) |
875 | 880 |
876 #define ONE_PER_CODE_SPACE(where, how, within) \ | 881 #define ONE_PER_CODE_SPACE(where, how, within) \ |
877 CASE_STATEMENT(where, how, within, CODE_SPACE) \ | 882 CASE_STATEMENT(where, how, within, CODE_SPACE) \ |
878 CASE_BODY(where, how, within, CODE_SPACE, kUnknownOffsetFromStart) \ | 883 CASE_BODY(where, how, within, CODE_SPACE, kUnknownOffsetFromStart) \ |
879 CASE_STATEMENT(where, how, within, kLargeCode) \ | 884 CASE_STATEMENT(where, how, within, kLargeCode) \ |
880 CASE_BODY(where, how, within, LO_SPACE, kUnknownOffsetFromStart) | 885 CASE_BODY(where, how, within, kLargeCode, kUnknownOffsetFromStart) |
881 | 886 |
882 #define EMIT_COMMON_REFERENCE_PATTERNS(pseudo_space_number, \ | 887 #define EMIT_COMMON_REFERENCE_PATTERNS(pseudo_space_number, \ |
883 space_number, \ | 888 space_number, \ |
884 offset_from_start) \ | 889 offset_from_start) \ |
885 CASE_STATEMENT(kFromStart, kPlain, kStartOfObject, pseudo_space_number) \ | 890 CASE_STATEMENT(kFromStart, kPlain, kStartOfObject, pseudo_space_number) \ |
886 CASE_BODY(kFromStart, kPlain, kStartOfObject, space_number, offset_from_start) | 891 CASE_BODY(kFromStart, kPlain, kStartOfObject, space_number, offset_from_start) |
887 | 892 |
888 // We generate 15 cases and bodies that process special tags that combine | 893 // We generate 15 cases and bodies that process special tags that combine |
889 // the raw data tag and the length into one byte. | 894 // the raw data tag and the length into one byte. |
890 #define RAW_CASE(index, size) \ | 895 #define RAW_CASE(index, size) \ |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1525 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); | 1530 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); |
1526 } | 1531 } |
1527 } | 1532 } |
1528 int allocation_address = fullness_[space]; | 1533 int allocation_address = fullness_[space]; |
1529 fullness_[space] = allocation_address + size; | 1534 fullness_[space] = allocation_address + size; |
1530 return allocation_address; | 1535 return allocation_address; |
1531 } | 1536 } |
1532 | 1537 |
1533 | 1538 |
1534 } } // namespace v8::internal | 1539 } } // namespace v8::internal |
OLD | NEW |