OLD | NEW |
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 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 FunctionTester T("(function(a,b) { return new foo(a,b).value; })"); | 123 FunctionTester T("(function(a,b) { return new foo(a,b).value; })"); |
124 CompileRun("function foo(a,b) { return { value: a + b + this.c }; }"); | 124 CompileRun("function foo(a,b) { return { value: a + b + this.c }; }"); |
125 CompileRun("foo.prototype.c = 23;"); | 125 CompileRun("foo.prototype.c = 23;"); |
126 | 126 |
127 T.CheckCall(T.Val(32), T.Val(4), T.Val(5)); | 127 T.CheckCall(T.Val(32), T.Val(4), T.Val(5)); |
128 T.CheckCall(T.Val("xy23"), T.Val("x"), T.Val("y")); | 128 T.CheckCall(T.Val("xy23"), T.Val("x"), T.Val("y")); |
129 T.CheckCall(T.nan(), T.undefined(), T.Val(3)); | 129 T.CheckCall(T.nan(), T.undefined(), T.Val(3)); |
130 } | 130 } |
131 | 131 |
132 | 132 |
133 // TODO(titzer): factor these out into test-runtime-calls.cc | |
134 TEST(RuntimeCallCPP2) { | 133 TEST(RuntimeCallCPP2) { |
135 FLAG_allow_natives_syntax = true; | 134 FLAG_allow_natives_syntax = true; |
136 FunctionTester T("(function(a,b) { return %NumberImul(a, b); })"); | 135 FunctionTester T("(function(a,b) { return %NumberImul(a, b); })"); |
137 | 136 |
138 T.CheckCall(T.Val(2730), T.Val(42), T.Val(65)); | 137 T.CheckCall(T.Val(2730), T.Val(42), T.Val(65)); |
139 T.CheckCall(T.Val(798), T.Val(42), T.Val(19)); | 138 T.CheckCall(T.Val(798), T.Val(42), T.Val(19)); |
140 } | 139 } |
141 | 140 |
142 | 141 |
143 TEST(RuntimeCallInline) { | 142 TEST(RuntimeCallInline) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |