Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: test/cctest/compiler/test-changes-lowering.cc

Issue 1157023002: [turbofan] Change End to take a variable number of inputs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/compiler/change-lowering.h" 7 #include "src/compiler/change-lowering.h"
8 #include "src/compiler/control-builders.h" 8 #include "src/compiler/control-builders.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/node-properties.h" 10 #include "src/compiler/node-properties.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 CHECK(this->isolate()->factory()->NewNumber(expected)->SameValue(number)); 81 CHECK(this->isolate()->factory()->NewNumber(expected)->SameValue(number));
82 } 82 }
83 83
84 void BuildAndLower(const Operator* op) { 84 void BuildAndLower(const Operator* op) {
85 // We build a graph by hand here, because the raw machine assembler 85 // We build a graph by hand here, because the raw machine assembler
86 // does not add the correct control and effect nodes. 86 // does not add the correct control and effect nodes.
87 Node* p0 = this->Parameter(0); 87 Node* p0 = this->Parameter(0);
88 Node* change = this->graph()->NewNode(op, p0); 88 Node* change = this->graph()->NewNode(op, p0);
89 Node* ret = this->graph()->NewNode(this->common()->Return(), change, 89 Node* ret = this->graph()->NewNode(this->common()->Return(), change,
90 this->start(), this->start()); 90 this->start(), this->start());
91 Node* end = this->graph()->NewNode(this->common()->End(), ret); 91 Node* end = this->graph()->NewNode(this->common()->End(1), ret);
92 this->graph()->SetEnd(end); 92 this->graph()->SetEnd(end);
93 LowerChange(change); 93 LowerChange(change);
94 } 94 }
95 95
96 void BuildStoreAndLower(const Operator* op, const Operator* store_op, 96 void BuildStoreAndLower(const Operator* op, const Operator* store_op,
97 void* location) { 97 void* location) {
98 // We build a graph by hand here, because the raw machine assembler 98 // We build a graph by hand here, because the raw machine assembler
99 // does not add the correct control and effect nodes. 99 // does not add the correct control and effect nodes.
100 Node* p0 = this->Parameter(0); 100 Node* p0 = this->Parameter(0);
101 Node* change = this->graph()->NewNode(op, p0); 101 Node* change = this->graph()->NewNode(op, p0);
102 Node* store = this->graph()->NewNode( 102 Node* store = this->graph()->NewNode(
103 store_op, this->PointerConstant(location), this->Int32Constant(0), 103 store_op, this->PointerConstant(location), this->Int32Constant(0),
104 change, this->start(), this->start()); 104 change, this->start(), this->start());
105 Node* ret = this->graph()->NewNode( 105 Node* ret = this->graph()->NewNode(
106 this->common()->Return(), this->Int32Constant(0), store, this->start()); 106 this->common()->Return(), this->Int32Constant(0), store, this->start());
107 Node* end = this->graph()->NewNode(this->common()->End(), ret); 107 Node* end = this->graph()->NewNode(this->common()->End(1), ret);
108 this->graph()->SetEnd(end); 108 this->graph()->SetEnd(end);
109 LowerChange(change); 109 LowerChange(change);
110 } 110 }
111 111
112 void BuildLoadAndLower(const Operator* op, const Operator* load_op, 112 void BuildLoadAndLower(const Operator* op, const Operator* load_op,
113 void* location) { 113 void* location) {
114 // We build a graph by hand here, because the raw machine assembler 114 // We build a graph by hand here, because the raw machine assembler
115 // does not add the correct control and effect nodes. 115 // does not add the correct control and effect nodes.
116 Node* load = this->graph()->NewNode( 116 Node* load = this->graph()->NewNode(
117 load_op, this->PointerConstant(location), this->Int32Constant(0), 117 load_op, this->PointerConstant(location), this->Int32Constant(0),
118 this->start(), this->start()); 118 this->start(), this->start());
119 Node* change = this->graph()->NewNode(op, load); 119 Node* change = this->graph()->NewNode(op, load);
120 Node* ret = this->graph()->NewNode(this->common()->Return(), change, 120 Node* ret = this->graph()->NewNode(this->common()->Return(), change,
121 this->start(), this->start()); 121 this->start(), this->start());
122 Node* end = this->graph()->NewNode(this->common()->End(), ret); 122 Node* end = this->graph()->NewNode(this->common()->End(1), ret);
123 this->graph()->SetEnd(end); 123 this->graph()->SetEnd(end);
124 LowerChange(change); 124 LowerChange(change);
125 } 125 }
126 126
127 void LowerChange(Node* change) { 127 void LowerChange(Node* change) {
128 // Run the graph reducer with changes lowering on a single node. 128 // Run the graph reducer with changes lowering on a single node.
129 Typer typer(this->isolate(), this->graph(), Handle<Context>()); 129 Typer typer(this->isolate(), this->graph(), Handle<Context>());
130 typer.Run(); 130 typer.Run();
131 ChangeLowering change_lowering(&jsgraph); 131 ChangeLowering change_lowering(&jsgraph);
132 SelectLowering select_lowering(this->graph(), this->common()); 132 SelectLowering select_lowering(this->graph(), this->common());
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 387
388 input = *i; 388 input = *i;
389 Object* result = t.CallWithPotentialGC<Object>(); 389 Object* result = t.CallWithPotentialGC<Object>();
390 t.CheckNumber(input, result); 390 t.CheckNumber(input, result);
391 } 391 }
392 } 392 }
393 } 393 }
394 } 394 }
395 395
396 #endif // V8_TURBOFAN_BACKEND 396 #endif // V8_TURBOFAN_BACKEND
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698