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

Side by Side Diff: test/cctest/compiler/test-run-inlining.cc

Issue 505753002: Fix borked tests after r23354. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "test/cctest/compiler/function-tester.h" 7 #include "test/cctest/compiler/function-tester.h"
8 8
9 #if V8_TURBOFAN_TARGET 9 #if V8_TURBOFAN_TARGET
10 10
(...skipping 18 matching lines...) Expand all
29 29
30 static void InstallAssertStackDepthHelper(v8::Isolate* isolate) { 30 static void InstallAssertStackDepthHelper(v8::Isolate* isolate) {
31 v8::Local<v8::Context> context = isolate->GetCurrentContext(); 31 v8::Local<v8::Context> context = isolate->GetCurrentContext();
32 v8::Local<v8::FunctionTemplate> t = 32 v8::Local<v8::FunctionTemplate> t =
33 v8::FunctionTemplate::New(isolate, AssertStackDepth); 33 v8::FunctionTemplate::New(isolate, AssertStackDepth);
34 context->Global()->Set(v8_str("AssertStackDepth"), t->GetFunction()); 34 context->Global()->Set(v8_str("AssertStackDepth"), t->GetFunction());
35 } 35 }
36 36
37 37
38 TEST(SimpleInlining) { 38 TEST(SimpleInlining) {
39 FLAG_context_specialization = true;
39 FLAG_turbo_inlining = true; 40 FLAG_turbo_inlining = true;
40 FunctionTester T( 41 FunctionTester T(
41 "(function(){" 42 "(function(){"
42 "function foo(s) { AssertStackDepth(1); return s; };" 43 "function foo(s) { AssertStackDepth(1); return s; };"
43 "function bar(s, t) { return foo(s); };" 44 "function bar(s, t) { return foo(s); };"
44 "return bar;})();"); 45 "return bar;})();");
45 46
46 InstallAssertStackDepthHelper(CcTest::isolate()); 47 InstallAssertStackDepthHelper(CcTest::isolate());
47 T.CheckCall(T.Val(1), T.Val(1), T.Val(2)); 48 T.CheckCall(T.Val(1), T.Val(1), T.Val(2));
48 } 49 }
49 50
50 51
51 TEST(SimpleInliningContext) { 52 TEST(SimpleInliningContext) {
53 FLAG_context_specialization = true;
52 FLAG_turbo_inlining = true; 54 FLAG_turbo_inlining = true;
53 FunctionTester T( 55 FunctionTester T(
54 "(function () {" 56 "(function () {"
55 "function foo(s) { AssertStackDepth(1); var x = 12; return s + x; };" 57 "function foo(s) { AssertStackDepth(1); var x = 12; return s + x; };"
56 "function bar(s, t) { return foo(s); };" 58 "function bar(s, t) { return foo(s); };"
57 "return bar;" 59 "return bar;"
58 "})();"); 60 "})();");
59 61
60 InstallAssertStackDepthHelper(CcTest::isolate()); 62 InstallAssertStackDepthHelper(CcTest::isolate());
61 T.CheckCall(T.Val(13), T.Val(1), T.Val(2)); 63 T.CheckCall(T.Val(13), T.Val(1), T.Val(2));
62 } 64 }
63 65
64 66
65 TEST(CaptureContext) { 67 TEST(CaptureContext) {
68 FLAG_context_specialization = true;
66 FLAG_turbo_inlining = true; 69 FLAG_turbo_inlining = true;
67 FunctionTester T( 70 FunctionTester T(
68 "var f = (function () {" 71 "var f = (function () {"
69 "var x = 42;" 72 "var x = 42;"
70 "function bar(s) { return x + s; };" 73 "function bar(s) { return x + s; };"
71 "return (function (s) { return bar(s); });" 74 "return (function (s) { return bar(s); });"
72 "})();" 75 "})();"
73 "(function (s) { return f(s)})"); 76 "(function (s) { return f(s)})");
74 77
75 InstallAssertStackDepthHelper(CcTest::isolate()); 78 InstallAssertStackDepthHelper(CcTest::isolate());
76 T.CheckCall(T.Val(42 + 12), T.Val(12), T.undefined()); 79 T.CheckCall(T.Val(42 + 12), T.Val(12), T.undefined());
77 } 80 }
78 81
79 82
80 // TODO(sigurds) For now we do not inline any native functions. If we do at 83 // TODO(sigurds) For now we do not inline any native functions. If we do at
81 // some point, change this test. 84 // some point, change this test.
82 TEST(DontInlineEval) { 85 TEST(DontInlineEval) {
86 FLAG_context_specialization = true;
83 FLAG_turbo_inlining = true; 87 FLAG_turbo_inlining = true;
84 FunctionTester T( 88 FunctionTester T(
85 "var x = 42;" 89 "var x = 42;"
86 "(function () {" 90 "(function () {"
87 "function bar(s, t) { return eval(\"AssertStackDepth(2); x\") };" 91 "function bar(s, t) { return eval(\"AssertStackDepth(2); x\") };"
88 "return bar;" 92 "return bar;"
89 "})();"); 93 "})();");
90 94
91 InstallAssertStackDepthHelper(CcTest::isolate()); 95 InstallAssertStackDepthHelper(CcTest::isolate());
92 T.CheckCall(T.Val(42), T.Val("x"), T.undefined()); 96 T.CheckCall(T.Val(42), T.Val("x"), T.undefined());
93 } 97 }
94 98
95 99
96 TEST(InlineOmitArguments) { 100 TEST(InlineOmitArguments) {
101 FLAG_context_specialization = true;
97 FLAG_turbo_inlining = true; 102 FLAG_turbo_inlining = true;
98 FunctionTester T( 103 FunctionTester T(
99 "(function () {" 104 "(function () {"
100 "var x = 42;" 105 "var x = 42;"
101 "function bar(s, t, u, v) { AssertStackDepth(1); return x + s; };" 106 "function bar(s, t, u, v) { AssertStackDepth(1); return x + s; };"
102 "return (function (s,t) { return bar(s); });" 107 "return (function (s,t) { return bar(s); });"
103 "})();"); 108 "})();");
104 109
105 InstallAssertStackDepthHelper(CcTest::isolate()); 110 InstallAssertStackDepthHelper(CcTest::isolate());
106 T.CheckCall(T.Val(42 + 12), T.Val(12), T.undefined()); 111 T.CheckCall(T.Val(42 + 12), T.Val(12), T.undefined());
107 } 112 }
108 113
109 114
110 TEST(InlineSurplusArguments) { 115 TEST(InlineSurplusArguments) {
116 FLAG_context_specialization = true;
111 FLAG_turbo_inlining = true; 117 FLAG_turbo_inlining = true;
112 FunctionTester T( 118 FunctionTester T(
113 "(function () {" 119 "(function () {"
114 "var x = 42;" 120 "var x = 42;"
115 "function foo(s) { AssertStackDepth(1); return x + s; };" 121 "function foo(s) { AssertStackDepth(1); return x + s; };"
116 "function bar(s,t) { return foo(s,t,13); };" 122 "function bar(s,t) { return foo(s,t,13); };"
117 "return bar;" 123 "return bar;"
118 "})();"); 124 "})();");
119 125
120 InstallAssertStackDepthHelper(CcTest::isolate()); 126 InstallAssertStackDepthHelper(CcTest::isolate());
121 T.CheckCall(T.Val(42 + 12), T.Val(12), T.undefined()); 127 T.CheckCall(T.Val(42 + 12), T.Val(12), T.undefined());
122 } 128 }
123 129
124 130
125 TEST(InlineTwice) { 131 TEST(InlineTwice) {
132 FLAG_context_specialization = true;
126 FLAG_turbo_inlining = true; 133 FLAG_turbo_inlining = true;
127 FunctionTester T( 134 FunctionTester T(
128 "(function () {" 135 "(function () {"
129 "var x = 42;" 136 "var x = 42;"
130 "function bar(s) { AssertStackDepth(1); return x + s; };" 137 "function bar(s) { AssertStackDepth(1); return x + s; };"
131 "return (function (s,t) { return bar(s) + bar(t); });" 138 "return (function (s,t) { return bar(s) + bar(t); });"
132 "})();"); 139 "})();");
133 140
134 InstallAssertStackDepthHelper(CcTest::isolate()); 141 InstallAssertStackDepthHelper(CcTest::isolate());
135 T.CheckCall(T.Val(2 * 42 + 12 + 4), T.Val(12), T.Val(4)); 142 T.CheckCall(T.Val(2 * 42 + 12 + 4), T.Val(12), T.Val(4));
136 } 143 }
137 144
138 145
139 TEST(InlineTwiceDependent) { 146 TEST(InlineTwiceDependent) {
147 FLAG_context_specialization = true;
140 FLAG_turbo_inlining = true; 148 FLAG_turbo_inlining = true;
141 FunctionTester T( 149 FunctionTester T(
142 "(function () {" 150 "(function () {"
143 "var x = 42;" 151 "var x = 42;"
144 "function foo(s) { AssertStackDepth(1); return x + s; };" 152 "function foo(s) { AssertStackDepth(1); return x + s; };"
145 "function bar(s,t) { return foo(foo(s)); };" 153 "function bar(s,t) { return foo(foo(s)); };"
146 "return bar;" 154 "return bar;"
147 "})();"); 155 "})();");
148 156
149 InstallAssertStackDepthHelper(CcTest::isolate()); 157 InstallAssertStackDepthHelper(CcTest::isolate());
150 T.CheckCall(T.Val(42 + 42 + 12), T.Val(12), T.Val(4)); 158 T.CheckCall(T.Val(42 + 42 + 12), T.Val(12), T.Val(4));
151 } 159 }
152 160
153 161
154 TEST(InlineTwiceDependentDiamond) { 162 TEST(InlineTwiceDependentDiamond) {
163 FLAG_context_specialization = true;
155 FLAG_turbo_inlining = true; 164 FLAG_turbo_inlining = true;
156 FunctionTester T( 165 FunctionTester T(
157 "(function () {" 166 "(function () {"
158 "function foo(s) { if (true) {" 167 "function foo(s) { if (true) {"
159 " return 12 } else { return 13; } };" 168 " return 12 } else { return 13; } };"
160 "function bar(s,t) { return foo(foo(1)); };" 169 "function bar(s,t) { return foo(foo(1)); };"
161 "return bar;" 170 "return bar;"
162 "})();"); 171 "})();");
163 172
164 InstallAssertStackDepthHelper(CcTest::isolate()); 173 InstallAssertStackDepthHelper(CcTest::isolate());
165 T.CheckCall(T.Val(12), T.undefined(), T.undefined()); 174 T.CheckCall(T.Val(12), T.undefined(), T.undefined());
166 } 175 }
167 176
168 177
169 TEST(InlineTwiceDependentDiamondReal) { 178 TEST(InlineTwiceDependentDiamondReal) {
179 FLAG_context_specialization = true;
170 FLAG_turbo_inlining = true; 180 FLAG_turbo_inlining = true;
171 FunctionTester T( 181 FunctionTester T(
172 "(function () {" 182 "(function () {"
173 "var x = 41;" 183 "var x = 41;"
174 "function foo(s) { AssertStackDepth(1); if (s % 2 == 0) {" 184 "function foo(s) { AssertStackDepth(1); if (s % 2 == 0) {"
175 " return x - s } else { return x + s; } };" 185 " return x - s } else { return x + s; } };"
176 "function bar(s,t) { return foo(foo(s)); };" 186 "function bar(s,t) { return foo(foo(s)); };"
177 "return bar;" 187 "return bar;"
178 "})();"); 188 "})();");
179 189
180 InstallAssertStackDepthHelper(CcTest::isolate()); 190 InstallAssertStackDepthHelper(CcTest::isolate());
181 T.CheckCall(T.Val(-11), T.Val(11), T.Val(4)); 191 T.CheckCall(T.Val(-11), T.Val(11), T.Val(4));
182 } 192 }
183 193
184 #endif // V8_TURBOFAN_TARGET 194 #endif // V8_TURBOFAN_TARGET
OLDNEW
« 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