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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 T t, int chars, uint32_t hash_field) { | 130 T t, int chars, uint32_t hash_field) { |
131 if (IsOneByte(t, chars)) { | 131 if (IsOneByte(t, chars)) { |
132 return AllocateInternalizedStringImpl<true>(t, chars, hash_field); | 132 return AllocateInternalizedStringImpl<true>(t, chars, hash_field); |
133 } | 133 } |
134 return AllocateInternalizedStringImpl<false>(t, chars, hash_field); | 134 return AllocateInternalizedStringImpl<false>(t, chars, hash_field); |
135 } | 135 } |
136 | 136 |
137 | 137 |
138 MaybeObject* Heap::AllocateOneByteInternalizedString(Vector<const uint8_t> str, | 138 MaybeObject* Heap::AllocateOneByteInternalizedString(Vector<const uint8_t> str, |
139 uint32_t hash_field) { | 139 uint32_t hash_field) { |
140 if (str.length() > SeqOneByteString::kMaxLength) { | 140 if (str.length() > String::kMaxLength) { |
141 return Failure::OutOfMemoryException(0x2); | 141 return Failure::OutOfMemoryException(0x2); |
142 } | 142 } |
143 // Compute map and object size. | 143 // Compute map and object size. |
144 Map* map = ascii_internalized_string_map(); | 144 Map* map = ascii_internalized_string_map(); |
145 int size = SeqOneByteString::SizeFor(str.length()); | 145 int size = SeqOneByteString::SizeFor(str.length()); |
146 AllocationSpace space = SelectSpace(size, OLD_DATA_SPACE, TENURED); | 146 AllocationSpace space = SelectSpace(size, OLD_DATA_SPACE, TENURED); |
147 | 147 |
148 // Allocate string. | 148 // Allocate string. |
149 Object* result; | 149 Object* result; |
150 { MaybeObject* maybe_result = AllocateRaw(size, space, OLD_DATA_SPACE); | 150 { MaybeObject* maybe_result = AllocateRaw(size, space, OLD_DATA_SPACE); |
(...skipping 12 matching lines...) Expand all Loading... |
163 // Fill in the characters. | 163 // Fill in the characters. |
164 OS::MemCopy(answer->address() + SeqOneByteString::kHeaderSize, | 164 OS::MemCopy(answer->address() + SeqOneByteString::kHeaderSize, |
165 str.start(), str.length()); | 165 str.start(), str.length()); |
166 | 166 |
167 return answer; | 167 return answer; |
168 } | 168 } |
169 | 169 |
170 | 170 |
171 MaybeObject* Heap::AllocateTwoByteInternalizedString(Vector<const uc16> str, | 171 MaybeObject* Heap::AllocateTwoByteInternalizedString(Vector<const uc16> str, |
172 uint32_t hash_field) { | 172 uint32_t hash_field) { |
173 if (str.length() > SeqTwoByteString::kMaxLength) { | 173 if (str.length() > String::kMaxLength) { |
174 return Failure::OutOfMemoryException(0x3); | 174 return Failure::OutOfMemoryException(0x3); |
175 } | 175 } |
176 // Compute map and object size. | 176 // Compute map and object size. |
177 Map* map = internalized_string_map(); | 177 Map* map = internalized_string_map(); |
178 int size = SeqTwoByteString::SizeFor(str.length()); | 178 int size = SeqTwoByteString::SizeFor(str.length()); |
179 AllocationSpace space = SelectSpace(size, OLD_DATA_SPACE, TENURED); | 179 AllocationSpace space = SelectSpace(size, OLD_DATA_SPACE, TENURED); |
180 | 180 |
181 // Allocate string. | 181 // Allocate string. |
182 Object* result; | 182 Object* result; |
183 { MaybeObject* maybe_result = AllocateRaw(size, space, OLD_DATA_SPACE); | 183 { MaybeObject* maybe_result = AllocateRaw(size, space, OLD_DATA_SPACE); |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 | 843 |
844 | 844 |
845 double GCTracer::SizeOfHeapObjects() { | 845 double GCTracer::SizeOfHeapObjects() { |
846 return (static_cast<double>(heap_->SizeOfObjects())) / MB; | 846 return (static_cast<double>(heap_->SizeOfObjects())) / MB; |
847 } | 847 } |
848 | 848 |
849 | 849 |
850 } } // namespace v8::internal | 850 } } // namespace v8::internal |
851 | 851 |
852 #endif // V8_HEAP_INL_H_ | 852 #endif // V8_HEAP_INL_H_ |
OLD | NEW |