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

Side by Side Diff: src/compiler.cc

Issue 14139033: Clean up VMState a little bit. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fixed mistake Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/builtins.cc ('k') | src/execution.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 v8::Extension* extension, 620 v8::Extension* extension,
621 ScriptDataImpl* pre_data, 621 ScriptDataImpl* pre_data,
622 Handle<Object> script_data, 622 Handle<Object> script_data,
623 NativesFlag natives) { 623 NativesFlag natives) {
624 Isolate* isolate = source->GetIsolate(); 624 Isolate* isolate = source->GetIsolate();
625 int source_length = source->length(); 625 int source_length = source->length();
626 isolate->counters()->total_load_size()->Increment(source_length); 626 isolate->counters()->total_load_size()->Increment(source_length);
627 isolate->counters()->total_compile_size()->Increment(source_length); 627 isolate->counters()->total_compile_size()->Increment(source_length);
628 628
629 // The VM is in the COMPILER state until exiting this function. 629 // The VM is in the COMPILER state until exiting this function.
630 VMState state(isolate, COMPILER); 630 VMState<COMPILER> state(isolate);
631 631
632 CompilationCache* compilation_cache = isolate->compilation_cache(); 632 CompilationCache* compilation_cache = isolate->compilation_cache();
633 633
634 // Do a lookup in the compilation cache but not for extensions. 634 // Do a lookup in the compilation cache but not for extensions.
635 Handle<SharedFunctionInfo> result; 635 Handle<SharedFunctionInfo> result;
636 if (extension == NULL) { 636 if (extension == NULL) {
637 result = compilation_cache->LookupScript(source, 637 result = compilation_cache->LookupScript(source,
638 script_name, 638 script_name,
639 line_offset, 639 line_offset,
640 column_offset, 640 column_offset,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 bool is_global, 694 bool is_global,
695 LanguageMode language_mode, 695 LanguageMode language_mode,
696 ParseRestriction restriction, 696 ParseRestriction restriction,
697 int scope_position) { 697 int scope_position) {
698 Isolate* isolate = source->GetIsolate(); 698 Isolate* isolate = source->GetIsolate();
699 int source_length = source->length(); 699 int source_length = source->length();
700 isolate->counters()->total_eval_size()->Increment(source_length); 700 isolate->counters()->total_eval_size()->Increment(source_length);
701 isolate->counters()->total_compile_size()->Increment(source_length); 701 isolate->counters()->total_compile_size()->Increment(source_length);
702 702
703 // The VM is in the COMPILER state until exiting this function. 703 // The VM is in the COMPILER state until exiting this function.
704 VMState state(isolate, COMPILER); 704 VMState<COMPILER> state(isolate);
705 705
706 // Do a lookup in the compilation cache; if the entry is not there, invoke 706 // Do a lookup in the compilation cache; if the entry is not there, invoke
707 // the compiler and add the result to the cache. 707 // the compiler and add the result to the cache.
708 Handle<SharedFunctionInfo> result; 708 Handle<SharedFunctionInfo> result;
709 CompilationCache* compilation_cache = isolate->compilation_cache(); 709 CompilationCache* compilation_cache = isolate->compilation_cache();
710 result = compilation_cache->LookupEval(source, 710 result = compilation_cache->LookupEval(source,
711 context, 711 context,
712 is_global, 712 is_global,
713 language_mode, 713 language_mode,
714 scope_position); 714 scope_position);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 return false; 857 return false;
858 } 858 }
859 859
860 860
861 bool Compiler::CompileLazy(CompilationInfo* info) { 861 bool Compiler::CompileLazy(CompilationInfo* info) {
862 Isolate* isolate = info->isolate(); 862 Isolate* isolate = info->isolate();
863 863
864 ZoneScope zone_scope(info->zone(), DELETE_ON_EXIT); 864 ZoneScope zone_scope(info->zone(), DELETE_ON_EXIT);
865 865
866 // The VM is in the COMPILER state until exiting this function. 866 // The VM is in the COMPILER state until exiting this function.
867 VMState state(isolate, COMPILER); 867 VMState<COMPILER> state(isolate);
868 868
869 PostponeInterruptsScope postpone(isolate); 869 PostponeInterruptsScope postpone(isolate);
870 870
871 Handle<SharedFunctionInfo> shared = info->shared_info(); 871 Handle<SharedFunctionInfo> shared = info->shared_info();
872 int compiled_size = shared->end_position() - shared->start_position(); 872 int compiled_size = shared->end_position() - shared->start_position();
873 isolate->counters()->total_compile_size()->Increment(compiled_size); 873 isolate->counters()->total_compile_size()->Increment(compiled_size);
874 874
875 if (InstallCodeFromOptimizedCodeMap(info)) return true; 875 if (InstallCodeFromOptimizedCodeMap(info)) return true;
876 876
877 // Generate the AST for the lazily compiled function. 877 // Generate the AST for the lazily compiled function.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 isolate, Logger::TimerEventScope::v8_recompile_synchronous); 921 isolate, Logger::TimerEventScope::v8_recompile_synchronous);
922 922
923 if (!isolate->optimizing_compiler_thread()->IsQueueAvailable()) { 923 if (!isolate->optimizing_compiler_thread()->IsQueueAvailable()) {
924 if (FLAG_trace_parallel_recompilation) { 924 if (FLAG_trace_parallel_recompilation) {
925 PrintF(" ** Compilation queue, will retry opting on next run.\n"); 925 PrintF(" ** Compilation queue, will retry opting on next run.\n");
926 } 926 }
927 return; 927 return;
928 } 928 }
929 929
930 SmartPointer<CompilationInfo> info(new CompilationInfoWithZone(closure)); 930 SmartPointer<CompilationInfo> info(new CompilationInfoWithZone(closure));
931 VMState state(isolate, PARALLEL_COMPILER); 931 VMState<COMPILER> state(isolate);
932 PostponeInterruptsScope postpone(isolate); 932 PostponeInterruptsScope postpone(isolate);
933 933
934 Handle<SharedFunctionInfo> shared = info->shared_info(); 934 Handle<SharedFunctionInfo> shared = info->shared_info();
935 int compiled_size = shared->end_position() - shared->start_position(); 935 int compiled_size = shared->end_position() - shared->start_position();
936 isolate->counters()->total_compile_size()->Increment(compiled_size); 936 isolate->counters()->total_compile_size()->Increment(compiled_size);
937 info->SetOptimizing(BailoutId::None()); 937 info->SetOptimizing(BailoutId::None());
938 938
939 { 939 {
940 CompilationHandleScope handle_scope(*info); 940 CompilationHandleScope handle_scope(*info);
941 941
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 if (FLAG_trace_parallel_recompilation) { 996 if (FLAG_trace_parallel_recompilation) {
997 PrintF(" ** aborting optimization for "); 997 PrintF(" ** aborting optimization for ");
998 info->closure()->PrintName(); 998 info->closure()->PrintName();
999 PrintF(" as it has been disabled.\n"); 999 PrintF(" as it has been disabled.\n");
1000 } 1000 }
1001 ASSERT(!info->closure()->IsMarkedForInstallingRecompiledCode()); 1001 ASSERT(!info->closure()->IsMarkedForInstallingRecompiledCode());
1002 return; 1002 return;
1003 } 1003 }
1004 1004
1005 Isolate* isolate = info->isolate(); 1005 Isolate* isolate = info->isolate();
1006 VMState state(isolate, PARALLEL_COMPILER); 1006 VMState<COMPILER> state(isolate);
1007 Logger::TimerEventScope timer( 1007 Logger::TimerEventScope timer(
1008 isolate, Logger::TimerEventScope::v8_recompile_synchronous); 1008 isolate, Logger::TimerEventScope::v8_recompile_synchronous);
1009 // If crankshaft succeeded, install the optimized code else install 1009 // If crankshaft succeeded, install the optimized code else install
1010 // the unoptimized code. 1010 // the unoptimized code.
1011 OptimizingCompiler::Status status = optimizing_compiler->last_status(); 1011 OptimizingCompiler::Status status = optimizing_compiler->last_status();
1012 if (status != OptimizingCompiler::SUCCEEDED) { 1012 if (status != OptimizingCompiler::SUCCEEDED) {
1013 optimizing_compiler->info()->set_bailout_reason( 1013 optimizing_compiler->info()->set_bailout_reason(
1014 "failed/bailed out last time"); 1014 "failed/bailed out last time");
1015 status = optimizing_compiler->AbortOptimization(); 1015 status = optimizing_compiler->AbortOptimization();
1016 } else { 1016 } else {
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 } 1170 }
1171 } 1171 }
1172 1172
1173 GDBJIT(AddCode(Handle<String>(shared->DebugName()), 1173 GDBJIT(AddCode(Handle<String>(shared->DebugName()),
1174 Handle<Script>(info->script()), 1174 Handle<Script>(info->script()),
1175 Handle<Code>(info->code()), 1175 Handle<Code>(info->code()),
1176 info)); 1176 info));
1177 } 1177 }
1178 1178
1179 } } // namespace v8::internal 1179 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/execution.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698