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