| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #ifdef DEBUG | 45 #ifdef DEBUG |
| 46 SemiSpace::AssertValidRange(target->GetIsolate()->heap()->new_space()->top(), | 46 SemiSpace::AssertValidRange(target->GetIsolate()->heap()->new_space()->top(), |
| 47 reinterpret_cast<Address>(rear_)); | 47 reinterpret_cast<Address>(rear_)); |
| 48 #endif | 48 #endif |
| 49 } | 49 } |
| 50 | 50 |
| 51 | 51 |
| 52 template <> | 52 template <> |
| 53 bool inline Heap::IsOneByte(Vector<const char> str, int chars) { | 53 bool inline Heap::IsOneByte(Vector<const char> str, int chars) { |
| 54 // TODO(dcarney): incorporate Latin-1 check when Latin-1 is supported? | 54 // TODO(dcarney): incorporate Latin-1 check when Latin-1 is supported? |
| 55 // ASCII only check. | |
| 56 return chars == str.length(); | 55 return chars == str.length(); |
| 57 } | 56 } |
| 58 | 57 |
| 59 | 58 |
| 60 template <> | 59 template <> |
| 61 bool inline Heap::IsOneByte(String* str, int chars) { | 60 bool inline Heap::IsOneByte(String* str, int chars) { |
| 62 return str->IsOneByteRepresentation(); | 61 return str->IsOneByteRepresentation(); |
| 63 } | 62 } |
| 64 | 63 |
| 65 | 64 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 80 return AllocateInternalizedStringImpl<true>(t, chars, hash_field); | 79 return AllocateInternalizedStringImpl<true>(t, chars, hash_field); |
| 81 } | 80 } |
| 82 return AllocateInternalizedStringImpl<false>(t, chars, hash_field); | 81 return AllocateInternalizedStringImpl<false>(t, chars, hash_field); |
| 83 } | 82 } |
| 84 | 83 |
| 85 | 84 |
| 86 AllocationResult Heap::AllocateOneByteInternalizedString( | 85 AllocationResult Heap::AllocateOneByteInternalizedString( |
| 87 Vector<const uint8_t> str, uint32_t hash_field) { | 86 Vector<const uint8_t> str, uint32_t hash_field) { |
| 88 CHECK_GE(String::kMaxLength, str.length()); | 87 CHECK_GE(String::kMaxLength, str.length()); |
| 89 // Compute map and object size. | 88 // Compute map and object size. |
| 90 Map* map = ascii_internalized_string_map(); | 89 Map* map = one_byte_internalized_string_map(); |
| 91 int size = SeqOneByteString::SizeFor(str.length()); | 90 int size = SeqOneByteString::SizeFor(str.length()); |
| 92 AllocationSpace space = SelectSpace(size, OLD_DATA_SPACE, TENURED); | 91 AllocationSpace space = SelectSpace(size, OLD_DATA_SPACE, TENURED); |
| 93 | 92 |
| 94 // Allocate string. | 93 // Allocate string. |
| 95 HeapObject* result; | 94 HeapObject* result; |
| 96 { | 95 { |
| 97 AllocationResult allocation = AllocateRaw(size, space, OLD_DATA_SPACE); | 96 AllocationResult allocation = AllocateRaw(size, space, OLD_DATA_SPACE); |
| 98 if (!allocation.To(&result)) return allocation; | 97 if (!allocation.To(&result)) return allocation; |
| 99 } | 98 } |
| 100 | 99 |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 | 765 |
| 767 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { | 766 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { |
| 768 for (Object** current = start; current < end; current++) { | 767 for (Object** current = start; current < end; current++) { |
| 769 CHECK((*current)->IsSmi()); | 768 CHECK((*current)->IsSmi()); |
| 770 } | 769 } |
| 771 } | 770 } |
| 772 } | 771 } |
| 773 } // namespace v8::internal | 772 } // namespace v8::internal |
| 774 | 773 |
| 775 #endif // V8_HEAP_HEAP_INL_H_ | 774 #endif // V8_HEAP_HEAP_INL_H_ |
| OLD | NEW |