| 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 <limits> | 5 #include <limits> |
| 6 | 6 |
| 7 #include "src/v8.h" | 7 #include "src/v8.h" |
| 8 #include "test/cctest/cctest.h" | 8 #include "test/cctest/cctest.h" |
| 9 #include "test/cctest/compiler/graph-builder-tester.h" | 9 #include "test/cctest/compiler/graph-builder-tester.h" |
| 10 #include "test/cctest/compiler/value-helper.h" | 10 #include "test/cctest/compiler/value-helper.h" |
| 11 | 11 |
| 12 #include "src/compiler/node-matchers.h" | 12 #include "src/compiler/node-matchers.h" |
| 13 #include "src/compiler/representation-change.h" | 13 #include "src/compiler/representation-change.h" |
| 14 #include "src/compiler/typer.h" | |
| 15 | 14 |
| 16 using namespace v8::internal; | 15 using namespace v8::internal; |
| 17 using namespace v8::internal::compiler; | 16 using namespace v8::internal::compiler; |
| 18 | 17 |
| 19 namespace v8 { // for friendiness. | 18 namespace v8 { // for friendiness. |
| 20 namespace internal { | 19 namespace internal { |
| 21 namespace compiler { | 20 namespace compiler { |
| 22 | 21 |
| 23 class RepresentationChangerTester : public HandleAndZoneScope, | 22 class RepresentationChangerTester : public HandleAndZoneScope, |
| 24 public GraphAndBuilders { | 23 public GraphAndBuilders { |
| 25 public: | 24 public: |
| 26 explicit RepresentationChangerTester(int num_parameters = 0) | 25 explicit RepresentationChangerTester(int num_parameters = 0) |
| 27 : GraphAndBuilders(main_zone()), | 26 : GraphAndBuilders(main_zone()), |
| 28 typer_(main_zone()), | |
| 29 javascript_(main_zone()), | 27 javascript_(main_zone()), |
| 30 jsgraph_(main_graph_, &main_common_, &javascript_, &typer_, | 28 jsgraph_(main_graph_, &main_common_, &javascript_, &main_machine_), |
| 31 &main_machine_), | |
| 32 changer_(&jsgraph_, &main_simplified_, main_isolate()) { | 29 changer_(&jsgraph_, &main_simplified_, main_isolate()) { |
| 33 Node* s = graph()->NewNode(common()->Start(num_parameters)); | 30 Node* s = graph()->NewNode(common()->Start(num_parameters)); |
| 34 graph()->SetStart(s); | 31 graph()->SetStart(s); |
| 35 } | 32 } |
| 36 | 33 |
| 37 Typer typer_; | |
| 38 JSOperatorBuilder javascript_; | 34 JSOperatorBuilder javascript_; |
| 39 JSGraph jsgraph_; | 35 JSGraph jsgraph_; |
| 40 RepresentationChanger changer_; | 36 RepresentationChanger changer_; |
| 41 | 37 |
| 42 Isolate* isolate() { return main_isolate(); } | 38 Isolate* isolate() { return main_isolate(); } |
| 43 Graph* graph() { return main_graph_; } | 39 Graph* graph() { return main_graph_; } |
| 44 CommonOperatorBuilder* common() { return &main_common_; } | 40 CommonOperatorBuilder* common() { return &main_common_; } |
| 45 JSGraph* jsgraph() { return &jsgraph_; } | 41 JSGraph* jsgraph() { return &jsgraph_; } |
| 46 RepresentationChanger* changer() { return &changer_; } | 42 RepresentationChanger* changer() { return &changer_; } |
| 47 | 43 |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 r.CheckTypeError(kRepWord32 | kTypeUint32, kRepWord64); | 538 r.CheckTypeError(kRepWord32 | kTypeUint32, kRepWord64); |
| 543 | 539 |
| 544 for (size_t i = 0; i < arraysize(all_reps); i++) { | 540 for (size_t i = 0; i < arraysize(all_reps); i++) { |
| 545 for (size_t j = 0; j < arraysize(all_reps); j++) { | 541 for (size_t j = 0; j < arraysize(all_reps); j++) { |
| 546 if (i == j) continue; | 542 if (i == j) continue; |
| 547 // Only a single from representation is allowed. | 543 // Only a single from representation is allowed. |
| 548 r.CheckTypeError(all_reps[i] | all_reps[j], kRepTagged); | 544 r.CheckTypeError(all_reps[i] | all_reps[j], kRepTagged); |
| 549 } | 545 } |
| 550 } | 546 } |
| 551 } | 547 } |
| OLD | NEW |