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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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())); |
184 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); | 184 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); |
185 JSFunction::EnsureLiterals(function); | |
186 | 185 |
187 Pipeline pipeline(&info); | 186 Pipeline pipeline(&info); |
188 Handle<Code> code = pipeline.GenerateCode(); | 187 Handle<Code> code = pipeline.GenerateCode(); |
189 CHECK(!code.is_null()); | 188 CHECK(!code.is_null()); |
190 info.dependencies()->Commit(code); | 189 info.dependencies()->Commit(code); |
191 info.context()->native_context()->AddOptimizedCode(*code); | 190 info.context()->native_context()->AddOptimizedCode(*code); |
192 function->ReplaceCode(*code); | 191 function->ReplaceCode(*code); |
193 return function; | 192 return function; |
194 } | 193 } |
195 | 194 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 Handle<JSFunction> CompileGraph(Graph* graph) { | 228 Handle<JSFunction> CompileGraph(Graph* graph) { |
230 Zone zone; | 229 Zone zone; |
231 ParseInfo parse_info(&zone, function); | 230 ParseInfo parse_info(&zone, function); |
232 CompilationInfo info(&parse_info); | 231 CompilationInfo info(&parse_info); |
233 | 232 |
234 CHECK(Parser::ParseStatic(info.parse_info())); | 233 CHECK(Parser::ParseStatic(info.parse_info())); |
235 info.SetOptimizing(BailoutId::None(), | 234 info.SetOptimizing(BailoutId::None(), |
236 Handle<Code>(function->shared()->code())); | 235 Handle<Code>(function->shared()->code())); |
237 CHECK(Compiler::Analyze(info.parse_info())); | 236 CHECK(Compiler::Analyze(info.parse_info())); |
238 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); | 237 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); |
239 JSFunction::EnsureLiterals(function); | |
240 | 238 |
241 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph); | 239 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph); |
242 CHECK(!code.is_null()); | 240 CHECK(!code.is_null()); |
243 function->ReplaceCode(*code); | 241 function->ReplaceCode(*code); |
244 return function; | 242 return function; |
245 } | 243 } |
246 }; | 244 }; |
247 } // namespace compiler | 245 } // namespace compiler |
248 } // namespace internal | 246 } // namespace internal |
249 } // namespace v8 | 247 } // namespace v8 |
250 | 248 |
251 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ | 249 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ |
OLD | NEW |