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

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

Issue 1656863002: [Interpreter] Adds support for with statement to interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed cctest.status. Created 4 years, 10 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
« no previous file with comments | « test/cctest/cctest.status ('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 #include <utility> 5 #include <utility>
6 6
7 #include "src/compiler/pipeline.h" 7 #include "src/compiler/pipeline.h"
8 #include "src/execution.h" 8 #include "src/execution.h"
9 #include "src/handles.h" 9 #include "src/handles.h"
10 #include "src/interpreter/bytecode-array-builder.h" 10 #include "src/interpreter/bytecode-array-builder.h"
(...skipping 2614 matching lines...) Expand 10 before | Expand all | Expand 10 after
2625 2625
2626 BytecodeGraphTester tester(isolate, zone, script.start()); 2626 BytecodeGraphTester tester(isolate, zone, script.start());
2627 auto callable = tester.GetCallable<>(); 2627 auto callable = tester.GetCallable<>();
2628 Handle<Object> return_value = callable().ToHandleChecked(); 2628 Handle<Object> return_value = callable().ToHandleChecked();
2629 CHECK(return_value->SameValue(*snippets[i].return_value())); 2629 CHECK(return_value->SameValue(*snippets[i].return_value()));
2630 } 2630 }
2631 2631
2632 FLAG_harmony_do_expressions = old_flag; 2632 FLAG_harmony_do_expressions = old_flag;
2633 } 2633 }
2634 2634
2635 TEST(BytecodeGraphBuilderWithStatement) {
2636 HandleAndZoneScope scope;
2637 Isolate* isolate = scope.main_isolate();
2638 Zone* zone = scope.main_zone();
2639
2640 ExpectedSnippet<0> snippets[] = {
2641 {"with({x:42}) return x;", {handle(Smi::FromInt(42), isolate)}},
2642 {"with({}) { var y = 10; return y;}",
2643 {handle(Smi::FromInt(10), isolate)}},
2644 {"var y = {x:42};"
2645 " function inner() {"
2646 " var x = 20;"
2647 " with(y) return x;"
2648 "}"
2649 "return inner();",
2650 {handle(Smi::FromInt(42), isolate)}},
2651 {"var y = {x:42};"
2652 " function inner(o) {"
2653 " var x = 20;"
2654 " with(o) return x;"
2655 "}"
2656 "return inner(y);",
2657 {handle(Smi::FromInt(42), isolate)}},
2658 };
2659
2660 for (size_t i = 0; i < arraysize(snippets); i++) {
2661 ScopedVector<char> script(1024);
2662 SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
2663 snippets[i].code_snippet, kFunctionName);
2664
2665 BytecodeGraphTester tester(isolate, zone, script.start());
2666 auto callable = tester.GetCallable<>();
2667 Handle<Object> return_value = callable().ToHandleChecked();
2668 CHECK(return_value->SameValue(*snippets[i].return_value()));
2669 }
2670 }
2671
2635 } // namespace compiler 2672 } // namespace compiler
2636 } // namespace internal 2673 } // namespace internal
2637 } // namespace v8 2674 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/cctest.status ('k') | test/cctest/interpreter/test-bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698