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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/hydrogen-instructions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3449 matching lines...) Expand 10 before | Expand all | Expand 10 after
3460 ASSERT(!HasStackOverflow()); 3460 ASSERT(!HasStackOverflow());
3461 ASSERT(current_block() != NULL); 3461 ASSERT(current_block() != NULL);
3462 ASSERT(current_block()->HasPredecessor()); 3462 ASSERT(current_block()->HasPredecessor());
3463 ZoneList<Expression*>* subexprs = expr->values(); 3463 ZoneList<Expression*>* subexprs = expr->values();
3464 int length = subexprs->length(); 3464 int length = subexprs->length();
3465 HValue* context = environment()->LookupContext(); 3465 HValue* context = environment()->LookupContext();
3466 3466
3467 Handle<FixedArray> literals(environment()->closure()->literals()); 3467 Handle<FixedArray> literals(environment()->closure()->literals());
3468 Handle<Object> raw_boilerplate(literals->get(expr->literal_index())); 3468 Handle<Object> raw_boilerplate(literals->get(expr->literal_index()));
3469 3469
3470 // For now, no boilerplate causes a deopt.
3471 if (raw_boilerplate->IsUndefined()) { 3470 if (raw_boilerplate->IsUndefined()) {
3472 AddInstruction(new(zone()) HSoftDeoptimize); 3471 raw_boilerplate = Runtime::CreateArrayLiteralBoilerplate(
3473 return ast_context()->ReturnValue(graph()->GetConstantUndefined()); 3472 isolate(), literals, expr->constant_elements());
3473 if (raw_boilerplate.is_null()) {
3474 return Bailout("array boilerplate creation failed");
3475 }
3476 literals->set(expr->literal_index(), *raw_boilerplate);
3477 if (JSObject::cast(*raw_boilerplate)->elements()->map() ==
3478 isolate()->heap()->fixed_cow_array_map()) {
3479 isolate()->counters()->cow_arrays_created_runtime()->Increment();
3480 }
3474 } 3481 }
3475 3482
3476 Handle<JSObject> boilerplate(Handle<JSObject>::cast(raw_boilerplate)); 3483 Handle<JSObject> boilerplate = Handle<JSObject>::cast(raw_boilerplate);
3477 ElementsKind boilerplate_elements_kind = boilerplate->GetElementsKind(); 3484 ElementsKind boilerplate_elements_kind =
3485 Handle<JSObject>::cast(boilerplate)->GetElementsKind();
3478 3486
3479 HArrayLiteral* literal = new(zone()) HArrayLiteral( 3487 HArrayLiteral* literal = new(zone()) HArrayLiteral(
3480 context, 3488 context,
3481 boilerplate, 3489 boilerplate,
3482 length, 3490 length,
3483 expr->literal_index(), 3491 expr->literal_index(),
3484 expr->depth()); 3492 expr->depth());
3485 3493
3486 // The array is expected in the bailout environment during computation 3494 // The array is expected in the bailout environment during computation
3487 // of the property values and is the value of the entire expression. 3495 // of the property values and is the value of the entire expression.
(...skipping 3778 matching lines...) Expand 10 before | Expand all | Expand 10 after
7266 } 7274 }
7267 } 7275 }
7268 7276
7269 #ifdef DEBUG 7277 #ifdef DEBUG
7270 if (graph_ != NULL) graph_->Verify(false); // No full verify. 7278 if (graph_ != NULL) graph_->Verify(false); // No full verify.
7271 if (allocator_ != NULL) allocator_->Verify(); 7279 if (allocator_ != NULL) allocator_->Verify();
7272 #endif 7280 #endif
7273 } 7281 }
7274 7282
7275 } } // namespace v8::internal 7283 } } // namespace v8::internal
OLDNEW
« 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