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

Side by Side Diff: src/compiler.cc

Issue 22984009: Merged r16150, r16174, r16175 into 3.19 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.19
Patch Set: Created 7 years, 4 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/hydrogen-instructions.h » ('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 // 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 no_frame_ranges_ = isolate->cpu_profiler()->is_profiling() 107 no_frame_ranges_ = isolate->cpu_profiler()->is_profiling()
108 ? new List<OffsetRange>(2) : NULL; 108 ? new List<OffsetRange>(2) : NULL;
109 for (int i = 0; i < DependentCode::kGroupCount; i++) { 109 for (int i = 0; i < DependentCode::kGroupCount; i++) {
110 dependent_maps_[i] = NULL; 110 dependent_maps_[i] = NULL;
111 } 111 }
112 if (mode == STUB) { 112 if (mode == STUB) {
113 mode_ = STUB; 113 mode_ = STUB;
114 return; 114 return;
115 } 115 }
116 mode_ = V8::UseCrankshaft() ? mode : NONOPT; 116 mode_ = V8::UseCrankshaft() ? mode : NONOPT;
117 abort_due_to_dependency_ = false;
117 if (script_->type()->value() == Script::TYPE_NATIVE) { 118 if (script_->type()->value() == Script::TYPE_NATIVE) {
118 MarkAsNative(); 119 MarkAsNative();
119 } 120 }
120 if (!shared_info_.is_null()) { 121 if (!shared_info_.is_null()) {
121 ASSERT(language_mode() == CLASSIC_MODE); 122 ASSERT(language_mode() == CLASSIC_MODE);
122 SetLanguageMode(shared_info_->language_mode()); 123 SetLanguageMode(shared_info_->language_mode());
123 } 124 }
124 set_bailout_reason("unknown"); 125 set_bailout_reason("unknown");
125 } 126 }
126 127
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 ASSERT(!graph_builder_->inline_bailout() || graph_ == NULL); 421 ASSERT(!graph_builder_->inline_bailout() || graph_ == NULL);
421 if (graph_ == NULL) { 422 if (graph_ == NULL) {
422 if (graph_builder_->inline_bailout()) { 423 if (graph_builder_->inline_bailout()) {
423 info_->AbortOptimization(); 424 info_->AbortOptimization();
424 return SetLastStatus(BAILED_OUT); 425 return SetLastStatus(BAILED_OUT);
425 } else { 426 } else {
426 return AbortOptimization(); 427 return AbortOptimization();
427 } 428 }
428 } 429 }
429 430
431 if (info()->HasAbortedDueToDependencyChange()) {
432 info_->set_bailout_reason("bailed out due to dependency change");
433 info_->AbortOptimization();
434 return SetLastStatus(BAILED_OUT);
435 }
436
430 return SetLastStatus(SUCCEEDED); 437 return SetLastStatus(SUCCEEDED);
431 } 438 }
432 439
433 OptimizingCompiler::Status OptimizingCompiler::OptimizeGraph() { 440 OptimizingCompiler::Status OptimizingCompiler::OptimizeGraph() {
434 DisallowHeapAllocation no_allocation; 441 DisallowHeapAllocation no_allocation;
435 DisallowHandleAllocation no_handles; 442 DisallowHandleAllocation no_handles;
436 DisallowHandleDereference no_deref; 443 DisallowHandleDereference no_deref;
444 DisallowCodeDependencyChange no_dependency_change;
437 445
438 ASSERT(last_status() == SUCCEEDED); 446 ASSERT(last_status() == SUCCEEDED);
439 Timer t(this, &time_taken_to_optimize_); 447 Timer t(this, &time_taken_to_optimize_);
440 ASSERT(graph_ != NULL); 448 ASSERT(graph_ != NULL);
441 SmartArrayPointer<char> bailout_reason; 449 SmartArrayPointer<char> bailout_reason;
442 if (!graph_->Optimize(&bailout_reason)) { 450 if (!graph_->Optimize(&bailout_reason)) {
443 if (!bailout_reason.is_empty()) graph_builder_->Bailout(*bailout_reason); 451 if (!bailout_reason.is_empty()) graph_builder_->Bailout(*bailout_reason);
444 return SetLastStatus(BAILED_OUT); 452 return SetLastStatus(BAILED_OUT);
445 } else { 453 } else {
446 chunk_ = LChunk::NewChunk(graph_); 454 chunk_ = LChunk::NewChunk(graph_);
447 if (chunk_ == NULL) { 455 if (chunk_ == NULL) {
448 return SetLastStatus(BAILED_OUT); 456 return SetLastStatus(BAILED_OUT);
449 } 457 }
450 } 458 }
451 return SetLastStatus(SUCCEEDED); 459 return SetLastStatus(SUCCEEDED);
452 } 460 }
453 461
454 462
455 OptimizingCompiler::Status OptimizingCompiler::GenerateAndInstallCode() { 463 OptimizingCompiler::Status OptimizingCompiler::GenerateAndInstallCode() {
456 ASSERT(last_status() == SUCCEEDED); 464 ASSERT(last_status() == SUCCEEDED);
465 ASSERT(!info()->HasAbortedDueToDependencyChange());
466 DisallowCodeDependencyChange no_dependency_change;
457 { // Scope for timer. 467 { // Scope for timer.
458 Timer timer(this, &time_taken_to_codegen_); 468 Timer timer(this, &time_taken_to_codegen_);
459 ASSERT(chunk_ != NULL); 469 ASSERT(chunk_ != NULL);
460 ASSERT(graph_ != NULL); 470 ASSERT(graph_ != NULL);
461 // Deferred handles reference objects that were accessible during 471 // Deferred handles reference objects that were accessible during
462 // graph creation. To make sure that we don't encounter inconsistencies 472 // graph creation. To make sure that we don't encounter inconsistencies
463 // between graph creation and code generation, we disallow accessing 473 // between graph creation and code generation, we disallow accessing
464 // objects through deferred handles during the latter, with exceptions. 474 // objects through deferred handles during the latter, with exceptions.
465 DisallowDeferredHandleDereference no_deferred_handle_deref; 475 DisallowDeferredHandleDereference no_deferred_handle_deref;
466 Handle<Code> optimized_code = chunk_->Codegen(); 476 Handle<Code> optimized_code = chunk_->Codegen();
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 797
788 798
789 static bool InstallFullCode(CompilationInfo* info) { 799 static bool InstallFullCode(CompilationInfo* info) {
790 // Update the shared function info with the compiled code and the 800 // Update the shared function info with the compiled code and the
791 // scope info. Please note, that the order of the shared function 801 // scope info. Please note, that the order of the shared function
792 // info initialization is important since set_scope_info might 802 // info initialization is important since set_scope_info might
793 // trigger a GC, causing the ASSERT below to be invalid if the code 803 // trigger a GC, causing the ASSERT below to be invalid if the code
794 // was flushed. By setting the code object last we avoid this. 804 // was flushed. By setting the code object last we avoid this.
795 Handle<SharedFunctionInfo> shared = info->shared_info(); 805 Handle<SharedFunctionInfo> shared = info->shared_info();
796 Handle<Code> code = info->code(); 806 Handle<Code> code = info->code();
807 CHECK(code->kind() == Code::FUNCTION);
797 Handle<JSFunction> function = info->closure(); 808 Handle<JSFunction> function = info->closure();
798 Handle<ScopeInfo> scope_info = 809 Handle<ScopeInfo> scope_info =
799 ScopeInfo::Create(info->scope(), info->zone()); 810 ScopeInfo::Create(info->scope(), info->zone());
800 shared->set_scope_info(*scope_info); 811 shared->set_scope_info(*scope_info);
801 shared->ReplaceCode(*code); 812 shared->ReplaceCode(*code);
802 if (!function.is_null()) { 813 if (!function.is_null()) {
803 function->ReplaceCode(*code); 814 function->ReplaceCode(*code);
804 ASSERT(!function->IsOptimized()); 815 ASSERT(!function->IsOptimized());
805 } 816 }
806 817
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 return; 1042 return;
1032 } 1043 }
1033 1044
1034 Isolate* isolate = info->isolate(); 1045 Isolate* isolate = info->isolate();
1035 VMState<COMPILER> state(isolate); 1046 VMState<COMPILER> state(isolate);
1036 Logger::TimerEventScope timer( 1047 Logger::TimerEventScope timer(
1037 isolate, Logger::TimerEventScope::v8_recompile_synchronous); 1048 isolate, Logger::TimerEventScope::v8_recompile_synchronous);
1038 // If crankshaft succeeded, install the optimized code else install 1049 // If crankshaft succeeded, install the optimized code else install
1039 // the unoptimized code. 1050 // the unoptimized code.
1040 OptimizingCompiler::Status status = optimizing_compiler->last_status(); 1051 OptimizingCompiler::Status status = optimizing_compiler->last_status();
1041 if (info->HasAbortedDueToDependentMap()) { 1052 if (info->HasAbortedDueToDependencyChange()) {
1042 info->set_bailout_reason("bailed out due to dependent map"); 1053 info->set_bailout_reason("bailed out due to dependent map");
1043 status = optimizing_compiler->AbortOptimization(); 1054 status = optimizing_compiler->AbortOptimization();
1044 } else if (status != OptimizingCompiler::SUCCEEDED) { 1055 } else if (status != OptimizingCompiler::SUCCEEDED) {
1045 info->set_bailout_reason("failed/bailed out last time"); 1056 info->set_bailout_reason("failed/bailed out last time");
1046 status = optimizing_compiler->AbortOptimization(); 1057 status = optimizing_compiler->AbortOptimization();
1047 } else { 1058 } else {
1048 status = optimizing_compiler->GenerateAndInstallCode(); 1059 status = optimizing_compiler->GenerateAndInstallCode();
1049 ASSERT(status == OptimizingCompiler::SUCCEEDED || 1060 ASSERT(status == OptimizingCompiler::SUCCEEDED ||
1050 status == OptimizingCompiler::BAILED_OUT); 1061 status == OptimizingCompiler::BAILED_OUT);
1051 } 1062 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 } 1212 }
1202 } 1213 }
1203 1214
1204 GDBJIT(AddCode(Handle<String>(shared->DebugName()), 1215 GDBJIT(AddCode(Handle<String>(shared->DebugName()),
1205 Handle<Script>(info->script()), 1216 Handle<Script>(info->script()),
1206 Handle<Code>(info->code()), 1217 Handle<Code>(info->code()),
1207 info)); 1218 info));
1208 } 1219 }
1209 1220
1210 } } // namespace v8::internal 1221 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698