OLD | NEW |
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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 return; | 120 return; |
121 } | 121 } |
122 mode_ = V8::UseCrankshaft() ? mode : NONOPT; | 122 mode_ = V8::UseCrankshaft() ? mode : NONOPT; |
123 if (script_->type()->value() == Script::TYPE_NATIVE) { | 123 if (script_->type()->value() == Script::TYPE_NATIVE) { |
124 MarkAsNative(); | 124 MarkAsNative(); |
125 } | 125 } |
126 if (!shared_info_.is_null()) { | 126 if (!shared_info_.is_null()) { |
127 ASSERT(language_mode() == CLASSIC_MODE); | 127 ASSERT(language_mode() == CLASSIC_MODE); |
128 SetLanguageMode(shared_info_->language_mode()); | 128 SetLanguageMode(shared_info_->language_mode()); |
129 } | 129 } |
130 set_bailout_reason("unknown"); | 130 set_bailout_reason(kUnknown); |
131 } | 131 } |
132 | 132 |
133 | 133 |
134 CompilationInfo::~CompilationInfo() { | 134 CompilationInfo::~CompilationInfo() { |
135 delete deferred_handles_; | 135 delete deferred_handles_; |
136 delete no_frame_ranges_; | 136 delete no_frame_ranges_; |
137 #ifdef DEBUG | 137 #ifdef DEBUG |
138 // Check that no dependent maps have been added or added dependent maps have | 138 // Check that no dependent maps have been added or added dependent maps have |
139 // been rolled back or committed. | 139 // been rolled back or committed. |
140 for (int i = 0; i < DependentCode::kGroupCount; i++) { | 140 for (int i = 0; i < DependentCode::kGroupCount; i++) { |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 if (AlwaysFullCompiler(isolate())) { | 344 if (AlwaysFullCompiler(isolate())) { |
345 info()->SetCode(code); | 345 info()->SetCode(code); |
346 return SetLastStatus(BAILED_OUT); | 346 return SetLastStatus(BAILED_OUT); |
347 } | 347 } |
348 | 348 |
349 // Limit the number of times we re-compile a functions with | 349 // Limit the number of times we re-compile a functions with |
350 // the optimizing compiler. | 350 // the optimizing compiler. |
351 const int kMaxOptCount = | 351 const int kMaxOptCount = |
352 FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000; | 352 FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000; |
353 if (info()->opt_count() > kMaxOptCount) { | 353 if (info()->opt_count() > kMaxOptCount) { |
354 info()->set_bailout_reason("optimized too many times"); | 354 info()->set_bailout_reason(kOptimizedTooManyTimes); |
355 return AbortOptimization(); | 355 return AbortOptimization(); |
356 } | 356 } |
357 | 357 |
358 // Due to an encoding limit on LUnallocated operands in the Lithium | 358 // Due to an encoding limit on LUnallocated operands in the Lithium |
359 // language, we cannot optimize functions with too many formal parameters | 359 // language, we cannot optimize functions with too many formal parameters |
360 // or perform on-stack replacement for function with too many | 360 // or perform on-stack replacement for function with too many |
361 // stack-allocated local variables. | 361 // stack-allocated local variables. |
362 // | 362 // |
363 // The encoding is as a signed value, with parameters and receiver using | 363 // The encoding is as a signed value, with parameters and receiver using |
364 // the negative indices and locals the non-negative ones. | 364 // the negative indices and locals the non-negative ones. |
365 const int parameter_limit = -LUnallocated::kMinFixedSlotIndex; | 365 const int parameter_limit = -LUnallocated::kMinFixedSlotIndex; |
366 Scope* scope = info()->scope(); | 366 Scope* scope = info()->scope(); |
367 if ((scope->num_parameters() + 1) > parameter_limit) { | 367 if ((scope->num_parameters() + 1) > parameter_limit) { |
368 info()->set_bailout_reason("too many parameters"); | 368 info()->set_bailout_reason(kTooManyParameters); |
369 return AbortOptimization(); | 369 return AbortOptimization(); |
370 } | 370 } |
371 | 371 |
372 const int locals_limit = LUnallocated::kMaxFixedSlotIndex; | 372 const int locals_limit = LUnallocated::kMaxFixedSlotIndex; |
373 if (!info()->osr_ast_id().IsNone() && | 373 if (!info()->osr_ast_id().IsNone() && |
374 scope->num_parameters() + 1 + scope->num_stack_slots() > locals_limit) { | 374 scope->num_parameters() + 1 + scope->num_stack_slots() > locals_limit) { |
375 info()->set_bailout_reason("too many parameters/locals"); | 375 info()->set_bailout_reason(kTooManyParametersLocals); |
376 return AbortOptimization(); | 376 return AbortOptimization(); |
377 } | 377 } |
378 | 378 |
379 // Take --hydrogen-filter into account. | 379 // Take --hydrogen-filter into account. |
380 if (!info()->closure()->PassesHydrogenFilter()) { | 380 if (!info()->closure()->PassesHydrogenFilter()) { |
381 info()->SetCode(code); | 381 info()->SetCode(code); |
382 return SetLastStatus(BAILED_OUT); | 382 return SetLastStatus(BAILED_OUT); |
383 } | 383 } |
384 | 384 |
385 // Recompile the unoptimized version of the code if the current version | 385 // Recompile the unoptimized version of the code if the current version |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 | 460 |
461 | 461 |
462 OptimizingCompiler::Status OptimizingCompiler::OptimizeGraph() { | 462 OptimizingCompiler::Status OptimizingCompiler::OptimizeGraph() { |
463 DisallowHeapAllocation no_allocation; | 463 DisallowHeapAllocation no_allocation; |
464 DisallowHandleAllocation no_handles; | 464 DisallowHandleAllocation no_handles; |
465 DisallowHandleDereference no_deref; | 465 DisallowHandleDereference no_deref; |
466 | 466 |
467 ASSERT(last_status() == SUCCEEDED); | 467 ASSERT(last_status() == SUCCEEDED); |
468 Timer t(this, &time_taken_to_optimize_); | 468 Timer t(this, &time_taken_to_optimize_); |
469 ASSERT(graph_ != NULL); | 469 ASSERT(graph_ != NULL); |
470 SmartArrayPointer<char> bailout_reason; | 470 BailoutReason bailout_reason = kNoReason; |
471 if (!graph_->Optimize(&bailout_reason)) { | 471 if (!graph_->Optimize(&bailout_reason)) { |
472 if (!bailout_reason.is_empty()) graph_builder_->Bailout(*bailout_reason); | 472 if (bailout_reason == kNoReason) graph_builder_->Bailout(bailout_reason); |
473 return SetLastStatus(BAILED_OUT); | 473 return SetLastStatus(BAILED_OUT); |
474 } else { | 474 } else { |
475 chunk_ = LChunk::NewChunk(graph_); | 475 chunk_ = LChunk::NewChunk(graph_); |
476 if (chunk_ == NULL) { | 476 if (chunk_ == NULL) { |
477 return SetLastStatus(BAILED_OUT); | 477 return SetLastStatus(BAILED_OUT); |
478 } | 478 } |
479 } | 479 } |
480 return SetLastStatus(SUCCEEDED); | 480 return SetLastStatus(SUCCEEDED); |
481 } | 481 } |
482 | 482 |
483 | 483 |
484 OptimizingCompiler::Status OptimizingCompiler::GenerateAndInstallCode() { | 484 OptimizingCompiler::Status OptimizingCompiler::GenerateAndInstallCode() { |
485 ASSERT(last_status() == SUCCEEDED); | 485 ASSERT(last_status() == SUCCEEDED); |
486 { // Scope for timer. | 486 { // Scope for timer. |
487 Timer timer(this, &time_taken_to_codegen_); | 487 Timer timer(this, &time_taken_to_codegen_); |
488 ASSERT(chunk_ != NULL); | 488 ASSERT(chunk_ != NULL); |
489 ASSERT(graph_ != NULL); | 489 ASSERT(graph_ != NULL); |
490 // Deferred handles reference objects that were accessible during | 490 // Deferred handles reference objects that were accessible during |
491 // graph creation. To make sure that we don't encounter inconsistencies | 491 // graph creation. To make sure that we don't encounter inconsistencies |
492 // between graph creation and code generation, we disallow accessing | 492 // between graph creation and code generation, we disallow accessing |
493 // objects through deferred handles during the latter, with exceptions. | 493 // objects through deferred handles during the latter, with exceptions. |
494 DisallowDeferredHandleDereference no_deferred_handle_deref; | 494 DisallowDeferredHandleDereference no_deferred_handle_deref; |
495 Handle<Code> optimized_code = chunk_->Codegen(); | 495 Handle<Code> optimized_code = chunk_->Codegen(); |
496 if (optimized_code.is_null()) { | 496 if (optimized_code.is_null()) { |
497 info()->set_bailout_reason("code generation failed"); | 497 if (info()->bailout_reason() != kNoReason) { |
| 498 info()->set_bailout_reason(kCodeGenerationFailed); |
| 499 } |
498 return AbortOptimization(); | 500 return AbortOptimization(); |
499 } | 501 } |
500 info()->SetCode(optimized_code); | 502 info()->SetCode(optimized_code); |
501 } | 503 } |
502 RecordOptimizationStats(); | 504 RecordOptimizationStats(); |
503 return SetLastStatus(SUCCEEDED); | 505 return SetLastStatus(SUCCEEDED); |
504 } | 506 } |
505 | 507 |
506 | 508 |
507 static bool GenerateCode(CompilationInfo* info) { | 509 static bool GenerateCode(CompilationInfo* info) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 PostponeInterruptsScope postpone(isolate); | 562 PostponeInterruptsScope postpone(isolate); |
561 | 563 |
562 ASSERT(!isolate->native_context().is_null()); | 564 ASSERT(!isolate->native_context().is_null()); |
563 Handle<Script> script = info->script(); | 565 Handle<Script> script = info->script(); |
564 // TODO(svenpanne) Obscure place for this, perhaps move to OnBeforeCompile? | 566 // TODO(svenpanne) Obscure place for this, perhaps move to OnBeforeCompile? |
565 FixedArray* array = isolate->native_context()->embedder_data(); | 567 FixedArray* array = isolate->native_context()->embedder_data(); |
566 script->set_context_data(array->get(0)); | 568 script->set_context_data(array->get(0)); |
567 | 569 |
568 #ifdef ENABLE_DEBUGGER_SUPPORT | 570 #ifdef ENABLE_DEBUGGER_SUPPORT |
569 if (info->is_eval()) { | 571 if (info->is_eval()) { |
570 Script::CompilationType compilation_type = Script::COMPILATION_TYPE_EVAL; | 572 script->set_compilation_type(Script::COMPILATION_TYPE_EVAL); |
571 script->set_compilation_type(Smi::FromInt(compilation_type)); | |
572 // For eval scripts add information on the function from which eval was | 573 // For eval scripts add information on the function from which eval was |
573 // called. | 574 // called. |
574 if (info->is_eval()) { | 575 if (info->is_eval()) { |
575 StackTraceFrameIterator it(isolate); | 576 StackTraceFrameIterator it(isolate); |
576 if (!it.done()) { | 577 if (!it.done()) { |
577 script->set_eval_from_shared(it.frame()->function()->shared()); | 578 script->set_eval_from_shared(it.frame()->function()->shared()); |
578 Code* code = it.frame()->LookupCode(); | 579 Code* code = it.frame()->LookupCode(); |
579 int offset = static_cast<int>( | 580 int offset = static_cast<int>( |
580 it.frame()->pc() - code->instruction_start()); | 581 it.frame()->pc() - code->instruction_start()); |
581 script->set_eval_from_instructions_offset(Smi::FromInt(offset)); | 582 script->set_eval_from_instructions_offset(Smi::FromInt(offset)); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 info, | 653 info, |
653 isolate->heap()->empty_string())); | 654 isolate->heap()->empty_string())); |
654 GDBJIT(AddCode(Handle<String>(), script, info->code(), info)); | 655 GDBJIT(AddCode(Handle<String>(), script, info->code(), info)); |
655 } | 656 } |
656 | 657 |
657 // Hint to the runtime system used when allocating space for initial | 658 // Hint to the runtime system used when allocating space for initial |
658 // property space by setting the expected number of properties for | 659 // property space by setting the expected number of properties for |
659 // the instances of the function. | 660 // the instances of the function. |
660 SetExpectedNofPropertiesFromEstimate(result, lit->expected_property_count()); | 661 SetExpectedNofPropertiesFromEstimate(result, lit->expected_property_count()); |
661 | 662 |
662 script->set_compilation_state( | 663 script->set_compilation_state(Script::COMPILATION_STATE_COMPILED); |
663 Smi::FromInt(Script::COMPILATION_STATE_COMPILED)); | |
664 | 664 |
665 #ifdef ENABLE_DEBUGGER_SUPPORT | 665 #ifdef ENABLE_DEBUGGER_SUPPORT |
666 // Notify debugger | 666 // Notify debugger |
667 isolate->debugger()->OnAfterCompile( | 667 isolate->debugger()->OnAfterCompile( |
668 script, Debugger::NO_AFTER_COMPILE_FLAGS); | 668 script, Debugger::NO_AFTER_COMPILE_FLAGS); |
669 #endif | 669 #endif |
670 | 670 |
671 live_edit_tracker.RecordFunctionInfo(result, lit, info->zone()); | 671 live_edit_tracker.RecordFunctionInfo(result, lit, info->zone()); |
672 | 672 |
673 return result; | 673 return result; |
674 } | 674 } |
675 | 675 |
676 | 676 |
677 Handle<SharedFunctionInfo> Compiler::Compile(Handle<String> source, | 677 Handle<SharedFunctionInfo> Compiler::Compile(Handle<String> source, |
678 Handle<Object> script_name, | 678 Handle<Object> script_name, |
679 int line_offset, | 679 int line_offset, |
680 int column_offset, | 680 int column_offset, |
| 681 bool is_shared_cross_origin, |
681 Handle<Context> context, | 682 Handle<Context> context, |
682 v8::Extension* extension, | 683 v8::Extension* extension, |
683 ScriptDataImpl* pre_data, | 684 ScriptDataImpl* pre_data, |
684 Handle<Object> script_data, | 685 Handle<Object> script_data, |
685 NativesFlag natives) { | 686 NativesFlag natives) { |
686 Isolate* isolate = source->GetIsolate(); | 687 Isolate* isolate = source->GetIsolate(); |
687 int source_length = source->length(); | 688 int source_length = source->length(); |
688 isolate->counters()->total_load_size()->Increment(source_length); | 689 isolate->counters()->total_load_size()->Increment(source_length); |
689 isolate->counters()->total_compile_size()->Increment(source_length); | 690 isolate->counters()->total_compile_size()->Increment(source_length); |
690 | 691 |
691 // The VM is in the COMPILER state until exiting this function. | 692 // The VM is in the COMPILER state until exiting this function. |
692 VMState<COMPILER> state(isolate); | 693 VMState<COMPILER> state(isolate); |
693 | 694 |
694 CompilationCache* compilation_cache = isolate->compilation_cache(); | 695 CompilationCache* compilation_cache = isolate->compilation_cache(); |
695 | 696 |
696 // Do a lookup in the compilation cache but not for extensions. | 697 // Do a lookup in the compilation cache but not for extensions. |
697 Handle<SharedFunctionInfo> result; | 698 Handle<SharedFunctionInfo> result; |
698 if (extension == NULL) { | 699 if (extension == NULL) { |
699 result = compilation_cache->LookupScript(source, | 700 result = compilation_cache->LookupScript(source, |
700 script_name, | 701 script_name, |
701 line_offset, | 702 line_offset, |
702 column_offset, | 703 column_offset, |
| 704 is_shared_cross_origin, |
703 context); | 705 context); |
704 } | 706 } |
705 | 707 |
706 if (result.is_null()) { | 708 if (result.is_null()) { |
707 // No cache entry found. Do pre-parsing, if it makes sense, and compile | 709 // No cache entry found. Do pre-parsing, if it makes sense, and compile |
708 // the script. | 710 // the script. |
709 // Building preparse data that is only used immediately after is only a | 711 // Building preparse data that is only used immediately after is only a |
710 // saving if we might skip building the AST for lazily compiled functions. | 712 // saving if we might skip building the AST for lazily compiled functions. |
711 // I.e., preparse data isn't relevant when the lazy flag is off, and | 713 // I.e., preparse data isn't relevant when the lazy flag is off, and |
712 // for small sources, odds are that there aren't many functions | 714 // for small sources, odds are that there aren't many functions |
713 // that would be compiled lazily anyway, so we skip the preparse step | 715 // that would be compiled lazily anyway, so we skip the preparse step |
714 // in that case too. | 716 // in that case too. |
715 | 717 |
716 // Create a script object describing the script to be compiled. | 718 // Create a script object describing the script to be compiled. |
717 Handle<Script> script = isolate->factory()->NewScript(source); | 719 Handle<Script> script = isolate->factory()->NewScript(source); |
718 if (natives == NATIVES_CODE) { | 720 if (natives == NATIVES_CODE) { |
719 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); | 721 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); |
720 } | 722 } |
721 if (!script_name.is_null()) { | 723 if (!script_name.is_null()) { |
722 script->set_name(*script_name); | 724 script->set_name(*script_name); |
723 script->set_line_offset(Smi::FromInt(line_offset)); | 725 script->set_line_offset(Smi::FromInt(line_offset)); |
724 script->set_column_offset(Smi::FromInt(column_offset)); | 726 script->set_column_offset(Smi::FromInt(column_offset)); |
725 } | 727 } |
| 728 script->set_is_shared_cross_origin(is_shared_cross_origin); |
726 | 729 |
727 script->set_data(script_data.is_null() ? HEAP->undefined_value() | 730 script->set_data(script_data.is_null() ? HEAP->undefined_value() |
728 : *script_data); | 731 : *script_data); |
729 | 732 |
730 // Compile the function and add it to the cache. | 733 // Compile the function and add it to the cache. |
731 CompilationInfoWithZone info(script); | 734 CompilationInfoWithZone info(script); |
732 info.MarkAsGlobal(); | 735 info.MarkAsGlobal(); |
733 info.SetExtension(extension); | 736 info.SetExtension(extension); |
734 info.SetPreParseData(pre_data); | 737 info.SetPreParseData(pre_data); |
735 info.SetContext(context); | 738 info.SetContext(context); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 CompilationInfoWithZone info(script); | 784 CompilationInfoWithZone info(script); |
782 info.MarkAsEval(); | 785 info.MarkAsEval(); |
783 if (is_global) info.MarkAsGlobal(); | 786 if (is_global) info.MarkAsGlobal(); |
784 info.SetLanguageMode(language_mode); | 787 info.SetLanguageMode(language_mode); |
785 info.SetParseRestriction(restriction); | 788 info.SetParseRestriction(restriction); |
786 info.SetContext(context); | 789 info.SetContext(context); |
787 result = MakeFunctionInfo(&info); | 790 result = MakeFunctionInfo(&info); |
788 if (!result.is_null()) { | 791 if (!result.is_null()) { |
789 // Explicitly disable optimization for eval code. We're not yet prepared | 792 // Explicitly disable optimization for eval code. We're not yet prepared |
790 // to handle eval-code in the optimizing compiler. | 793 // to handle eval-code in the optimizing compiler. |
791 result->DisableOptimization("eval"); | 794 result->DisableOptimization(kEval); |
792 | 795 |
793 // If caller is strict mode, the result must be in strict mode or | 796 // If caller is strict mode, the result must be in strict mode or |
794 // extended mode as well, but not the other way around. Consider: | 797 // extended mode as well, but not the other way around. Consider: |
795 // eval("'use strict'; ..."); | 798 // eval("'use strict'; ..."); |
796 ASSERT(language_mode != STRICT_MODE || !result->is_classic_mode()); | 799 ASSERT(language_mode != STRICT_MODE || !result->is_classic_mode()); |
797 // If caller is in extended mode, the result must also be in | 800 // If caller is in extended mode, the result must also be in |
798 // extended mode. | 801 // extended mode. |
799 ASSERT(language_mode != EXTENDED_MODE || | 802 ASSERT(language_mode != EXTENDED_MODE || |
800 result->is_extended_mode()); | 803 result->is_extended_mode()); |
801 if (!result->dont_cache()) { | 804 if (!result->dont_cache()) { |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 ASSERT(closure->IsMarkedForParallelRecompilation()); | 974 ASSERT(closure->IsMarkedForParallelRecompilation()); |
972 | 975 |
973 Isolate* isolate = closure->GetIsolate(); | 976 Isolate* isolate = closure->GetIsolate(); |
974 // Here we prepare compile data for the parallel recompilation thread, but | 977 // Here we prepare compile data for the parallel recompilation thread, but |
975 // this still happens synchronously and interrupts execution. | 978 // this still happens synchronously and interrupts execution. |
976 Logger::TimerEventScope timer( | 979 Logger::TimerEventScope timer( |
977 isolate, Logger::TimerEventScope::v8_recompile_synchronous); | 980 isolate, Logger::TimerEventScope::v8_recompile_synchronous); |
978 | 981 |
979 if (!isolate->optimizing_compiler_thread()->IsQueueAvailable()) { | 982 if (!isolate->optimizing_compiler_thread()->IsQueueAvailable()) { |
980 if (FLAG_trace_parallel_recompilation) { | 983 if (FLAG_trace_parallel_recompilation) { |
981 PrintF(" ** Compilation queue full, will retry optimizing "); | 984 PrintF(" ** Compilation queue, will retry opting on next run.\n"); |
982 closure->PrintName(); | |
983 PrintF(" on next run.\n"); | |
984 } | 985 } |
985 return; | 986 return; |
986 } | 987 } |
987 | 988 |
988 SmartPointer<CompilationInfo> info(new CompilationInfoWithZone(closure)); | 989 SmartPointer<CompilationInfo> info(new CompilationInfoWithZone(closure)); |
989 VMState<COMPILER> state(isolate); | 990 VMState<COMPILER> state(isolate); |
990 PostponeInterruptsScope postpone(isolate); | 991 PostponeInterruptsScope postpone(isolate); |
991 | 992 |
992 Handle<SharedFunctionInfo> shared = info->shared_info(); | 993 Handle<SharedFunctionInfo> shared = info->shared_info(); |
993 int compiled_size = shared->end_position() - shared->start_position(); | 994 int compiled_size = shared->end_position() - shared->start_position(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1058 } | 1059 } |
1059 | 1060 |
1060 Isolate* isolate = info->isolate(); | 1061 Isolate* isolate = info->isolate(); |
1061 VMState<COMPILER> state(isolate); | 1062 VMState<COMPILER> state(isolate); |
1062 Logger::TimerEventScope timer( | 1063 Logger::TimerEventScope timer( |
1063 isolate, Logger::TimerEventScope::v8_recompile_synchronous); | 1064 isolate, Logger::TimerEventScope::v8_recompile_synchronous); |
1064 // If crankshaft succeeded, install the optimized code else install | 1065 // If crankshaft succeeded, install the optimized code else install |
1065 // the unoptimized code. | 1066 // the unoptimized code. |
1066 OptimizingCompiler::Status status = optimizing_compiler->last_status(); | 1067 OptimizingCompiler::Status status = optimizing_compiler->last_status(); |
1067 if (info->HasAbortedDueToDependencyChange()) { | 1068 if (info->HasAbortedDueToDependencyChange()) { |
1068 info->set_bailout_reason("bailed out due to dependent map"); | 1069 info->set_bailout_reason(kBailedOutDueToDependentMap); |
1069 status = optimizing_compiler->AbortOptimization(); | 1070 status = optimizing_compiler->AbortOptimization(); |
1070 } else if (status != OptimizingCompiler::SUCCEEDED) { | 1071 } else if (status != OptimizingCompiler::SUCCEEDED) { |
1071 info->set_bailout_reason("failed/bailed out last time"); | 1072 info->set_bailout_reason(kFailedBailedOutLastTime); |
1072 status = optimizing_compiler->AbortOptimization(); | 1073 status = optimizing_compiler->AbortOptimization(); |
1073 } else if (isolate->DebuggerHasBreakPoints()) { | 1074 } else if (isolate->DebuggerHasBreakPoints()) { |
1074 info->set_bailout_reason("debugger is active"); | 1075 info->set_bailout_reason(kDebuggerIsActive); |
1075 status = optimizing_compiler->AbortOptimization(); | 1076 status = optimizing_compiler->AbortOptimization(); |
1076 } else { | 1077 } else { |
1077 status = optimizing_compiler->GenerateAndInstallCode(); | 1078 status = optimizing_compiler->GenerateAndInstallCode(); |
1078 ASSERT(status == OptimizingCompiler::SUCCEEDED || | 1079 ASSERT(status == OptimizingCompiler::SUCCEEDED || |
1079 status == OptimizingCompiler::BAILED_OUT); | 1080 status == OptimizingCompiler::BAILED_OUT); |
1080 } | 1081 } |
1081 | 1082 |
1082 InstallCodeCommon(*info); | 1083 InstallCodeCommon(*info); |
1083 if (status == OptimizingCompiler::SUCCEEDED) { | 1084 if (status == OptimizingCompiler::SUCCEEDED) { |
1084 Handle<Code> code = info->code(); | 1085 Handle<Code> code = info->code(); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 // Trace if the appropriate trace flag is set and the phase name's first | 1262 // Trace if the appropriate trace flag is set and the phase name's first |
1262 // character is in the FLAG_trace_phase command line parameter. | 1263 // character is in the FLAG_trace_phase command line parameter. |
1263 bool tracing_on = info()->IsStub() ? | 1264 bool tracing_on = info()->IsStub() ? |
1264 FLAG_trace_hydrogen_stubs : | 1265 FLAG_trace_hydrogen_stubs : |
1265 FLAG_trace_hydrogen; | 1266 FLAG_trace_hydrogen; |
1266 return (tracing_on && | 1267 return (tracing_on && |
1267 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1268 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
1268 } | 1269 } |
1269 | 1270 |
1270 } } // namespace v8::internal | 1271 } } // namespace v8::internal |
OLD | NEW |