From 6da97b1d4a91f7957ffc64cb5df4ba7b2183f2b0 Mon Sep 17 00:00:00 2001 From: "yangguo@chromium.org" Date: Tue, 11 Jun 2013 11:55:56 +0000 Subject: [PATCH] Revert "Enable map dependency to in-flight compilation info." This includes r15032, r15030 and r15005. R=ulan@chromium.org BUG=248076 Review URL: https://chromiumcodereview.appspot.com/16482004 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15061 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/lithium-codegen-arm.cc | 24 ++++- src/arm/lithium-codegen-arm.h | 4 + src/compiler.cc | 48 +-------- src/compiler.h | 53 ++-------- src/hydrogen-instructions.h | 35 ++----- src/hydrogen.cc | 101 +++++++++---------- src/hydrogen.h | 13 +-- src/ia32/lithium-codegen-ia32.cc | 24 ++++- src/ia32/lithium-codegen-ia32.h | 4 + src/mark-compact.cc | 14 ++- src/mips/lithium-codegen-mips.cc | 24 ++++- src/mips/lithium-codegen-mips.h | 4 + src/objects-inl.h | 41 +++----- src/objects.cc | 112 +++------------------ src/objects.h | 32 ++---- src/runtime.cc | 10 +- src/runtime.h | 2 +- src/x64/lithium-codegen-x64.cc | 24 ++++- src/x64/lithium-codegen-x64.h | 4 + test/mjsunit/compiler/parallel-proto-change.js | 17 ++-- test/mjsunit/manual-parallel-recompile.js | 18 +--- test/mjsunit/parallel-initial-prototype-change.js | 50 --------- test/mjsunit/parallel-invalidate-transition-map.js | 56 ----------- test/mjsunit/parallel-optimize-disabled.js | 2 +- 24 files changed, 239 insertions(+), 477 deletions(-) delete mode 100644 test/mjsunit/parallel-initial-prototype-change.js delete mode 100644 test/mjsunit/parallel-invalidate-transition-map.js diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc index ed7e779..96befb0 100644 --- a/src/arm/lithium-codegen-arm.cc +++ b/src/arm/lithium-codegen-arm.cc @@ -87,7 +87,20 @@ void LCodeGen::FinishCode(Handle code) { RegisterDependentCodeForEmbeddedMaps(code); } PopulateDeoptimizationData(code); - info()->CommitDependentMaps(code); + for (int i = 0 ; i < prototype_maps_.length(); i++) { + prototype_maps_.at(i)->AddDependentCode( + DependentCode::kPrototypeCheckGroup, code); + } + for (int i = 0 ; i < transition_maps_.length(); i++) { + transition_maps_.at(i)->AddDependentCode( + DependentCode::kTransitionGroup, code); + } + if (graph()->depends_on_empty_array_proto_elements()) { + isolate()->initial_object_prototype()->map()->AddDependentCode( + DependentCode::kElementsCantBeAddedGroup, code); + isolate()->initial_array_prototype()->map()->AddDependentCode( + DependentCode::kElementsCantBeAddedGroup, code); + } } @@ -4254,6 +4267,9 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { } if (!transition.is_null()) { + if (transition->CanBeDeprecated()) { + transition_maps_.Add(transition, info()->zone()); + } __ mov(scratch, Operand(transition)); __ str(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); if (instr->hydrogen()->NeedsWriteBarrierForMap()) { @@ -5366,7 +5382,11 @@ void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { ASSERT(prototypes->length() == maps->length()); - if (!instr->hydrogen()->CanOmitPrototypeChecks()) { + if (instr->hydrogen()->CanOmitPrototypeChecks()) { + for (int i = 0; i < maps->length(); i++) { + prototype_maps_.Add(maps->at(i), info()->zone()); + } + } else { for (int i = 0; i < prototypes->length(); i++) { __ LoadHeapObject(prototype_reg, prototypes->at(i)); __ ldr(map_reg, FieldMemOperand(prototype_reg, HeapObject::kMapOffset)); diff --git a/src/arm/lithium-codegen-arm.h b/src/arm/lithium-codegen-arm.h index cecf152..f264259 100644 --- a/src/arm/lithium-codegen-arm.h +++ b/src/arm/lithium-codegen-arm.h @@ -56,6 +56,8 @@ class LCodeGen BASE_EMBEDDED { deoptimizations_(4, info->zone()), deopt_jump_table_(4, info->zone()), deoptimization_literals_(8, info->zone()), + prototype_maps_(0, info->zone()), + transition_maps_(0, info->zone()), inlined_function_count_(0), scope_(info->scope()), status_(UNUSED), @@ -404,6 +406,8 @@ class LCodeGen BASE_EMBEDDED { ZoneList deoptimizations_; ZoneList deopt_jump_table_; ZoneList > deoptimization_literals_; + ZoneList > prototype_maps_; + ZoneList > transition_maps_; int inlined_function_count_; Scope* const scope_; Status status_; diff --git a/src/compiler.cc b/src/compiler.cc index c6b911f..5fc107f 100644 --- a/src/compiler.cc +++ b/src/compiler.cc @@ -106,9 +106,6 @@ void CompilationInfo::Initialize(Isolate* isolate, Mode mode, Zone* zone) { opt_count_ = shared_info().is_null() ? 0 : shared_info()->opt_count(); no_frame_ranges_ = isolate->cpu_profiler()->is_profiling() ? new List(2) : NULL; - for (int i = 0; i < DependentCode::kGroupCount; i++) { - dependent_maps_[i] = NULL; - } if (mode == STUB) { mode_ = STUB; return; @@ -128,41 +125,6 @@ void CompilationInfo::Initialize(Isolate* isolate, Mode mode, Zone* zone) { CompilationInfo::~CompilationInfo() { delete deferred_handles_; delete no_frame_ranges_; -#ifdef DEBUG - // Check that no dependent maps have been added or added dependent maps have - // been rolled back or committed. - for (int i = 0; i < DependentCode::kGroupCount; i++) { - ASSERT_EQ(NULL, dependent_maps_[i]); - } -#endif // DEBUG -} - - -void CompilationInfo::CommitDependentMaps(Handle code) { - for (int i = 0; i < DependentCode::kGroupCount; i++) { - ZoneList >* group_maps = dependent_maps_[i]; - if (group_maps == NULL) continue; - ASSERT(!object_wrapper_.is_null()); - for (int j = 0; j < group_maps->length(); j++) { - group_maps->at(j)->dependent_code()->UpdateToFinishedCode( - static_cast(i), this, *code); - } - dependent_maps_[i] = NULL; // Zone-allocated, no need to delete. - } -} - - -void CompilationInfo::RollbackDependentMaps() { - // Unregister from all dependent maps if not yet committed. - for (int i = 0; i < DependentCode::kGroupCount; i++) { - ZoneList >* group_maps = dependent_maps_[i]; - if (group_maps == NULL) continue; - for (int j = 0; j < group_maps->length(); j++) { - group_maps->at(j)->dependent_code()->RemoveCompilationInfo( - static_cast(i), this); - } - dependent_maps_[i] = NULL; // Zone-allocated, no need to delete. - } } @@ -1020,7 +982,7 @@ void Compiler::InstallOptimizedCode(OptimizingCompiler* optimizing_compiler) { // The function may have already been optimized by OSR. Simply continue. // Except when OSR already disabled optimization for some reason. if (info->shared_info()->optimization_disabled()) { - info->AbortOptimization(); + info->SetCode(Handle(info->shared_info()->code())); InstallFullCode(*info); if (FLAG_trace_parallel_recompilation) { PrintF(" ** aborting optimization for "); @@ -1038,11 +1000,9 @@ void Compiler::InstallOptimizedCode(OptimizingCompiler* optimizing_compiler) { // If crankshaft succeeded, install the optimized code else install // the unoptimized code. OptimizingCompiler::Status status = optimizing_compiler->last_status(); - if (info->HasAbortedDueToDependentMap()) { - info->set_bailout_reason("bailed out due to dependent map"); - status = optimizing_compiler->AbortOptimization(); - } else if (status != OptimizingCompiler::SUCCEEDED) { - info->set_bailout_reason("failed/bailed out last time"); + if (status != OptimizingCompiler::SUCCEEDED) { + optimizing_compiler->info()->set_bailout_reason( + "failed/bailed out last time"); status = optimizing_compiler->AbortOptimization(); } else { status = optimizing_compiler->GenerateAndInstallCode(); diff --git a/src/compiler.h b/src/compiler.h index f53feb9..8e6d295 100644 --- a/src/compiler.h +++ b/src/compiler.h @@ -57,8 +57,12 @@ struct OffsetRange { // is constructed based on the resources available at compile-time. class CompilationInfo { public: + CompilationInfo(Handle