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

Unified Diff: src/hydrogen.cc

Issue 15841007: Remove HCheckSmi, LCheckSmi and rename LCheckSmiAndReturn to LCheckSmi. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use ForceRepresentation rather than directly inserting HChange Created 7 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 | « src/code-stubs-hydrogen.cc ('k') | 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 d001534bf579edf413d71ac8e74275c8594961db..39e1e159ee1b7b4bfade9c65602041ff0e685ce6 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -1099,11 +1099,6 @@ HInstruction* HGraphBuilder::BuildFastElementAccess(
switch (elements_kind) {
case FAST_SMI_ELEMENTS:
case FAST_HOLEY_SMI_ELEMENTS:
- if (!val->type().IsSmi()) {
- // Smi-only arrays need a smi check.
- AddInstruction(new(zone) HCheckSmi(val));
- }
- // Fall through.
case FAST_ELEMENTS:
case FAST_HOLEY_ELEMENTS:
case FAST_DOUBLE_ELEMENTS:
@@ -1292,14 +1287,17 @@ HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess(
fast_elements ||
IsFastDoubleElementsKind(elements_kind));
+ // In case val is stored into a fast smi array, assure that the value is a smi
+ // before manipulating the backing store. Otherwise the actual store may
+ // deopt, leaving the backing store in an invalid state.
if (is_store && IsFastSmiElementsKind(elements_kind) &&
!val->type().IsSmi()) {
- AddInstruction(new(zone) HCheckSmi(val));
+ val = AddInstruction(new(zone) HForceRepresentation(
+ val, Representation::Smi()));
}
if (IsGrowStoreMode(store_mode)) {
NoObservableSideEffectsScope no_effects(this);
-
elements = BuildCheckForCapacityGrow(object, elements, elements_kind,
length, key, is_js_array);
checked_key = key;
@@ -1542,6 +1540,7 @@ void HGraphBuilder::BuildFillElementsWithHole(HValue* context,
if (IsFastSmiOrObjectElementsKind(elements_kind)) {
elements_kind = FAST_HOLEY_ELEMENTS;
}
+
if (unfold_loop) {
for (int i = 0; i < initial_capacity; i++) {
HInstruction* key = AddInstruction(new(zone)
@@ -6939,11 +6938,6 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
switch (boilerplate_elements_kind) {
case FAST_SMI_ELEMENTS:
case FAST_HOLEY_SMI_ELEMENTS:
- if (!value->type().IsSmi()) {
- // Smi-only arrays need a smi check.
- AddInstruction(new(zone()) HCheckSmi(value));
- // Fall through.
- }
case FAST_ELEMENTS:
case FAST_HOLEY_ELEMENTS:
case FAST_DOUBLE_ELEMENTS:
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698