| 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 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 Object** write_back) { | 725 Object** write_back) { |
| 726 int size = source_->GetInt() << kObjectAlignmentBits; | 726 int size = source_->GetInt() << kObjectAlignmentBits; |
| 727 Address address = Allocate(space_number, space, size); | 727 Address address = Allocate(space_number, space, size); |
| 728 *write_back = HeapObject::FromAddress(address); | 728 *write_back = HeapObject::FromAddress(address); |
| 729 Object** current = reinterpret_cast<Object**>(address); | 729 Object** current = reinterpret_cast<Object**>(address); |
| 730 Object** limit = current + (size >> kPointerSizeLog2); | 730 Object** limit = current + (size >> kPointerSizeLog2); |
| 731 if (FLAG_log_snapshot_positions) { | 731 if (FLAG_log_snapshot_positions) { |
| 732 LOG(isolate_, SnapshotPositionEvent(address, source_->position())); | 732 LOG(isolate_, SnapshotPositionEvent(address, source_->position())); |
| 733 } | 733 } |
| 734 ReadChunk(current, limit, space_number, address); | 734 ReadChunk(current, limit, space_number, address); |
| 735 #ifdef DEBUG |
| 736 bool is_codespace = (space == HEAP->code_space()) || |
| 737 ((space == HEAP->lo_space()) && (space_number == kLargeCode)); |
| 738 ASSERT(HeapObject::FromAddress(address)->IsCode() == is_codespace); |
| 739 #endif |
| 735 } | 740 } |
| 736 | 741 |
| 737 | 742 |
| 738 // This macro is always used with a constant argument so it should all fold | 743 // This macro is always used with a constant argument so it should all fold |
| 739 // away to almost nothing in the generated code. It might be nicer to do this | 744 // away to almost nothing in the generated code. It might be nicer to do this |
| 740 // with the ternary operator but there are type issues with that. | 745 // with the ternary operator but there are type issues with that. |
| 741 #define ASSIGN_DEST_SPACE(space_number) \ | 746 #define ASSIGN_DEST_SPACE(space_number) \ |
| 742 Space* dest_space; \ | 747 Space* dest_space; \ |
| 743 if (space_number == NEW_SPACE) { \ | 748 if (space_number == NEW_SPACE) { \ |
| 744 dest_space = isolate->heap()->new_space(); \ | 749 dest_space = isolate->heap()->new_space(); \ |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 CASE_STATEMENT(where, how, within, MAP_SPACE) \ | 887 CASE_STATEMENT(where, how, within, MAP_SPACE) \ |
| 883 CASE_STATEMENT(where, how, within, kLargeData) \ | 888 CASE_STATEMENT(where, how, within, kLargeData) \ |
| 884 CASE_STATEMENT(where, how, within, kLargeCode) \ | 889 CASE_STATEMENT(where, how, within, kLargeCode) \ |
| 885 CASE_STATEMENT(where, how, within, kLargeFixedArray) \ | 890 CASE_STATEMENT(where, how, within, kLargeFixedArray) \ |
| 886 CASE_BODY(where, how, within, kAnyOldSpace, kUnknownOffsetFromStart) | 891 CASE_BODY(where, how, within, kAnyOldSpace, kUnknownOffsetFromStart) |
| 887 | 892 |
| 888 #define ONE_PER_CODE_SPACE(where, how, within) \ | 893 #define ONE_PER_CODE_SPACE(where, how, within) \ |
| 889 CASE_STATEMENT(where, how, within, CODE_SPACE) \ | 894 CASE_STATEMENT(where, how, within, CODE_SPACE) \ |
| 890 CASE_BODY(where, how, within, CODE_SPACE, kUnknownOffsetFromStart) \ | 895 CASE_BODY(where, how, within, CODE_SPACE, kUnknownOffsetFromStart) \ |
| 891 CASE_STATEMENT(where, how, within, kLargeCode) \ | 896 CASE_STATEMENT(where, how, within, kLargeCode) \ |
| 892 CASE_BODY(where, how, within, LO_SPACE, kUnknownOffsetFromStart) | 897 CASE_BODY(where, how, within, kLargeCode, kUnknownOffsetFromStart) |
| 893 | 898 |
| 894 #define EMIT_COMMON_REFERENCE_PATTERNS(pseudo_space_number, \ | 899 #define EMIT_COMMON_REFERENCE_PATTERNS(pseudo_space_number, \ |
| 895 space_number, \ | 900 space_number, \ |
| 896 offset_from_start) \ | 901 offset_from_start) \ |
| 897 CASE_STATEMENT(kFromStart, kPlain, kStartOfObject, pseudo_space_number) \ | 902 CASE_STATEMENT(kFromStart, kPlain, kStartOfObject, pseudo_space_number) \ |
| 898 CASE_BODY(kFromStart, kPlain, kStartOfObject, space_number, offset_from_start) | 903 CASE_BODY(kFromStart, kPlain, kStartOfObject, space_number, offset_from_start) |
| 899 | 904 |
| 900 // We generate 15 cases and bodies that process special tags that combine | 905 // We generate 15 cases and bodies that process special tags that combine |
| 901 // the raw data tag and the length into one byte. | 906 // the raw data tag and the length into one byte. |
| 902 #define RAW_CASE(index, size) \ | 907 #define RAW_CASE(index, size) \ |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1550 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); | 1555 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); |
| 1551 } | 1556 } |
| 1552 } | 1557 } |
| 1553 int allocation_address = fullness_[space]; | 1558 int allocation_address = fullness_[space]; |
| 1554 fullness_[space] = allocation_address + size; | 1559 fullness_[space] = allocation_address + size; |
| 1555 return allocation_address; | 1560 return allocation_address; |
| 1556 } | 1561 } |
| 1557 | 1562 |
| 1558 | 1563 |
| 1559 } } // namespace v8::internal | 1564 } } // namespace v8::internal |
| OLD | NEW |