Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: src/spaces.h

Issue 11566011: Use MemoryChunk-based allocation for deoptimization entry code (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/deoptimizer.cc ('k') | src/spaces.cc » ('j') | src/spaces.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 return static_cast<int>(area_end() - area_start()); 646 return static_cast<int>(area_end() - area_start());
647 } 647 }
648 648
649 // Approximate amount of physical memory committed for this chunk. 649 // Approximate amount of physical memory committed for this chunk.
650 size_t CommittedPhysicalMemory() { 650 size_t CommittedPhysicalMemory() {
651 return high_water_mark_; 651 return high_water_mark_;
652 } 652 }
653 653
654 static inline void UpdateHighWaterMark(Address mark); 654 static inline void UpdateHighWaterMark(Address mark);
655 655
656 // Commit the delta memory region from area_end_ to area_start_ + body_size,
danno 2013/01/17 10:49:55 Please don't include implementation details (e.g.
haitao.feng 2013/01/17 14:20:33 Done.
657 // If body_size <= area_end_ - area_start_, this function just returns true
658 // and no uncommitment happens.
danno 2013/01/17 10:49:55 s/area_end_ to area_start_/Pages are never uncommi
haitao.feng 2013/01/17 14:20:33 Done.
659 bool CommitBody(size_t body_size, Executability executable);
660
656 protected: 661 protected:
657 MemoryChunk* next_chunk_; 662 MemoryChunk* next_chunk_;
658 MemoryChunk* prev_chunk_; 663 MemoryChunk* prev_chunk_;
659 size_t size_; 664 size_t size_;
660 intptr_t flags_; 665 intptr_t flags_;
661 666
662 // Start and end of allocatable memory on this chunk. 667 // Start and end of allocatable memory on this chunk.
663 Address area_start_; 668 Address area_start_;
664 Address area_end_; 669 Address area_end_;
665 670
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 bool contains(Address address) { 886 bool contains(Address address) {
882 if (this == NULL || code_range_ == NULL) return false; 887 if (this == NULL || code_range_ == NULL) return false;
883 Address start = static_cast<Address>(code_range_->address()); 888 Address start = static_cast<Address>(code_range_->address());
884 return start <= address && address < start + code_range_->size(); 889 return start <= address && address < start + code_range_->size();
885 } 890 }
886 891
887 // Allocates a chunk of memory from the large-object portion of 892 // Allocates a chunk of memory from the large-object portion of
888 // the code range. On platforms with no separate code range, should 893 // the code range. On platforms with no separate code range, should
889 // not be called. 894 // not be called.
890 MUST_USE_RESULT Address AllocateRawMemory(const size_t requested, 895 MUST_USE_RESULT Address AllocateRawMemory(const size_t requested,
891 size_t* allocated); 896 size_t* allocated,
897 size_t commit_body_size);
danno 2013/01/17 10:49:55 Can you make this the second parameter? Also, "bod
haitao.feng 2013/01/17 14:20:33 Done.
898 bool CommitRawMemory(Address start, size_t length);
892 void FreeRawMemory(Address buf, size_t length); 899 void FreeRawMemory(Address buf, size_t length);
893 900
894 private: 901 private:
895 Isolate* isolate_; 902 Isolate* isolate_;
896 903
897 // The reserved range of virtual memory that all code objects are put in. 904 // The reserved range of virtual memory that all code objects are put in.
898 VirtualMemory* code_range_; 905 VirtualMemory* code_range_;
899 // Plain old data class, just a struct plus a constructor. 906 // Plain old data class, just a struct plus a constructor.
900 class FreeBlock { 907 class FreeBlock {
901 public: 908 public:
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 // Returns maximum available bytes that the old space can have. 1036 // Returns maximum available bytes that the old space can have.
1030 intptr_t MaxAvailable() { 1037 intptr_t MaxAvailable() {
1031 return (Available() / Page::kPageSize) * Page::kMaxNonCodeHeapObjectSize; 1038 return (Available() / Page::kPageSize) * Page::kMaxNonCodeHeapObjectSize;
1032 } 1039 }
1033 1040
1034 #ifdef DEBUG 1041 #ifdef DEBUG
1035 // Reports statistic info of the space. 1042 // Reports statistic info of the space.
1036 void ReportStatistics(); 1043 void ReportStatistics();
1037 #endif 1044 #endif
1038 1045
1039 MemoryChunk* AllocateChunk(intptr_t body_size, 1046 // After calling this function, the memory region from commit_body_size to
1047 // reserve_body_size of the body is reserved but not committed, they could be
1048 // committed later by calling MemoryChunk::CommitBody with a new body size.
1049 MemoryChunk* AllocateChunk(intptr_t reserve_body_size,
1050 intptr_t commit_body_size,
1040 Executability executable, 1051 Executability executable,
1041 Space* space); 1052 Space* space);
1042 1053
1043 Address ReserveAlignedMemory(size_t requested, 1054 Address ReserveAlignedMemory(size_t requested,
1044 size_t alignment, 1055 size_t alignment,
1045 VirtualMemory* controller); 1056 VirtualMemory* controller);
1046 Address AllocateAlignedMemory(size_t requested, 1057 Address AllocateAlignedMemory(size_t requested,
danno 2013/01/17 10:49:55 "requested_size" should be first parameter, second
haitao.feng 2013/01/17 14:20:33 Done.
1047 size_t alignment, 1058 size_t alignment,
1059 size_t commit_body_size,
1048 Executability executable, 1060 Executability executable,
1049 VirtualMemory* controller); 1061 VirtualMemory* controller);
1050 1062
1051 void FreeMemory(VirtualMemory* reservation, Executability executable); 1063 void FreeMemory(VirtualMemory* reservation, Executability executable);
1052 void FreeMemory(Address addr, size_t size, Executability executable); 1064 void FreeMemory(Address addr, size_t size, Executability executable);
1053 1065
1054 // Commit a contiguous block of memory from the initial chunk. Assumes that 1066 // Commit a contiguous block of memory from the initial chunk. Assumes that
1055 // the address is not NULL, the size is greater than zero, and that the 1067 // the address is not NULL, the size is greater than zero, and that the
1056 // block is contained in the initial chunk. Returns true if it succeeded 1068 // block is contained in the initial chunk. Returns true if it succeeded
1057 // and false otherwise. 1069 // and false otherwise.
(...skipping 30 matching lines...) Expand all
1088 static int CodePageAreaStartOffset(); 1100 static int CodePageAreaStartOffset();
1089 1101
1090 static int CodePageAreaEndOffset(); 1102 static int CodePageAreaEndOffset();
1091 1103
1092 static int CodePageAreaSize() { 1104 static int CodePageAreaSize() {
1093 return CodePageAreaEndOffset() - CodePageAreaStartOffset(); 1105 return CodePageAreaEndOffset() - CodePageAreaStartOffset();
1094 } 1106 }
1095 1107
1096 MUST_USE_RESULT static bool CommitCodePage(VirtualMemory* vm, 1108 MUST_USE_RESULT static bool CommitCodePage(VirtualMemory* vm,
1097 Address start, 1109 Address start,
1098 size_t size); 1110 size_t size,
1111 size_t body_size);
1099 1112
1100 private: 1113 private:
1101 Isolate* isolate_; 1114 Isolate* isolate_;
1102 1115
1103 // Maximum space size in bytes. 1116 // Maximum space size in bytes.
1104 size_t capacity_; 1117 size_t capacity_;
1105 // Maximum subset of capacity_ that can be executable 1118 // Maximum subset of capacity_ that can be executable
1106 size_t capacity_executable_; 1119 size_t capacity_executable_;
1107 1120
1108 // Allocated space size in bytes. 1121 // Allocated space size in bytes.
(...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after
2763 } 2776 }
2764 // Must be small, since an iteration is used for lookup. 2777 // Must be small, since an iteration is used for lookup.
2765 static const int kMaxComments = 64; 2778 static const int kMaxComments = 64;
2766 }; 2779 };
2767 #endif 2780 #endif
2768 2781
2769 2782
2770 } } // namespace v8::internal 2783 } } // namespace v8::internal
2771 2784
2772 #endif // V8_SPACES_H_ 2785 #endif // V8_SPACES_H_
OLDNEW
« no previous file with comments | « src/deoptimizer.cc ('k') | src/spaces.cc » ('j') | src/spaces.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698