| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 no_frame_ranges_ = isolate->cpu_profiler()->is_profiling() | 113 no_frame_ranges_ = isolate->cpu_profiler()->is_profiling() |
| 114 ? new List<OffsetRange>(2) : NULL; | 114 ? new List<OffsetRange>(2) : NULL; |
| 115 for (int i = 0; i < DependentCode::kGroupCount; i++) { | 115 for (int i = 0; i < DependentCode::kGroupCount; i++) { |
| 116 dependencies_[i] = NULL; | 116 dependencies_[i] = NULL; |
| 117 } | 117 } |
| 118 if (mode == STUB) { | 118 if (mode == STUB) { |
| 119 mode_ = STUB; | 119 mode_ = STUB; |
| 120 return; | 120 return; |
| 121 } | 121 } |
| 122 mode_ = V8::UseCrankshaft() ? mode : NONOPT; | 122 mode_ = V8::UseCrankshaft() ? mode : NONOPT; |
| 123 abort_due_to_dependency_ = false; |
| 123 if (script_->type()->value() == Script::TYPE_NATIVE) { | 124 if (script_->type()->value() == Script::TYPE_NATIVE) { |
| 124 MarkAsNative(); | 125 MarkAsNative(); |
| 125 } | 126 } |
| 126 if (!shared_info_.is_null()) { | 127 if (!shared_info_.is_null()) { |
| 127 ASSERT(language_mode() == CLASSIC_MODE); | 128 ASSERT(language_mode() == CLASSIC_MODE); |
| 128 SetLanguageMode(shared_info_->language_mode()); | 129 SetLanguageMode(shared_info_->language_mode()); |
| 129 } | 130 } |
| 130 set_bailout_reason(kUnknown); | 131 set_bailout_reason(kUnknown); |
| 131 } | 132 } |
| 132 | 133 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 bool CompilationInfo::ShouldSelfOptimize() { | 225 bool CompilationInfo::ShouldSelfOptimize() { |
| 225 return FLAG_self_optimization && | 226 return FLAG_self_optimization && |
| 226 FLAG_crankshaft && | 227 FLAG_crankshaft && |
| 227 !function()->flags()->Contains(kDontSelfOptimize) && | 228 !function()->flags()->Contains(kDontSelfOptimize) && |
| 228 !function()->flags()->Contains(kDontOptimize) && | 229 !function()->flags()->Contains(kDontOptimize) && |
| 229 function()->scope()->AllowsLazyCompilation() && | 230 function()->scope()->AllowsLazyCompilation() && |
| 230 (shared_info().is_null() || !shared_info()->optimization_disabled()); | 231 (shared_info().is_null() || !shared_info()->optimization_disabled()); |
| 231 } | 232 } |
| 232 | 233 |
| 233 | 234 |
| 234 void CompilationInfo::AbortOptimization() { | |
| 235 Handle<Code> code(shared_info()->code()); | |
| 236 SetCode(code); | |
| 237 } | |
| 238 | |
| 239 | |
| 240 // Determine whether to use the full compiler for all code. If the flag | 235 // Determine whether to use the full compiler for all code. If the flag |
| 241 // --always-full-compiler is specified this is the case. For the virtual frame | 236 // --always-full-compiler is specified this is the case. For the virtual frame |
| 242 // based compiler the full compiler is also used if a debugger is connected, as | 237 // based compiler the full compiler is also used if a debugger is connected, as |
| 243 // the code from the full compiler supports mode precise break points. For the | 238 // the code from the full compiler supports mode precise break points. For the |
| 244 // crankshaft adaptive compiler debugging the optimized code is not possible at | 239 // crankshaft adaptive compiler debugging the optimized code is not possible at |
| 245 // all. However crankshaft support recompilation of functions, so in this case | 240 // all. However crankshaft support recompilation of functions, so in this case |
| 246 // the full compiler need not be be used if a debugger is attached, but only if | 241 // the full compiler need not be be used if a debugger is attached, but only if |
| 247 // break points has actually been set. | 242 // break points has actually been set. |
| 248 static bool IsDebuggerActive(Isolate* isolate) { | 243 static bool IsDebuggerActive(Isolate* isolate) { |
| 249 #ifdef ENABLE_DEBUGGER_SUPPORT | 244 #ifdef ENABLE_DEBUGGER_SUPPORT |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 } | 310 } |
| 316 | 311 |
| 317 | 312 |
| 318 OptimizingCompiler::Status OptimizingCompiler::CreateGraph() { | 313 OptimizingCompiler::Status OptimizingCompiler::CreateGraph() { |
| 319 ASSERT(V8::UseCrankshaft()); | 314 ASSERT(V8::UseCrankshaft()); |
| 320 ASSERT(info()->IsOptimizing()); | 315 ASSERT(info()->IsOptimizing()); |
| 321 ASSERT(!info()->IsCompilingForDebugging()); | 316 ASSERT(!info()->IsCompilingForDebugging()); |
| 322 | 317 |
| 323 // We should never arrive here if there is no code object on the | 318 // We should never arrive here if there is no code object on the |
| 324 // shared function object. | 319 // shared function object. |
| 325 Handle<Code> code(info()->shared_info()->code()); | 320 ASSERT(info()->shared_info()->code()->kind() == Code::FUNCTION); |
| 326 ASSERT(code->kind() == Code::FUNCTION); | |
| 327 | 321 |
| 328 if (FLAG_trace_opt) { | 322 if (FLAG_trace_opt) { |
| 329 // TODO(jbramley): This was added to help analyse the behaviour of | 323 // TODO(jbramley): This was added to help analyse the behaviour of |
| 330 // Crankshaft for the A64 Crankshaft port. It should eventually be deleted. | 324 // Crankshaft for the A64 Crankshaft port. It should eventually be deleted. |
| 331 Handle<JSFunction> function = info()->closure(); | 325 Handle<JSFunction> function = info()->closure(); |
| 332 PrintF("Attempting optimization of "); | 326 PrintF("Attempting optimization of "); |
| 333 function->PrintName(); | 327 function->PrintName(); |
| 334 PrintF(" / %" V8PRIxPTR "\n", reinterpret_cast<intptr_t>(*function)); | 328 PrintF(" / %" V8PRIxPTR "\n", reinterpret_cast<intptr_t>(*function)); |
| 335 } | 329 } |
| 336 | 330 |
| 337 // We should never arrive here if optimization has been disabled on the | 331 // We should never arrive here if optimization has been disabled on the |
| 338 // shared function info. | 332 // shared function info. |
| 339 ASSERT(!info()->shared_info()->optimization_disabled()); | 333 ASSERT(!info()->shared_info()->optimization_disabled()); |
| 340 | 334 |
| 341 // Fall back to using the full code generator if it's not possible | 335 // Fall back to using the full code generator if it's not possible |
| 342 // to use the Hydrogen-based optimizing compiler. We already have | 336 // to use the Hydrogen-based optimizing compiler. We already have |
| 343 // generated code for this from the shared function object. | 337 // generated code for this from the shared function object. |
| 344 if (AlwaysFullCompiler(isolate())) { | 338 if (AlwaysFullCompiler(isolate())) { |
| 345 info()->SetCode(code); | 339 info()->AbortOptimization(); |
| 346 return SetLastStatus(BAILED_OUT); | 340 return SetLastStatus(BAILED_OUT); |
| 347 } | 341 } |
| 348 | 342 |
| 349 // Limit the number of times we re-compile a functions with | 343 // Limit the number of times we re-compile a functions with |
| 350 // the optimizing compiler. | 344 // the optimizing compiler. |
| 351 const int kMaxOptCount = | 345 const int kMaxOptCount = |
| 352 FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000; | 346 FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000; |
| 353 if (info()->opt_count() > kMaxOptCount) { | 347 if (info()->opt_count() > kMaxOptCount) { |
| 354 info()->set_bailout_reason(kOptimizedTooManyTimes); | 348 info()->set_bailout_reason(kOptimizedTooManyTimes); |
| 355 return AbortOptimization(); | 349 return AbortOptimization(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 371 | 365 |
| 372 const int locals_limit = LUnallocated::kMaxFixedSlotIndex; | 366 const int locals_limit = LUnallocated::kMaxFixedSlotIndex; |
| 373 if (!info()->osr_ast_id().IsNone() && | 367 if (!info()->osr_ast_id().IsNone() && |
| 374 scope->num_parameters() + 1 + scope->num_stack_slots() > locals_limit) { | 368 scope->num_parameters() + 1 + scope->num_stack_slots() > locals_limit) { |
| 375 info()->set_bailout_reason(kTooManyParametersLocals); | 369 info()->set_bailout_reason(kTooManyParametersLocals); |
| 376 return AbortOptimization(); | 370 return AbortOptimization(); |
| 377 } | 371 } |
| 378 | 372 |
| 379 // Take --hydrogen-filter into account. | 373 // Take --hydrogen-filter into account. |
| 380 if (!info()->closure()->PassesHydrogenFilter()) { | 374 if (!info()->closure()->PassesHydrogenFilter()) { |
| 381 info()->SetCode(code); | 375 info()->AbortOptimization(); |
| 382 return SetLastStatus(BAILED_OUT); | 376 return SetLastStatus(BAILED_OUT); |
| 383 } | 377 } |
| 384 | 378 |
| 385 // Recompile the unoptimized version of the code if the current version | 379 // Recompile the unoptimized version of the code if the current version |
| 386 // doesn't have deoptimization support. Alternatively, we may decide to | 380 // doesn't have deoptimization support. Alternatively, we may decide to |
| 387 // run the full code generator to get a baseline for the compile-time | 381 // run the full code generator to get a baseline for the compile-time |
| 388 // performance of the hydrogen-based compiler. | 382 // performance of the hydrogen-based compiler. |
| 389 bool should_recompile = !info()->shared_info()->has_deoptimization_support(); | 383 bool should_recompile = !info()->shared_info()->has_deoptimization_support(); |
| 390 if (should_recompile || FLAG_hydrogen_stats) { | 384 if (should_recompile || FLAG_hydrogen_stats) { |
| 391 int64_t start_ticks = 0; | 385 int64_t start_ticks = 0; |
| 392 if (FLAG_hydrogen_stats) { | 386 if (FLAG_hydrogen_stats) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 412 int64_t ticks = OS::Ticks() - start_ticks; | 406 int64_t ticks = OS::Ticks() - start_ticks; |
| 413 isolate()->GetHStatistics()->IncrementFullCodeGen(ticks); | 407 isolate()->GetHStatistics()->IncrementFullCodeGen(ticks); |
| 414 } | 408 } |
| 415 } | 409 } |
| 416 | 410 |
| 417 // Check that the unoptimized, shared code is ready for | 411 // Check that the unoptimized, shared code is ready for |
| 418 // optimizations. When using the always_opt flag we disregard the | 412 // optimizations. When using the always_opt flag we disregard the |
| 419 // optimizable marker in the code object and optimize anyway. This | 413 // optimizable marker in the code object and optimize anyway. This |
| 420 // is safe as long as the unoptimized code has deoptimization | 414 // is safe as long as the unoptimized code has deoptimization |
| 421 // support. | 415 // support. |
| 422 ASSERT(FLAG_always_opt || code->optimizable()); | 416 ASSERT(FLAG_always_opt || info()->shared_info()->code()->optimizable()); |
| 423 ASSERT(info()->shared_info()->has_deoptimization_support()); | 417 ASSERT(info()->shared_info()->has_deoptimization_support()); |
| 424 | 418 |
| 425 if (FLAG_trace_hydrogen) { | 419 if (FLAG_trace_hydrogen) { |
| 426 Handle<String> name = info()->function()->debug_name(); | 420 Handle<String> name = info()->function()->debug_name(); |
| 427 PrintF("-----------------------------------------------------------\n"); | 421 PrintF("-----------------------------------------------------------\n"); |
| 428 PrintF("Compiling method %s using hydrogen\n", *name->ToCString()); | 422 PrintF("Compiling method %s using hydrogen\n", *name->ToCString()); |
| 429 isolate()->GetHTracer()->TraceCompilation(info()); | 423 isolate()->GetHTracer()->TraceCompilation(info()); |
| 430 } | 424 } |
| 431 | 425 |
| 432 // Type-check the function. | 426 // Type-check the function. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 448 ASSERT(!graph_builder_->inline_bailout() || graph_ == NULL); | 442 ASSERT(!graph_builder_->inline_bailout() || graph_ == NULL); |
| 449 if (graph_ == NULL) { | 443 if (graph_ == NULL) { |
| 450 if (graph_builder_->inline_bailout()) { | 444 if (graph_builder_->inline_bailout()) { |
| 451 info_->AbortOptimization(); | 445 info_->AbortOptimization(); |
| 452 return SetLastStatus(BAILED_OUT); | 446 return SetLastStatus(BAILED_OUT); |
| 453 } else { | 447 } else { |
| 454 return AbortOptimization(); | 448 return AbortOptimization(); |
| 455 } | 449 } |
| 456 } | 450 } |
| 457 | 451 |
| 452 if (info()->HasAbortedDueToDependencyChange()) { |
| 453 info_->set_bailout_reason(kBailedOutDueToDependencyChange); |
| 454 info_->AbortOptimization(); |
| 455 return SetLastStatus(BAILED_OUT); |
| 456 } |
| 457 |
| 458 return SetLastStatus(SUCCEEDED); | 458 return SetLastStatus(SUCCEEDED); |
| 459 } | 459 } |
| 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 DisallowCodeDependencyChange no_dependency_change; |
| 466 | 467 |
| 467 ASSERT(last_status() == SUCCEEDED); | 468 ASSERT(last_status() == SUCCEEDED); |
| 468 Timer t(this, &time_taken_to_optimize_); | 469 Timer t(this, &time_taken_to_optimize_); |
| 469 ASSERT(graph_ != NULL); | 470 ASSERT(graph_ != NULL); |
| 470 BailoutReason bailout_reason = kNoReason; | 471 BailoutReason bailout_reason = kNoReason; |
| 471 if (!graph_->Optimize(&bailout_reason)) { | 472 if (!graph_->Optimize(&bailout_reason)) { |
| 472 if (bailout_reason == kNoReason) graph_builder_->Bailout(bailout_reason); | 473 if (bailout_reason == kNoReason) graph_builder_->Bailout(bailout_reason); |
| 473 return SetLastStatus(BAILED_OUT); | 474 return SetLastStatus(BAILED_OUT); |
| 474 } else { | 475 } else { |
| 475 chunk_ = LChunk::NewChunk(graph_); | 476 chunk_ = LChunk::NewChunk(graph_); |
| 476 if (chunk_ == NULL) { | 477 if (chunk_ == NULL) { |
| 477 return SetLastStatus(BAILED_OUT); | 478 return SetLastStatus(BAILED_OUT); |
| 478 } | 479 } |
| 479 } | 480 } |
| 480 return SetLastStatus(SUCCEEDED); | 481 return SetLastStatus(SUCCEEDED); |
| 481 } | 482 } |
| 482 | 483 |
| 483 | 484 |
| 484 OptimizingCompiler::Status OptimizingCompiler::GenerateAndInstallCode() { | 485 OptimizingCompiler::Status OptimizingCompiler::GenerateAndInstallCode() { |
| 485 ASSERT(last_status() == SUCCEEDED); | 486 ASSERT(last_status() == SUCCEEDED); |
| 487 ASSERT(!info()->HasAbortedDueToDependencyChange()); |
| 488 DisallowCodeDependencyChange no_dependency_change; |
| 486 { // Scope for timer. | 489 { // Scope for timer. |
| 487 Timer timer(this, &time_taken_to_codegen_); | 490 Timer timer(this, &time_taken_to_codegen_); |
| 488 ASSERT(chunk_ != NULL); | 491 ASSERT(chunk_ != NULL); |
| 489 ASSERT(graph_ != NULL); | 492 ASSERT(graph_ != NULL); |
| 490 // Deferred handles reference objects that were accessible during | 493 // Deferred handles reference objects that were accessible during |
| 491 // graph creation. To make sure that we don't encounter inconsistencies | 494 // graph creation. To make sure that we don't encounter inconsistencies |
| 492 // between graph creation and code generation, we disallow accessing | 495 // between graph creation and code generation, we disallow accessing |
| 493 // objects through deferred handles during the latter, with exceptions. | 496 // objects through deferred handles during the latter, with exceptions. |
| 494 DisallowDeferredHandleDereference no_deferred_handle_deref; | 497 DisallowDeferredHandleDereference no_deferred_handle_deref; |
| 495 Handle<Code> optimized_code = chunk_->Codegen(); | 498 Handle<Code> optimized_code = chunk_->Codegen(); |
| 496 if (optimized_code.is_null()) { | 499 if (optimized_code.is_null()) { |
| 497 if (info()->bailout_reason() != kNoReason) { | 500 if (info()->bailout_reason() == kNoReason) { |
| 498 info()->set_bailout_reason(kCodeGenerationFailed); | 501 info()->set_bailout_reason(kCodeGenerationFailed); |
| 499 } | 502 } |
| 500 return AbortOptimization(); | 503 return AbortOptimization(); |
| 501 } | 504 } |
| 502 info()->SetCode(optimized_code); | 505 info()->SetCode(optimized_code); |
| 503 } | 506 } |
| 504 RecordOptimizationStats(); | 507 RecordOptimizationStats(); |
| 505 return SetLastStatus(SUCCEEDED); | 508 return SetLastStatus(SUCCEEDED); |
| 506 } | 509 } |
| 507 | 510 |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 | 820 |
| 818 | 821 |
| 819 static bool InstallFullCode(CompilationInfo* info) { | 822 static bool InstallFullCode(CompilationInfo* info) { |
| 820 // Update the shared function info with the compiled code and the | 823 // Update the shared function info with the compiled code and the |
| 821 // scope info. Please note, that the order of the shared function | 824 // scope info. Please note, that the order of the shared function |
| 822 // info initialization is important since set_scope_info might | 825 // info initialization is important since set_scope_info might |
| 823 // trigger a GC, causing the ASSERT below to be invalid if the code | 826 // trigger a GC, causing the ASSERT below to be invalid if the code |
| 824 // was flushed. By setting the code object last we avoid this. | 827 // was flushed. By setting the code object last we avoid this. |
| 825 Handle<SharedFunctionInfo> shared = info->shared_info(); | 828 Handle<SharedFunctionInfo> shared = info->shared_info(); |
| 826 Handle<Code> code = info->code(); | 829 Handle<Code> code = info->code(); |
| 830 CHECK(code->kind() == Code::FUNCTION); |
| 827 Handle<JSFunction> function = info->closure(); | 831 Handle<JSFunction> function = info->closure(); |
| 828 Handle<ScopeInfo> scope_info = | 832 Handle<ScopeInfo> scope_info = |
| 829 ScopeInfo::Create(info->scope(), info->zone()); | 833 ScopeInfo::Create(info->scope(), info->zone()); |
| 830 shared->set_scope_info(*scope_info); | 834 shared->set_scope_info(*scope_info); |
| 831 shared->ReplaceCode(*code); | 835 shared->ReplaceCode(*code); |
| 832 if (!function.is_null()) { | 836 if (!function.is_null()) { |
| 833 function->ReplaceCode(*code); | 837 function->ReplaceCode(*code); |
| 834 ASSERT(!function->IsOptimized()); | 838 ASSERT(!function->IsOptimized()); |
| 835 } | 839 } |
| 836 | 840 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 } | 1065 } |
| 1062 | 1066 |
| 1063 Isolate* isolate = info->isolate(); | 1067 Isolate* isolate = info->isolate(); |
| 1064 VMState<COMPILER> state(isolate); | 1068 VMState<COMPILER> state(isolate); |
| 1065 Logger::TimerEventScope timer( | 1069 Logger::TimerEventScope timer( |
| 1066 isolate, Logger::TimerEventScope::v8_recompile_synchronous); | 1070 isolate, Logger::TimerEventScope::v8_recompile_synchronous); |
| 1067 // If crankshaft succeeded, install the optimized code else install | 1071 // If crankshaft succeeded, install the optimized code else install |
| 1068 // the unoptimized code. | 1072 // the unoptimized code. |
| 1069 OptimizingCompiler::Status status = optimizing_compiler->last_status(); | 1073 OptimizingCompiler::Status status = optimizing_compiler->last_status(); |
| 1070 if (info->HasAbortedDueToDependencyChange()) { | 1074 if (info->HasAbortedDueToDependencyChange()) { |
| 1071 info->set_bailout_reason(kBailedOutDueToDependentMap); | 1075 info->set_bailout_reason(kBailedOutDueToDependencyChange); |
| 1072 status = optimizing_compiler->AbortOptimization(); | 1076 status = optimizing_compiler->AbortOptimization(); |
| 1073 } else if (status != OptimizingCompiler::SUCCEEDED) { | 1077 } else if (status != OptimizingCompiler::SUCCEEDED) { |
| 1074 info->set_bailout_reason(kFailedBailedOutLastTime); | 1078 info->set_bailout_reason(kFailedBailedOutLastTime); |
| 1075 status = optimizing_compiler->AbortOptimization(); | 1079 status = optimizing_compiler->AbortOptimization(); |
| 1076 } else if (isolate->DebuggerHasBreakPoints()) { | 1080 } else if (isolate->DebuggerHasBreakPoints()) { |
| 1077 info->set_bailout_reason(kDebuggerIsActive); | 1081 info->set_bailout_reason(kDebuggerIsActive); |
| 1078 status = optimizing_compiler->AbortOptimization(); | 1082 status = optimizing_compiler->AbortOptimization(); |
| 1079 } else { | 1083 } else { |
| 1080 status = optimizing_compiler->GenerateAndInstallCode(); | 1084 status = optimizing_compiler->GenerateAndInstallCode(); |
| 1081 ASSERT(status == OptimizingCompiler::SUCCEEDED || | 1085 ASSERT(status == OptimizingCompiler::SUCCEEDED || |
| 1082 status == OptimizingCompiler::BAILED_OUT); | 1086 status == OptimizingCompiler::BAILED_OUT); |
| 1083 } | 1087 } |
| 1084 | 1088 |
| 1085 InstallCodeCommon(*info); | 1089 InstallCodeCommon(*info); |
| 1086 if (status == OptimizingCompiler::SUCCEEDED) { | 1090 if (status == OptimizingCompiler::SUCCEEDED) { |
| 1087 Handle<Code> code = info->code(); | 1091 Handle<Code> code = info->code(); |
| 1088 ASSERT(info->shared_info()->scope_info() != ScopeInfo::Empty(isolate)); | 1092 ASSERT(info->shared_info()->scope_info() != ScopeInfo::Empty(isolate)); |
| 1089 info->closure()->ReplaceCode(*code); | 1093 info->closure()->ReplaceCode(*code); |
| 1090 if (info->shared_info()->SearchOptimizedCodeMap( | 1094 if (info->shared_info()->SearchOptimizedCodeMap( |
| 1091 info->closure()->context()->native_context()) == -1) { | 1095 info->closure()->context()->native_context()) == -1) { |
| 1092 InsertCodeIntoOptimizedCodeMap(*info); | 1096 InsertCodeIntoOptimizedCodeMap(*info); |
| 1093 } | 1097 } |
| 1094 if (FLAG_trace_parallel_recompilation) { | 1098 if (FLAG_trace_parallel_recompilation) { |
| 1095 PrintF(" ** Optimized code for "); | 1099 PrintF(" ** Optimized code for "); |
| 1096 info->closure()->PrintName(); | 1100 info->closure()->PrintName(); |
| 1097 PrintF(" installed.\n"); | 1101 PrintF(" installed.\n"); |
| 1098 } | 1102 } |
| 1099 } else { | 1103 } else { |
| 1100 info->SetCode(Handle<Code>(info->shared_info()->code())); | 1104 info->AbortOptimization(); |
| 1101 InstallFullCode(*info); | 1105 InstallFullCode(*info); |
| 1102 } | 1106 } |
| 1103 // Optimized code is finally replacing unoptimized code. Reset the latter's | 1107 // Optimized code is finally replacing unoptimized code. Reset the latter's |
| 1104 // profiler ticks to prevent too soon re-opt after a deopt. | 1108 // profiler ticks to prevent too soon re-opt after a deopt. |
| 1105 info->shared_info()->code()->set_profiler_ticks(0); | 1109 info->shared_info()->code()->set_profiler_ticks(0); |
| 1106 ASSERT(!info->closure()->IsMarkedForInstallingRecompiledCode()); | 1110 ASSERT(!info->closure()->IsMarkedForInstallingRecompiledCode()); |
| 1107 } | 1111 } |
| 1108 | 1112 |
| 1109 | 1113 |
| 1110 Handle<SharedFunctionInfo> Compiler::BuildFunctionInfo(FunctionLiteral* literal, | 1114 Handle<SharedFunctionInfo> Compiler::BuildFunctionInfo(FunctionLiteral* literal, |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1264 // Trace if the appropriate trace flag is set and the phase name's first | 1268 // Trace if the appropriate trace flag is set and the phase name's first |
| 1265 // character is in the FLAG_trace_phase command line parameter. | 1269 // character is in the FLAG_trace_phase command line parameter. |
| 1266 bool tracing_on = info()->IsStub() ? | 1270 bool tracing_on = info()->IsStub() ? |
| 1267 FLAG_trace_hydrogen_stubs : | 1271 FLAG_trace_hydrogen_stubs : |
| 1268 FLAG_trace_hydrogen; | 1272 FLAG_trace_hydrogen; |
| 1269 return (tracing_on && | 1273 return (tracing_on && |
| 1270 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1274 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
| 1271 } | 1275 } |
| 1272 | 1276 |
| 1273 } } // namespace v8::internal | 1277 } } // namespace v8::internal |
| OLD | NEW |