| OLD | NEW |
| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 int size = SeqOneByteString::SizeFor(str.length()); | 228 int size = SeqOneByteString::SizeFor(str.length()); |
| 229 | 229 |
| 230 // Allocate string. | 230 // Allocate string. |
| 231 HeapObject* result = nullptr; | 231 HeapObject* result = nullptr; |
| 232 { | 232 { |
| 233 AllocationResult allocation = AllocateRaw(size, OLD_SPACE); | 233 AllocationResult allocation = AllocateRaw(size, OLD_SPACE); |
| 234 if (!allocation.To(&result)) return allocation; | 234 if (!allocation.To(&result)) return allocation; |
| 235 } | 235 } |
| 236 | 236 |
| 237 // String maps are all immortal immovable objects. | 237 // String maps are all immortal immovable objects. |
| 238 result->set_map_no_write_barrier(map); | 238 result->set_map_after_allocation(map, SKIP_WRITE_BARRIER); |
| 239 // Set length and hash fields of the allocated string. | 239 // Set length and hash fields of the allocated string. |
| 240 String* answer = String::cast(result); | 240 String* answer = String::cast(result); |
| 241 answer->set_length(str.length()); | 241 answer->set_length(str.length()); |
| 242 answer->set_hash_field(hash_field); | 242 answer->set_hash_field(hash_field); |
| 243 | 243 |
| 244 DCHECK_EQ(size, answer->Size()); | 244 DCHECK_EQ(size, answer->Size()); |
| 245 | 245 |
| 246 // Fill in the characters. | 246 // Fill in the characters. |
| 247 MemCopy(answer->address() + SeqOneByteString::kHeaderSize, str.start(), | 247 MemCopy(answer->address() + SeqOneByteString::kHeaderSize, str.start(), |
| 248 str.length()); | 248 str.length()); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 259 Map* map = internalized_string_map(); | 259 Map* map = internalized_string_map(); |
| 260 int size = SeqTwoByteString::SizeFor(str.length()); | 260 int size = SeqTwoByteString::SizeFor(str.length()); |
| 261 | 261 |
| 262 // Allocate string. | 262 // Allocate string. |
| 263 HeapObject* result = nullptr; | 263 HeapObject* result = nullptr; |
| 264 { | 264 { |
| 265 AllocationResult allocation = AllocateRaw(size, OLD_SPACE); | 265 AllocationResult allocation = AllocateRaw(size, OLD_SPACE); |
| 266 if (!allocation.To(&result)) return allocation; | 266 if (!allocation.To(&result)) return allocation; |
| 267 } | 267 } |
| 268 | 268 |
| 269 result->set_map(map); | 269 result->set_map_after_allocation(map); |
| 270 // Set length and hash fields of the allocated string. | 270 // Set length and hash fields of the allocated string. |
| 271 String* answer = String::cast(result); | 271 String* answer = String::cast(result); |
| 272 answer->set_length(str.length()); | 272 answer->set_length(str.length()); |
| 273 answer->set_hash_field(hash_field); | 273 answer->set_hash_field(hash_field); |
| 274 | 274 |
| 275 DCHECK_EQ(size, answer->Size()); | 275 DCHECK_EQ(size, answer->Size()); |
| 276 | 276 |
| 277 // Fill in the characters. | 277 // Fill in the characters. |
| 278 MemCopy(answer->address() + SeqTwoByteString::kHeaderSize, str.start(), | 278 MemCopy(answer->address() + SeqTwoByteString::kHeaderSize, str.start(), |
| 279 str.length() * kUC16Size); | 279 str.length() * kUC16Size); |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 void VerifySmisVisitor::VisitRootPointers(Root root, Object** start, | 883 void VerifySmisVisitor::VisitRootPointers(Root root, Object** start, |
| 884 Object** end) { | 884 Object** end) { |
| 885 for (Object** current = start; current < end; current++) { | 885 for (Object** current = start; current < end; current++) { |
| 886 CHECK((*current)->IsSmi()); | 886 CHECK((*current)->IsSmi()); |
| 887 } | 887 } |
| 888 } | 888 } |
| 889 } // namespace internal | 889 } // namespace internal |
| 890 } // namespace v8 | 890 } // namespace v8 |
| 891 | 891 |
| 892 #endif // V8_HEAP_HEAP_INL_H_ | 892 #endif // V8_HEAP_HEAP_INL_H_ |
| OLD | NEW |