Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index f5c8693d50f248a2ebff0279cecfede4d496f9ac..53ce1eba0d13d07130f8d07d9a637edefb637542 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -13375,23 +13375,17 @@ void Script::InitLineEnds(Handle<Script> script) { |
Isolate* isolate = script->GetIsolate(); |
if (!script->line_ends()->IsUndefined(isolate)) return; |
- if (!script->source()->IsString()) { |
- DCHECK(script->source()->IsUndefined(isolate)); |
- Handle<FixedArray> empty = isolate->factory()->NewFixedArray(0); |
- script->set_line_ends(*empty); |
- DCHECK(script->line_ends()->IsFixedArray()); |
- return; |
- } |
- |
- Handle<String> src(String::cast(script->source()), isolate); |
- |
- Handle<FixedArray> array = String::CalculateLineEnds(src, true); |
- |
- if (*array != isolate->heap()->empty_fixed_array()) { |
- array->set_map(isolate->heap()->fixed_cow_array_map()); |
+ Object* src_obj = script->source(); |
+ if (!src_obj->IsString()) { |
+ DCHECK(src_obj->IsUndefined(isolate)); |
+ script->set_line_ends(isolate->heap()->empty_fixed_array()); |
+ } else { |
+ DCHECK(src_obj->IsString()); |
+ Handle<String> src(String::cast(src_obj), isolate); |
+ Handle<FixedArray> array = String::CalculateLineEnds(src, true); |
+ script->set_line_ends(*array); |
} |
- script->set_line_ends(*array); |
DCHECK(script->line_ends()->IsFixedArray()); |
} |