OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include "src/factory.h" | 5 #include "src/factory.h" |
6 | 6 |
7 #include "src/allocation-site-scopes.h" | 7 #include "src/allocation-site-scopes.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 return result; | 571 return result; |
572 } | 572 } |
573 | 573 |
574 return (is_one_byte_data_in_two_byte_string) | 574 return (is_one_byte_data_in_two_byte_string) |
575 ? ConcatStringContent<uint8_t>( | 575 ? ConcatStringContent<uint8_t>( |
576 NewRawOneByteString(length).ToHandleChecked(), left, right) | 576 NewRawOneByteString(length).ToHandleChecked(), left, right) |
577 : ConcatStringContent<uc16>( | 577 : ConcatStringContent<uc16>( |
578 NewRawTwoByteString(length).ToHandleChecked(), left, right); | 578 NewRawTwoByteString(length).ToHandleChecked(), left, right); |
579 } | 579 } |
580 | 580 |
581 return (is_one_byte || is_one_byte_data_in_two_byte_string) | 581 Handle<ConsString> result = |
582 ? NewOneByteConsString(length, left, right) | 582 (is_one_byte || is_one_byte_data_in_two_byte_string) |
583 : NewTwoByteConsString(length, left, right); | 583 ? New<ConsString>(cons_one_byte_string_map(), NEW_SPACE) |
584 } | 584 : New<ConsString>(cons_string_map(), NEW_SPACE); |
585 | |
586 | |
587 MaybeHandle<String> Factory::NewOneByteConsString(int length, | |
588 Handle<String> left, | |
589 Handle<String> right) { | |
590 return NewRawConsString(cons_one_byte_string_map(), length, left, right); | |
591 } | |
592 | |
593 | |
594 MaybeHandle<String> Factory::NewTwoByteConsString(int length, | |
595 Handle<String> left, | |
596 Handle<String> right) { | |
597 return NewRawConsString(cons_string_map(), length, left, right); | |
598 } | |
599 | |
600 | |
601 MaybeHandle<String> Factory::NewRawConsString(Handle<Map> map, int length, | |
602 Handle<String> left, | |
603 Handle<String> right) { | |
604 Handle<ConsString> result = New<ConsString>(map, NEW_SPACE); | |
605 | 585 |
606 DisallowHeapAllocation no_gc; | 586 DisallowHeapAllocation no_gc; |
607 WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc); | 587 WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc); |
608 | 588 |
609 result->set_hash_field(String::kEmptyHashField); | 589 result->set_hash_field(String::kEmptyHashField); |
610 result->set_length(length); | 590 result->set_length(length); |
611 result->set_first(*left, mode); | 591 result->set_first(*left, mode); |
612 result->set_second(*right, mode); | 592 result->set_second(*right, mode); |
613 return result; | 593 return result; |
614 } | 594 } |
(...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2412 } | 2392 } |
2413 | 2393 |
2414 | 2394 |
2415 Handle<Object> Factory::ToBoolean(bool value) { | 2395 Handle<Object> Factory::ToBoolean(bool value) { |
2416 return value ? true_value() : false_value(); | 2396 return value ? true_value() : false_value(); |
2417 } | 2397 } |
2418 | 2398 |
2419 | 2399 |
2420 } // namespace internal | 2400 } // namespace internal |
2421 } // namespace v8 | 2401 } // namespace v8 |
OLD | NEW |