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

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

Issue 1692223002: Make FunctionTester::Compile() private. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « test/cctest/compiler/function-tester.h ('k') | 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 "test/cctest/compiler/function-tester.h" 5 #include "test/cctest/compiler/function-tester.h"
6 6
7 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 namespace compiler { 9 namespace compiler {
10 10
11 TEST(SimpleCall) { 11 TEST(SimpleCall) {
12 FunctionTester T("(function(foo,a) { return foo(a); })"); 12 FunctionTester T("(function(foo,a) { return foo(a); })");
13 Handle<JSFunction> foo = T.NewFunction("(function(a) { return a; })"); 13 Handle<JSFunction> foo = T.NewFunction("(function(a) { return a; })");
14 14
15 T.CheckCall(T.Val(3), foo, T.Val(3)); 15 T.CheckCall(T.Val(3), foo, T.Val(3));
16 T.CheckCall(T.Val(3.1), foo, T.Val(3.1)); 16 T.CheckCall(T.Val(3.1), foo, T.Val(3.1));
17 T.CheckCall(foo, foo, foo); 17 T.CheckCall(foo, foo, foo);
18 T.CheckCall(T.Val("Abba"), foo, T.Val("Abba")); 18 T.CheckCall(T.Val("Abba"), foo, T.Val("Abba"));
19 } 19 }
20 20
21 21
22 TEST(SimpleCall2) { 22 TEST(SimpleCall2) {
23 FunctionTester T("(function(foo,a) { return foo(a); })"); 23 FunctionTester T("(function(foo,a) { return foo(a); })");
24 Handle<JSFunction> foo = T.NewFunction("(function(a) { return a; })"); 24 FunctionTester U("(function(a) { return a; })");
25 T.Compile(foo);
26 25
27 T.CheckCall(T.Val(3), foo, T.Val(3)); 26 T.CheckCall(T.Val(3), U.function, T.Val(3));
28 T.CheckCall(T.Val(3.1), foo, T.Val(3.1)); 27 T.CheckCall(T.Val(3.1), U.function, T.Val(3.1));
29 T.CheckCall(foo, foo, foo); 28 T.CheckCall(U.function, U.function, U.function);
30 T.CheckCall(T.Val("Abba"), foo, T.Val("Abba")); 29 T.CheckCall(T.Val("Abba"), U.function, T.Val("Abba"));
31 } 30 }
32 31
33 32
34 TEST(ConstCall) { 33 TEST(ConstCall) {
35 FunctionTester T("(function(foo,a) { return foo(a,3); })"); 34 FunctionTester T("(function(foo,a) { return foo(a,3); })");
36 Handle<JSFunction> foo = T.NewFunction("(function(a,b) { return a + b; })"); 35 FunctionTester U("(function(a,b) { return a + b; })");
37 T.Compile(foo);
38 36
39 T.CheckCall(T.Val(6), foo, T.Val(3)); 37 T.CheckCall(T.Val(6), U.function, T.Val(3));
40 T.CheckCall(T.Val(6.1), foo, T.Val(3.1)); 38 T.CheckCall(T.Val(6.1), U.function, T.Val(3.1));
41 T.CheckCall(T.Val("function (a,b) { return a + b; }3"), foo, foo); 39 T.CheckCall(T.Val("function (a,b) { return a + b; }3"), U.function,
42 T.CheckCall(T.Val("Abba3"), foo, T.Val("Abba")); 40 U.function);
41 T.CheckCall(T.Val("Abba3"), U.function, T.Val("Abba"));
43 } 42 }
44 43
45 44
46 TEST(ConstCall2) { 45 TEST(ConstCall2) {
47 FunctionTester T("(function(foo,a) { return foo(a,\"3\"); })"); 46 FunctionTester T("(function(foo,a) { return foo(a,\"3\"); })");
48 Handle<JSFunction> foo = T.NewFunction("(function(a,b) { return a + b; })"); 47 FunctionTester U("(function(a,b) { return a + b; })");
49 T.Compile(foo);
50 48
51 T.CheckCall(T.Val("33"), foo, T.Val(3)); 49 T.CheckCall(T.Val("33"), U.function, T.Val(3));
52 T.CheckCall(T.Val("3.13"), foo, T.Val(3.1)); 50 T.CheckCall(T.Val("3.13"), U.function, T.Val(3.1));
53 T.CheckCall(T.Val("function (a,b) { return a + b; }3"), foo, foo); 51 T.CheckCall(T.Val("function (a,b) { return a + b; }3"), U.function,
54 T.CheckCall(T.Val("Abba3"), foo, T.Val("Abba")); 52 U.function);
53 T.CheckCall(T.Val("Abba3"), U.function, T.Val("Abba"));
55 } 54 }
56 55
57 56
58 TEST(PropertyNamedCall) { 57 TEST(PropertyNamedCall) {
59 FunctionTester T("(function(a,b) { return a.foo(b,23); })"); 58 FunctionTester T("(function(a,b) { return a.foo(b,23); })");
60 CompileRun("function foo(y,z) { return this.x + y + z; }"); 59 CompileRun("function foo(y,z) { return this.x + y + z; }");
61 60
62 T.CheckCall(T.Val(32), T.NewObject("({ foo:foo, x:4 })"), T.Val(5)); 61 T.CheckCall(T.Val(32), T.NewObject("({ foo:foo, x:4 })"), T.Val(5));
63 T.CheckCall(T.Val("xy23"), T.NewObject("({ foo:foo, x:'x' })"), T.Val("y")); 62 T.CheckCall(T.Val("xy23"), T.NewObject("({ foo:foo, x:'x' })"), T.Val("y"));
64 T.CheckCall(T.nan(), T.NewObject("({ foo:foo, y:0 })"), T.Val(3)); 63 T.CheckCall(T.nan(), T.NewObject("({ foo:foo, y:0 })"), T.Val(3));
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 CHECK(context->Global() 240 CHECK(context->Global()
242 ->Set(context, v8_str("foo"), v8::Utils::CallableToLocal(jsfun)) 241 ->Set(context, v8_str("foo"), v8::Utils::CallableToLocal(jsfun))
243 .FromJust()); 242 .FromJust());
244 CompileRun("var x = 24;"); 243 CompileRun("var x = 24;");
245 ExpectObject("foo()", context->Global()); 244 ExpectObject("foo()", context->Global());
246 } 245 }
247 246
248 } // namespace compiler 247 } // namespace compiler
249 } // namespace internal 248 } // namespace internal
250 } // namespace v8 249 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/function-tester.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698