Chromium Code Reviews| 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 #include "test/cctest/compiler/function-tester.h" | 5 #include "test/cctest/compiler/function-tester.h" |
| 6 | 6 |
| 7 #include "src/ast/ast-numbering.h" | 7 #include "src/ast/ast-numbering.h" |
| 8 #include "src/compilation-info.h" | 8 #include "src/compilation-info.h" |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 FunctionTester f(graph, param_count); | 154 FunctionTester f(graph, param_count); |
| 155 p = *f.function; | 155 p = *f.function; |
| 156 } | 156 } |
| 157 return Handle<JSFunction>(p); // allocated in outer handle scope. | 157 return Handle<JSFunction>(p); // allocated in outer handle scope. |
| 158 } | 158 } |
| 159 | 159 |
| 160 Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) { | 160 Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) { |
| 161 Zone zone(function->GetIsolate()->allocator()); | 161 Zone zone(function->GetIsolate()->allocator()); |
| 162 ParseInfo parse_info(&zone, function); | 162 ParseInfo parse_info(&zone, function); |
| 163 CompilationInfo info(&parse_info, function); | 163 CompilationInfo info(&parse_info, function); |
| 164 | |
| 165 info.SetOptimizing(); | |
| 164 info.MarkAsDeoptimizationEnabled(); | 166 info.MarkAsDeoptimizationEnabled(); |
| 165 | |
| 166 if (!FLAG_turbo_from_bytecode) { | |
| 167 CHECK(Parser::ParseStatic(info.parse_info())); | |
| 168 } | |
| 169 info.SetOptimizing(); | |
| 170 if (flags_ & CompilationInfo::kNativeContextSpecializing) { | 167 if (flags_ & CompilationInfo::kNativeContextSpecializing) { |
| 171 info.MarkAsNativeContextSpecializing(); | 168 info.MarkAsNativeContextSpecializing(); |
| 172 } | 169 } |
| 173 if (flags_ & CompilationInfo::kInliningEnabled) { | 170 if (flags_ & CompilationInfo::kInliningEnabled) { |
| 174 info.MarkAsInliningEnabled(); | 171 info.MarkAsInliningEnabled(); |
| 175 } | 172 } |
| 176 if (FLAG_turbo_from_bytecode) { | 173 if (Compiler::EnsureBytecode(&info)) { |
|
rmcilroy
2016/10/06 14:22:57
Just thinking about this again - this basically ma
Michael Starzinger
2016/10/06 14:26:12
This is true for cctest, yes. But compiler.cc stil
| |
| 177 CHECK(Compiler::EnsureBytecode(&info)); | |
| 178 info.MarkAsOptimizeFromBytecode(); | 174 info.MarkAsOptimizeFromBytecode(); |
| 179 } else { | 175 } else { |
| 180 CHECK(Compiler::Analyze(info.parse_info())); | 176 CHECK(Compiler::ParseAndAnalyze(info.parse_info())); |
| 181 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); | 177 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); |
| 182 } | 178 } |
| 183 JSFunction::EnsureLiterals(function); | 179 JSFunction::EnsureLiterals(function); |
| 184 | 180 |
| 185 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info); | 181 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info); |
| 186 CHECK(!code.is_null()); | 182 CHECK(!code.is_null()); |
| 187 info.dependencies()->Commit(code); | 183 info.dependencies()->Commit(code); |
| 188 info.context()->native_context()->AddOptimizedCode(*code); | 184 info.context()->native_context()->AddOptimizedCode(*code); |
| 189 function->ReplaceCode(*code); | 185 function->ReplaceCode(*code); |
| 190 return function; | 186 return function; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 202 | 198 |
| 203 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph); | 199 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph); |
| 204 CHECK(!code.is_null()); | 200 CHECK(!code.is_null()); |
| 205 function->ReplaceCode(*code); | 201 function->ReplaceCode(*code); |
| 206 return function; | 202 return function; |
| 207 } | 203 } |
| 208 | 204 |
| 209 } // namespace compiler | 205 } // namespace compiler |
| 210 } // namespace internal | 206 } // namespace internal |
| 211 } // namespace v8 | 207 } // namespace v8 |
| OLD | NEW |