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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) { | 157 Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) { |
158 Zone zone(function->GetIsolate()->allocator(), ZONE_NAME); | 158 Zone zone(function->GetIsolate()->allocator(), ZONE_NAME); |
159 ParseInfo parse_info(&zone, handle(function->shared())); | 159 ParseInfo parse_info(&zone, handle(function->shared())); |
160 CompilationInfo info(&parse_info, function); | 160 CompilationInfo info(&parse_info, function); |
161 | 161 |
162 info.SetOptimizing(); | 162 info.SetOptimizing(); |
163 info.MarkAsDeoptimizationEnabled(); | 163 info.MarkAsDeoptimizationEnabled(); |
164 if (flags_ & CompilationInfo::kInliningEnabled) { | 164 if (flags_ & CompilationInfo::kInliningEnabled) { |
165 info.MarkAsInliningEnabled(); | 165 info.MarkAsInliningEnabled(); |
166 } | 166 } |
167 if (Compiler::EnsureBytecode(&info)) { | 167 |
168 info.MarkAsOptimizeFromBytecode(); | 168 info.shared_info()->set_dont_crankshaft(true); |
169 } else { | 169 CHECK(Compiler::EnsureBytecode(&info)); |
170 CHECK(Compiler::ParseAndAnalyze(info.parse_info())); | 170 info.MarkAsOptimizeFromBytecode(); |
rmcilroy
2016/11/18 15:29:23
I updated this as well to ensure we always go thro
| |
171 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); | 171 |
172 } | |
173 JSFunction::EnsureLiterals(function); | 172 JSFunction::EnsureLiterals(function); |
174 | 173 |
175 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info); | 174 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info); |
176 CHECK(!code.is_null()); | 175 CHECK(!code.is_null()); |
177 info.dependencies()->Commit(code); | 176 info.dependencies()->Commit(code); |
178 info.context()->native_context()->AddOptimizedCode(*code); | 177 info.context()->native_context()->AddOptimizedCode(*code); |
179 function->ReplaceCode(*code); | 178 function->ReplaceCode(*code); |
180 return function; | 179 return function; |
181 } | 180 } |
182 | 181 |
183 // Compile the given machine graph instead of the source of the function | 182 // Compile the given machine graph instead of the source of the function |
184 // and replace the JSFunction's code with the result. | 183 // and replace the JSFunction's code with the result. |
185 Handle<JSFunction> FunctionTester::CompileGraph(Graph* graph) { | 184 Handle<JSFunction> FunctionTester::CompileGraph(Graph* graph) { |
186 Zone zone(function->GetIsolate()->allocator(), ZONE_NAME); | 185 Zone zone(function->GetIsolate()->allocator(), ZONE_NAME); |
187 ParseInfo parse_info(&zone, handle(function->shared())); | 186 ParseInfo parse_info(&zone, handle(function->shared())); |
188 CompilationInfo info(&parse_info, function); | 187 CompilationInfo info(&parse_info, function); |
189 | 188 |
190 CHECK(Parser::ParseStatic(info.parse_info())); | 189 CHECK(Parser::ParseStatic(info.parse_info())); |
191 info.SetOptimizing(); | 190 info.SetOptimizing(); |
192 | 191 |
193 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph); | 192 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph); |
194 CHECK(!code.is_null()); | 193 CHECK(!code.is_null()); |
195 function->ReplaceCode(*code); | 194 function->ReplaceCode(*code); |
196 return function; | 195 return function; |
197 } | 196 } |
198 | 197 |
199 } // namespace compiler | 198 } // namespace compiler |
200 } // namespace internal | 199 } // namespace internal |
201 } // namespace v8 | 200 } // namespace v8 |
OLD | NEW |