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

Unified Diff: src/crankshaft/hydrogen.cc

Issue 2000673002: Bugfix: Crankshaft array literals with incorrect values. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 months 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 | test/mjsunit/regress/regress-606021.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/hydrogen.cc
diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc
index 8033207ba479c20f4345ac5b4b3619ffd941fd14..11a1af1fa77917ad2d638557903839bd15867f56 100644
--- a/src/crankshaft/hydrogen.cc
+++ b/src/crankshaft/hydrogen.cc
@@ -6180,11 +6180,6 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
JSObject::cast(site->transition_info()), isolate());
}
- ElementsKind boilerplate_elements_kind = expr->constant_elements_kind();
- if (!boilerplate_object.is_null()) {
- boilerplate_elements_kind = boilerplate_object->GetElementsKind();
- }
-
// Check whether to use fast or slow deep-copying for boilerplate.
int max_properties = kMaxFastLiteralProperties;
if (!boilerplate_object.is_null() &&
@@ -6235,20 +6230,28 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
HValue* key = Add<HConstant>(i);
- switch (boilerplate_elements_kind) {
- case FAST_SMI_ELEMENTS:
- case FAST_HOLEY_SMI_ELEMENTS:
- case FAST_ELEMENTS:
- case FAST_HOLEY_ELEMENTS:
- case FAST_DOUBLE_ELEMENTS:
- case FAST_HOLEY_DOUBLE_ELEMENTS: {
- Add<HStoreKeyed>(elements, key, value, nullptr,
- boilerplate_elements_kind);
- break;
+ if (!boilerplate_object.is_null()) {
+ ElementsKind boilerplate_elements_kind =
+ boilerplate_object->GetElementsKind();
+ switch (boilerplate_elements_kind) {
+ case FAST_SMI_ELEMENTS:
+ case FAST_HOLEY_SMI_ELEMENTS:
+ case FAST_ELEMENTS:
+ case FAST_HOLEY_ELEMENTS:
+ case FAST_DOUBLE_ELEMENTS:
+ case FAST_HOLEY_DOUBLE_ELEMENTS: {
+ Add<HStoreKeyed>(elements, key, value, nullptr,
+ boilerplate_elements_kind);
+ break;
+ }
+ default:
+ UNREACHABLE();
+ break;
}
- default:
- UNREACHABLE();
- break;
+ } else {
+ HInstruction* instr = BuildKeyedGeneric(
+ STORE, expr, expr->LiteralFeedbackSlot(), literal, key, value);
+ AddInstruction(instr);
}
Add<HSimulate>(expr->GetIdForElement(i));
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-606021.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698