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

Side by Side Diff: test/cctest/compiler/test-run-bytecode-graph-builder.cc

Issue 1471913004: Revert of [Interpreter] Add CreateClosure to BytecodeGraphBuilder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
« no previous file with comments | « src/interpreter/interpreter.cc ('k') | test/cctest/interpreter/test-bytecode-generator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // TODO(jochen): Remove this after the setting is turned on globally. 5 // TODO(jochen): Remove this after the setting is turned on globally.
6 #define V8_IMMINENT_DEPRECATION_WARNINGS 6 #define V8_IMMINENT_DEPRECATION_WARNINGS
7 7
8 #include <utility> 8 #include <utility>
9 9
10 #include "src/compiler/pipeline.h" 10 #include "src/compiler/pipeline.h"
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]); 568 size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]);
569 for (size_t i = 0; i < num_snippets; i++) { 569 for (size_t i = 0; i < num_snippets; i++) {
570 BytecodeGraphTester tester(isolate, zone, snippets[i].code_snippet); 570 BytecodeGraphTester tester(isolate, zone, snippets[i].code_snippet);
571 auto callable = tester.GetCallable<>(); 571 auto callable = tester.GetCallable<>();
572 Handle<Object> return_value = callable().ToHandleChecked(); 572 Handle<Object> return_value = callable().ToHandleChecked();
573 CHECK(return_value->SameValue(*snippets[i].return_value())); 573 CHECK(return_value->SameValue(*snippets[i].return_value()));
574 } 574 }
575 } 575 }
576 576
577 577
578 TEST(BytecodeGraphBuilderCreateClosure) {
579 HandleAndZoneScope scope;
580 Isolate* isolate = scope.main_isolate();
581 Zone* zone = scope.main_zone();
582 Factory* factory = isolate->factory();
583
584 ExpectedSnippet<0> snippets[] = {
585 {"function f() {\n"
586 " function counter() { this.count = 20; }\n"
587 " var c = new counter();\n"
588 " return c.count;\n"
589 "}; f()",
590 {factory->NewNumberFromInt(20)}},
591 {"function f() {\n"
592 " function counter(arg0) { this.count = 17; this.x = arg0; }\n"
593 " var c = new counter(6);\n"
594 " return c.count + c.x;\n"
595 "}; f()",
596 {factory->NewNumberFromInt(23)}},
597 {"function f() {\n"
598 " function counter(arg0, arg1) {\n"
599 " this.count = 17; this.x = arg0; this.y = arg1;\n"
600 " }\n"
601 " var c = new counter(3, 5);\n"
602 " return c.count + c.x + c.y;\n"
603 "}; f()",
604 {factory->NewNumberFromInt(25)}},
605 };
606
607 size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]);
608 for (size_t i = 0; i < num_snippets; i++) {
609 BytecodeGraphTester tester(isolate, zone, snippets[i].code_snippet);
610 auto callable = tester.GetCallable<>();
611 Handle<Object> return_value = callable().ToHandleChecked();
612 CHECK(return_value->SameValue(*snippets[i].return_value()));
613 }
614 }
615
616
617 TEST(BytecodeGraphBuilderCallRuntime) { 578 TEST(BytecodeGraphBuilderCallRuntime) {
618 HandleAndZoneScope scope; 579 HandleAndZoneScope scope;
619 Isolate* isolate = scope.main_isolate(); 580 Isolate* isolate = scope.main_isolate();
620 Zone* zone = scope.main_zone(); 581 Zone* zone = scope.main_zone();
621 Factory* factory = isolate->factory(); 582 Factory* factory = isolate->factory();
622 583
623 ExpectedSnippet<1> snippets[] = { 584 ExpectedSnippet<1> snippets[] = {
624 {"function f(arg0) { return %MaxSmi(); }\nf()", 585 {"function f(arg0) { return %MaxSmi(); }\nf()",
625 {factory->NewNumberFromInt(Smi::kMaxValue), factory->undefined_value()}}, 586 {factory->NewNumberFromInt(Smi::kMaxValue), factory->undefined_value()}},
626 {"function f(arg0) { return %IsArray(arg0) }\nf(undefined)", 587 {"function f(arg0) { return %IsArray(arg0) }\nf(undefined)",
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 auto callable = tester.GetCallable<Handle<Object>>(); 758 auto callable = tester.GetCallable<Handle<Object>>();
798 Handle<Object> return_value = 759 Handle<Object> return_value =
799 callable(snippets[i].parameter(0)).ToHandleChecked(); 760 callable(snippets[i].parameter(0)).ToHandleChecked();
800 CHECK(return_value->SameValue(*snippets[i].return_value())); 761 CHECK(return_value->SameValue(*snippets[i].return_value()));
801 } 762 }
802 } 763 }
803 764
804 } // namespace compiler 765 } // namespace compiler
805 } // namespace internal 766 } // namespace internal
806 } // namespace v8 767 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/interpreter.cc ('k') | test/cctest/interpreter/test-bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698