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

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

Issue 1513543003: [turbofan] Make MachineType a pair of enums. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Moar rebase Created 5 years 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/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/compiler/access-builder.h" 6 #include "src/compiler/access-builder.h"
7 #include "src/compiler/js-graph.h" 7 #include "src/compiler/js-graph.h"
8 #include "src/compiler/js-operator.h" 8 #include "src/compiler/js-operator.h"
9 #include "src/compiler/js-typed-lowering.h" 9 #include "src/compiler/js-typed-lowering.h"
10 #include "src/compiler/machine-operator.h" 10 #include "src/compiler/machine-operator.h"
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 350
351 TEST_F(JSTypedLoweringTest, JSToObjectWithAny) { 351 TEST_F(JSTypedLoweringTest, JSToObjectWithAny) {
352 Node* const input = Parameter(Type::Any(), 0); 352 Node* const input = Parameter(Type::Any(), 0);
353 Node* const context = Parameter(Type::Any(), 1); 353 Node* const context = Parameter(Type::Any(), 1);
354 Node* const frame_state = EmptyFrameState(); 354 Node* const frame_state = EmptyFrameState();
355 Node* const effect = graph()->start(); 355 Node* const effect = graph()->start();
356 Node* const control = graph()->start(); 356 Node* const control = graph()->start();
357 Reduction r = Reduce(graph()->NewNode(javascript()->ToObject(), input, 357 Reduction r = Reduce(graph()->NewNode(javascript()->ToObject(), input,
358 context, frame_state, effect, control)); 358 context, frame_state, effect, control));
359 ASSERT_TRUE(r.Changed()); 359 ASSERT_TRUE(r.Changed());
360 EXPECT_THAT(r.replacement(), IsPhi(kMachAnyTagged, _, _, _)); 360 EXPECT_THAT(r.replacement(), IsPhi(MachineRepresentation::kTagged, _, _, _));
361 } 361 }
362 362
363 363
364 TEST_F(JSTypedLoweringTest, JSToObjectWithReceiver) { 364 TEST_F(JSTypedLoweringTest, JSToObjectWithReceiver) {
365 Node* const input = Parameter(Type::Receiver(), 0); 365 Node* const input = Parameter(Type::Receiver(), 0);
366 Node* const context = Parameter(Type::Any(), 1); 366 Node* const context = Parameter(Type::Any(), 1);
367 Node* const frame_state = EmptyFrameState(); 367 Node* const frame_state = EmptyFrameState();
368 Node* const effect = graph()->start(); 368 Node* const effect = graph()->start();
369 Node* const control = graph()->start(); 369 Node* const control = graph()->start();
370 Reduction r = Reduce(graph()->NewNode(javascript()->ToObject(), input, 370 Reduction r = Reduce(graph()->NewNode(javascript()->ToObject(), input,
371 context, frame_state, effect, control)); 371 context, frame_state, effect, control));
372 ASSERT_TRUE(r.Changed()); 372 ASSERT_TRUE(r.Changed());
373 EXPECT_EQ(input, r.replacement()); 373 EXPECT_EQ(input, r.replacement());
374 } 374 }
375 375
376 376
377 // ----------------------------------------------------------------------------- 377 // -----------------------------------------------------------------------------
378 // JSToString 378 // JSToString
379 379
380 380
381 TEST_F(JSTypedLoweringTest, JSToStringWithBoolean) { 381 TEST_F(JSTypedLoweringTest, JSToStringWithBoolean) {
382 Node* const input = Parameter(Type::Boolean(), 0); 382 Node* const input = Parameter(Type::Boolean(), 0);
383 Node* const context = Parameter(Type::Any(), 1); 383 Node* const context = Parameter(Type::Any(), 1);
384 Node* const frame_state = EmptyFrameState(); 384 Node* const frame_state = EmptyFrameState();
385 Node* const effect = graph()->start(); 385 Node* const effect = graph()->start();
386 Node* const control = graph()->start(); 386 Node* const control = graph()->start();
387 Reduction r = Reduce(graph()->NewNode(javascript()->ToString(), input, 387 Reduction r = Reduce(graph()->NewNode(javascript()->ToString(), input,
388 context, frame_state, effect, control)); 388 context, frame_state, effect, control));
389 ASSERT_TRUE(r.Changed()); 389 ASSERT_TRUE(r.Changed());
390 EXPECT_THAT( 390 EXPECT_THAT(r.replacement(),
391 r.replacement(), 391 IsSelect(MachineRepresentation::kTagged, input,
392 IsSelect(kMachAnyTagged, input, IsHeapConstant(factory()->true_string()), 392 IsHeapConstant(factory()->true_string()),
393 IsHeapConstant(factory()->false_string()))); 393 IsHeapConstant(factory()->false_string())));
394 } 394 }
395 395
396 396
397 // ----------------------------------------------------------------------------- 397 // -----------------------------------------------------------------------------
398 // JSStrictEqual 398 // JSStrictEqual
399 399
400 400
401 TEST_F(JSTypedLoweringTest, JSStrictEqualWithTheHole) { 401 TEST_F(JSTypedLoweringTest, JSStrictEqualWithTheHole) {
402 Node* const the_hole = HeapConstant(factory()->the_hole_value()); 402 Node* const the_hole = HeapConstant(factory()->the_hole_value());
403 Node* const context = UndefinedConstant(); 403 Node* const context = UndefinedConstant();
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 Node* dummy = graph()->NewNode(javascript()->ToObject(), instanceOf, context, 1220 Node* dummy = graph()->NewNode(javascript()->ToObject(), instanceOf, context,
1221 frame_state, effect, control); 1221 frame_state, effect, control);
1222 Reduction r = Reduce(instanceOf); 1222 Reduction r = Reduce(instanceOf);
1223 ASSERT_FALSE(r.Changed()); 1223 ASSERT_FALSE(r.Changed());
1224 ASSERT_EQ(instanceOf, dummy->InputAt(0)); 1224 ASSERT_EQ(instanceOf, dummy->InputAt(0));
1225 } 1225 }
1226 1226
1227 } // namespace compiler 1227 } // namespace compiler
1228 } // namespace internal 1228 } // namespace internal
1229 } // namespace v8 1229 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/js-intrinsic-lowering-unittest.cc ('k') | test/unittests/compiler/linkage-tail-call-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698