OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 SinkChar* sink = result->GetChars(); | 303 SinkChar* sink = result->GetChars(); |
304 String::WriteToFlat(*first, sink, 0, first->length()); | 304 String::WriteToFlat(*first, sink, 0, first->length()); |
305 String::WriteToFlat(*second, sink + first->length(), 0, second->length()); | 305 String::WriteToFlat(*second, sink + first->length(), 0, second->length()); |
306 return result; | 306 return result; |
307 } | 307 } |
308 | 308 |
309 | 309 |
310 Handle<String> Factory::NewFlatConcatString(Handle<String> first, | 310 Handle<String> Factory::NewFlatConcatString(Handle<String> first, |
311 Handle<String> second) { | 311 Handle<String> second) { |
312 int total_length = first->length() + second->length(); | 312 int total_length = first->length() + second->length(); |
313 if (first->IsOneByteRepresentationUnderneath() && | 313 if (first->IsOneByteRepresentation() && second->IsOneByteRepresentation()) { |
314 second->IsOneByteRepresentationUnderneath()) { | |
315 return ConcatStringContent<uint8_t>( | 314 return ConcatStringContent<uint8_t>( |
316 NewRawOneByteString(total_length), first, second); | 315 NewRawOneByteString(total_length), first, second); |
317 } else { | 316 } else { |
318 return ConcatStringContent<uc16>( | 317 return ConcatStringContent<uc16>( |
319 NewRawTwoByteString(total_length), first, second); | 318 NewRawTwoByteString(total_length), first, second); |
320 } | 319 } |
321 } | 320 } |
322 | 321 |
323 | 322 |
324 Handle<String> Factory::NewSubString(Handle<String> str, | 323 Handle<String> Factory::NewSubString(Handle<String> str, |
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1780 return Handle<Object>::null(); | 1779 return Handle<Object>::null(); |
1781 } | 1780 } |
1782 | 1781 |
1783 | 1782 |
1784 Handle<Object> Factory::ToBoolean(bool value) { | 1783 Handle<Object> Factory::ToBoolean(bool value) { |
1785 return value ? true_value() : false_value(); | 1784 return value ? true_value() : false_value(); |
1786 } | 1785 } |
1787 | 1786 |
1788 | 1787 |
1789 } } // namespace v8::internal | 1788 } } // namespace v8::internal |
OLD | NEW |