From cb650a51de534197fefe24b45de9e0bfd70d65d9 Mon Sep 17 00:00:00 2001 From: "danno@chromium.org" Date: Thu, 4 Apr 2013 11:38:10 +0000 Subject: [PATCH] Remove extranous holder load in some prototype-chain checking cases R=ulan@chromium.org Review URL: https://codereview.chromium.org/13620003 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14136 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/lithium-arm.cc | 2 +- src/arm/lithium-arm.h | 2 +- src/arm/lithium-codegen-arm.cc | 3 --- src/hydrogen.cc | 4 +++- src/ia32/lithium-codegen-ia32.cc | 6 ------ src/ia32/lithium-ia32.cc | 2 +- src/ia32/lithium-ia32.h | 2 +- src/x64/lithium-codegen-x64.cc | 2 -- src/x64/lithium-x64.cc | 2 +- src/x64/lithium-x64.h | 2 +- 10 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc index f2b65ef..32daff0 100644 --- a/src/arm/lithium-arm.cc +++ b/src/arm/lithium-arm.cc @@ -1933,7 +1933,7 @@ LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) { LUnallocated* temp1 = TempRegister(); LOperand* temp2 = TempRegister(); LCheckPrototypeMaps* result = new(zone()) LCheckPrototypeMaps(temp1, temp2); - return AssignEnvironment(Define(result, temp1)); + return AssignEnvironment(result); } diff --git a/src/arm/lithium-arm.h b/src/arm/lithium-arm.h index 207faf4..cc97948 100644 --- a/src/arm/lithium-arm.h +++ b/src/arm/lithium-arm.h @@ -2239,7 +2239,7 @@ class LCheckMaps: public LTemplateInstruction<0, 1, 0> { }; -class LCheckPrototypeMaps: public LTemplateInstruction<1, 0, 2> { +class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 2> { public: LCheckPrototypeMaps(LOperand* temp, LOperand* temp2) { temps_[0] = temp; diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc index 7bb3535..02fac88 100644 --- a/src/arm/lithium-codegen-arm.cc +++ b/src/arm/lithium-codegen-arm.cc @@ -5541,7 +5541,6 @@ void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) { void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { - ASSERT(instr->temp()->Equals(instr->result())); Register prototype_reg = ToRegister(instr->temp()); Register map_reg = ToRegister(instr->temp2()); @@ -5554,8 +5553,6 @@ void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { for (int i = 0; i < maps->length(); i++) { prototype_maps_.Add(maps->at(i), info()->zone()); } - __ LoadHeapObject(prototype_reg, - prototypes->at(prototypes->length() - 1)); } else { for (int i = 0; i < prototypes->length(); i++) { __ LoadHeapObject(prototype_reg, prototypes->at(i)); diff --git a/src/hydrogen.cc b/src/hydrogen.cc index abff7b7..bb56296 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -7113,8 +7113,10 @@ HInstruction* HOptimizedGraphBuilder::BuildLoadNamedMonomorphic( Handle holder(lookup.holder()); Handle holder_map(holder->map()); AddCheckMap(object, map); - HInstruction* holder_value = AddInstruction( + AddInstruction( new(zone()) HCheckPrototypeMaps(prototype, holder, zone())); + HValue* holder_value = AddInstruction( + new(zone()) HConstant(holder, Representation::Tagged())); return BuildLoadNamedField(holder_value, holder_map, &lookup); } diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc index 4d23aef..5a69ed0 100644 --- a/src/ia32/lithium-codegen-ia32.cc +++ b/src/ia32/lithium-codegen-ia32.cc @@ -5415,7 +5415,6 @@ void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) { void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { - ASSERT(instr->temp()->Equals(instr->result())); Register reg = ToRegister(instr->temp()); ZoneList >* prototypes = instr->prototypes(); @@ -5423,15 +5422,10 @@ void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { ASSERT(prototypes->length() == maps->length()); - // TODO(ulan): Move this check to hydrogen and split HCheckPrototypeMaps - // into two instruction: one that checks the prototypes and another that - // loads the holder (HConstant). Find a way to do it without breaking - // parallel recompilation. if (instr->hydrogen()->CanOmitPrototypeChecks()) { for (int i = 0; i < maps->length(); i++) { prototype_maps_.Add(maps->at(i), info()->zone()); } - __ LoadHeapObject(reg, prototypes->at(prototypes->length() - 1)); } else { for (int i = 0; i < prototypes->length(); i++) { __ LoadHeapObject(reg, prototypes->at(i)); diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc index 102515a..a4b1b86 100644 --- a/src/ia32/lithium-ia32.cc +++ b/src/ia32/lithium-ia32.cc @@ -1947,7 +1947,7 @@ LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) { LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) { LUnallocated* temp = TempRegister(); LCheckPrototypeMaps* result = new(zone()) LCheckPrototypeMaps(temp); - return AssignEnvironment(Define(result, temp)); + return AssignEnvironment(result); } diff --git a/src/ia32/lithium-ia32.h b/src/ia32/lithium-ia32.h index 1c490bb..4c188c3 100644 --- a/src/ia32/lithium-ia32.h +++ b/src/ia32/lithium-ia32.h @@ -2313,7 +2313,7 @@ class LCheckMaps: public LTemplateInstruction<0, 1, 0> { }; -class LCheckPrototypeMaps: public LTemplateInstruction<1, 0, 1> { +class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 1> { public: explicit LCheckPrototypeMaps(LOperand* temp) { temps_[0] = temp; diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc index 817a9d3..56d8615 100644 --- a/src/x64/lithium-codegen-x64.cc +++ b/src/x64/lithium-codegen-x64.cc @@ -4977,7 +4977,6 @@ void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) { void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { - ASSERT(instr->temp()->Equals(instr->result())); Register reg = ToRegister(instr->temp()); ZoneList >* prototypes = instr->prototypes(); @@ -4989,7 +4988,6 @@ void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { for (int i = 0; i < maps->length(); i++) { prototype_maps_.Add(maps->at(i), info()->zone()); } - __ LoadHeapObject(reg, prototypes->at(prototypes->length() - 1)); } else { for (int i = 0; i < prototypes->length(); i++) { __ LoadHeapObject(reg, prototypes->at(i)); diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc index 9a3166e..3b82b47 100644 --- a/src/x64/lithium-x64.cc +++ b/src/x64/lithium-x64.cc @@ -1843,7 +1843,7 @@ LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) { LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) { LUnallocated* temp = TempRegister(); LCheckPrototypeMaps* result = new(zone()) LCheckPrototypeMaps(temp); - return AssignEnvironment(Define(result, temp)); + return AssignEnvironment(result); } diff --git a/src/x64/lithium-x64.h b/src/x64/lithium-x64.h index 051f9a4..6ec89fc 100644 --- a/src/x64/lithium-x64.h +++ b/src/x64/lithium-x64.h @@ -2158,7 +2158,7 @@ class LCheckMaps: public LTemplateInstruction<0, 1, 0> { }; -class LCheckPrototypeMaps: public LTemplateInstruction<1, 0, 1> { +class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 1> { public: explicit LCheckPrototypeMaps(LOperand* temp) { temps_[0] = temp; -- 2.7.4