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

Side by Side Diff: src/compiler.cc

Issue 11411144: Also time other API functions calling into javascript. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years 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/api.cc ('k') | src/counters.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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 } 389 }
390 RecordOptimizationStats(); 390 RecordOptimizationStats();
391 return SetLastStatus(SUCCEEDED); 391 return SetLastStatus(SUCCEEDED);
392 } 392 }
393 393
394 394
395 static bool GenerateCode(CompilationInfo* info) { 395 static bool GenerateCode(CompilationInfo* info) {
396 bool is_optimizing = V8::UseCrankshaft() && 396 bool is_optimizing = V8::UseCrankshaft() &&
397 !info->IsCompilingForDebugging() && 397 !info->IsCompilingForDebugging() &&
398 info->IsOptimizing(); 398 info->IsOptimizing();
399 Logger* logger = info->isolate()->logger();
400 if (is_optimizing) { 399 if (is_optimizing) {
401 Logger::TimerEventScope timer( 400 Logger::TimerEventScope timer(
402 logger, Logger::TimerEventScope::v8_recompile_synchronous); 401 info->isolate(), Logger::TimerEventScope::v8_recompile_synchronous);
403 return MakeCrankshaftCode(info); 402 return MakeCrankshaftCode(info);
404 } else { 403 } else {
405 if (info->IsOptimizing()) { 404 if (info->IsOptimizing()) {
406 // Have the CompilationInfo decide if the compilation should be 405 // Have the CompilationInfo decide if the compilation should be
407 // BASE or NONOPT. 406 // BASE or NONOPT.
408 info->DisableOptimization(); 407 info->DisableOptimization();
409 } 408 }
410 Logger::TimerEventScope timer( 409 Logger::TimerEventScope timer(
411 logger, Logger::TimerEventScope::v8_compile_full_code); 410 info->isolate(), Logger::TimerEventScope::v8_compile_full_code);
412 return FullCodeGenerator::MakeCode(info); 411 return FullCodeGenerator::MakeCode(info);
413 } 412 }
414 } 413 }
415 414
416 415
417 static bool MakeCode(CompilationInfo* info) { 416 static bool MakeCode(CompilationInfo* info) {
418 // Precondition: code has been parsed. Postcondition: the code field in 417 // Precondition: code has been parsed. Postcondition: the code field in
419 // the compilation info is set if compilation succeeded. 418 // the compilation info is set if compilation succeeded.
420 ASSERT(info->function() != NULL); 419 ASSERT(info->function() != NULL);
421 return Rewriter::Rewrite(info) && Scope::Analyze(info) && GenerateCode(info); 420 return Rewriter::Rewrite(info) && Scope::Analyze(info) && GenerateCode(info);
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 852
854 853
855 void Compiler::RecompileParallel(Handle<JSFunction> closure) { 854 void Compiler::RecompileParallel(Handle<JSFunction> closure) {
856 if (closure->IsInRecompileQueue()) return; 855 if (closure->IsInRecompileQueue()) return;
857 ASSERT(closure->IsMarkedForParallelRecompilation()); 856 ASSERT(closure->IsMarkedForParallelRecompilation());
858 857
859 Isolate* isolate = closure->GetIsolate(); 858 Isolate* isolate = closure->GetIsolate();
860 // Here we prepare compile data for the parallel recompilation thread, but 859 // Here we prepare compile data for the parallel recompilation thread, but
861 // this still happens synchronously and interrupts execution. 860 // this still happens synchronously and interrupts execution.
862 Logger::TimerEventScope timer( 861 Logger::TimerEventScope timer(
863 isolate->logger(), Logger::TimerEventScope::v8_recompile_synchronous); 862 isolate, Logger::TimerEventScope::v8_recompile_synchronous);
864 863
865 if (!isolate->optimizing_compiler_thread()->IsQueueAvailable()) { 864 if (!isolate->optimizing_compiler_thread()->IsQueueAvailable()) {
866 if (FLAG_trace_parallel_recompilation) { 865 if (FLAG_trace_parallel_recompilation) {
867 PrintF(" ** Compilation queue, will retry opting on next run.\n"); 866 PrintF(" ** Compilation queue, will retry opting on next run.\n");
868 } 867 }
869 return; 868 return;
870 } 869 }
871 870
872 SmartPointer<CompilationInfo> info(new CompilationInfoWithZone(closure)); 871 SmartPointer<CompilationInfo> info(new CompilationInfoWithZone(closure));
873 VMState state(isolate, PARALLEL_COMPILER); 872 VMState state(isolate, PARALLEL_COMPILER);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 isolate->clear_pending_exception(); 913 isolate->clear_pending_exception();
915 } 914 }
916 } 915 }
917 916
918 917
919 void Compiler::InstallOptimizedCode(OptimizingCompiler* optimizing_compiler) { 918 void Compiler::InstallOptimizedCode(OptimizingCompiler* optimizing_compiler) {
920 SmartPointer<CompilationInfo> info(optimizing_compiler->info()); 919 SmartPointer<CompilationInfo> info(optimizing_compiler->info());
921 Isolate* isolate = info->isolate(); 920 Isolate* isolate = info->isolate();
922 VMState state(isolate, PARALLEL_COMPILER); 921 VMState state(isolate, PARALLEL_COMPILER);
923 Logger::TimerEventScope timer( 922 Logger::TimerEventScope timer(
924 isolate->logger(), Logger::TimerEventScope::v8_recompile_synchronous); 923 isolate, Logger::TimerEventScope::v8_recompile_synchronous);
925 // If crankshaft succeeded, install the optimized code else install 924 // If crankshaft succeeded, install the optimized code else install
926 // the unoptimized code. 925 // the unoptimized code.
927 OptimizingCompiler::Status status = optimizing_compiler->last_status(); 926 OptimizingCompiler::Status status = optimizing_compiler->last_status();
928 if (status != OptimizingCompiler::SUCCEEDED) { 927 if (status != OptimizingCompiler::SUCCEEDED) {
929 optimizing_compiler->info()->set_bailout_reason( 928 optimizing_compiler->info()->set_bailout_reason(
930 "failed/bailed out last time"); 929 "failed/bailed out last time");
931 status = optimizing_compiler->AbortOptimization(); 930 status = optimizing_compiler->AbortOptimization();
932 } else { 931 } else {
933 status = optimizing_compiler->GenerateAndInstallCode(); 932 status = optimizing_compiler->GenerateAndInstallCode();
934 ASSERT(status == OptimizingCompiler::SUCCEEDED || 933 ASSERT(status == OptimizingCompiler::SUCCEEDED ||
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 } 1074 }
1076 } 1075 }
1077 1076
1078 GDBJIT(AddCode(Handle<String>(shared->DebugName()), 1077 GDBJIT(AddCode(Handle<String>(shared->DebugName()),
1079 Handle<Script>(info->script()), 1078 Handle<Script>(info->script()),
1080 Handle<Code>(info->code()), 1079 Handle<Code>(info->code()),
1081 info)); 1080 info));
1082 } 1081 }
1083 1082
1084 } } // namespace v8::internal 1083 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/counters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698