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

Side by Side Diff: src/compiler.cc

Issue 1261973004: Add debug mode flag to force recompiling debug code for verification. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@allassert
Patch Set: small fix Created 5 years, 4 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/flag-definitions.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-numbering.h" 9 #include "src/ast-numbering.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 Isolate* isolate = info->isolate(); 652 Isolate* isolate = info->isolate();
653 if (!isolate->has_pending_exception()) isolate->StackOverflow(); 653 if (!isolate->has_pending_exception()) isolate->StackOverflow();
654 return false; 654 return false;
655 } 655 }
656 return true; 656 return true;
657 } 657 }
658 658
659 659
660 MUST_USE_RESULT static MaybeHandle<Code> GetUnoptimizedCodeCommon( 660 MUST_USE_RESULT static MaybeHandle<Code> GetUnoptimizedCodeCommon(
661 CompilationInfo* info) { 661 CompilationInfo* info) {
662 VMState<COMPILER> state(info->isolate()); 662 Isolate* isolate = info->isolate();
663 PostponeInterruptsScope postpone(info->isolate()); 663 VMState<COMPILER> state(isolate);
664 PostponeInterruptsScope postpone(isolate);
664 665
665 // Parse and update CompilationInfo with the results. 666 // Parse and update CompilationInfo with the results.
666 if (!Parser::ParseStatic(info->parse_info())) return MaybeHandle<Code>(); 667 if (!Parser::ParseStatic(info->parse_info())) return MaybeHandle<Code>();
667 Handle<SharedFunctionInfo> shared = info->shared_info(); 668 Handle<SharedFunctionInfo> shared = info->shared_info();
668 FunctionLiteral* lit = info->function(); 669 FunctionLiteral* lit = info->function();
669 shared->set_language_mode(lit->language_mode()); 670 shared->set_language_mode(lit->language_mode());
670 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); 671 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count());
671 MaybeDisableOptimization(shared, lit->dont_optimize_reason()); 672 MaybeDisableOptimization(shared, lit->dont_optimize_reason());
672 673
673 // Compile unoptimized code. 674 // Compile unoptimized code.
674 if (!CompileUnoptimizedCode(info)) return MaybeHandle<Code>(); 675 if (!CompileUnoptimizedCode(info)) return MaybeHandle<Code>();
675 676
676 CHECK_EQ(Code::FUNCTION, info->code()->kind()); 677 CHECK_EQ(Code::FUNCTION, info->code()->kind());
677 RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, info, shared); 678 RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, info, shared);
678 679
679 // Update the shared function info with the scope info. Allocating the 680 // Update the shared function info with the scope info. Allocating the
680 // ScopeInfo object may cause a GC. 681 // ScopeInfo object may cause a GC.
681 Handle<ScopeInfo> scope_info = 682 Handle<ScopeInfo> scope_info =
682 ScopeInfo::Create(info->isolate(), info->zone(), info->scope()); 683 ScopeInfo::Create(isolate, info->zone(), info->scope());
683 shared->set_scope_info(*scope_info); 684 shared->set_scope_info(*scope_info);
684 685
685 // Update the code and feedback vector for the shared function info. 686 // Update the code and feedback vector for the shared function info.
686 shared->ReplaceCode(*info->code()); 687 shared->ReplaceCode(*info->code());
687 shared->set_feedback_vector(*info->feedback_vector()); 688 shared->set_feedback_vector(*info->feedback_vector());
688 689
690 #ifdef DEBUG
691 if (FLAG_always_recompile_debug && !isolate->debug()->is_active() &&
692 !info->closure().is_null() &&
693 info->shared_info()->IsSubjectToDebugging()) {
694 Compiler::CompileDebugCode(info->closure());
695 }
696 #endif
697
689 return info->code(); 698 return info->code();
690 } 699 }
691 700
692 701
693 MUST_USE_RESULT static MaybeHandle<Code> GetCodeFromOptimizedCodeMap( 702 MUST_USE_RESULT static MaybeHandle<Code> GetCodeFromOptimizedCodeMap(
694 Handle<JSFunction> function, BailoutId osr_ast_id) { 703 Handle<JSFunction> function, BailoutId osr_ast_id) {
695 Handle<SharedFunctionInfo> shared(function->shared()); 704 Handle<SharedFunctionInfo> shared(function->shared());
696 DisallowHeapAllocation no_gc; 705 DisallowHeapAllocation no_gc;
697 CodeAndLiterals cached = shared->SearchOptimizedCodeMap( 706 CodeAndLiterals cached = shared->SearchOptimizedCodeMap(
698 function->context()->native_context(), osr_ast_id); 707 function->context()->native_context(), osr_ast_id);
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
1670 1679
1671 1680
1672 #if DEBUG 1681 #if DEBUG
1673 void CompilationInfo::PrintAstForTesting() { 1682 void CompilationInfo::PrintAstForTesting() {
1674 PrintF("--- Source from AST ---\n%s\n", 1683 PrintF("--- Source from AST ---\n%s\n",
1675 PrettyPrinter(isolate(), zone()).PrintProgram(function())); 1684 PrettyPrinter(isolate(), zone()).PrintProgram(function()));
1676 } 1685 }
1677 #endif 1686 #endif
1678 } // namespace internal 1687 } // namespace internal
1679 } // namespace v8 1688 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698