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 i::Isolate* isolate = CcTest::i_isolate(); | 228 |
229 CHECK( | 229 CHECK(T.Call(T.Val(0.0), T.Val(0.0)).ToHandleChecked()->IsUndefined()); |
230 T.Call(T.Val(0.0), T.Val(0.0)).ToHandleChecked()->IsUndefined(isolate)); | 230 CHECK(T.Call(T.Val(2.0), T.Val(0.0)).ToHandleChecked()->IsUndefined()); |
231 CHECK( | 231 CHECK(T.Call(T.Val(-2.1), T.Val(0.0)).ToHandleChecked()->IsUndefined()); |
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)); | |
236 } | 232 } |
237 | 233 |
238 { | 234 { |
239 FunctionTester T( | 235 FunctionTester T( |
240 "(function() { if (false) { var x = 1; } function inc(a)" | 236 "(function() { if (false) { var x = 1; } function inc(a)" |
241 " { return a + x; } return inc; })()"); // x is undefined! | 237 " { return a + x; } return inc; })()"); // x is undefined! |
242 | 238 |
243 CHECK(T.Call(T.Val(0.0), T.Val(0.0)).ToHandleChecked()->IsNaN()); | 239 CHECK(T.Call(T.Val(0.0), T.Val(0.0)).ToHandleChecked()->IsNaN()); |
244 CHECK(T.Call(T.Val(2.0), T.Val(0.0)).ToHandleChecked()->IsNaN()); | 240 CHECK(T.Call(T.Val(2.0), T.Val(0.0)).ToHandleChecked()->IsNaN()); |
245 CHECK(T.Call(T.Val(-2.1), T.Val(0.0)).ToHandleChecked()->IsNaN()); | 241 CHECK(T.Call(T.Val(-2.1), T.Val(0.0)).ToHandleChecked()->IsNaN()); |
246 } | 242 } |
247 } | 243 } |
248 | 244 |
249 } // namespace compiler | 245 } // namespace compiler |
250 } // namespace internal | 246 } // namespace internal |
251 } // namespace v8 | 247 } // namespace v8 |
OLD | NEW |