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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 Handle<Object> true_value() { return isolate->factory()->true_value(); } | 153 Handle<Object> true_value() { return isolate->factory()->true_value(); } |
154 | 154 |
155 Handle<Object> false_value() { return isolate->factory()->false_value(); } | 155 Handle<Object> false_value() { return isolate->factory()->false_value(); } |
156 | 156 |
157 Handle<JSFunction> Compile(Handle<JSFunction> function) { | 157 Handle<JSFunction> Compile(Handle<JSFunction> function) { |
158 // TODO(titzer): make this method private. | 158 // TODO(titzer): make this method private. |
159 #if V8_TURBOFAN_TARGET | 159 #if V8_TURBOFAN_TARGET |
160 Zone zone; | 160 Zone zone; |
161 ParseInfo parse_info(&zone, function); | 161 ParseInfo parse_info(&zone, function); |
162 CompilationInfo info(&parse_info); | 162 CompilationInfo info(&parse_info); |
| 163 info.MarkAsDeoptimizationEnabled(); |
163 | 164 |
164 CHECK(Parser::ParseStatic(info.parse_info())); | 165 CHECK(Parser::ParseStatic(info.parse_info())); |
165 info.SetOptimizing(BailoutId::None(), Handle<Code>(function->code())); | 166 info.SetOptimizing(BailoutId::None(), Handle<Code>(function->code())); |
166 if (flags_ & CompilationInfo::kContextSpecializing) { | 167 if (flags_ & CompilationInfo::kContextSpecializing) { |
167 info.MarkAsContextSpecializing(); | 168 info.MarkAsContextSpecializing(); |
168 } | 169 } |
169 if (flags_ & CompilationInfo::kInliningEnabled) { | 170 if (flags_ & CompilationInfo::kInliningEnabled) { |
170 info.MarkAsInliningEnabled(); | 171 info.MarkAsInliningEnabled(); |
171 } | 172 } |
172 if (flags_ & CompilationInfo::kTypingEnabled) { | 173 if (flags_ & CompilationInfo::kTypingEnabled) { |
173 info.MarkAsTypingEnabled(); | 174 info.MarkAsTypingEnabled(); |
174 } | 175 } |
175 CHECK(Compiler::Analyze(info.parse_info())); | 176 CHECK(Compiler::Analyze(info.parse_info())); |
176 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); | 177 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); |
177 | 178 |
178 Pipeline pipeline(&info); | 179 Pipeline pipeline(&info); |
179 Handle<Code> code = pipeline.GenerateCode(); | 180 Handle<Code> code = pipeline.GenerateCode(); |
180 if (FLAG_turbo_deoptimization) { | |
181 info.context()->native_context()->AddOptimizedCode(*code); | |
182 } | |
183 | |
184 CHECK(!code.is_null()); | 181 CHECK(!code.is_null()); |
| 182 info.context()->native_context()->AddOptimizedCode(*code); |
185 function->ReplaceCode(*code); | 183 function->ReplaceCode(*code); |
186 #elif USE_CRANKSHAFT | 184 #elif USE_CRANKSHAFT |
187 Handle<Code> unoptimized = Handle<Code>(function->code()); | 185 Handle<Code> unoptimized = Handle<Code>(function->code()); |
188 Handle<Code> code = Compiler::GetOptimizedCode(function, unoptimized, | 186 Handle<Code> code = Compiler::GetOptimizedCode(function, unoptimized, |
189 Compiler::NOT_CONCURRENT); | 187 Compiler::NOT_CONCURRENT); |
190 CHECK(!code.is_null()); | 188 CHECK(!code.is_null()); |
191 #if ENABLE_DISASSEMBLER | 189 #if ENABLE_DISASSEMBLER |
192 if (FLAG_print_opt_code) { | 190 if (FLAG_print_opt_code) { |
193 CodeTracer::Scope tracing_scope(isolate->GetCodeTracer()); | 191 CodeTracer::Scope tracing_scope(isolate->GetCodeTracer()); |
194 code->Disassemble("test code", tracing_scope.file()); | 192 code->Disassemble("test code", tracing_scope.file()); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 CHECK(!code.is_null()); | 227 CHECK(!code.is_null()); |
230 function->ReplaceCode(*code); | 228 function->ReplaceCode(*code); |
231 return function; | 229 return function; |
232 } | 230 } |
233 }; | 231 }; |
234 } | 232 } |
235 } | 233 } |
236 } // namespace v8::internal::compiler | 234 } // namespace v8::internal::compiler |
237 | 235 |
238 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ | 236 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ |
OLD | NEW |