OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3616 object->set_map(constructor->initial_map()); | 3616 object->set_map(constructor->initial_map()); |
3617 | 3617 |
3618 // Reinitialize the object from the constructor map. | 3618 // Reinitialize the object from the constructor map. |
3619 InitializeJSObjectFromMap(object, FixedArray::cast(properties), map); | 3619 InitializeJSObjectFromMap(object, FixedArray::cast(properties), map); |
3620 return object; | 3620 return object; |
3621 } | 3621 } |
3622 | 3622 |
3623 | 3623 |
3624 MaybeObject* Heap::AllocateStringFromAscii(Vector<const char> string, | 3624 MaybeObject* Heap::AllocateStringFromAscii(Vector<const char> string, |
3625 PretenureFlag pretenure) { | 3625 PretenureFlag pretenure) { |
| 3626 if (string.length() == 1) { |
| 3627 return Heap::LookupSingleCharacterStringFromCode(string[0]); |
| 3628 } |
3626 Object* result; | 3629 Object* result; |
3627 { MaybeObject* maybe_result = | 3630 { MaybeObject* maybe_result = |
3628 AllocateRawAsciiString(string.length(), pretenure); | 3631 AllocateRawAsciiString(string.length(), pretenure); |
3629 if (!maybe_result->ToObject(&result)) return maybe_result; | 3632 if (!maybe_result->ToObject(&result)) return maybe_result; |
3630 } | 3633 } |
3631 | 3634 |
3632 // Copy the characters into the new object. | 3635 // Copy the characters into the new object. |
3633 SeqAsciiString* string_result = SeqAsciiString::cast(result); | 3636 SeqAsciiString* string_result = SeqAsciiString::cast(result); |
3634 for (int i = 0; i < string.length(); i++) { | 3637 for (int i = 0; i < string.length(); i++) { |
3635 string_result->SeqAsciiStringSet(i, string[i]); | 3638 string_result->SeqAsciiStringSet(i, string[i]); |
(...skipping 2587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6223 } | 6226 } |
6224 | 6227 |
6225 | 6228 |
6226 void ExternalStringTable::TearDown() { | 6229 void ExternalStringTable::TearDown() { |
6227 new_space_strings_.Free(); | 6230 new_space_strings_.Free(); |
6228 old_space_strings_.Free(); | 6231 old_space_strings_.Free(); |
6229 } | 6232 } |
6230 | 6233 |
6231 | 6234 |
6232 } } // namespace v8::internal | 6235 } } // namespace v8::internal |
OLD | NEW |