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 <functional> | 5 #include <functional> |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/compiler/js-operator.h" | 8 #include "src/compiler/js-operator.h" |
9 #include "src/compiler/node-properties-inl.h" | 9 #include "src/compiler/node-properties-inl.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/graph-builder-tester.h" | 12 #include "test/cctest/compiler/graph-builder-tester.h" |
13 #include "test/cctest/types-fuzz.h" | 13 #include "test/cctest/types-fuzz.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 | 18 |
19 // TODO(titzer): generate a large set of deterministic inputs for these tests. | 19 // TODO(titzer): generate a large set of deterministic inputs for these tests. |
20 class TyperTester : public HandleAndZoneScope, public GraphAndBuilders { | 20 class TyperTester : public HandleAndZoneScope, public GraphAndBuilders { |
21 public: | 21 public: |
22 TyperTester() | 22 TyperTester() |
23 : GraphAndBuilders(main_zone()), | 23 : GraphAndBuilders(main_zone()), |
24 types_(main_zone(), isolate()), | 24 types_(main_zone(), isolate()), |
25 typer_(graph(), MaybeHandle<Context>()), | 25 typer_(isolate(), graph(), MaybeHandle<Context>()), |
26 javascript_(main_zone()) { | 26 javascript_(main_zone()) { |
27 Node* s = graph()->NewNode(common()->Start(3)); | 27 Node* s = graph()->NewNode(common()->Start(3)); |
28 graph()->SetStart(s); | 28 graph()->SetStart(s); |
29 context_node_ = graph()->NewNode(common()->Parameter(2), graph()->start()); | 29 context_node_ = graph()->NewNode(common()->Parameter(2), graph()->start()); |
30 rng_ = isolate()->random_number_generator(); | 30 rng_ = isolate()->random_number_generator(); |
31 | 31 |
32 integers.push_back(0); | 32 integers.push_back(0); |
33 integers.push_back(0); | 33 integers.push_back(0); |
34 integers.push_back(-1); | 34 integers.push_back(-1); |
35 integers.push_back(+1); | 35 integers.push_back(+1); |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 V(Modulus) | 371 V(Modulus) |
372 | 372 |
373 | 373 |
374 #define TEST_FUNC(name) \ | 374 #define TEST_FUNC(name) \ |
375 TEST(Monotonicity_##name) { \ | 375 TEST(Monotonicity_##name) { \ |
376 TyperTester t; \ | 376 TyperTester t; \ |
377 t.TestBinaryMonotonicity(t.javascript_.name()); \ | 377 t.TestBinaryMonotonicity(t.javascript_.name()); \ |
378 } | 378 } |
379 JSBINOP_LIST(TEST_FUNC) | 379 JSBINOP_LIST(TEST_FUNC) |
380 #undef TEST_FUNC | 380 #undef TEST_FUNC |
OLD | NEW |