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/graph-replay.h" | 5 #include "src/compiler/graph-replay.h" |
6 | 6 |
7 #include "src/compiler/all-nodes.h" | 7 #include "src/compiler/all-nodes.h" |
8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/graph.h" | 9 #include "src/compiler/graph.h" |
10 #include "src/compiler/node.h" | 10 #include "src/compiler/node.h" |
11 #include "src/compiler/operator.h" | 11 #include "src/compiler/operator.h" |
12 #include "src/compiler/operator-properties.h" | 12 #include "src/compiler/operator-properties.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 namespace compiler { | 16 namespace compiler { |
17 | 17 |
18 #ifdef DEBUG | 18 #ifdef DEBUG |
19 | 19 |
20 void GraphReplayPrinter::PrintReplay(Graph* graph) { | 20 void GraphReplayPrinter::PrintReplay(Graph* graph) { |
21 GraphReplayPrinter replay; | 21 GraphReplayPrinter replay; |
22 PrintF(" Node* nil = graph.NewNode(common_builder.Dead());\n"); | 22 PrintF(" Node* nil = graph()->NewNode(common()->Dead());\n"); |
23 Zone zone; | 23 Zone zone; |
24 AllNodes nodes(&zone, graph); | 24 AllNodes nodes(&zone, graph); |
25 | 25 |
26 // Allocate the nodes first. | 26 // Allocate the nodes first. |
27 for (Node* node : nodes.live) { | 27 for (Node* node : nodes.live) { |
28 PrintReplayOpCreator(node->op()); | 28 PrintReplayOpCreator(node->op()); |
29 PrintF(" Node* n%d = graph.NewNode(op", node->id()); | 29 PrintF(" Node* n%d = graph()->NewNode(op", node->id()); |
30 for (int i = 0; i < node->InputCount(); ++i) { | 30 for (int i = 0; i < node->InputCount(); ++i) { |
31 PrintF(", nil"); | 31 PrintF(", nil"); |
32 } | 32 } |
33 PrintF("); USE(n%d);\n", node->id()); | 33 PrintF("); USE(n%d);\n", node->id()); |
34 } | 34 } |
35 | 35 |
36 // Connect the nodes to their inputs. | 36 // Connect the nodes to their inputs. |
37 for (Node* node : nodes.live) { | 37 for (Node* node : nodes.live) { |
38 for (int i = 0; i < node->InputCount(); i++) { | 38 for (int i = 0; i < node->InputCount(); i++) { |
39 PrintF(" n%d->ReplaceInput(%d, n%d);\n", node->id(), i, | 39 PrintF(" n%d->ReplaceInput(%d, n%d);\n", node->id(), i, |
40 node->InputAt(i)->id()); | 40 node->InputAt(i)->id()); |
41 } | 41 } |
42 } | 42 } |
43 } | 43 } |
44 | 44 |
45 | 45 |
46 void GraphReplayPrinter::PrintReplayOpCreator(const Operator* op) { | 46 void GraphReplayPrinter::PrintReplayOpCreator(const Operator* op) { |
47 IrOpcode::Value opcode = static_cast<IrOpcode::Value>(op->opcode()); | 47 IrOpcode::Value opcode = static_cast<IrOpcode::Value>(op->opcode()); |
48 const char* builder = | 48 const char* builder = IrOpcode::IsCommonOpcode(opcode) ? "common" : "js"; |
49 IrOpcode::IsCommonOpcode(opcode) ? "common_builder" : "js_builder"; | |
50 const char* mnemonic = IrOpcode::IsCommonOpcode(opcode) | 49 const char* mnemonic = IrOpcode::IsCommonOpcode(opcode) |
51 ? IrOpcode::Mnemonic(opcode) | 50 ? IrOpcode::Mnemonic(opcode) |
52 : IrOpcode::Mnemonic(opcode) + 2; | 51 : IrOpcode::Mnemonic(opcode) + 2; |
53 PrintF(" op = %s.%s(", builder, mnemonic); | 52 PrintF(" op = %s()->%s(", builder, mnemonic); |
54 switch (opcode) { | 53 switch (opcode) { |
55 case IrOpcode::kParameter: | 54 case IrOpcode::kParameter: |
| 55 PrintF("%d", ParameterIndexOf(op)); |
| 56 break; |
56 case IrOpcode::kNumberConstant: | 57 case IrOpcode::kNumberConstant: |
57 PrintF("0"); | 58 PrintF("%g", OpParameter<double>(op)); |
58 break; | |
59 case IrOpcode::kLoad: | |
60 PrintF("unique_name"); | |
61 break; | 59 break; |
62 case IrOpcode::kHeapConstant: | 60 case IrOpcode::kHeapConstant: |
63 PrintF("unique_constant"); | 61 PrintF("unique_constant"); |
64 break; | 62 break; |
65 case IrOpcode::kPhi: | 63 case IrOpcode::kPhi: |
| 64 PrintF("kMachAnyTagged, %d", op->ValueInputCount()); |
| 65 break; |
| 66 case IrOpcode::kStateValues: |
66 PrintF("%d", op->ValueInputCount()); | 67 PrintF("%d", op->ValueInputCount()); |
67 break; | 68 break; |
68 case IrOpcode::kEffectPhi: | 69 case IrOpcode::kEffectPhi: |
69 PrintF("%d", op->EffectInputCount()); | 70 PrintF("%d", op->EffectInputCount()); |
70 break; | 71 break; |
71 case IrOpcode::kLoop: | 72 case IrOpcode::kLoop: |
72 case IrOpcode::kMerge: | 73 case IrOpcode::kMerge: |
73 PrintF("%d", op->ControlInputCount()); | 74 PrintF("%d", op->ControlInputCount()); |
74 break; | 75 break; |
| 76 case IrOpcode::kStart: |
| 77 PrintF("%d", op->ValueOutputCount() - 3); |
| 78 break; |
| 79 case IrOpcode::kFrameState: |
| 80 PrintF("JS_FRAME, BailoutId(-1), OutputFrameStateCombine::Ignore()"); |
| 81 break; |
75 default: | 82 default: |
76 break; | 83 break; |
77 } | 84 } |
78 PrintF(");\n"); | 85 PrintF(");\n"); |
79 } | 86 } |
80 | 87 |
81 #endif // DEBUG | 88 #endif // DEBUG |
82 } | 89 |
83 } | 90 } // namespace compiler |
84 } // namespace v8::internal::compiler | 91 } // namespace internal |
| 92 } // namespace v8 |
OLD | NEW |