| Index: src/runtime.cc
|
| diff --git a/src/runtime.cc b/src/runtime.cc
|
| index b32ae8a1b4b81a85c4d8e0d1737eea1b367d61b3..c12c71d8ec112c5ae81edb1d909967f0a1616b1b 100644
|
| --- a/src/runtime.cc
|
| +++ b/src/runtime.cc
|
| @@ -2060,20 +2060,11 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringCharCodeAt) {
|
| i = static_cast<uint32_t>(DoubleToInteger(value));
|
| }
|
|
|
| - // Flatten the string. If someone wants to get a char at an index
|
| - // in a cons string, it is likely that more indices will be
|
| - // accessed.
|
| - Object* flat;
|
| - { MaybeObject* maybe_flat = subject->TryFlatten();
|
| - if (!maybe_flat->ToObject(&flat)) return maybe_flat;
|
| - }
|
| - subject = String::cast(flat);
|
| -
|
| if (i >= static_cast<uint32_t>(subject->length())) {
|
| return isolate->heap()->nan_value();
|
| }
|
|
|
| - return Smi::FromInt(subject->Get(i));
|
| + return subject->GetMayFlatten(i);
|
| }
|
|
|
|
|
| @@ -3636,9 +3627,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToPrecision) {
|
| // string->Get(index).
|
| static Handle<Object> GetCharAt(Handle<String> string, uint32_t index) {
|
| if (index < static_cast<uint32_t>(string->length())) {
|
| - string->TryFlatten();
|
| return LookupSingleCharacterStringFromCode(
|
| - string->Get(index));
|
| + StringGetMayFlatten(string, index));
|
| }
|
| return Execution::CharAt(string, index);
|
| }
|
|
|