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

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

Issue 515103002: Add more inlining unit tests. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 "function bar(s,t) { return foo(foo(s)); };" 184 "function bar(s,t) { return foo(foo(s)); };"
185 "return bar;" 185 "return bar;"
186 "})();", 186 "})();",
187 CompilationInfo::kInliningEnabled | 187 CompilationInfo::kInliningEnabled |
188 CompilationInfo::kContextSpecializing); 188 CompilationInfo::kContextSpecializing);
189 189
190 InstallAssertStackDepthHelper(CcTest::isolate()); 190 InstallAssertStackDepthHelper(CcTest::isolate());
191 T.CheckCall(T.Val(-11), T.Val(11), T.Val(4)); 191 T.CheckCall(T.Val(-11), T.Val(11), T.Val(4));
192 } 192 }
193 193
194
195 TEST(InlineLoop) {
196 FunctionTester T(
197 "(function () {"
198 "var x = 41;"
199 "function foo(s) { AssertStackDepth(1); while (s > 0) {"
200 " s = s - 1; }; return s; };"
201 "function bar(s,t) { return foo(foo(s)); };"
202 "return bar;"
203 "})();",
204 CompilationInfo::kInliningEnabled |
205 CompilationInfo::kContextSpecializing);
206
207 InstallAssertStackDepthHelper(CcTest::isolate());
208 T.CheckCall(T.Val(0.0), T.Val(11), T.Val(4));
209 }
210
211
212 TEST(InlineStrictIntoNonStrict) {
213 FunctionTester T(
214 "(function () {"
215 "var x = {};"
216 "Object.defineProperty(x, \"y\", { value: 42, writable: false });"
217 "function foo(s) { 'use strict';"
218 " x.y = 9; };"
219 "function bar(s,t) { return foo(s); };"
220 "return bar;"
221 "})();",
222 CompilationInfo::kInliningEnabled |
223 CompilationInfo::kContextSpecializing);
224
225 InstallAssertStackDepthHelper(CcTest::isolate());
226 T.CheckThrows(T.undefined(), T.undefined());
227 }
228
229
230 TEST(InlineNonStrictIntoStrict) {
231 FunctionTester T(
232 "(function () {"
233 "var x = {};"
234 "Object.defineProperty(obj1, \"y\", { value: 42, writable: false });"
Michael Starzinger 2014/08/28 09:49:00 It seems "obj1" is never defined. This means that
sigurds 2014/08/28 11:05:37 That's a mistake, thanks for catching!
235 "function foo(s) { x.y = 9; return 42; };"
Michael Starzinger 2014/08/28 09:49:00 You could use "return x.y" here as an additional v
sigurds 2014/08/28 11:05:37 Done.
236 "function bar(s,t) { \'use strict\'; return foo(s); };"
237 "return bar;"
238 "})();",
239 CompilationInfo::kInliningEnabled |
240 CompilationInfo::kContextSpecializing);
241
242 InstallAssertStackDepthHelper(CcTest::isolate());
243 T.CheckCall(T.Val(42), T.undefined(), T.undefined());
244 }
245
246
194 #endif // V8_TURBOFAN_TARGET 247 #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