Reviewers: Jakob,
Message:
PTAL
Description:
Also delete force representations that have no uses.
BUG=
Please review this at https://codereview.chromium.org/187773002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+26, -1 lines):
M src/hydrogen-representation-changes.cc
A test/mjsunit/regress/regress-force-representation.js
Index: src/hydrogen-representation-changes.cc
diff --git a/src/hydrogen-representation-changes.cc
b/src/hydrogen-representation-changes.cc
index
7d0720c6044d0d83dba8a61f867016e726a57128..0b87d12eb34ba0e24970d6489e18a13157c8c36c
100644
--- a/src/hydrogen-representation-changes.cc
+++ b/src/hydrogen-representation-changes.cc
@@ -78,7 +78,10 @@ void
HRepresentationChangesPhase::InsertRepresentationChangesForValue(
HValue* value) {
Representation r = value->representation();
if (r.IsNone()) return;
- if (value->HasNoUses()) return;
+ if (value->HasNoUses()) {
+ if (value->IsForceRepresentation()) value->DeleteAndReplaceWith(NULL);
+ return;
+ }
for (HUseIterator it(value->uses()); !it.Done(); it.Advance()) {
HValue* use_value = it.value();
Index: test/mjsunit/regress/regress-force-representation.js
diff --git a/test/mjsunit/regress/regress-force-representation.js
b/test/mjsunit/regress/regress-force-representation.js
new file mode 100644
index
0000000000000000000000000000000000000000..8f6746b7f2c47a43f61b31b47574a908d78cf52c
--- /dev/null
+++ b/test/mjsunit/regress/regress-force-representation.js
@@ -0,0 +1,22 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+function optimize(crankshaft_test) {
+ crankshaft_test();
+ crankshaft_test();
+ %OptimizeFunctionOnNextCall(crankshaft_test);
+ crankshaft_test();
+}
+
+function f() {
+ var v1 = 0;
+ var v2 = -0;
+ var t = v2++;
+ v2++;
+ return Math.max(v2++, v1++);
+}
+
+optimize(f);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.