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

Side by Side Diff: test/unittests/compiler/graph-reducer-unittest.cc

Issue 2207533002: [turbofan] Remove IfExceptionHint from exception projections. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. Created 4 years, 4 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 "src/compiler/common-operator.h" 5 #include "src/compiler/common-operator.h"
6 #include "src/compiler/graph.h" 6 #include "src/compiler/graph.h"
7 #include "src/compiler/node.h" 7 #include "src/compiler/node.h"
8 #include "src/compiler/node-properties.h" 8 #include "src/compiler/node-properties.h"
9 #include "src/compiler/operator.h" 9 #include "src/compiler/operator.h"
10 #include "test/unittests/compiler/graph-reducer-unittest.h" 10 #include "test/unittests/compiler/graph-reducer-unittest.h"
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 using AdvancedReducer::ReplaceWithValue; 276 using AdvancedReducer::ReplaceWithValue;
277 }; 277 };
278 278
279 const Operator kMockOperator(IrOpcode::kDead, Operator::kNoProperties, 279 const Operator kMockOperator(IrOpcode::kDead, Operator::kNoProperties,
280 "MockOperator", 0, 0, 0, 1, 0, 0); 280 "MockOperator", 0, 0, 0, 1, 0, 0);
281 const Operator kMockOpEffect(IrOpcode::kDead, Operator::kNoProperties, 281 const Operator kMockOpEffect(IrOpcode::kDead, Operator::kNoProperties,
282 "MockOpEffect", 0, 1, 0, 1, 1, 0); 282 "MockOpEffect", 0, 1, 0, 1, 1, 0);
283 const Operator kMockOpControl(IrOpcode::kDead, Operator::kNoProperties, 283 const Operator kMockOpControl(IrOpcode::kDead, Operator::kNoProperties,
284 "MockOpControl", 0, 0, 1, 1, 0, 1); 284 "MockOpControl", 0, 0, 1, 1, 0, 1);
285 285
286 const IfExceptionHint kNoHint = IfExceptionHint::kLocallyCaught;
287
288 } // namespace 286 } // namespace
289 287
290 288
291 TEST_F(AdvancedReducerTest, ReplaceWithValue_ValueUse) { 289 TEST_F(AdvancedReducerTest, ReplaceWithValue_ValueUse) {
292 CommonOperatorBuilder common(zone()); 290 CommonOperatorBuilder common(zone());
293 Node* node = graph()->NewNode(&kMockOperator); 291 Node* node = graph()->NewNode(&kMockOperator);
294 Node* start = graph()->NewNode(common.Start(1)); 292 Node* start = graph()->NewNode(common.Start(1));
295 Node* use_value = graph()->NewNode(common.Return(), node, start, start); 293 Node* use_value = graph()->NewNode(common.Return(), node, start, start);
296 Node* replacement = graph()->NewNode(&kMockOperator); 294 Node* replacement = graph()->NewNode(&kMockOperator);
297 GraphReducer graph_reducer(zone(), graph(), nullptr); 295 GraphReducer graph_reducer(zone(), graph(), nullptr);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 } 339 }
342 340
343 341
344 TEST_F(AdvancedReducerTest, ReplaceWithValue_ControlUse2) { 342 TEST_F(AdvancedReducerTest, ReplaceWithValue_ControlUse2) {
345 CommonOperatorBuilder common(zone()); 343 CommonOperatorBuilder common(zone());
346 Node* start = graph()->NewNode(common.Start(1)); 344 Node* start = graph()->NewNode(common.Start(1));
347 Node* effect = graph()->NewNode(&kMockOperator); 345 Node* effect = graph()->NewNode(&kMockOperator);
348 Node* dead = graph()->NewNode(&kMockOperator); 346 Node* dead = graph()->NewNode(&kMockOperator);
349 Node* node = graph()->NewNode(&kMockOpControl, start); 347 Node* node = graph()->NewNode(&kMockOpControl, start);
350 Node* success = graph()->NewNode(common.IfSuccess(), node); 348 Node* success = graph()->NewNode(common.IfSuccess(), node);
351 Node* exception = graph()->NewNode(common.IfException(kNoHint), effect, node); 349 Node* exception = graph()->NewNode(common.IfException(), effect, node);
352 Node* use_control = graph()->NewNode(common.Merge(1), success); 350 Node* use_control = graph()->NewNode(common.Merge(1), success);
353 Node* replacement = graph()->NewNode(&kMockOperator); 351 Node* replacement = graph()->NewNode(&kMockOperator);
354 GraphReducer graph_reducer(zone(), graph(), dead); 352 GraphReducer graph_reducer(zone(), graph(), dead);
355 ReplaceWithValueReducer r(&graph_reducer); 353 ReplaceWithValueReducer r(&graph_reducer);
356 r.ReplaceWithValue(node, replacement); 354 r.ReplaceWithValue(node, replacement);
357 EXPECT_EQ(start, use_control->InputAt(0)); 355 EXPECT_EQ(start, use_control->InputAt(0));
358 EXPECT_EQ(dead, exception->InputAt(1)); 356 EXPECT_EQ(dead, exception->InputAt(1));
359 EXPECT_EQ(0, node->UseCount()); 357 EXPECT_EQ(0, node->UseCount());
360 EXPECT_EQ(2, start->UseCount()); 358 EXPECT_EQ(2, start->UseCount());
361 EXPECT_EQ(1, dead->UseCount()); 359 EXPECT_EQ(1, dead->UseCount());
362 EXPECT_EQ(0, replacement->UseCount()); 360 EXPECT_EQ(0, replacement->UseCount());
363 EXPECT_THAT(start->uses(), UnorderedElementsAre(use_control, node)); 361 EXPECT_THAT(start->uses(), UnorderedElementsAre(use_control, node));
364 EXPECT_THAT(dead->uses(), ElementsAre(exception)); 362 EXPECT_THAT(dead->uses(), ElementsAre(exception));
365 } 363 }
366 364
367 365
368 TEST_F(AdvancedReducerTest, ReplaceWithValue_ControlUse3) { 366 TEST_F(AdvancedReducerTest, ReplaceWithValue_ControlUse3) {
369 CommonOperatorBuilder common(zone()); 367 CommonOperatorBuilder common(zone());
370 Node* start = graph()->NewNode(common.Start(1)); 368 Node* start = graph()->NewNode(common.Start(1));
371 Node* effect = graph()->NewNode(&kMockOperator); 369 Node* effect = graph()->NewNode(&kMockOperator);
372 Node* dead = graph()->NewNode(&kMockOperator); 370 Node* dead = graph()->NewNode(&kMockOperator);
373 Node* node = graph()->NewNode(&kMockOpControl, start); 371 Node* node = graph()->NewNode(&kMockOpControl, start);
374 Node* success = graph()->NewNode(common.IfSuccess(), node); 372 Node* success = graph()->NewNode(common.IfSuccess(), node);
375 Node* exception = graph()->NewNode(common.IfException(kNoHint), effect, node); 373 Node* exception = graph()->NewNode(common.IfException(), effect, node);
376 Node* use_control = graph()->NewNode(common.Merge(1), success); 374 Node* use_control = graph()->NewNode(common.Merge(1), success);
377 Node* replacement = graph()->NewNode(&kMockOperator); 375 Node* replacement = graph()->NewNode(&kMockOperator);
378 GraphReducer graph_reducer(zone(), graph(), dead); 376 GraphReducer graph_reducer(zone(), graph(), dead);
379 ReplaceWithValueReducer r(&graph_reducer); 377 ReplaceWithValueReducer r(&graph_reducer);
380 r.ReplaceWithValue(node, replacement); 378 r.ReplaceWithValue(node, replacement);
381 EXPECT_EQ(start, use_control->InputAt(0)); 379 EXPECT_EQ(start, use_control->InputAt(0));
382 EXPECT_EQ(dead, exception->InputAt(1)); 380 EXPECT_EQ(dead, exception->InputAt(1));
383 EXPECT_EQ(0, node->UseCount()); 381 EXPECT_EQ(0, node->UseCount());
384 EXPECT_EQ(2, start->UseCount()); 382 EXPECT_EQ(2, start->UseCount());
385 EXPECT_EQ(1, dead->UseCount()); 383 EXPECT_EQ(1, dead->UseCount());
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 EXPECT_EQ(&kOpC0, n1->op()); 850 EXPECT_EQ(&kOpC0, n1->op());
853 EXPECT_EQ(&kOpC1, end->op()); 851 EXPECT_EQ(&kOpC1, end->op());
854 EXPECT_EQ(n1, end->InputAt(0)); 852 EXPECT_EQ(n1, end->InputAt(0));
855 } 853 }
856 } 854 }
857 } 855 }
858 856
859 } // namespace compiler 857 } // namespace compiler
860 } // namespace internal 858 } // namespace internal
861 } // namespace v8 859 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/dead-code-elimination-unittest.cc ('k') | test/unittests/compiler/node-properties-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698