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

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

Issue 2394213003: Named all zones in the project (Closed)
Patch Set: Merge branch 'master' into zonenames Created 4 years, 2 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/compiler/code-assembler-tester.h ('k') | test/cctest/compiler/test-instruction.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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 int param_count) { 150 int param_count) {
151 JSFunction* p = NULL; 151 JSFunction* p = NULL;
152 { // because of the implicit handle scope of FunctionTester. 152 { // because of the implicit handle scope of FunctionTester.
153 FunctionTester f(graph, param_count); 153 FunctionTester f(graph, param_count);
154 p = *f.function; 154 p = *f.function;
155 } 155 }
156 return Handle<JSFunction>(p); // allocated in outer handle scope. 156 return Handle<JSFunction>(p); // allocated in outer handle scope.
157 } 157 }
158 158
159 Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) { 159 Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) {
160 Zone zone(function->GetIsolate()->allocator()); 160 Zone zone(function->GetIsolate()->allocator(), ZONE_NAME);
161 ParseInfo parse_info(&zone, handle(function->shared())); 161 ParseInfo parse_info(&zone, handle(function->shared()));
162 CompilationInfo info(&parse_info, function); 162 CompilationInfo info(&parse_info, function);
163 163
164 info.SetOptimizing(); 164 info.SetOptimizing();
165 info.MarkAsDeoptimizationEnabled(); 165 info.MarkAsDeoptimizationEnabled();
166 if (flags_ & CompilationInfo::kInliningEnabled) { 166 if (flags_ & CompilationInfo::kInliningEnabled) {
167 info.MarkAsInliningEnabled(); 167 info.MarkAsInliningEnabled();
168 } 168 }
169 if (Compiler::EnsureBytecode(&info)) { 169 if (Compiler::EnsureBytecode(&info)) {
170 info.MarkAsOptimizeFromBytecode(); 170 info.MarkAsOptimizeFromBytecode();
171 } else { 171 } else {
172 CHECK(Compiler::ParseAndAnalyze(info.parse_info())); 172 CHECK(Compiler::ParseAndAnalyze(info.parse_info()));
173 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); 173 CHECK(Compiler::EnsureDeoptimizationSupport(&info));
174 } 174 }
175 JSFunction::EnsureLiterals(function); 175 JSFunction::EnsureLiterals(function);
176 176
177 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info); 177 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info);
178 CHECK(!code.is_null()); 178 CHECK(!code.is_null());
179 info.dependencies()->Commit(code); 179 info.dependencies()->Commit(code);
180 info.context()->native_context()->AddOptimizedCode(*code); 180 info.context()->native_context()->AddOptimizedCode(*code);
181 function->ReplaceCode(*code); 181 function->ReplaceCode(*code);
182 return function; 182 return function;
183 } 183 }
184 184
185 // Compile the given machine graph instead of the source of the function 185 // Compile the given machine graph instead of the source of the function
186 // and replace the JSFunction's code with the result. 186 // and replace the JSFunction's code with the result.
187 Handle<JSFunction> FunctionTester::CompileGraph(Graph* graph) { 187 Handle<JSFunction> FunctionTester::CompileGraph(Graph* graph) {
188 Zone zone(function->GetIsolate()->allocator()); 188 Zone zone(function->GetIsolate()->allocator(), ZONE_NAME);
189 ParseInfo parse_info(&zone, handle(function->shared())); 189 ParseInfo parse_info(&zone, handle(function->shared()));
190 CompilationInfo info(&parse_info, function); 190 CompilationInfo info(&parse_info, function);
191 191
192 CHECK(Parser::ParseStatic(info.parse_info())); 192 CHECK(Parser::ParseStatic(info.parse_info()));
193 info.SetOptimizing(); 193 info.SetOptimizing();
194 194
195 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph); 195 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph);
196 CHECK(!code.is_null()); 196 CHECK(!code.is_null());
197 function->ReplaceCode(*code); 197 function->ReplaceCode(*code);
198 return function; 198 return function;
199 } 199 }
200 200
201 } // namespace compiler 201 } // namespace compiler
202 } // namespace internal 202 } // namespace internal
203 } // namespace v8 203 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/code-assembler-tester.h ('k') | test/cctest/compiler/test-instruction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698