| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 Handle<Object> false_value() { return isolate->factory()->false_value(); } | 163 Handle<Object> false_value() { return isolate->factory()->false_value(); } |
| 164 | 164 |
| 165 Handle<JSFunction> Compile(Handle<JSFunction> function) { | 165 Handle<JSFunction> Compile(Handle<JSFunction> function) { |
| 166 // TODO(titzer): make this method private. | 166 // TODO(titzer): make this method private. |
| 167 Zone zone; | 167 Zone zone; |
| 168 ParseInfo parse_info(&zone, function); | 168 ParseInfo parse_info(&zone, function); |
| 169 CompilationInfo info(&parse_info); | 169 CompilationInfo info(&parse_info); |
| 170 info.MarkAsDeoptimizationEnabled(); | 170 info.MarkAsDeoptimizationEnabled(); |
| 171 | 171 |
| 172 CHECK(Parser::ParseStatic(info.parse_info())); | 172 CHECK(Parser::ParseStatic(info.parse_info())); |
| 173 info.SetOptimizing(BailoutId::None(), Handle<Code>(function->code())); | 173 info.SetOptimizing(); |
| 174 if (flags_ & CompilationInfo::kFunctionContextSpecializing) { | 174 if (flags_ & CompilationInfo::kFunctionContextSpecializing) { |
| 175 info.MarkAsFunctionContextSpecializing(); | 175 info.MarkAsFunctionContextSpecializing(); |
| 176 } | 176 } |
| 177 if (flags_ & CompilationInfo::kInliningEnabled) { | 177 if (flags_ & CompilationInfo::kInliningEnabled) { |
| 178 info.MarkAsInliningEnabled(); | 178 info.MarkAsInliningEnabled(); |
| 179 } | 179 } |
| 180 if (flags_ & CompilationInfo::kTypingEnabled) { | 180 if (flags_ & CompilationInfo::kTypingEnabled) { |
| 181 info.MarkAsTypingEnabled(); | 181 info.MarkAsTypingEnabled(); |
| 182 } | 182 } |
| 183 CHECK(Compiler::Analyze(info.parse_info())); | 183 CHECK(Compiler::Analyze(info.parse_info())); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 } | 224 } |
| 225 | 225 |
| 226 // Compile the given machine graph instead of the source of the function | 226 // Compile the given machine graph instead of the source of the function |
| 227 // and replace the JSFunction's code with the result. | 227 // and replace the JSFunction's code with the result. |
| 228 Handle<JSFunction> CompileGraph(Graph* graph) { | 228 Handle<JSFunction> CompileGraph(Graph* graph) { |
| 229 Zone zone; | 229 Zone zone; |
| 230 ParseInfo parse_info(&zone, function); | 230 ParseInfo parse_info(&zone, function); |
| 231 CompilationInfo info(&parse_info); | 231 CompilationInfo info(&parse_info); |
| 232 | 232 |
| 233 CHECK(Parser::ParseStatic(info.parse_info())); | 233 CHECK(Parser::ParseStatic(info.parse_info())); |
| 234 info.SetOptimizing(BailoutId::None(), | 234 info.SetOptimizing(); |
| 235 Handle<Code>(function->shared()->code())); | |
| 236 CHECK(Compiler::Analyze(info.parse_info())); | 235 CHECK(Compiler::Analyze(info.parse_info())); |
| 237 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); | 236 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); |
| 238 | 237 |
| 239 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph); | 238 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph); |
| 240 CHECK(!code.is_null()); | 239 CHECK(!code.is_null()); |
| 241 function->ReplaceCode(*code); | 240 function->ReplaceCode(*code); |
| 242 return function; | 241 return function; |
| 243 } | 242 } |
| 244 }; | 243 }; |
| 245 } // namespace compiler | 244 } // namespace compiler |
| 246 } // namespace internal | 245 } // namespace internal |
| 247 } // namespace v8 | 246 } // namespace v8 |
| 248 | 247 |
| 249 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ | 248 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ |
| OLD | NEW |