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

Unified Diff: test/mjsunit/compiler/inline-construct.js

Issue 10825382: Extend constructor inlining test case. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/compiler/inline-construct.js
diff --git a/test/mjsunit/compiler/inline-construct.js b/test/mjsunit/compiler/inline-construct.js
index f73e8910ad17558197cf406968eb7cb64bd79391..fa784cfc99e21c7c4b51c5797a2cfe7d68ab98eb 100644
--- a/test/mjsunit/compiler/inline-construct.js
+++ b/test/mjsunit/compiler/inline-construct.js
@@ -32,43 +32,46 @@
function TestInlinedConstructor(constructor, closure) {
var result;
var counter = { value:0 };
+ var noDeopt = { deopt:0 };
+ var forceDeopt = { /*empty*/ };
- result = closure(constructor, 11, 12, counter);
- assertEquals(23, result);
+ result = closure(constructor, 11, noDeopt, counter);
+ assertEquals(11, result);
assertEquals(1, counter.value);
- result = closure(constructor, 23, 19, counter);
- assertEquals(42, result);
+ result = closure(constructor, 23, noDeopt, counter);
+ assertEquals(23, result);
assertEquals(2, counter.value);
%OptimizeFunctionOnNextCall(closure);
- result = closure(constructor, 1, 42, counter);
- assertEquals(43, result);
+ result = closure(constructor, 42, noDeopt, counter);
+ assertEquals(42, result);
assertEquals(3, counter.value);
- result = closure(constructor, "foo", "bar", counter);
- assertEquals("foobar", result)
+ result = closure(constructor, 127, forceDeopt, counter);
+ assertEquals(127, result)
assertEquals(4, counter.value);
%DeoptimizeFunction(closure);
%ClearFunctionTypeFeedback(closure);
+ %ClearFunctionTypeFeedback(constructor);
}
-function value_context(constructor, a, b, counter) {
- var obj = new constructor(a, b, counter);
+function value_context(constructor, val, deopt, counter) {
+ var obj = new constructor(val, deopt, counter);
return obj.x;
}
-function test_context(constructor, a, b, counter) {
- if (!new constructor(a, b, counter)) {
+function test_context(constructor, val, deopt, counter) {
+ if (!new constructor(val, deopt, counter)) {
assertUnreachable("should not happen");
}
- return a + b;
+ return val;
}
-function effect_context(constructor, a, b, counter) {
- new constructor(a, b, counter);
- return a + b;
+function effect_context(constructor, val, deopt, counter) {
+ new constructor(val, deopt, counter);
+ return val;
}
function TestInAllContexts(constructor) {
@@ -79,17 +82,19 @@ function TestInAllContexts(constructor) {
// Test constructor returning nothing in all contexts.
-function c1(a, b, counter) {
- this.x = a + b;
+function c1(val, deopt, counter) {
+ deopt.deopt;
+ this.x = val;
counter.value++;
}
TestInAllContexts(c1);
// Test constructor returning an object in all contexts.
-function c2(a, b, counter) {
+function c2(val, deopt, counter) {
var obj = {};
- obj.x = a + b;
+ deopt.deopt;
+ obj.x = val;
counter.value++;
return obj;
}
@@ -97,8 +102,9 @@ TestInAllContexts(c2);
// Test constructor returning a primitive value in all contexts.
-function c3(a, b, counter) {
- this.x = a + b;
+function c3(val, deopt, counter) {
+ deopt.deopt;
+ this.x = val;
counter.value++;
return "not an object";
}
@@ -137,9 +143,10 @@ assertEquals("foo1", f_too_few("foo"))
// Test constructor that cannot be inlined.
-function c_unsupported_syntax(a, b, counter) {
+function c_unsupported_syntax(val, deopt, counter) {
try {
- this.x = a + b;
+ deopt.deopt;
+ this.x = val;
counter.value++;
} catch(e) {
throw new Error();
@@ -150,9 +157,10 @@ TestInAllContexts(c_unsupported_syntax);
// Regression test: Inlined constructors called as functions do not get their
// implicit receiver object set to undefined, even in strict mode.
-function c_strict(a, b, counter) {
+function c_strict(val, deopt, counter) {
"use strict";
- this.x = a + b;
+ deopt.deopt;
+ this.x = val;
counter.value++;
}
TestInAllContexts(c_strict);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698