Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: src/compiler.cc

Issue 1883403002: [compiler] Move ensuring deoptimization support to backends. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler/pipeline.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 "src/compiler.h" 5 #include "src/compiler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "src/ast/ast-numbering.h" 9 #include "src/ast/ast-numbering.h"
10 #include "src/ast/prettyprinter.h" 10 #include "src/ast/prettyprinter.h"
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 return AbortOptimization(kFunctionBeingDebugged); 315 return AbortOptimization(kFunctionBeingDebugged);
316 } 316 }
317 317
318 // Limit the number of times we try to optimize functions. 318 // Limit the number of times we try to optimize functions.
319 const int kMaxOptCount = 319 const int kMaxOptCount =
320 FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000; 320 FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000;
321 if (info()->shared_info()->opt_count() > kMaxOptCount) { 321 if (info()->shared_info()->opt_count() > kMaxOptCount) {
322 return AbortOptimization(kOptimizedTooManyTimes); 322 return AbortOptimization(kOptimizedTooManyTimes);
323 } 323 }
324 324
325 // Optimization requires a version of fullcode with deoptimization support.
326 // Recompile the unoptimized version of the code if the current version
327 // doesn't have deoptimization support already.
328 // Otherwise, if we are gathering compilation time and space statistics
329 // for hydrogen, gather baseline statistics for a fullcode compilation.
330 bool should_recompile = !info()->shared_info()->has_deoptimization_support();
331 if (should_recompile || FLAG_hydrogen_stats) {
332 base::ElapsedTimer timer;
333 if (FLAG_hydrogen_stats) {
334 timer.Start();
335 }
336 if (!Compiler::EnsureDeoptimizationSupport(info())) {
337 return SetLastStatus(FAILED);
338 }
339 if (FLAG_hydrogen_stats) {
340 isolate()->GetHStatistics()->IncrementFullCodeGen(timer.Elapsed());
341 }
342 }
343
344 DCHECK(info()->shared_info()->has_deoptimization_support());
345 DCHECK(!info()->shared_info()->never_compiled());
346
347 if (FLAG_trace_opt) { 325 if (FLAG_trace_opt) {
348 OFStream os(stdout); 326 OFStream os(stdout);
349 os << "[compiling method " << Brief(*info()->closure()) << " using " 327 os << "[compiling method " << Brief(*info()->closure()) << " using "
350 << compiler_name_; 328 << compiler_name_;
351 if (info()->is_osr()) os << " OSR"; 329 if (info()->is_osr()) os << " OSR";
352 os << "]" << std::endl; 330 os << "]" << std::endl;
353 } 331 }
354 332
355 // Delegate to the underlying implementation. 333 // Delegate to the underlying implementation.
356 DCHECK_EQ(SUCCEEDED, last_status()); 334 DCHECK_EQ(SUCCEEDED, last_status());
(...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1682 MaybeHandle<Code> code; 1660 MaybeHandle<Code> code;
1683 if (cached.code != nullptr) code = handle(cached.code); 1661 if (cached.code != nullptr) code = handle(cached.code);
1684 Handle<Context> native_context(function->context()->native_context()); 1662 Handle<Context> native_context(function->context()->native_context());
1685 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, 1663 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code,
1686 literals, BailoutId::None()); 1664 literals, BailoutId::None());
1687 } 1665 }
1688 } 1666 }
1689 1667
1690 } // namespace internal 1668 } // namespace internal
1691 } // namespace v8 1669 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698