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 (function->shared()->HasBytecodeArray()) { | 191 if (function->shared()->HasBytecodeArray()) { |
192 info.MarkAsOptimizeFromBytecode(); | 192 info.MarkAsOptimizeFromBytecode(); |
193 } | 193 } |
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 Pipeline pipeline(&info); | 197 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info); |
198 Handle<Code> code = pipeline.GenerateCode(); | |
199 CHECK(!code.is_null()); | 198 CHECK(!code.is_null()); |
200 info.dependencies()->Commit(code); | 199 info.dependencies()->Commit(code); |
201 info.context()->native_context()->AddOptimizedCode(*code); | 200 info.context()->native_context()->AddOptimizedCode(*code); |
202 function->ReplaceCode(*code); | 201 function->ReplaceCode(*code); |
203 return function; | 202 return function; |
204 } | 203 } |
205 | 204 |
206 std::string BuildFunction(int param_count) { | 205 std::string BuildFunction(int param_count) { |
207 std::string function_string = "(function("; | 206 std::string function_string = "(function("; |
208 if (param_count > 0) { | 207 if (param_count > 0) { |
(...skipping 28 matching lines...) Expand all Loading... |
237 CHECK(!code.is_null()); | 236 CHECK(!code.is_null()); |
238 function->ReplaceCode(*code); | 237 function->ReplaceCode(*code); |
239 return function; | 238 return function; |
240 } | 239 } |
241 }; | 240 }; |
242 } // namespace compiler | 241 } // namespace compiler |
243 } // namespace internal | 242 } // namespace internal |
244 } // namespace v8 | 243 } // namespace v8 |
245 | 244 |
246 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ | 245 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ |
OLD | NEW |