Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Unified Diff: src/hydrogen.cc

Issue 8914006: Create missing boilerplate for array literals instead of deoptimizing (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: address comments Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/hydrogen-instructions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « no previous file | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698