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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 if (IsOneByte(t, chars)) { | 125 if (IsOneByte(t, chars)) { |
126 return AllocateInternalSymbol<true>(t, chars, hash_field); | 126 return AllocateInternalSymbol<true>(t, chars, hash_field); |
127 } | 127 } |
128 return AllocateInternalSymbol<false>(t, chars, hash_field); | 128 return AllocateInternalSymbol<false>(t, chars, hash_field); |
129 } | 129 } |
130 | 130 |
131 | 131 |
132 MaybeObject* Heap::AllocateAsciiSymbol(Vector<const char> str, | 132 MaybeObject* Heap::AllocateAsciiSymbol(Vector<const char> str, |
133 uint32_t hash_field) { | 133 uint32_t hash_field) { |
134 if (str.length() > SeqOneByteString::kMaxLength) { | 134 if (str.length() > SeqOneByteString::kMaxLength) { |
135 return Failure::OutOfMemoryException(); | 135 return Failure::OutOfMemoryException(0x2); |
136 } | 136 } |
137 // Compute map and object size. | 137 // Compute map and object size. |
138 Map* map = ascii_symbol_map(); | 138 Map* map = ascii_symbol_map(); |
139 int size = SeqOneByteString::SizeFor(str.length()); | 139 int size = SeqOneByteString::SizeFor(str.length()); |
140 | 140 |
141 // Allocate string. | 141 // Allocate string. |
142 Object* result; | 142 Object* result; |
143 { MaybeObject* maybe_result = (size > Page::kMaxNonCodeHeapObjectSize) | 143 { MaybeObject* maybe_result = (size > Page::kMaxNonCodeHeapObjectSize) |
144 ? lo_space_->AllocateRaw(size, NOT_EXECUTABLE) | 144 ? lo_space_->AllocateRaw(size, NOT_EXECUTABLE) |
145 : old_data_space_->AllocateRaw(size); | 145 : old_data_space_->AllocateRaw(size); |
(...skipping 13 matching lines...) Expand all Loading... |
159 memcpy(answer->address() + SeqOneByteString::kHeaderSize, | 159 memcpy(answer->address() + SeqOneByteString::kHeaderSize, |
160 str.start(), str.length()); | 160 str.start(), str.length()); |
161 | 161 |
162 return answer; | 162 return answer; |
163 } | 163 } |
164 | 164 |
165 | 165 |
166 MaybeObject* Heap::AllocateTwoByteSymbol(Vector<const uc16> str, | 166 MaybeObject* Heap::AllocateTwoByteSymbol(Vector<const uc16> str, |
167 uint32_t hash_field) { | 167 uint32_t hash_field) { |
168 if (str.length() > SeqTwoByteString::kMaxLength) { | 168 if (str.length() > SeqTwoByteString::kMaxLength) { |
169 return Failure::OutOfMemoryException(); | 169 return Failure::OutOfMemoryException(0x3); |
170 } | 170 } |
171 // Compute map and object size. | 171 // Compute map and object size. |
172 Map* map = symbol_map(); | 172 Map* map = symbol_map(); |
173 int size = SeqTwoByteString::SizeFor(str.length()); | 173 int size = SeqTwoByteString::SizeFor(str.length()); |
174 | 174 |
175 // Allocate string. | 175 // Allocate string. |
176 Object* result; | 176 Object* result; |
177 { MaybeObject* maybe_result = (size > Page::kMaxNonCodeHeapObjectSize) | 177 { MaybeObject* maybe_result = (size > Page::kMaxNonCodeHeapObjectSize) |
178 ? lo_space_->AllocateRaw(size, NOT_EXECUTABLE) | 178 ? lo_space_->AllocateRaw(size, NOT_EXECUTABLE) |
179 : old_data_space_->AllocateRaw(size); | 179 : old_data_space_->AllocateRaw(size); |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 AssertNoAllocation::~AssertNoAllocation() { } | 826 AssertNoAllocation::~AssertNoAllocation() { } |
827 DisableAssertNoAllocation::DisableAssertNoAllocation() { } | 827 DisableAssertNoAllocation::DisableAssertNoAllocation() { } |
828 DisableAssertNoAllocation::~DisableAssertNoAllocation() { } | 828 DisableAssertNoAllocation::~DisableAssertNoAllocation() { } |
829 | 829 |
830 #endif | 830 #endif |
831 | 831 |
832 | 832 |
833 } } // namespace v8::internal | 833 } } // namespace v8::internal |
834 | 834 |
835 #endif // V8_HEAP_INL_H_ | 835 #endif // V8_HEAP_INL_H_ |
OLD | NEW |