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" |
11 #include "test/cctest/cctest.h" | 11 #include "test/cctest/cctest.h" |
12 #include "test/cctest/compiler/function-tester.h" | 12 #include "test/cctest/compiler/function-tester.h" |
13 #include "test/cctest/compiler/graph-builder-tester.h" | 13 #include "test/cctest/compiler/graph-builder-tester.h" |
14 | 14 |
15 using namespace v8::internal; | 15 using namespace v8::internal; |
16 using namespace v8::internal::compiler; | 16 using namespace v8::internal::compiler; |
17 | 17 |
18 class ContextSpecializationTester : public HandleAndZoneScope { | 18 class ContextSpecializationTester : public HandleAndZoneScope { |
19 public: | 19 public: |
20 ContextSpecializationTester() | 20 ContextSpecializationTester() |
21 : graph_(new (main_zone()) Graph(main_zone())), | 21 : graph_(new (main_zone()) Graph(main_zone())), |
22 common_(main_zone()), | 22 common_(main_zone()), |
23 javascript_(main_zone()), | 23 javascript_(main_zone()), |
24 machine_(main_zone()), | 24 machine_(main_zone()), |
25 simplified_(main_zone()), | 25 simplified_(main_zone()), |
26 jsgraph_(main_isolate(), graph(), common(), &javascript_, &machine_), | 26 jsgraph_(main_isolate(), graph(), common(), &javascript_, &simplified_, |
| 27 &machine_), |
27 reducer_(main_zone(), graph()), | 28 reducer_(main_zone(), graph()), |
28 spec_(&reducer_, jsgraph(), MaybeHandle<Context>()) {} | 29 spec_(&reducer_, jsgraph(), MaybeHandle<Context>()) {} |
29 | 30 |
30 JSContextSpecialization* spec() { return &spec_; } | 31 JSContextSpecialization* spec() { return &spec_; } |
31 Factory* factory() { return main_isolate()->factory(); } | 32 Factory* factory() { return main_isolate()->factory(); } |
32 CommonOperatorBuilder* common() { return &common_; } | 33 CommonOperatorBuilder* common() { return &common_; } |
33 JSOperatorBuilder* javascript() { return &javascript_; } | 34 JSOperatorBuilder* javascript() { return &javascript_; } |
34 SimplifiedOperatorBuilder* simplified() { return &simplified_; } | 35 SimplifiedOperatorBuilder* simplified() { return &simplified_; } |
35 JSGraph* jsgraph() { return &jsgraph_; } | 36 JSGraph* jsgraph() { return &jsgraph_; } |
36 Graph* graph() { return graph_; } | 37 Graph* graph() { return graph_; } |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 { | 308 { |
308 FunctionTester T( | 309 FunctionTester T( |
309 "(function() { if (false) { var x = 1; } function inc(a)" | 310 "(function() { if (false) { var x = 1; } function inc(a)" |
310 " { return a + x; } return inc; })()"); // x is undefined! | 311 " { return a + x; } return inc; })()"); // x is undefined! |
311 | 312 |
312 CHECK(T.Call(T.Val(0.0), T.Val(0.0)).ToHandleChecked()->IsNaN()); | 313 CHECK(T.Call(T.Val(0.0), T.Val(0.0)).ToHandleChecked()->IsNaN()); |
313 CHECK(T.Call(T.Val(2.0), T.Val(0.0)).ToHandleChecked()->IsNaN()); | 314 CHECK(T.Call(T.Val(2.0), T.Val(0.0)).ToHandleChecked()->IsNaN()); |
314 CHECK(T.Call(T.Val(-2.1), T.Val(0.0)).ToHandleChecked()->IsNaN()); | 315 CHECK(T.Call(T.Val(-2.1), T.Val(0.0)).ToHandleChecked()->IsNaN()); |
315 } | 316 } |
316 } | 317 } |
OLD | NEW |