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

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

Issue 1459543003: [Interpreter] Add support for unary operators to bytecode graph builder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 <iostream> 5 #include <iostream>
6 6
7 #include "src/compiler/bytecode-graph-builder.h" 7 #include "src/compiler/bytecode-graph-builder.h"
8 #include "src/compiler/common-operator.h" 8 #include "src/compiler/common-operator.h"
9 #include "src/compiler/graph-visualizer.h" 9 #include "src/compiler/graph-visualizer.h"
10 #include "src/compiler/instruction.h" 10 #include "src/compiler/instruction.h"
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 Matcher<Node*> feedback_vector_matcher = IsFeedbackVector(start, start); 520 Matcher<Node*> feedback_vector_matcher = IsFeedbackVector(start, start);
521 Matcher<Node*> store_global_matcher = IsJSStoreGlobal( 521 Matcher<Node*> store_global_matcher = IsJSStoreGlobal(
522 name, value_matcher, feedback_vector_matcher, start, start); 522 name, value_matcher, feedback_vector_matcher, start, start);
523 523
524 EXPECT_THAT(ret, IsReturn(_, store_global_matcher, _)); 524 EXPECT_THAT(ret, IsReturn(_, store_global_matcher, _));
525 } 525 }
526 } 526 }
527 } 527 }
528 528
529 529
530 TEST_F(BytecodeGraphBuilderTest, LogicalNot) {
531 interpreter::BytecodeArrayBuilder array_builder(isolate(), zone());
532 array_builder.set_locals_count(1);
533 array_builder.set_context_count(0);
534 array_builder.set_parameter_count(2);
535 array_builder.LoadAccumulatorWithRegister(array_builder.Parameter(1))
536 .LogicalNot()
537 .Return();
538
539 FeedbackVectorSpec feedback_spec(zone());
540 Handle<TypeFeedbackVector> vector =
541 NewTypeFeedbackVector(isolate(), &feedback_spec);
542 Graph* graph = GetCompletedGraph(array_builder.ToBytecodeArray(), vector);
543
544 Node* ret = graph->end()->InputAt(0);
545 EXPECT_THAT(ret, IsReturn(IsJSUnaryNot(IsParameter(1)), _, _));
546 }
547
548
549 TEST_F(BytecodeGraphBuilderTest, TypeOf) {
550 interpreter::BytecodeArrayBuilder array_builder(isolate(), zone());
551 array_builder.set_locals_count(1);
552 array_builder.set_context_count(0);
553 array_builder.set_parameter_count(2);
554 array_builder.LoadAccumulatorWithRegister(array_builder.Parameter(1))
555 .TypeOf()
556 .Return();
557
558 FeedbackVectorSpec feedback_spec(zone());
559 Handle<TypeFeedbackVector> vector =
560 NewTypeFeedbackVector(isolate(), &feedback_spec);
561 Graph* graph = GetCompletedGraph(array_builder.ToBytecodeArray(), vector);
562
563 Node* ret = graph->end()->InputAt(0);
564 EXPECT_THAT(ret, IsReturn(IsJSTypeOf(IsParameter(1)), _, _));
565 }
566
567
568 TEST_F(BytecodeGraphBuilderTest, Delete) {
569 TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) {
570 interpreter::BytecodeArrayBuilder array_builder(isolate(), zone());
571 array_builder.set_locals_count(1);
572 array_builder.set_context_count(0);
573 array_builder.set_parameter_count(2);
574 Handle<Name> name = GetName(isolate(), "val");
575 array_builder.LoadLiteral(name)
576 .Delete(array_builder.Parameter(1), language_mode)
577 .Return();
578
579 FeedbackVectorSpec feedback_spec(zone());
580 Handle<TypeFeedbackVector> vector =
581 NewTypeFeedbackVector(isolate(), &feedback_spec);
582 Graph* graph = GetCompletedGraph(array_builder.ToBytecodeArray(), vector,
583 language_mode);
584
585 Node* start = graph->start();
586 Node* ret = graph->end()->InputAt(0);
587
588 Matcher<Node*> delete_matcher =
589 IsJSDeleteProperty(IsParameter(1), IsHeapConstant(name), start, start);
590 EXPECT_THAT(ret, IsReturn(delete_matcher, _, _));
591 }
592 }
593
530 } // namespace compiler 594 } // namespace compiler
531 } // namespace internal 595 } // namespace internal
532 } // namespace v8 596 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-run-bytecode-graph-builder.cc ('k') | test/unittests/compiler/node-test-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698