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

Unified Diff: test/mjsunit/regress/regress-201590.js

Issue 13527007: Ensure UseRegisterAtStart not used with fixed temp/return register (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix another missed case Created 7 years, 9 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/x64/lithium-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/regress-201590.js
diff --git a/test/mjsunit/compiler/multiply-sub.js b/test/mjsunit/regress/regress-201590.js
similarity index 60%
copy from test/mjsunit/compiler/multiply-sub.js
copy to test/mjsunit/regress/regress-201590.js
index 4793181d47a2b4a2b2390f5049758e651ef1ec1c..0e7ba572332eca6f1ccc49d76ade086b411a24da 100644
--- a/test/mjsunit/compiler/multiply-sub.js
+++ b/test/mjsunit/regress/regress-201590.js
@@ -26,31 +26,41 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax
-// Test expressions that can be computed with a multiply-add instruction.
-function f(a, b, c) {
- return a - b * c;
-}
+var gdpRatio = 16/9;
-function g(a, b, c) {
- return a * b - c;
+function Foo(initialX, initialY, initialScale, initialMapHeight) {
+ this.ORIGIN = { x: initialX, y: initialY };
+ this.scale = initialScale;
+ this.mapHeight = initialMapHeight;
}
-function h(a, b, c, d) {
- return a * b - c * d;
+Foo.prototype.bar = function (x, y, xOffset, yOffset) {
+ var tileHeight = 64 * 0.25 * this.scale,
+ tileWidth = 128 * 0.25 * this.scale,
+ xOffset = xOffset * 0.5 || 0,
+ yOffset = yOffset * 0.5 || 0;
+ var xPos = ((xOffset) * gdpRatio) + this.ORIGIN.x * this.scale -
+ ((y * tileWidth ) * gdpRatio) + ((x * tileWidth ) * gdpRatio);
+ var yPos = ((yOffset) * gdpRatio) + this.ORIGIN.y * this.scale +
+ ((y * tileHeight) * gdpRatio) + ((x * tileHeight) * gdpRatio);
+ xPos = xPos - Math.round(((tileWidth) * gdpRatio)) +
+ this.mapHeight * Math.round(((tileWidth) * gdpRatio));
+ return {
+ x: Math.floor(xPos),
+ y: Math.floor(yPos)
+ };
}
-assertEquals(-5.41, f(1.1, 2.1, 3.1));
-assertEquals(-5.41, f(1.1, 2.1, 3.1));
-%OptimizeFunctionOnNextCall(f);
-assertEquals(-5.41, f(1.1, 2.1, 3.1));
+var f = new Foo(10, 20, 2.5, 400);
-assertEquals(8.36, g(2.2, 3.3, -1.1));
-assertEquals(8.36, g(2.2, 3.3, -1.1));
-%OptimizeFunctionOnNextCall(g);
-assertEquals(8.36, g(2.2, 3.3, -1.1));
+function baz() {
+ var b = f.bar(1.1, 2.2, 3.3, 4.4);
+ assertEquals(56529, b.x);
+ assertEquals(288, b.y);
+}
-assertEquals(-1.5, h(1.5, 3.0, 12, 0.5));
-assertEquals(-1.5, h(1.5, 3.0, 12, 0.5));
-%OptimizeFunctionOnNextCall(h);
-assertEquals(-1.5, h(1.5, 3.0, 12, 0.5));
+baz();
+baz();
+%OptimizeFunctionOnNextCall(Foo.prototype.bar);
+baz();
« no previous file with comments | « src/x64/lithium-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698