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

Side by Side Diff: src/compiler.cc

Issue 582703002: Widen the intake valve for TurboFan. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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/compiler.h ('k') | 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 return SetLastStatus(FAILED); 389 return SetLastStatus(FAILED);
390 } 390 }
391 if (FLAG_hydrogen_stats) { 391 if (FLAG_hydrogen_stats) {
392 isolate()->GetHStatistics()->IncrementFullCodeGen(timer.Elapsed()); 392 isolate()->GetHStatistics()->IncrementFullCodeGen(timer.Elapsed());
393 } 393 }
394 } 394 }
395 395
396 DCHECK(info()->shared_info()->has_deoptimization_support()); 396 DCHECK(info()->shared_info()->has_deoptimization_support());
397 397
398 // Check the whitelist for TurboFan. 398 // Check the whitelist for TurboFan.
399 if (info()->closure()->PassesFilter(FLAG_turbo_filter) && 399 if (info()->closure()->PassesFilter(FLAG_turbo_filter)) {
400 // TODO(turbofan): Make try-catch work and remove this bailout.
401 info()->function()->dont_optimize_reason() != kTryCatchStatement &&
402 info()->function()->dont_optimize_reason() != kTryFinallyStatement &&
403 // TODO(turbofan): Make ES6 for-of work and remove this bailout.
404 info()->function()->dont_optimize_reason() != kForOfStatement &&
405 // TODO(turbofan): Make super work and remove this bailout.
406 info()->function()->dont_optimize_reason() != kSuperReference &&
407 // TODO(turbofan): Make OSR work and remove this bailout.
408 !info()->is_osr()) {
409 compiler::Pipeline pipeline(info()); 400 compiler::Pipeline pipeline(info());
410 pipeline.GenerateCode(); 401 pipeline.GenerateCode();
411 if (!info()->code().is_null()) { 402 if (!info()->code().is_null()) {
412 if (FLAG_turbo_deoptimization) { 403 if (FLAG_turbo_deoptimization) {
413 info()->context()->native_context()->AddOptimizedCode(*info()->code()); 404 info()->context()->native_context()->AddOptimizedCode(*info()->code());
414 } 405 }
415 return SetLastStatus(SUCCEEDED); 406 return SetLastStatus(SUCCEEDED);
416 } 407 }
417 } 408 }
418 409
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 function_info->set_allows_lazy_compilation_without_context( 609 function_info->set_allows_lazy_compilation_without_context(
619 lit->AllowsLazyCompilationWithoutContext()); 610 lit->AllowsLazyCompilationWithoutContext());
620 function_info->set_strict_mode(lit->strict_mode()); 611 function_info->set_strict_mode(lit->strict_mode());
621 function_info->set_uses_arguments(lit->scope()->arguments() != NULL); 612 function_info->set_uses_arguments(lit->scope()->arguments() != NULL);
622 function_info->set_has_duplicate_parameters(lit->has_duplicate_parameters()); 613 function_info->set_has_duplicate_parameters(lit->has_duplicate_parameters());
623 function_info->set_ast_node_count(lit->ast_node_count()); 614 function_info->set_ast_node_count(lit->ast_node_count());
624 function_info->set_is_function(lit->is_function()); 615 function_info->set_is_function(lit->is_function());
625 function_info->set_bailout_reason(lit->dont_optimize_reason()); 616 function_info->set_bailout_reason(lit->dont_optimize_reason());
626 function_info->set_dont_cache(lit->flags()->Contains(kDontCache)); 617 function_info->set_dont_cache(lit->flags()->Contains(kDontCache));
627 function_info->set_kind(lit->kind()); 618 function_info->set_kind(lit->kind());
619 function_info->set_asm_function(lit->scope()->asm_function());
628 } 620 }
629 621
630 622
631 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, 623 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag,
632 CompilationInfo* info, 624 CompilationInfo* info,
633 Handle<SharedFunctionInfo> shared) { 625 Handle<SharedFunctionInfo> shared) {
634 // SharedFunctionInfo is passed separately, because if CompilationInfo 626 // SharedFunctionInfo is passed separately, because if CompilationInfo
635 // was created using Script object, it will not have it. 627 // was created using Script object, it will not have it.
636 628
637 // Log the code generation. If source information is available include 629 // Log the code generation. If source information is available include
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 ASSIGN_RETURN_ON_EXCEPTION(info.isolate(), result, 716 ASSIGN_RETURN_ON_EXCEPTION(info.isolate(), result,
725 GetUnoptimizedCodeCommon(&info), 717 GetUnoptimizedCodeCommon(&info),
726 Code); 718 Code);
727 return result; 719 return result;
728 } 720 }
729 721
730 722
731 MaybeHandle<Code> Compiler::GetLazyCode(Handle<JSFunction> function) { 723 MaybeHandle<Code> Compiler::GetLazyCode(Handle<JSFunction> function) {
732 DCHECK(!function->GetIsolate()->has_pending_exception()); 724 DCHECK(!function->GetIsolate()->has_pending_exception());
733 DCHECK(!function->is_compiled()); 725 DCHECK(!function->is_compiled());
726
727 if (FLAG_turbo_asm && function->shared()->asm_function()) {
728 CompilationInfoWithZone info(function);
729
730 VMState<COMPILER> state(info.isolate());
731 PostponeInterruptsScope postpone(info.isolate());
732
733 if (FLAG_trace_opt) {
734 // TODO(titzer): record and report full stats here.
735 PrintF("[optimizing asm ");
736 function->ShortPrint();
737 PrintF("]\n");
738 }
739
740 if (!Parser::Parse(&info)) return MaybeHandle<Code>();
741 if (!Rewriter::Rewrite(&info)) return MaybeHandle<Code>();
742 if (!Scope::Analyze(&info)) return MaybeHandle<Code>();
743 if (FLAG_turbo_deoptimization && !EnsureDeoptimizationSupport(&info)) {
744 return MaybeHandle<Code>();
745 }
746
747 info.SetOptimizing(BailoutId::None(),
748 Handle<Code>(function->shared()->code()));
749
750 info.MarkAsContextSpecializing();
751 info.MarkAsTypingEnabled();
752 info.MarkAsInliningDisabled();
753 compiler::Pipeline pipeline(&info);
754 pipeline.GenerateCode();
755 if (!info.code().is_null()) return info.code();
756 }
757
734 if (function->shared()->is_compiled()) { 758 if (function->shared()->is_compiled()) {
735 return Handle<Code>(function->shared()->code()); 759 return Handle<Code>(function->shared()->code());
736 } 760 }
737 761
738 CompilationInfoWithZone info(function); 762 CompilationInfoWithZone info(function);
739 Handle<Code> result; 763 Handle<Code> result;
740 ASSIGN_RETURN_ON_EXCEPTION(info.isolate(), result, 764 ASSIGN_RETURN_ON_EXCEPTION(info.isolate(), result,
741 GetUnoptimizedCodeCommon(&info), Code); 765 GetUnoptimizedCodeCommon(&info), Code);
742 766
743 if (FLAG_always_opt && 767 if (FLAG_always_opt &&
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 AllowHandleDereference allow_deref; 1451 AllowHandleDereference allow_deref;
1428 bool tracing_on = info()->IsStub() 1452 bool tracing_on = info()->IsStub()
1429 ? FLAG_trace_hydrogen_stubs 1453 ? FLAG_trace_hydrogen_stubs
1430 : (FLAG_trace_hydrogen && 1454 : (FLAG_trace_hydrogen &&
1431 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); 1455 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter));
1432 return (tracing_on && 1456 return (tracing_on &&
1433 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); 1457 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL);
1434 } 1458 }
1435 1459
1436 } } // namespace v8::internal 1460 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698