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