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

Side by Side Diff: src/heap/heap-inl.h

Issue 2627783006: Version 5.7.442.2 (cherry-pick) (Closed)
Patch Set: Created 3 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
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_HEAP_HEAP_INL_H_ 5 #ifndef V8_HEAP_HEAP_INL_H_
6 #define V8_HEAP_HEAP_INL_H_ 6 #define V8_HEAP_HEAP_INL_H_
7 7
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 if (IsOneByte(t, chars)) { 218 if (IsOneByte(t, chars)) {
219 return AllocateInternalizedStringImpl<true>(t, chars, hash_field); 219 return AllocateInternalizedStringImpl<true>(t, chars, hash_field);
220 } 220 }
221 return AllocateInternalizedStringImpl<false>(t, chars, hash_field); 221 return AllocateInternalizedStringImpl<false>(t, chars, hash_field);
222 } 222 }
223 223
224 224
225 AllocationResult Heap::AllocateOneByteInternalizedString( 225 AllocationResult Heap::AllocateOneByteInternalizedString(
226 Vector<const uint8_t> str, uint32_t hash_field) { 226 Vector<const uint8_t> str, uint32_t hash_field) {
227 CHECK_GE(String::kMaxLength, str.length()); 227 CHECK_GE(String::kMaxLength, str.length());
228 // The canonical empty_string is the only zero-length string we allow.
229 DCHECK_IMPLIES(str.length() == 0, roots_[kempty_stringRootIndex] == nullptr);
230 // Compute map and object size. 228 // Compute map and object size.
231 Map* map = one_byte_internalized_string_map(); 229 Map* map = one_byte_internalized_string_map();
232 int size = SeqOneByteString::SizeFor(str.length()); 230 int size = SeqOneByteString::SizeFor(str.length());
233 231
234 // Allocate string. 232 // Allocate string.
235 HeapObject* result = nullptr; 233 HeapObject* result = nullptr;
236 { 234 {
237 AllocationResult allocation = AllocateRaw(size, OLD_SPACE); 235 AllocationResult allocation = AllocateRaw(size, OLD_SPACE);
238 if (!allocation.To(&result)) return allocation; 236 if (!allocation.To(&result)) return allocation;
239 } 237 }
(...skipping 11 matching lines...) Expand all
251 MemCopy(answer->address() + SeqOneByteString::kHeaderSize, str.start(), 249 MemCopy(answer->address() + SeqOneByteString::kHeaderSize, str.start(),
252 str.length()); 250 str.length());
253 251
254 return answer; 252 return answer;
255 } 253 }
256 254
257 255
258 AllocationResult Heap::AllocateTwoByteInternalizedString(Vector<const uc16> str, 256 AllocationResult Heap::AllocateTwoByteInternalizedString(Vector<const uc16> str,
259 uint32_t hash_field) { 257 uint32_t hash_field) {
260 CHECK_GE(String::kMaxLength, str.length()); 258 CHECK_GE(String::kMaxLength, str.length());
261 DCHECK_NE(0, str.length()); // Use Heap::empty_string() instead.
262 // Compute map and object size. 259 // Compute map and object size.
263 Map* map = internalized_string_map(); 260 Map* map = internalized_string_map();
264 int size = SeqTwoByteString::SizeFor(str.length()); 261 int size = SeqTwoByteString::SizeFor(str.length());
265 262
266 // Allocate string. 263 // Allocate string.
267 HeapObject* result = nullptr; 264 HeapObject* result = nullptr;
268 { 265 {
269 AllocationResult allocation = AllocateRaw(size, OLD_SPACE); 266 AllocationResult allocation = AllocateRaw(size, OLD_SPACE);
270 if (!allocation.To(&result)) return allocation; 267 if (!allocation.To(&result)) return allocation;
271 } 268 }
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 857
861 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { 858 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) {
862 for (Object** current = start; current < end; current++) { 859 for (Object** current = start; current < end; current++) {
863 CHECK((*current)->IsSmi()); 860 CHECK((*current)->IsSmi());
864 } 861 }
865 } 862 }
866 } // namespace internal 863 } // namespace internal
867 } // namespace v8 864 } // namespace v8
868 865
869 #endif // V8_HEAP_HEAP_INL_H_ 866 #endif // V8_HEAP_HEAP_INL_H_
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698