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

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

Issue 552653003: [turbofan] Fix the node matchers. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address nit. Created 6 years, 3 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 | Annotate | Revision Log
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 "src/v8.h" 5 #include "src/v8.h"
6 #include "test/cctest/cctest.h" 6 #include "test/cctest/cctest.h"
7 7
8 #include "src/compiler/graph-inl.h" 8 #include "src/compiler/graph-inl.h"
9 #include "src/compiler/js-typed-lowering.h" 9 #include "src/compiler/js-typed-lowering.h"
10 #include "src/compiler/node-properties-inl.h" 10 #include "src/compiler/node-properties-inl.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 return graph.NewNode(javascript.ToNumber(), node, context(), node, 101 return graph.NewNode(javascript.ToNumber(), node, context(), node,
102 control()); 102 control());
103 } 103 }
104 104
105 void CheckEffectInput(Node* effect, Node* use) { 105 void CheckEffectInput(Node* effect, Node* use) {
106 CHECK_EQ(effect, NodeProperties::GetEffectInput(use)); 106 CHECK_EQ(effect, NodeProperties::GetEffectInput(use));
107 } 107 }
108 108
109 void CheckInt32Constant(int32_t expected, Node* result) { 109 void CheckInt32Constant(int32_t expected, Node* result) {
110 CHECK_EQ(IrOpcode::kInt32Constant, result->opcode()); 110 CHECK_EQ(IrOpcode::kInt32Constant, result->opcode());
111 CHECK_EQ(expected, ValueOf<int32_t>(result->op())); 111 CHECK_EQ(expected, OpParameter<int32_t>(result));
112 } 112 }
113 113
114 void CheckNumberConstant(double expected, Node* result) { 114 void CheckNumberConstant(double expected, Node* result) {
115 CHECK_EQ(IrOpcode::kNumberConstant, result->opcode()); 115 CHECK_EQ(IrOpcode::kNumberConstant, result->opcode());
116 CHECK_EQ(expected, ValueOf<double>(result->op())); 116 CHECK_EQ(expected, OpParameter<double>(result));
117 } 117 }
118 118
119 void CheckNaN(Node* result) { 119 void CheckNaN(Node* result) {
120 CHECK_EQ(IrOpcode::kNumberConstant, result->opcode()); 120 CHECK_EQ(IrOpcode::kNumberConstant, result->opcode());
121 double value = ValueOf<double>(result->op()); 121 double value = OpParameter<double>(result);
122 CHECK(std::isnan(value)); 122 CHECK(std::isnan(value));
123 } 123 }
124 124
125 void CheckTrue(Node* result) { 125 void CheckTrue(Node* result) {
126 CheckHandle(isolate->factory()->true_value(), result); 126 CheckHandle(isolate->factory()->true_value(), result);
127 } 127 }
128 128
129 void CheckFalse(Node* result) { 129 void CheckFalse(Node* result) {
130 CheckHandle(isolate->factory()->false_value(), result); 130 CheckHandle(isolate->factory()->false_value(), result);
131 } 131 }
132 132
133 void CheckHandle(Handle<Object> expected, Node* result) { 133 void CheckHandle(Handle<Object> expected, Node* result) {
134 CHECK_EQ(IrOpcode::kHeapConstant, result->opcode()); 134 CHECK_EQ(IrOpcode::kHeapConstant, result->opcode());
135 Handle<Object> value = ValueOf<Handle<Object> >(result->op()); 135 Handle<Object> value = OpParameter<Unique<Object> >(result).handle();
136 CHECK_EQ(*expected, *value); 136 CHECK_EQ(*expected, *value);
137 } 137 }
138 }; 138 };
139 139
140 static Type* kStringTypes[] = {Type::InternalizedString(), Type::OtherString(), 140 static Type* kStringTypes[] = {Type::InternalizedString(), Type::OtherString(),
141 Type::String()}; 141 Type::String()};
142 142
143 143
144 static Type* kInt32Types[] = { 144 static Type* kInt32Types[] = {
145 Type::UnsignedSmall(), Type::OtherSignedSmall(), Type::OtherUnsigned31(), 145 Type::UnsignedSmall(), Type::OtherSignedSmall(), Type::OtherUnsigned31(),
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 } 233 }
234 234
235 235
236 static void CheckToI32(Node* old_input, Node* new_input, bool is_signed) { 236 static void CheckToI32(Node* old_input, Node* new_input, bool is_signed) {
237 Type* old_type = NodeProperties::GetBounds(old_input).upper; 237 Type* old_type = NodeProperties::GetBounds(old_input).upper;
238 Type* expected_type = I32Type(is_signed); 238 Type* expected_type = I32Type(is_signed);
239 if (old_type->Is(expected_type)) { 239 if (old_type->Is(expected_type)) {
240 CHECK_EQ(old_input, new_input); 240 CHECK_EQ(old_input, new_input);
241 } else if (new_input->opcode() == IrOpcode::kNumberConstant) { 241 } else if (new_input->opcode() == IrOpcode::kNumberConstant) {
242 CHECK(NodeProperties::GetBounds(new_input).upper->Is(expected_type)); 242 CHECK(NodeProperties::GetBounds(new_input).upper->Is(expected_type));
243 double v = ValueOf<double>(new_input->op()); 243 double v = OpParameter<double>(new_input);
244 double e = static_cast<double>(is_signed ? FastD2I(v) : FastD2UI(v)); 244 double e = static_cast<double>(is_signed ? FastD2I(v) : FastD2UI(v));
245 CHECK_EQ(e, v); 245 CHECK_EQ(e, v);
246 } else { 246 } else {
247 CHECK_EQ(NumberToI32(is_signed), new_input->opcode()); 247 CHECK_EQ(NumberToI32(is_signed), new_input->opcode());
248 } 248 }
249 } 249 }
250 250
251 251
252 // A helper class for testing lowering of bitwise shift operators. 252 // A helper class for testing lowering of bitwise shift operators.
253 class JSBitwiseShiftTypedLoweringTester : public JSTypedLoweringTester { 253 class JSBitwiseShiftTypedLoweringTester : public JSTypedLoweringTester {
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 CHECK_EQ(p1, r->InputAt(0)); 1343 CHECK_EQ(p1, r->InputAt(0));
1344 CHECK_EQ(p0, r->InputAt(1)); 1344 CHECK_EQ(p0, r->InputAt(1));
1345 } else { 1345 } else {
1346 CHECK_EQ(p0, r->InputAt(0)); 1346 CHECK_EQ(p0, r->InputAt(0));
1347 CHECK_EQ(p1, r->InputAt(1)); 1347 CHECK_EQ(p1, r->InputAt(1));
1348 } 1348 }
1349 } 1349 }
1350 } 1350 }
1351 } 1351 }
1352 } 1352 }
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-js-context-specialization.cc ('k') | test/cctest/compiler/test-machine-operator-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698