| 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/v8.h" | 8 #include "src/v8.h" |
| 9 #include "test/cctest/cctest.h" | 9 #include "test/cctest/cctest.h" |
| 10 | 10 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 Handle<Object> null() { return isolate->factory()->null_value(); } | 144 Handle<Object> null() { return isolate->factory()->null_value(); } |
| 145 | 145 |
| 146 Handle<Object> true_value() { return isolate->factory()->true_value(); } | 146 Handle<Object> true_value() { return isolate->factory()->true_value(); } |
| 147 | 147 |
| 148 Handle<Object> false_value() { return isolate->factory()->false_value(); } | 148 Handle<Object> false_value() { return isolate->factory()->false_value(); } |
| 149 | 149 |
| 150 Handle<JSFunction> Compile(Handle<JSFunction> function) { | 150 Handle<JSFunction> Compile(Handle<JSFunction> function) { |
| 151 // TODO(titzer): make this method private. | 151 // TODO(titzer): make this method private. |
| 152 #if V8_TURBOFAN_TARGET | 152 #if V8_TURBOFAN_TARGET |
| 153 CompilationInfoWithZone info(function); | 153 Zone zone; |
| 154 ParseInfo parse_info(&zone, function); |
| 155 CompilationInfo info(&parse_info); |
| 154 | 156 |
| 155 CHECK(Parser::ParseStatic(info.parse_info())); | 157 CHECK(Parser::ParseStatic(info.parse_info())); |
| 156 info.SetOptimizing(BailoutId::None(), Handle<Code>(function->code())); | 158 info.SetOptimizing(BailoutId::None(), Handle<Code>(function->code())); |
| 157 if (flags_ & CompilationInfo::kContextSpecializing) { | 159 if (flags_ & CompilationInfo::kContextSpecializing) { |
| 158 info.MarkAsContextSpecializing(); | 160 info.MarkAsContextSpecializing(); |
| 159 } | 161 } |
| 160 if (flags_ & CompilationInfo::kInliningEnabled) { | 162 if (flags_ & CompilationInfo::kInliningEnabled) { |
| 161 info.MarkAsInliningEnabled(); | 163 info.MarkAsInliningEnabled(); |
| 162 } | 164 } |
| 163 if (flags_ & CompilationInfo::kTypingEnabled) { | 165 if (flags_ & CompilationInfo::kTypingEnabled) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 return Handle<JSFunction>(p); // allocated in outer handle scope. | 201 return Handle<JSFunction>(p); // allocated in outer handle scope. |
| 200 } | 202 } |
| 201 | 203 |
| 202 private: | 204 private: |
| 203 uint32_t flags_; | 205 uint32_t flags_; |
| 204 | 206 |
| 205 // Compile the given machine graph instead of the source of the function | 207 // Compile the given machine graph instead of the source of the function |
| 206 // and replace the JSFunction's code with the result. | 208 // and replace the JSFunction's code with the result. |
| 207 Handle<JSFunction> CompileGraph(Graph* graph) { | 209 Handle<JSFunction> CompileGraph(Graph* graph) { |
| 208 CHECK(Pipeline::SupportedTarget()); | 210 CHECK(Pipeline::SupportedTarget()); |
| 209 CompilationInfoWithZone info(function); | 211 Zone zone; |
| 212 ParseInfo parse_info(&zone, function); |
| 213 CompilationInfo info(&parse_info); |
| 210 | 214 |
| 211 CHECK(Parser::ParseStatic(info.parse_info())); | 215 CHECK(Parser::ParseStatic(info.parse_info())); |
| 212 info.SetOptimizing(BailoutId::None(), | 216 info.SetOptimizing(BailoutId::None(), |
| 213 Handle<Code>(function->shared()->code())); | 217 Handle<Code>(function->shared()->code())); |
| 214 CHECK(Compiler::Analyze(info.parse_info())); | 218 CHECK(Compiler::Analyze(info.parse_info())); |
| 215 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); | 219 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); |
| 216 | 220 |
| 217 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph); | 221 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph); |
| 218 CHECK(!code.is_null()); | 222 CHECK(!code.is_null()); |
| 219 function->ReplaceCode(*code); | 223 function->ReplaceCode(*code); |
| 220 return function; | 224 return function; |
| 221 } | 225 } |
| 222 }; | 226 }; |
| 223 } | 227 } |
| 224 } | 228 } |
| 225 } // namespace v8::internal::compiler | 229 } // namespace v8::internal::compiler |
| 226 | 230 |
| 227 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ | 231 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ |
| OLD | NEW |