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

Side by Side Diff: test/cctest/compiler/function-tester.cc

Issue 2645403002: [Compiler] Enable use of seperate zones for parsing and compiling. (Closed)
Patch Set: Add back header Created 3 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/zone/zone.cc ('k') | test/cctest/compiler/test-linkage.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 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 "test/cctest/compiler/function-tester.h" 5 #include "test/cctest/compiler/function-tester.h"
6 6
7 #include "src/ast/ast-numbering.h" 7 #include "src/ast/ast-numbering.h"
8 #include "src/compilation-info.h" 8 #include "src/compilation-info.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 JSFunction* p = NULL; 149 JSFunction* p = NULL;
150 { // because of the implicit handle scope of FunctionTester. 150 { // because of the implicit handle scope of FunctionTester.
151 FunctionTester f(graph, param_count); 151 FunctionTester f(graph, param_count);
152 p = *f.function; 152 p = *f.function;
153 } 153 }
154 return Handle<JSFunction>(p); // allocated in outer handle scope. 154 return Handle<JSFunction>(p); // allocated in outer handle scope.
155 } 155 }
156 156
157 Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) { 157 Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) {
158 ParseInfo parse_info(handle(function->shared())); 158 ParseInfo parse_info(handle(function->shared()));
159 CompilationInfo info(&parse_info, function); 159 CompilationInfo info(parse_info.zone(), &parse_info, function);
160 160
161 info.SetOptimizing(); 161 info.SetOptimizing();
162 info.MarkAsDeoptimizationEnabled(); 162 info.MarkAsDeoptimizationEnabled();
163 if (flags_ & CompilationInfo::kInliningEnabled) { 163 if (flags_ & CompilationInfo::kInliningEnabled) {
164 info.MarkAsInliningEnabled(); 164 info.MarkAsInliningEnabled();
165 } 165 }
166 166
167 CHECK(Compiler::Compile(function, Compiler::CLEAR_EXCEPTION)); 167 CHECK(Compiler::Compile(function, Compiler::CLEAR_EXCEPTION));
168 if (info.shared_info()->HasBytecodeArray()) { 168 if (info.shared_info()->HasBytecodeArray()) {
169 info.MarkAsOptimizeFromBytecode(); 169 info.MarkAsOptimizeFromBytecode();
170 } else { 170 } else {
171 CHECK(Compiler::ParseAndAnalyze(info.parse_info())); 171 CHECK(Compiler::ParseAndAnalyze(info.parse_info()));
172 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); 172 CHECK(Compiler::EnsureDeoptimizationSupport(&info));
173 } 173 }
174 JSFunction::EnsureLiterals(function); 174 JSFunction::EnsureLiterals(function);
175 175
176 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info); 176 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info);
177 CHECK(!code.is_null()); 177 CHECK(!code.is_null());
178 info.dependencies()->Commit(code); 178 info.dependencies()->Commit(code);
179 info.context()->native_context()->AddOptimizedCode(*code); 179 info.context()->native_context()->AddOptimizedCode(*code);
180 function->ReplaceCode(*code); 180 function->ReplaceCode(*code);
181 return function; 181 return function;
182 } 182 }
183 183
184 // Compile the given machine graph instead of the source of the function 184 // Compile the given machine graph instead of the source of the function
185 // and replace the JSFunction's code with the result. 185 // and replace the JSFunction's code with the result.
186 Handle<JSFunction> FunctionTester::CompileGraph(Graph* graph) { 186 Handle<JSFunction> FunctionTester::CompileGraph(Graph* graph) {
187 ParseInfo parse_info(handle(function->shared())); 187 ParseInfo parse_info(handle(function->shared()));
188 CompilationInfo info(&parse_info, function); 188 CompilationInfo info(parse_info.zone(), &parse_info, function);
189 189
190 CHECK(parsing::ParseFunction(info.parse_info())); 190 CHECK(parsing::ParseFunction(info.parse_info()));
191 info.SetOptimizing(); 191 info.SetOptimizing();
192 192
193 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph); 193 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph);
194 CHECK(!code.is_null()); 194 CHECK(!code.is_null());
195 function->ReplaceCode(*code); 195 function->ReplaceCode(*code);
196 return function; 196 return function;
197 } 197 }
198 198
199 } // namespace compiler 199 } // namespace compiler
200 } // namespace internal 200 } // namespace internal
201 } // namespace v8 201 } // namespace v8
OLDNEW
« no previous file with comments | « src/zone/zone.cc ('k') | test/cctest/compiler/test-linkage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698