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 "src/compiler/js-context-specialization.h" | 5 #include "src/compiler/js-context-specialization.h" |
6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
7 #include "src/compiler/js-operator.h" | 7 #include "src/compiler/js-operator.h" |
8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 #include "src/compiler/source-position.h" | 10 #include "src/compiler/source-position.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 T.CheckCall(-10.5, 1.0, 0.0); | 218 T.CheckCall(-10.5, 1.0, 0.0); |
219 T.CheckCall(-10.4, 1.1, 0.0); | 219 T.CheckCall(-10.4, 1.1, 0.0); |
220 } | 220 } |
221 | 221 |
222 | 222 |
223 TEST(SpecializeJSFunction_ToConstant_uninit) { | 223 TEST(SpecializeJSFunction_ToConstant_uninit) { |
224 { | 224 { |
225 FunctionTester T( | 225 FunctionTester T( |
226 "(function() { if (false) { var x = 1; } function inc(a)" | 226 "(function() { if (false) { var x = 1; } function inc(a)" |
227 " { return x; } return inc; })()"); // x is undefined! | 227 " { return x; } return inc; })()"); // x is undefined! |
228 | 228 i::Isolate* isolate = CcTest::i_isolate(); |
229 CHECK(T.Call(T.Val(0.0), T.Val(0.0)).ToHandleChecked()->IsUndefined()); | 229 CHECK( |
230 CHECK(T.Call(T.Val(2.0), T.Val(0.0)).ToHandleChecked()->IsUndefined()); | 230 T.Call(T.Val(0.0), T.Val(0.0)).ToHandleChecked()->IsUndefined(isolate)); |
231 CHECK(T.Call(T.Val(-2.1), T.Val(0.0)).ToHandleChecked()->IsUndefined()); | 231 CHECK( |
| 232 T.Call(T.Val(2.0), T.Val(0.0)).ToHandleChecked()->IsUndefined(isolate)); |
| 233 CHECK(T.Call(T.Val(-2.1), T.Val(0.0)) |
| 234 .ToHandleChecked() |
| 235 ->IsUndefined(isolate)); |
232 } | 236 } |
233 | 237 |
234 { | 238 { |
235 FunctionTester T( | 239 FunctionTester T( |
236 "(function() { if (false) { var x = 1; } function inc(a)" | 240 "(function() { if (false) { var x = 1; } function inc(a)" |
237 " { return a + x; } return inc; })()"); // x is undefined! | 241 " { return a + x; } return inc; })()"); // x is undefined! |
238 | 242 |
239 CHECK(T.Call(T.Val(0.0), T.Val(0.0)).ToHandleChecked()->IsNaN()); | 243 CHECK(T.Call(T.Val(0.0), T.Val(0.0)).ToHandleChecked()->IsNaN()); |
240 CHECK(T.Call(T.Val(2.0), T.Val(0.0)).ToHandleChecked()->IsNaN()); | 244 CHECK(T.Call(T.Val(2.0), T.Val(0.0)).ToHandleChecked()->IsNaN()); |
241 CHECK(T.Call(T.Val(-2.1), T.Val(0.0)).ToHandleChecked()->IsNaN()); | 245 CHECK(T.Call(T.Val(-2.1), T.Val(0.0)).ToHandleChecked()->IsNaN()); |
242 } | 246 } |
243 } | 247 } |
244 | 248 |
245 } // namespace compiler | 249 } // namespace compiler |
246 } // namespace internal | 250 } // namespace internal |
247 } // namespace v8 | 251 } // namespace v8 |
OLD | NEW |