Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 36632374e1ec7d1c00ccc511b9b4b5b98b9f7484..fb6598c5f72149615c3aaff79a1e563727ad568f 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -3467,14 +3467,22 @@ void HGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { |
Handle<FixedArray> literals(environment()->closure()->literals()); |
Handle<Object> raw_boilerplate(literals->get(expr->literal_index())); |
- // For now, no boilerplate causes a deopt. |
if (raw_boilerplate->IsUndefined()) { |
- AddInstruction(new(zone()) HSoftDeoptimize); |
- return ast_context()->ReturnValue(graph()->GetConstantUndefined()); |
+ raw_boilerplate = Runtime::CreateArrayLiteralBoilerplate( |
+ isolate(), literals, expr->constant_elements()); |
+ if (raw_boilerplate.is_null()) { |
+ return Bailout("array boilerplate creation failed"); |
+ } |
+ literals->set(expr->literal_index(), *raw_boilerplate); |
+ if (JSObject::cast(*raw_boilerplate)->elements()->map() == |
+ isolate()->heap()->fixed_cow_array_map()) { |
+ isolate()->counters()->cow_arrays_created_runtime()->Increment(); |
+ } |
} |
- Handle<JSObject> boilerplate(Handle<JSObject>::cast(raw_boilerplate)); |
- ElementsKind boilerplate_elements_kind = boilerplate->GetElementsKind(); |
+ Handle<JSObject> boilerplate = Handle<JSObject>::cast(raw_boilerplate); |
+ ElementsKind boilerplate_elements_kind = |
+ Handle<JSObject>::cast(boilerplate)->GetElementsKind(); |
HArrayLiteral* literal = new(zone()) HArrayLiteral( |
context, |