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

Side by Side Diff: src/compiler.cc

Issue 2044063002: [compiler] Improve contract for Compiler::CompileDebugCode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Workaround for regenerated bytecode. Created 4 years, 6 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/debug/liveedit.h » ('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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 info->shared_info()->set_feedback_metadata(*feedback_metadata); 426 info->shared_info()->set_feedback_metadata(*feedback_metadata);
427 } 427 }
428 428
429 // It's very important that recompiles do not alter the structure of the type 429 // It's very important that recompiles do not alter the structure of the type
430 // feedback vector. Verify that the structure fits the function literal. 430 // feedback vector. Verify that the structure fits the function literal.
431 CHECK(!info->shared_info()->feedback_metadata()->SpecDiffersFrom( 431 CHECK(!info->shared_info()->feedback_metadata()->SpecDiffersFrom(
432 info->literal()->feedback_vector_spec())); 432 info->literal()->feedback_vector_spec()));
433 } 433 }
434 434
435 bool UseIgnition(CompilationInfo* info) { 435 bool UseIgnition(CompilationInfo* info) {
436 if (info->is_debug()) return false; 436 DCHECK(info->has_shared_info());
437
438 // When requesting debug code as a replacement for existing code, we provide
439 // the same kind as the existing code (to prevent implicit tier-change).
440 if (info->is_debug() && info->shared_info()->is_compiled()) {
441 return info->shared_info()->HasBytecodeArray();
442 }
443
444 // For generator or async functions we might avoid Ignition wholesale.
437 if (info->shared_info()->is_resumable() && !FLAG_ignition_generators) { 445 if (info->shared_info()->is_resumable() && !FLAG_ignition_generators) {
438 return false; 446 return false;
439 } 447 }
440 448
441 // Since we can't OSR from Ignition, skip Ignition for asm.js functions. 449 // Since we can't OSR from Ignition, skip Ignition for asm.js functions.
442 if (info->shared_info()->asm_function()) { 450 if (info->shared_info()->asm_function()) {
443 return false; 451 return false;
444 } 452 }
445 453
446 // Checks whether top level functions should be passed by the filter. 454 // Checks whether top level functions should be passed by the filter.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 510
503 void InstallSharedScopeInfo(CompilationInfo* info, 511 void InstallSharedScopeInfo(CompilationInfo* info,
504 Handle<SharedFunctionInfo> shared) { 512 Handle<SharedFunctionInfo> shared) {
505 Handle<ScopeInfo> scope_info = 513 Handle<ScopeInfo> scope_info =
506 ScopeInfo::Create(info->isolate(), info->zone(), info->scope()); 514 ScopeInfo::Create(info->isolate(), info->zone(), info->scope());
507 shared->set_scope_info(*scope_info); 515 shared->set_scope_info(*scope_info);
508 } 516 }
509 517
510 void InstallSharedCompilationResult(CompilationInfo* info, 518 void InstallSharedCompilationResult(CompilationInfo* info,
511 Handle<SharedFunctionInfo> shared) { 519 Handle<SharedFunctionInfo> shared) {
520 // TODO(mstarzinger): Compiling for debug code might be used to reveal inner
521 // functions via {FindSharedFunctionInfoInScript}, in which case we end up
522 // regenerating existing bytecode. Fix this!
523 if (info->is_debug() && info->has_bytecode_array()) {
524 shared->ClearBytecodeArray();
525 }
512 // Assert that we are not overwriting (possibly patched) debug code. 526 // Assert that we are not overwriting (possibly patched) debug code.
513 DCHECK(!shared->HasDebugInfo()); 527 DCHECK(!shared->HasDebugInfo());
514 DCHECK(!info->code().is_null()); 528 DCHECK(!info->code().is_null());
515 shared->ReplaceCode(*info->code()); 529 shared->ReplaceCode(*info->code());
516 if (info->has_bytecode_array()) { 530 if (info->has_bytecode_array()) {
517 DCHECK(!shared->HasBytecodeArray()); // Only compiled once. 531 DCHECK(!shared->HasBytecodeArray()); // Only compiled once.
518 shared->set_bytecode_array(*info->bytecode_array()); 532 shared->set_bytecode_array(*info->bytecode_array());
519 } 533 }
520 } 534 }
521 535
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1791 DCHECK(shared->is_compiled()); 1805 DCHECK(shared->is_compiled());
1792 function->set_literals(cached.literals); 1806 function->set_literals(cached.literals);
1793 } else if (shared->is_compiled()) { 1807 } else if (shared->is_compiled()) {
1794 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. 1808 // TODO(mvstanton): pass pretenure flag to EnsureLiterals.
1795 JSFunction::EnsureLiterals(function); 1809 JSFunction::EnsureLiterals(function);
1796 } 1810 }
1797 } 1811 }
1798 1812
1799 } // namespace internal 1813 } // namespace internal
1800 } // namespace v8 1814 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/debug/liveedit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698