Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ | 5 #ifndef V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ |
| 6 #define V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ | 6 #define V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ |
| 7 | 7 |
| 8 #include "src/ast/ast-numbering.h" | 8 #include "src/ast/ast-numbering.h" |
| 9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
| 10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 } | 187 } |
| 188 if (flags_ & CompilationInfo::kInliningEnabled) { | 188 if (flags_ & CompilationInfo::kInliningEnabled) { |
| 189 info.MarkAsInliningEnabled(); | 189 info.MarkAsInliningEnabled(); |
| 190 } | 190 } |
| 191 if (FLAG_turbo_from_bytecode && function->shared()->HasBytecodeArray()) { | 191 if (FLAG_turbo_from_bytecode && function->shared()->HasBytecodeArray()) { |
| 192 info.MarkAsOptimizeFromBytecode(); | 192 info.MarkAsOptimizeFromBytecode(); |
| 193 } else { | 193 } else { |
| 194 CHECK(Compiler::Analyze(info.parse_info())); | 194 CHECK(Compiler::Analyze(info.parse_info())); |
| 195 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); | 195 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); |
| 196 } | 196 } |
| 197 JSFunction::EnsureLiterals(function); | |
| 197 | 198 |
| 198 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info); | 199 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info); |
| 199 CHECK(!code.is_null()); | 200 CHECK(!code.is_null()); |
| 200 info.dependencies()->Commit(code); | 201 info.dependencies()->Commit(code); |
| 201 info.context()->native_context()->AddOptimizedCode(*code); | 202 info.context()->native_context()->AddOptimizedCode(*code); |
| 202 function->ReplaceCode(*code); | 203 function->ReplaceCode(*code); |
| 203 return function; | 204 return function; |
| 204 } | 205 } |
| 205 | 206 |
| 206 std::string BuildFunction(int param_count) { | 207 std::string BuildFunction(int param_count) { |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 223 | 224 |
| 224 // Compile the given machine graph instead of the source of the function | 225 // Compile the given machine graph instead of the source of the function |
| 225 // and replace the JSFunction's code with the result. | 226 // and replace the JSFunction's code with the result. |
| 226 Handle<JSFunction> CompileGraph(Graph* graph) { | 227 Handle<JSFunction> CompileGraph(Graph* graph) { |
| 227 Zone zone(function->GetIsolate()->allocator()); | 228 Zone zone(function->GetIsolate()->allocator()); |
| 228 ParseInfo parse_info(&zone, function); | 229 ParseInfo parse_info(&zone, function); |
| 229 CompilationInfo info(&parse_info, function); | 230 CompilationInfo info(&parse_info, function); |
| 230 | 231 |
| 231 CHECK(Parser::ParseStatic(info.parse_info())); | 232 CHECK(Parser::ParseStatic(info.parse_info())); |
| 232 info.SetOptimizing(); | 233 info.SetOptimizing(); |
| 234 CHECK(Compiler::Analyze(info.parse_info())); | |
| 235 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); | |
| 236 JSFunction::EnsureLiterals(function); | |
|
Michael Starzinger
2016/05/10 13:47:20
nit: This is only used to compile hand-crafted gra
mvstanton
2016/05/24 16:31:50
Done.
| |
| 233 | 237 |
| 234 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph); | 238 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph); |
| 235 CHECK(!code.is_null()); | 239 CHECK(!code.is_null()); |
| 236 function->ReplaceCode(*code); | 240 function->ReplaceCode(*code); |
| 237 return function; | 241 return function; |
| 238 } | 242 } |
| 239 }; | 243 }; |
| 240 } // namespace compiler | 244 } // namespace compiler |
| 241 } // namespace internal | 245 } // namespace internal |
| 242 } // namespace v8 | 246 } // namespace v8 |
| 243 | 247 |
| 244 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ | 248 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ |
| OLD | NEW |