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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 return AbortOptimization(); | 389 return AbortOptimization(); |
390 } | 390 } |
391 } | 391 } |
392 | 392 |
393 return SetLastStatus(SUCCEEDED); | 393 return SetLastStatus(SUCCEEDED); |
394 } | 394 } |
395 | 395 |
396 OptimizingCompiler::Status OptimizingCompiler::OptimizeGraph() { | 396 OptimizingCompiler::Status OptimizingCompiler::OptimizeGraph() { |
397 AssertNoAllocation no_gc; | 397 AssertNoAllocation no_gc; |
398 NoHandleAllocation no_handles(isolate()); | 398 NoHandleAllocation no_handles(isolate()); |
399 NoHandleDereference no_deref(isolate()); | 399 HandleDereferenceGuard no_deref(isolate(), HandleDereferenceGuard::DISALLOW); |
400 | 400 |
401 ASSERT(last_status() == SUCCEEDED); | 401 ASSERT(last_status() == SUCCEEDED); |
402 Timer t(this, &time_taken_to_optimize_); | 402 Timer t(this, &time_taken_to_optimize_); |
403 ASSERT(graph_ != NULL); | 403 ASSERT(graph_ != NULL); |
404 SmartArrayPointer<char> bailout_reason; | 404 SmartArrayPointer<char> bailout_reason; |
405 if (!graph_->Optimize(&bailout_reason)) { | 405 if (!graph_->Optimize(&bailout_reason)) { |
406 if (!bailout_reason.is_empty()) graph_builder_->Bailout(*bailout_reason); | 406 if (!bailout_reason.is_empty()) graph_builder_->Bailout(*bailout_reason); |
407 return SetLastStatus(BAILED_OUT); | 407 return SetLastStatus(BAILED_OUT); |
408 } else { | 408 } else { |
409 chunk_ = LChunk::NewChunk(graph_); | 409 chunk_ = LChunk::NewChunk(graph_); |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 LanguageMode language_mode = info->function()->language_mode(); | 936 LanguageMode language_mode = info->function()->language_mode(); |
937 info->SetLanguageMode(language_mode); | 937 info->SetLanguageMode(language_mode); |
938 shared->set_language_mode(language_mode); | 938 shared->set_language_mode(language_mode); |
939 info->SaveHandles(); | 939 info->SaveHandles(); |
940 | 940 |
941 if (Rewriter::Rewrite(*info) && Scope::Analyze(*info)) { | 941 if (Rewriter::Rewrite(*info) && Scope::Analyze(*info)) { |
942 OptimizingCompiler* compiler = | 942 OptimizingCompiler* compiler = |
943 new(info->zone()) OptimizingCompiler(*info); | 943 new(info->zone()) OptimizingCompiler(*info); |
944 OptimizingCompiler::Status status = compiler->CreateGraph(); | 944 OptimizingCompiler::Status status = compiler->CreateGraph(); |
945 if (status == OptimizingCompiler::SUCCEEDED) { | 945 if (status == OptimizingCompiler::SUCCEEDED) { |
| 946 // Do a scavenge to put off the next scavenge as far as possible. |
| 947 // This may ease the issue that GVN blocks the next scavenge. |
| 948 isolate->heap()->CollectGarbage(NEW_SPACE, "parallel recompile"); |
946 closure->MarkInRecompileQueue(); | 949 closure->MarkInRecompileQueue(); |
947 shared->code()->set_profiler_ticks(0); | 950 shared->code()->set_profiler_ticks(0); |
948 info.Detach(); | 951 info.Detach(); |
949 isolate->optimizing_compiler_thread()->QueueForOptimization(compiler); | 952 isolate->optimizing_compiler_thread()->QueueForOptimization(compiler); |
950 } else if (status == OptimizingCompiler::BAILED_OUT) { | 953 } else if (status == OptimizingCompiler::BAILED_OUT) { |
951 isolate->clear_pending_exception(); | 954 isolate->clear_pending_exception(); |
952 InstallFullCode(*info); | 955 InstallFullCode(*info); |
953 } | 956 } |
954 } | 957 } |
955 } | 958 } |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 } | 1145 } |
1143 } | 1146 } |
1144 | 1147 |
1145 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 1148 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
1146 Handle<Script>(info->script()), | 1149 Handle<Script>(info->script()), |
1147 Handle<Code>(info->code()), | 1150 Handle<Code>(info->code()), |
1148 info)); | 1151 info)); |
1149 } | 1152 } |
1150 | 1153 |
1151 } } // namespace v8::internal | 1154 } } // namespace v8::internal |
OLD | NEW |