| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "runtime-profiler.h" | 46 #include "runtime-profiler.h" |
| 47 #include "scanner-character-streams.h" | 47 #include "scanner-character-streams.h" |
| 48 #include "scopeinfo.h" | 48 #include "scopeinfo.h" |
| 49 #include "scopes.h" | 49 #include "scopes.h" |
| 50 #include "vm-state-inl.h" | 50 #include "vm-state-inl.h" |
| 51 | 51 |
| 52 namespace v8 { | 52 namespace v8 { |
| 53 namespace internal { | 53 namespace internal { |
| 54 | 54 |
| 55 | 55 |
| 56 CompilationInfo::CompilationInfo(Handle<Script> script, Zone* zone) | 56 CompilationInfo::CompilationInfo(Handle<Script> script, |
| 57 Zone* zone) |
| 57 : flags_(LanguageModeField::encode(CLASSIC_MODE)), | 58 : flags_(LanguageModeField::encode(CLASSIC_MODE)), |
| 58 script_(script), | 59 script_(script), |
| 59 osr_ast_id_(BailoutId::None()) { | 60 osr_ast_id_(BailoutId::None()) { |
| 60 Initialize(script->GetIsolate(), BASE, zone); | 61 Initialize(script->GetIsolate(), BASE, zone); |
| 61 } | 62 } |
| 62 | 63 |
| 63 | 64 |
| 64 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info, | 65 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info, |
| 65 Zone* zone) | 66 Zone* zone) |
| 66 : flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)), | 67 : flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)), |
| 67 shared_info_(shared_info), | 68 shared_info_(shared_info), |
| 68 script_(Handle<Script>(Script::cast(shared_info->script()))), | 69 script_(Handle<Script>(Script::cast(shared_info->script()))), |
| 69 osr_ast_id_(BailoutId::None()) { | 70 osr_ast_id_(BailoutId::None()) { |
| 70 Initialize(script_->GetIsolate(), BASE, zone); | 71 Initialize(script_->GetIsolate(), BASE, zone); |
| 71 } | 72 } |
| 72 | 73 |
| 73 | 74 |
| 74 CompilationInfo::CompilationInfo(Handle<JSFunction> closure, Zone* zone) | 75 CompilationInfo::CompilationInfo(Handle<JSFunction> closure, |
| 76 Zone* zone) |
| 75 : flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)), | 77 : flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)), |
| 76 closure_(closure), | 78 closure_(closure), |
| 77 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), | 79 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), |
| 78 script_(Handle<Script>(Script::cast(shared_info_->script()))), | 80 script_(Handle<Script>(Script::cast(shared_info_->script()))), |
| 79 context_(closure->context()), | 81 context_(closure->context()), |
| 80 osr_ast_id_(BailoutId::None()) { | 82 osr_ast_id_(BailoutId::None()) { |
| 81 Initialize(script_->GetIsolate(), BASE, zone); | 83 Initialize(script_->GetIsolate(), BASE, zone); |
| 82 } | 84 } |
| 83 | 85 |
| 84 | 86 |
| 85 CompilationInfo::CompilationInfo(HydrogenCodeStub* stub, | 87 CompilationInfo::CompilationInfo(HydrogenCodeStub* stub, |
| 86 Isolate* isolate, Zone* zone) | 88 Isolate* isolate, |
| 89 Zone* zone) |
| 87 : flags_(LanguageModeField::encode(CLASSIC_MODE) | | 90 : flags_(LanguageModeField::encode(CLASSIC_MODE) | |
| 88 IsLazy::encode(true)), | 91 IsLazy::encode(true)), |
| 89 osr_ast_id_(BailoutId::None()) { | 92 osr_ast_id_(BailoutId::None()) { |
| 90 Initialize(isolate, STUB, zone); | 93 Initialize(isolate, STUB, zone); |
| 91 code_stub_ = stub; | 94 code_stub_ = stub; |
| 92 } | 95 } |
| 93 | 96 |
| 94 | 97 |
| 95 void CompilationInfo::Initialize(Isolate* isolate, Mode mode, Zone* zone) { | 98 void CompilationInfo::Initialize(Isolate* isolate, |
| 99 Mode mode, |
| 100 Zone* zone) { |
| 96 isolate_ = isolate; | 101 isolate_ = isolate; |
| 97 function_ = NULL; | 102 function_ = NULL; |
| 98 scope_ = NULL; | 103 scope_ = NULL; |
| 99 global_scope_ = NULL; | 104 global_scope_ = NULL; |
| 100 extension_ = NULL; | 105 extension_ = NULL; |
| 101 pre_parse_data_ = NULL; | 106 pre_parse_data_ = NULL; |
| 102 zone_ = zone; | 107 zone_ = zone; |
| 103 deferred_handles_ = NULL; | 108 deferred_handles_ = NULL; |
| 104 code_stub_ = NULL; | 109 code_stub_ = NULL; |
| 105 prologue_offset_ = kPrologueOffsetNotSet; | 110 prologue_offset_ = kPrologueOffsetNotSet; |
| 106 opt_count_ = shared_info().is_null() ? 0 : shared_info()->opt_count(); | 111 opt_count_ = shared_info().is_null() ? 0 : shared_info()->opt_count(); |
| 107 no_frame_ranges_ = isolate->cpu_profiler()->is_profiling() | 112 no_frame_ranges_ = isolate->cpu_profiler()->is_profiling() |
| 108 ? new List<OffsetRange>(2) : NULL; | 113 ? new List<OffsetRange>(2) : NULL; |
| 109 for (int i = 0; i < DependentCode::kGroupCount; i++) { | 114 for (int i = 0; i < DependentCode::kGroupCount; i++) { |
| 110 dependent_maps_[i] = NULL; | 115 dependencies_[i] = NULL; |
| 111 } | 116 } |
| 112 if (mode == STUB) { | 117 if (mode == STUB) { |
| 113 mode_ = STUB; | 118 mode_ = STUB; |
| 114 return; | 119 return; |
| 115 } | 120 } |
| 116 mode_ = V8::UseCrankshaft() ? mode : NONOPT; | 121 mode_ = V8::UseCrankshaft() ? mode : NONOPT; |
| 117 if (script_->type()->value() == Script::TYPE_NATIVE) { | 122 if (script_->type()->value() == Script::TYPE_NATIVE) { |
| 118 MarkAsNative(); | 123 MarkAsNative(); |
| 119 } | 124 } |
| 120 if (!shared_info_.is_null()) { | 125 if (!shared_info_.is_null()) { |
| 121 ASSERT(language_mode() == CLASSIC_MODE); | 126 ASSERT(language_mode() == CLASSIC_MODE); |
| 122 SetLanguageMode(shared_info_->language_mode()); | 127 SetLanguageMode(shared_info_->language_mode()); |
| 123 } | 128 } |
| 124 set_bailout_reason("unknown"); | 129 set_bailout_reason("unknown"); |
| 125 } | 130 } |
| 126 | 131 |
| 127 | 132 |
| 128 CompilationInfo::~CompilationInfo() { | 133 CompilationInfo::~CompilationInfo() { |
| 129 delete deferred_handles_; | 134 delete deferred_handles_; |
| 130 delete no_frame_ranges_; | 135 delete no_frame_ranges_; |
| 131 #ifdef DEBUG | 136 #ifdef DEBUG |
| 132 // Check that no dependent maps have been added or added dependent maps have | 137 // Check that no dependent maps have been added or added dependent maps have |
| 133 // been rolled back or committed. | 138 // been rolled back or committed. |
| 134 for (int i = 0; i < DependentCode::kGroupCount; i++) { | 139 for (int i = 0; i < DependentCode::kGroupCount; i++) { |
| 135 ASSERT_EQ(NULL, dependent_maps_[i]); | 140 ASSERT_EQ(NULL, dependencies_[i]); |
| 136 } | 141 } |
| 137 #endif // DEBUG | 142 #endif // DEBUG |
| 138 } | 143 } |
| 139 | 144 |
| 140 | 145 |
| 141 void CompilationInfo::CommitDependentMaps(Handle<Code> code) { | 146 void CompilationInfo::CommitDependencies(Handle<Code> code) { |
| 142 for (int i = 0; i < DependentCode::kGroupCount; i++) { | 147 for (int i = 0; i < DependentCode::kGroupCount; i++) { |
| 143 ZoneList<Handle<Map> >* group_maps = dependent_maps_[i]; | 148 ZoneList<Handle<HeapObject> >* group_objects = dependencies_[i]; |
| 144 if (group_maps == NULL) continue; | 149 if (group_objects == NULL) continue; |
| 145 ASSERT(!object_wrapper_.is_null()); | 150 ASSERT(!object_wrapper_.is_null()); |
| 146 for (int j = 0; j < group_maps->length(); j++) { | 151 for (int j = 0; j < group_objects->length(); j++) { |
| 147 group_maps->at(j)->dependent_code()->UpdateToFinishedCode( | 152 DependentCode::DependencyGroup group = |
| 148 static_cast<DependentCode::DependencyGroup>(i), this, *code); | 153 static_cast<DependentCode::DependencyGroup>(i); |
| 154 DependentCode* dependent_code = |
| 155 DependentCode::ForObject(group_objects->at(j), group); |
| 156 dependent_code->UpdateToFinishedCode(group, this, *code); |
| 149 } | 157 } |
| 150 dependent_maps_[i] = NULL; // Zone-allocated, no need to delete. | 158 dependencies_[i] = NULL; // Zone-allocated, no need to delete. |
| 151 } | 159 } |
| 152 } | 160 } |
| 153 | 161 |
| 154 | 162 |
| 155 void CompilationInfo::RollbackDependentMaps() { | 163 void CompilationInfo::RollbackDependencies() { |
| 156 // Unregister from all dependent maps if not yet committed. | 164 // Unregister from all dependent maps if not yet committed. |
| 157 for (int i = 0; i < DependentCode::kGroupCount; i++) { | 165 for (int i = 0; i < DependentCode::kGroupCount; i++) { |
| 158 ZoneList<Handle<Map> >* group_maps = dependent_maps_[i]; | 166 ZoneList<Handle<HeapObject> >* group_objects = dependencies_[i]; |
| 159 if (group_maps == NULL) continue; | 167 if (group_objects == NULL) continue; |
| 160 for (int j = 0; j < group_maps->length(); j++) { | 168 for (int j = 0; j < group_objects->length(); j++) { |
| 161 group_maps->at(j)->dependent_code()->RemoveCompilationInfo( | 169 DependentCode::DependencyGroup group = |
| 162 static_cast<DependentCode::DependencyGroup>(i), this); | 170 static_cast<DependentCode::DependencyGroup>(i); |
| 171 DependentCode* dependent_code = |
| 172 DependentCode::ForObject(group_objects->at(j), group); |
| 173 dependent_code->RemoveCompilationInfo(group, this); |
| 163 } | 174 } |
| 164 dependent_maps_[i] = NULL; // Zone-allocated, no need to delete. | 175 dependencies_[i] = NULL; // Zone-allocated, no need to delete. |
| 165 } | 176 } |
| 166 } | 177 } |
| 167 | 178 |
| 168 | 179 |
| 169 int CompilationInfo::num_parameters() const { | 180 int CompilationInfo::num_parameters() const { |
| 170 ASSERT(!IsStub()); | 181 ASSERT(!IsStub()); |
| 171 return scope()->num_parameters(); | 182 return scope()->num_parameters(); |
| 172 } | 183 } |
| 173 | 184 |
| 174 | 185 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 info()->SetCode(code); | 380 info()->SetCode(code); |
| 370 return SetLastStatus(BAILED_OUT); | 381 return SetLastStatus(BAILED_OUT); |
| 371 } | 382 } |
| 372 | 383 |
| 373 // Recompile the unoptimized version of the code if the current version | 384 // Recompile the unoptimized version of the code if the current version |
| 374 // doesn't have deoptimization support. Alternatively, we may decide to | 385 // doesn't have deoptimization support. Alternatively, we may decide to |
| 375 // run the full code generator to get a baseline for the compile-time | 386 // run the full code generator to get a baseline for the compile-time |
| 376 // performance of the hydrogen-based compiler. | 387 // performance of the hydrogen-based compiler. |
| 377 bool should_recompile = !info()->shared_info()->has_deoptimization_support(); | 388 bool should_recompile = !info()->shared_info()->has_deoptimization_support(); |
| 378 if (should_recompile || FLAG_hydrogen_stats) { | 389 if (should_recompile || FLAG_hydrogen_stats) { |
| 379 HPhase phase(HPhase::kFullCodeGen, isolate(), info()->zone()); | 390 int64_t start_ticks = 0; |
| 391 if (FLAG_hydrogen_stats) { |
| 392 start_ticks = OS::Ticks(); |
| 393 } |
| 380 CompilationInfoWithZone unoptimized(info()->shared_info()); | 394 CompilationInfoWithZone unoptimized(info()->shared_info()); |
| 381 // Note that we use the same AST that we will use for generating the | 395 // Note that we use the same AST that we will use for generating the |
| 382 // optimized code. | 396 // optimized code. |
| 383 unoptimized.SetFunction(info()->function()); | 397 unoptimized.SetFunction(info()->function()); |
| 384 unoptimized.SetScope(info()->scope()); | 398 unoptimized.SetScope(info()->scope()); |
| 385 unoptimized.SetContext(info()->context()); | 399 unoptimized.SetContext(info()->context()); |
| 386 if (should_recompile) unoptimized.EnableDeoptimizationSupport(); | 400 if (should_recompile) unoptimized.EnableDeoptimizationSupport(); |
| 387 bool succeeded = FullCodeGenerator::MakeCode(&unoptimized); | 401 bool succeeded = FullCodeGenerator::MakeCode(&unoptimized); |
| 388 if (should_recompile) { | 402 if (should_recompile) { |
| 389 if (!succeeded) return SetLastStatus(FAILED); | 403 if (!succeeded) return SetLastStatus(FAILED); |
| 390 Handle<SharedFunctionInfo> shared = info()->shared_info(); | 404 Handle<SharedFunctionInfo> shared = info()->shared_info(); |
| 391 shared->EnableDeoptimizationSupport(*unoptimized.code()); | 405 shared->EnableDeoptimizationSupport(*unoptimized.code()); |
| 392 // The existing unoptimized code was replaced with the new one. | 406 // The existing unoptimized code was replaced with the new one. |
| 393 Compiler::RecordFunctionCompilation( | 407 Compiler::RecordFunctionCompilation( |
| 394 Logger::LAZY_COMPILE_TAG, &unoptimized, shared); | 408 Logger::LAZY_COMPILE_TAG, &unoptimized, shared); |
| 395 } | 409 } |
| 410 if (FLAG_hydrogen_stats) { |
| 411 int64_t ticks = OS::Ticks() - start_ticks; |
| 412 isolate()->GetHStatistics()->IncrementFullCodeGen(ticks); |
| 413 } |
| 396 } | 414 } |
| 397 | 415 |
| 398 // Check that the unoptimized, shared code is ready for | 416 // Check that the unoptimized, shared code is ready for |
| 399 // optimizations. When using the always_opt flag we disregard the | 417 // optimizations. When using the always_opt flag we disregard the |
| 400 // optimizable marker in the code object and optimize anyway. This | 418 // optimizable marker in the code object and optimize anyway. This |
| 401 // is safe as long as the unoptimized code has deoptimization | 419 // is safe as long as the unoptimized code has deoptimization |
| 402 // support. | 420 // support. |
| 403 ASSERT(FLAG_always_opt || code->optimizable()); | 421 ASSERT(FLAG_always_opt || code->optimizable()); |
| 404 ASSERT(info()->shared_info()->has_deoptimization_support()); | 422 ASSERT(info()->shared_info()->has_deoptimization_support()); |
| 405 | 423 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 | 548 |
| 531 static bool DebuggerWantsEagerCompilation(CompilationInfo* info, | 549 static bool DebuggerWantsEagerCompilation(CompilationInfo* info, |
| 532 bool allow_lazy_without_ctx = false) { | 550 bool allow_lazy_without_ctx = false) { |
| 533 return LiveEditFunctionTracker::IsActive(info->isolate()) || | 551 return LiveEditFunctionTracker::IsActive(info->isolate()) || |
| 534 (info->isolate()->DebuggerHasBreakPoints() && !allow_lazy_without_ctx); | 552 (info->isolate()->DebuggerHasBreakPoints() && !allow_lazy_without_ctx); |
| 535 } | 553 } |
| 536 | 554 |
| 537 | 555 |
| 538 static Handle<SharedFunctionInfo> MakeFunctionInfo(CompilationInfo* info) { | 556 static Handle<SharedFunctionInfo> MakeFunctionInfo(CompilationInfo* info) { |
| 539 Isolate* isolate = info->isolate(); | 557 Isolate* isolate = info->isolate(); |
| 540 ZoneScope zone_scope(info->zone(), DELETE_ON_EXIT); | |
| 541 PostponeInterruptsScope postpone(isolate); | 558 PostponeInterruptsScope postpone(isolate); |
| 542 | 559 |
| 543 ASSERT(!isolate->native_context().is_null()); | 560 ASSERT(!isolate->native_context().is_null()); |
| 544 Handle<Script> script = info->script(); | 561 Handle<Script> script = info->script(); |
| 545 // TODO(svenpanne) Obscure place for this, perhaps move to OnBeforeCompile? | 562 // TODO(svenpanne) Obscure place for this, perhaps move to OnBeforeCompile? |
| 546 FixedArray* array = isolate->native_context()->embedder_data(); | 563 FixedArray* array = isolate->native_context()->embedder_data(); |
| 547 script->set_context_data(array->get(0)); | 564 script->set_context_data(array->get(0)); |
| 548 | 565 |
| 549 #ifdef ENABLE_DEBUGGER_SUPPORT | 566 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 550 if (info->is_eval()) { | 567 if (info->is_eval()) { |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 ASSERT(!function->IsOptimized()); | 830 ASSERT(!function->IsOptimized()); |
| 814 } | 831 } |
| 815 | 832 |
| 816 // Set the expected number of properties for instances. | 833 // Set the expected number of properties for instances. |
| 817 FunctionLiteral* lit = info->function(); | 834 FunctionLiteral* lit = info->function(); |
| 818 int expected = lit->expected_property_count(); | 835 int expected = lit->expected_property_count(); |
| 819 SetExpectedNofPropertiesFromEstimate(shared, expected); | 836 SetExpectedNofPropertiesFromEstimate(shared, expected); |
| 820 | 837 |
| 821 // Check the function has compiled code. | 838 // Check the function has compiled code. |
| 822 ASSERT(shared->is_compiled()); | 839 ASSERT(shared->is_compiled()); |
| 823 shared->set_code_age(0); | |
| 824 shared->set_dont_optimize(lit->flags()->Contains(kDontOptimize)); | 840 shared->set_dont_optimize(lit->flags()->Contains(kDontOptimize)); |
| 825 shared->set_dont_inline(lit->flags()->Contains(kDontInline)); | 841 shared->set_dont_inline(lit->flags()->Contains(kDontInline)); |
| 826 shared->set_ast_node_count(lit->ast_node_count()); | 842 shared->set_ast_node_count(lit->ast_node_count()); |
| 827 | 843 |
| 828 if (V8::UseCrankshaft() && | 844 if (V8::UseCrankshaft() && |
| 829 !function.is_null() && | 845 !function.is_null() && |
| 830 !shared->optimization_disabled()) { | 846 !shared->optimization_disabled()) { |
| 831 // If we're asked to always optimize, we compile the optimized | 847 // If we're asked to always optimize, we compile the optimized |
| 832 // version of the function right away - unless the debugger is | 848 // version of the function right away - unless the debugger is |
| 833 // active as it makes no sense to compile optimized code then. | 849 // active as it makes no sense to compile optimized code then. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 return true; | 911 return true; |
| 896 } | 912 } |
| 897 } | 913 } |
| 898 return false; | 914 return false; |
| 899 } | 915 } |
| 900 | 916 |
| 901 | 917 |
| 902 bool Compiler::CompileLazy(CompilationInfo* info) { | 918 bool Compiler::CompileLazy(CompilationInfo* info) { |
| 903 Isolate* isolate = info->isolate(); | 919 Isolate* isolate = info->isolate(); |
| 904 | 920 |
| 905 ZoneScope zone_scope(info->zone(), DELETE_ON_EXIT); | |
| 906 | |
| 907 // The VM is in the COMPILER state until exiting this function. | 921 // The VM is in the COMPILER state until exiting this function. |
| 908 VMState<COMPILER> state(isolate); | 922 VMState<COMPILER> state(isolate); |
| 909 | 923 |
| 910 PostponeInterruptsScope postpone(isolate); | 924 PostponeInterruptsScope postpone(isolate); |
| 911 | 925 |
| 912 Handle<SharedFunctionInfo> shared = info->shared_info(); | 926 Handle<SharedFunctionInfo> shared = info->shared_info(); |
| 913 int compiled_size = shared->end_position() - shared->start_position(); | 927 int compiled_size = shared->end_position() - shared->start_position(); |
| 914 isolate->counters()->total_compile_size()->Increment(compiled_size); | 928 isolate->counters()->total_compile_size()->Increment(compiled_size); |
| 915 | 929 |
| 916 if (InstallCodeFromOptimizedCodeMap(info)) return true; | 930 if (InstallCodeFromOptimizedCodeMap(info)) return true; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1040 return; | 1054 return; |
| 1041 } | 1055 } |
| 1042 | 1056 |
| 1043 Isolate* isolate = info->isolate(); | 1057 Isolate* isolate = info->isolate(); |
| 1044 VMState<COMPILER> state(isolate); | 1058 VMState<COMPILER> state(isolate); |
| 1045 Logger::TimerEventScope timer( | 1059 Logger::TimerEventScope timer( |
| 1046 isolate, Logger::TimerEventScope::v8_recompile_synchronous); | 1060 isolate, Logger::TimerEventScope::v8_recompile_synchronous); |
| 1047 // If crankshaft succeeded, install the optimized code else install | 1061 // If crankshaft succeeded, install the optimized code else install |
| 1048 // the unoptimized code. | 1062 // the unoptimized code. |
| 1049 OptimizingCompiler::Status status = optimizing_compiler->last_status(); | 1063 OptimizingCompiler::Status status = optimizing_compiler->last_status(); |
| 1050 if (info->HasAbortedDueToDependentMap()) { | 1064 if (info->HasAbortedDueToDependencyChange()) { |
| 1051 info->set_bailout_reason("bailed out due to dependent map"); | 1065 info->set_bailout_reason("bailed out due to dependent map"); |
| 1052 status = optimizing_compiler->AbortOptimization(); | 1066 status = optimizing_compiler->AbortOptimization(); |
| 1053 } else if (status != OptimizingCompiler::SUCCEEDED) { | 1067 } else if (status != OptimizingCompiler::SUCCEEDED) { |
| 1054 info->set_bailout_reason("failed/bailed out last time"); | 1068 info->set_bailout_reason("failed/bailed out last time"); |
| 1055 status = optimizing_compiler->AbortOptimization(); | 1069 status = optimizing_compiler->AbortOptimization(); |
| 1056 } else { | 1070 } else { |
| 1057 status = optimizing_compiler->GenerateAndInstallCode(); | 1071 status = optimizing_compiler->GenerateAndInstallCode(); |
| 1058 ASSERT(status == OptimizingCompiler::SUCCEEDED || | 1072 ASSERT(status == OptimizingCompiler::SUCCEEDED || |
| 1059 status == OptimizingCompiler::BAILED_OUT); | 1073 status == OptimizingCompiler::BAILED_OUT); |
| 1060 } | 1074 } |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 shared->DebugName())); | 1223 shared->DebugName())); |
| 1210 } | 1224 } |
| 1211 } | 1225 } |
| 1212 | 1226 |
| 1213 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 1227 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
| 1214 Handle<Script>(info->script()), | 1228 Handle<Script>(info->script()), |
| 1215 Handle<Code>(info->code()), | 1229 Handle<Code>(info->code()), |
| 1216 info)); | 1230 info)); |
| 1217 } | 1231 } |
| 1218 | 1232 |
| 1233 |
| 1234 CompilationPhase::CompilationPhase(const char* name, CompilationInfo* info) |
| 1235 : name_(name), info_(info), zone_(info->isolate()) { |
| 1236 if (FLAG_hydrogen_stats) { |
| 1237 info_zone_start_allocation_size_ = info->zone()->allocation_size(); |
| 1238 start_ticks_ = OS::Ticks(); |
| 1239 } |
| 1240 } |
| 1241 |
| 1242 |
| 1243 CompilationPhase::~CompilationPhase() { |
| 1244 if (FLAG_hydrogen_stats) { |
| 1245 unsigned size = zone()->allocation_size(); |
| 1246 size += info_->zone()->allocation_size() - info_zone_start_allocation_size_; |
| 1247 int64_t ticks = OS::Ticks() - start_ticks_; |
| 1248 isolate()->GetHStatistics()->SaveTiming(name_, ticks, size); |
| 1249 } |
| 1250 } |
| 1251 |
| 1252 |
| 1253 bool CompilationPhase::ShouldProduceTraceOutput() const { |
| 1254 // Produce trace output if flag is set so that the first letter of the |
| 1255 // phase name matches the command line parameter FLAG_trace_phase. |
| 1256 return (FLAG_trace_hydrogen && |
| 1257 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
| 1258 } |
| 1259 |
| 1219 } } // namespace v8::internal | 1260 } } // namespace v8::internal |
| OLD | NEW |