From e87530603792dfe347507355e150dc8294f6c074 Mon Sep 17 00:00:00 2001 From: "verwaest@chromium.org" Date: Fri, 13 Jul 2012 09:13:10 +0000 Subject: [PATCH] MIPS: Swap bitfield3 and backpointer. Port r12034 (f17b84c0) Original commit message: Bitfield3 now has its own field, while the backpointer shares the field with the descriptor array; which will become the transition array. BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/10692192 Patch from Akos Palfi . git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12075 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/mips/full-codegen-mips.cc | 4 ++-- src/mips/lithium-codegen-mips.cc | 3 ++- src/mips/lithium-mips.cc | 3 ++- src/mips/lithium-mips.h | 6 ++++-- src/mips/macro-assembler-mips.cc | 27 ++++++++++++++++++++------- src/mips/macro-assembler-mips.h | 4 +++- 6 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc index 079e8b3fe4..9ae025d7b2 100644 --- a/src/mips/full-codegen-mips.cc +++ b/src/mips/full-codegen-mips.cc @@ -1148,7 +1148,7 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { // We got a map in register v0. Get the enumeration cache from it. __ bind(&use_cache); - __ LoadInstanceDescriptors(v0, a1); + __ LoadInstanceDescriptors(v0, a1, a2); __ lw(a1, FieldMemOperand(a1, DescriptorArray::kEnumerationIndexOffset)); __ lw(a2, FieldMemOperand(a1, DescriptorArray::kEnumCacheBridgeCacheOffset)); @@ -2759,7 +2759,7 @@ void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf( // Look for valueOf symbol in the descriptor array, and indicate false if // found. The type is not checked, so if it is a transition it is a false // negative. - __ LoadInstanceDescriptors(a1, t0); + __ LoadInstanceDescriptors(a1, t0, a3); __ lw(a3, FieldMemOperand(t0, FixedArray::kLengthOffset)); // t0: descriptor array // a3: length of descriptor array diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc index c9256407fd..737aafcc9b 100644 --- a/src/mips/lithium-codegen-mips.cc +++ b/src/mips/lithium-codegen-mips.cc @@ -5165,7 +5165,8 @@ void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) { void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) { Register map = ToRegister(instr->map()); Register result = ToRegister(instr->result()); - __ LoadInstanceDescriptors(map, result); + Register scratch = ToRegister(instr->scratch()); + __ LoadInstanceDescriptors(map, result, scratch); __ lw(result, FieldMemOperand(result, DescriptorArray::kEnumerationIndexOffset)); __ lw(result, diff --git a/src/mips/lithium-mips.cc b/src/mips/lithium-mips.cc index 9426c2cac9..da5beb6186 100644 --- a/src/mips/lithium-mips.cc +++ b/src/mips/lithium-mips.cc @@ -2200,8 +2200,9 @@ LInstruction* LChunkBuilder::DoForInPrepareMap(HForInPrepareMap* instr) { LInstruction* LChunkBuilder::DoForInCacheArray(HForInCacheArray* instr) { LOperand* map = UseRegister(instr->map()); + LOperand* scratch = TempRegister(); return AssignEnvironment(DefineAsRegister( - new(zone()) LForInCacheArray(map))); + new(zone()) LForInCacheArray(map, scratch))); } diff --git a/src/mips/lithium-mips.h b/src/mips/lithium-mips.h index b07d225399..86b8f33979 100644 --- a/src/mips/lithium-mips.h +++ b/src/mips/lithium-mips.h @@ -2143,13 +2143,15 @@ class LForInPrepareMap: public LTemplateInstruction<1, 1, 0> { }; -class LForInCacheArray: public LTemplateInstruction<1, 1, 0> { +class LForInCacheArray: public LTemplateInstruction<1, 1, 1> { public: - explicit LForInCacheArray(LOperand* map) { + explicit LForInCacheArray(LOperand* map, LOperand* scratch) { inputs_[0] = map; + temps_[0] = scratch; } LOperand* map() { return inputs_[0]; } + LOperand* scratch() { return temps_[0]; } DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array") diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc index 1a6bc216cc..6233b830e0 100644 --- a/src/mips/macro-assembler-mips.cc +++ b/src/mips/macro-assembler-mips.cc @@ -5290,13 +5290,21 @@ void MacroAssembler::EnsureNotWhite( void MacroAssembler::LoadInstanceDescriptors(Register map, - Register descriptors) { + Register descriptors, + Register scratch) { lw(descriptors, - FieldMemOperand(map, Map::kInstanceDescriptorsOrBitField3Offset)); - Label not_smi; - JumpIfNotSmi(descriptors, ¬_smi); + FieldMemOperand(map, Map::kInstanceDescriptorsOrBackPointerOffset)); + + Label ok, fail; + CheckMap(descriptors, + scratch, + isolate()->factory()->fixed_array_map(), + &fail, + DONT_DO_SMI_CHECK); + jmp(&ok); + bind(&fail); LoadRoot(descriptors, Heap::kEmptyDescriptorArrayRootIndex); - bind(¬_smi); + bind(&ok); } @@ -5320,8 +5328,13 @@ void MacroAssembler::CheckEnumCache(Register null_value, Label* call_runtime) { // check for an enum cache. Leave the map in a2 for the subsequent // prototype load. lw(a2, FieldMemOperand(a1, HeapObject::kMapOffset)); - lw(a3, FieldMemOperand(a2, Map::kInstanceDescriptorsOrBitField3Offset)); - JumpIfSmi(a3, call_runtime); + lw(a3, FieldMemOperand(a2, Map::kInstanceDescriptorsOrBackPointerOffset)); + + CheckMap(a3, + t3, + isolate()->factory()->fixed_array_map(), + call_runtime, + DONT_DO_SMI_CHECK); // Check that there is an enum cache in the non-empty instance // descriptors (a3). This is the case if the next enumeration diff --git a/src/mips/macro-assembler-mips.h b/src/mips/macro-assembler-mips.h index bb3dc01e39..dd8c1195b8 100644 --- a/src/mips/macro-assembler-mips.h +++ b/src/mips/macro-assembler-mips.h @@ -1396,7 +1396,9 @@ class MacroAssembler: public Assembler { DoubleRegister temp_double_reg); - void LoadInstanceDescriptors(Register map, Register descriptors); + void LoadInstanceDescriptors(Register map, + Register descriptors, + Register scratch); // Activation support.