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

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

Issue 1679313002: [interpreter] Make it possible to optimize without parse. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_interpreter-language-mode
Patch Set: 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 | « src/compiler/pipeline.cc ('k') | no next file » | 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 64
65 class BytecodeGraphTester { 65 class BytecodeGraphTester {
66 public: 66 public:
67 BytecodeGraphTester(Isolate* isolate, Zone* zone, const char* script, 67 BytecodeGraphTester(Isolate* isolate, Zone* zone, const char* script,
68 const char* filter = kFunctionName) 68 const char* filter = kFunctionName)
69 : isolate_(isolate), zone_(zone), script_(script) { 69 : isolate_(isolate), zone_(zone), script_(script) {
70 i::FLAG_ignition = true; 70 i::FLAG_ignition = true;
71 i::FLAG_always_opt = false; 71 i::FLAG_always_opt = false;
72 i::FLAG_allow_natives_syntax = true; 72 i::FLAG_allow_natives_syntax = true;
73 i::FLAG_loop_assignment_analysis = false;
73 // Set ignition filter flag via SetFlagsFromString to avoid double-free 74 // Set ignition filter flag via SetFlagsFromString to avoid double-free
74 // (or potential leak with StrDup() based on ownership confusion). 75 // (or potential leak with StrDup() based on ownership confusion).
75 ScopedVector<char> ignition_filter(64); 76 ScopedVector<char> ignition_filter(64);
76 SNPrintF(ignition_filter, "--ignition-filter=%s", filter); 77 SNPrintF(ignition_filter, "--ignition-filter=%s", filter);
77 FlagList::SetFlagsFromString(ignition_filter.start(), 78 FlagList::SetFlagsFromString(ignition_filter.start(),
78 ignition_filter.length()); 79 ignition_filter.length());
79 // Ensure handler table is generated. 80 // Ensure handler table is generated.
80 isolate->interpreter()->Initialize(); 81 isolate->interpreter()->Initialize();
81 } 82 }
82 virtual ~BytecodeGraphTester() {} 83 virtual ~BytecodeGraphTester() {}
(...skipping 28 matching lines...) Expand all
111 Handle<JSFunction> GetFunction(const char* functionName) { 112 Handle<JSFunction> GetFunction(const char* functionName) {
112 CompileRun(script_); 113 CompileRun(script_);
113 Local<Function> api_function = Local<Function>::Cast( 114 Local<Function> api_function = Local<Function>::Cast(
114 CcTest::global() 115 CcTest::global()
115 ->Get(CcTest::isolate()->GetCurrentContext(), v8_str(functionName)) 116 ->Get(CcTest::isolate()->GetCurrentContext(), v8_str(functionName))
116 .ToLocalChecked()); 117 .ToLocalChecked());
117 Handle<JSFunction> function = 118 Handle<JSFunction> function =
118 Handle<JSFunction>::cast(v8::Utils::OpenHandle(*api_function)); 119 Handle<JSFunction>::cast(v8::Utils::OpenHandle(*api_function));
119 CHECK(function->shared()->HasBytecodeArray()); 120 CHECK(function->shared()->HasBytecodeArray());
120 121
122 // TODO(mstarzinger): We should be able to prime CompilationInfo without
123 // having to instantiate a ParseInfo first. Fix this!
121 ParseInfo parse_info(zone_, function); 124 ParseInfo parse_info(zone_, function);
122 125
123 CompilationInfo compilation_info(&parse_info); 126 CompilationInfo compilation_info(&parse_info);
124 compilation_info.SetOptimizing(BailoutId::None(), Handle<Code>()); 127 compilation_info.SetOptimizing(BailoutId::None(), Handle<Code>());
125 compilation_info.MarkAsDeoptimizationEnabled(); 128 compilation_info.MarkAsDeoptimizationEnabled();
126 // TODO(mythria): Remove this step once parse_info is not needed.
127 CHECK(Compiler::ParseAndAnalyze(&parse_info));
128 compiler::Pipeline pipeline(&compilation_info); 129 compiler::Pipeline pipeline(&compilation_info);
129 Handle<Code> code = pipeline.GenerateCode(); 130 Handle<Code> code = pipeline.GenerateCode();
130 function->ReplaceCode(*code); 131 function->ReplaceCode(*code);
131 132
132 return function; 133 return function;
133 } 134 }
134 135
135 DISALLOW_COPY_AND_ASSIGN(BytecodeGraphTester); 136 DISALLOW_COPY_AND_ASSIGN(BytecodeGraphTester);
136 }; 137 };
137 138
(...skipping 2864 matching lines...) Expand 10 before | Expand all | Expand 10 after
3002 3003
3003 BytecodeGraphTester tester(isolate, zone, script.start()); 3004 BytecodeGraphTester tester(isolate, zone, script.start());
3004 auto callable = tester.GetCallable<>(); 3005 auto callable = tester.GetCallable<>();
3005 Handle<Object> return_value = callable().ToHandleChecked(); 3006 Handle<Object> return_value = callable().ToHandleChecked();
3006 CHECK(return_value->SameValue(*snippet.return_value())); 3007 CHECK(return_value->SameValue(*snippet.return_value()));
3007 } 3008 }
3008 3009
3009 } // namespace compiler 3010 } // namespace compiler
3010 } // namespace internal 3011 } // namespace internal
3011 } // namespace v8 3012 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/pipeline.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698