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

Unified Diff: src/compiler/ast-graph-builder.cc

Issue 1216463003: [strong] Implement strong mode semantics for the count operation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cl feedback + eliminate runtime check Created 5 years, 6 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/arm64/full-codegen-arm64.cc ('k') | src/hydrogen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index 89373a37bca255dfad94d1bb0d2eae11685375d9..631319167bdcb02e5690a6636812f8425690af05 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -2661,9 +2661,11 @@ void AstGraphBuilder::VisitCountOperation(CountOperation* expr) {
}
// Convert old value into a number.
- old_value = NewNode(javascript()->ToNumber(), old_value);
- PrepareFrameState(old_value, expr->ToNumberId(),
- OutputFrameStateCombine::Push());
+ if (!is_strong(language_mode())) {
+ old_value = NewNode(javascript()->ToNumber(), old_value);
+ PrepareFrameState(old_value, expr->ToNumberId(),
+ OutputFrameStateCombine::Push());
+ }
// TODO(titzer): combine this framestate with the above?
FrameStateBeforeAndAfter store_states(this, assign_type == KEYED_PROPERTY
@@ -2679,9 +2681,10 @@ void AstGraphBuilder::VisitCountOperation(CountOperation* expr) {
FrameStateBeforeAndAfter states(this, BailoutId::None());
value =
BuildBinaryOp(old_value, jsgraph()->OneConstant(), expr->binary_op());
- // This should never deoptimize because we have converted to number
- // before.
- states.AddToNode(value, BailoutId::None(),
+ // This should never deoptimize outside strong mode because otherwise we
+ // have converted to number before.
+ states.AddToNode(value, is_strong(language_mode()) ? expr->ToNumberId()
+ : BailoutId::None(),
OutputFrameStateCombine::Ignore());
}
« no previous file with comments | « src/arm64/full-codegen-arm64.cc ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698