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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 201 |
202 private: | 202 private: |
203 uint32_t flags_; | 203 uint32_t flags_; |
204 | 204 |
205 Handle<JSFunction> Compile(Handle<JSFunction> function) { | 205 Handle<JSFunction> Compile(Handle<JSFunction> function) { |
206 Zone zone(function->GetIsolate()->allocator()); | 206 Zone zone(function->GetIsolate()->allocator()); |
207 ParseInfo parse_info(&zone, function); | 207 ParseInfo parse_info(&zone, function); |
208 CompilationInfo info(&parse_info, function); | 208 CompilationInfo info(&parse_info, function); |
209 info.MarkAsDeoptimizationEnabled(); | 209 info.MarkAsDeoptimizationEnabled(); |
210 | 210 |
211 CHECK(Parser::ParseStatic(info.parse_info())); | 211 if (!FLAG_turbo_from_bytecode) { |
| 212 CHECK(Parser::ParseStatic(info.parse_info())); |
| 213 } |
212 info.SetOptimizing(); | 214 info.SetOptimizing(); |
213 if (flags_ & CompilationInfo::kFunctionContextSpecializing) { | 215 if (flags_ & CompilationInfo::kFunctionContextSpecializing) { |
214 info.MarkAsFunctionContextSpecializing(); | 216 info.MarkAsFunctionContextSpecializing(); |
215 } | 217 } |
216 if (flags_ & CompilationInfo::kInliningEnabled) { | 218 if (flags_ & CompilationInfo::kInliningEnabled) { |
217 info.MarkAsInliningEnabled(); | 219 info.MarkAsInliningEnabled(); |
218 } | 220 } |
219 if (FLAG_turbo_from_bytecode && function->shared()->HasBytecodeArray()) { | 221 if (FLAG_turbo_from_bytecode) { |
| 222 CHECK(Compiler::EnsureBytecode(&info)); |
220 info.MarkAsOptimizeFromBytecode(); | 223 info.MarkAsOptimizeFromBytecode(); |
221 } else { | 224 } else { |
222 CHECK(Compiler::Analyze(info.parse_info())); | 225 CHECK(Compiler::Analyze(info.parse_info())); |
223 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); | 226 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); |
224 } | 227 } |
225 JSFunction::EnsureLiterals(function); | 228 JSFunction::EnsureLiterals(function); |
226 | 229 |
227 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info); | 230 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info); |
228 CHECK(!code.is_null()); | 231 CHECK(!code.is_null()); |
229 info.dependencies()->Commit(code); | 232 info.dependencies()->Commit(code); |
(...skipping 29 matching lines...) Expand all Loading... |
259 CHECK(!code.is_null()); | 262 CHECK(!code.is_null()); |
260 function->ReplaceCode(*code); | 263 function->ReplaceCode(*code); |
261 return function; | 264 return function; |
262 } | 265 } |
263 }; | 266 }; |
264 } // namespace compiler | 267 } // namespace compiler |
265 } // namespace internal | 268 } // namespace internal |
266 } // namespace v8 | 269 } // namespace v8 |
267 | 270 |
268 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ | 271 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ |
OLD | NEW |