Chromium Code Reviews| Index: src/factory.cc |
| diff --git a/src/factory.cc b/src/factory.cc |
| index 340bd50a774554834fa08c07166fde4546df100e..db72413415e3e67b01c5c260aaf82fcb922bf3bb 100644 |
| --- a/src/factory.cc |
| +++ b/src/factory.cc |
| @@ -711,10 +711,20 @@ MaybeHandle<String> Factory::NewConsString(Handle<String> left, |
| NewRawTwoByteString(length).ToHandleChecked(), left, right); |
| } |
| + bool one_byte = (is_one_byte || is_one_byte_data_in_two_byte_string); |
| + return NewConsString(left, right, length, one_byte); |
| +} |
| + |
| +Handle<String> Factory::NewConsString(Handle<String> left, Handle<String> right, |
| + int length, bool one_byte) { |
| + DCHECK(!left->IsThinString()); |
| + DCHECK(!right->IsThinString()); |
| + DCHECK(0 <= length && length <= String::kMaxLength); |
|
Yang
2017/03/09 09:37:07
The 0 <= length check is a bit redundant, consider
jgruber
2017/03/09 09:55:16
Yup noticed that myself. Will fix and land after.
|
| + DCHECK_GE(length, ConsString::kMinLength); |
| + |
| Handle<ConsString> result = |
| - (is_one_byte || is_one_byte_data_in_two_byte_string) |
| - ? New<ConsString>(cons_one_byte_string_map(), NEW_SPACE) |
| - : New<ConsString>(cons_string_map(), NEW_SPACE); |
| + one_byte ? New<ConsString>(cons_one_byte_string_map(), NEW_SPACE) |
| + : New<ConsString>(cons_string_map(), NEW_SPACE); |
| DisallowHeapAllocation no_gc; |
| WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc); |