| 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-operator.h" | 6 #include "src/compiler/js-operator.h" |
| 7 #include "src/compiler/node-matchers.h" | 7 #include "src/compiler/node-matchers.h" |
| 8 #include "src/compiler/node-properties-inl.h" | 8 #include "src/compiler/node-properties-inl.h" |
| 9 #include "src/compiler/source-position.h" | 9 #include "src/compiler/source-position.h" |
| 10 #include "src/compiler/typer.h" | 10 #include "src/compiler/typer.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 DirectGraphBuilder { | 19 public DirectGraphBuilder { |
| 20 public: | 20 public: |
| 21 ContextSpecializationTester() | 21 ContextSpecializationTester() |
| 22 : DirectGraphBuilder(new (main_zone()) Graph(main_zone())), | 22 : DirectGraphBuilder(new (main_zone()) Graph(main_zone())), |
| 23 common_(main_zone()), | 23 common_(main_zone()), |
| 24 javascript_(main_zone()), | 24 javascript_(main_zone()), |
| 25 machine_(main_zone()), | |
| 26 simplified_(main_zone()), | 25 simplified_(main_zone()), |
| 27 typer_(main_zone()), | 26 typer_(main_zone()), |
| 28 jsgraph_(graph(), common(), &javascript_, &typer_, &machine_), | 27 jsgraph_(graph(), common(), &typer_), |
| 29 info_(main_isolate(), main_zone()) {} | 28 info_(main_isolate(), main_zone()) {} |
| 30 | 29 |
| 31 Factory* factory() { return main_isolate()->factory(); } | 30 Factory* factory() { return main_isolate()->factory(); } |
| 32 CommonOperatorBuilder* common() { return &common_; } | 31 CommonOperatorBuilder* common() { return &common_; } |
| 33 JSOperatorBuilder* javascript() { return &javascript_; } | 32 JSOperatorBuilder* javascript() { return &javascript_; } |
| 34 SimplifiedOperatorBuilder* simplified() { return &simplified_; } | 33 SimplifiedOperatorBuilder* simplified() { return &simplified_; } |
| 35 JSGraph* jsgraph() { return &jsgraph_; } | 34 JSGraph* jsgraph() { return &jsgraph_; } |
| 36 CompilationInfo* info() { return &info_; } | 35 CompilationInfo* info() { return &info_; } |
| 37 | 36 |
| 38 private: | 37 private: |
| 39 CommonOperatorBuilder common_; | 38 CommonOperatorBuilder common_; |
| 40 JSOperatorBuilder javascript_; | 39 JSOperatorBuilder javascript_; |
| 41 MachineOperatorBuilder machine_; | |
| 42 SimplifiedOperatorBuilder simplified_; | 40 SimplifiedOperatorBuilder simplified_; |
| 43 Typer typer_; | 41 Typer typer_; |
| 44 JSGraph jsgraph_; | 42 JSGraph jsgraph_; |
| 45 CompilationInfo info_; | 43 CompilationInfo info_; |
| 46 }; | 44 }; |
| 47 | 45 |
| 48 | 46 |
| 49 TEST(ReduceJSLoadContext) { | 47 TEST(ReduceJSLoadContext) { |
| 50 ContextSpecializationTester t; | 48 ContextSpecializationTester t; |
| 51 | 49 |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 { | 296 { |
| 299 FunctionTester T( | 297 FunctionTester T( |
| 300 "(function() { if (false) { var x = 1; } function inc(a)" | 298 "(function() { if (false) { var x = 1; } function inc(a)" |
| 301 " { return a + x; } return inc; })()"); // x is undefined! | 299 " { return a + x; } return inc; })()"); // x is undefined! |
| 302 | 300 |
| 303 CHECK(T.Call(T.Val(0.0), T.Val(0.0)).ToHandleChecked()->IsNaN()); | 301 CHECK(T.Call(T.Val(0.0), T.Val(0.0)).ToHandleChecked()->IsNaN()); |
| 304 CHECK(T.Call(T.Val(2.0), T.Val(0.0)).ToHandleChecked()->IsNaN()); | 302 CHECK(T.Call(T.Val(2.0), T.Val(0.0)).ToHandleChecked()->IsNaN()); |
| 305 CHECK(T.Call(T.Val(-2.1), T.Val(0.0)).ToHandleChecked()->IsNaN()); | 303 CHECK(T.Call(T.Val(-2.1), T.Val(0.0)).ToHandleChecked()->IsNaN()); |
| 306 } | 304 } |
| 307 } | 305 } |
| OLD | NEW |