Commit 725818c3 authored by verwaest@chromium.org's avatar verwaest@chromium.org

MIPS: Do not go to slow mode and back to fast in initializer blocks.

Port r12534 (4acfb92e)

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/10905313
Patch from Akos Palfi <palfia@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12539 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 5bf15c5d
......@@ -2759,27 +2759,31 @@ void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf(
__ Branch(if_false, eq, a2, Operand(t0));
// 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, a3);
__ lw(a3, FieldMemOperand(t0, FixedArray::kLengthOffset));
// t0: descriptor array
// a3: length of descriptor array
// Calculate the end of the descriptor array.
// found. Since we omit an enumeration index check, if it is added via a
// transition that shares its descriptor array, this is a false positive.
Label entry, loop, done;
// Skip loop if no descriptors are valid.
__ NumberOfOwnDescriptors(a3, a1);
__ Branch(&done, eq, a3, Operand(zero_reg));
__ LoadInstanceDescriptors(a1, t0, a2);
// t0: descriptor array.
// a3: valid entries in the descriptor array.
STATIC_ASSERT(kSmiTag == 0);
STATIC_ASSERT(kSmiTagSize == 1);
STATIC_ASSERT(kPointerSize == 4);
__ Addu(a2, t0, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
__ li(at, Operand(DescriptorArray::kDescriptorSize));
__ Mult(a3, at);
// Calculate location of the first key name.
__ Addu(t0, t0, Operand(DescriptorArray::kFirstOffset - kHeapObjectTag));
// Calculate the end of the descriptor array.
__ mov(a2, t0);
__ sll(t1, a3, kPointerSizeLog2 - kSmiTagSize);
__ Addu(a2, a2, t1);
// Calculate location of the first key name.
__ Addu(t0,
t0,
Operand(DescriptorArray::kFirstOffset - kHeapObjectTag));
// Loop through all the keys in the descriptor array. If one of these is the
// symbol valueOf the result is false.
Label entry, loop;
// The use of t2 to store the valueOf symbol asumes that it is not otherwise
// used in the loop below.
__ LoadRoot(t2, Heap::kvalue_of_symbolRootIndex);
......@@ -2791,7 +2795,8 @@ void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf(
__ bind(&entry);
__ Branch(&loop, ne, t0, Operand(a2));
// If a valueOf property is not found on the object check that it's
__ bind(&done);
// If a valueOf property is not found on the object check that its
// prototype is the un-modified String prototype. If not result is false.
__ lw(a2, FieldMemOperand(a1, Map::kPrototypeOffset));
__ JumpIfSmi(a2, if_false);
......
......@@ -5299,20 +5299,37 @@ void MacroAssembler::LoadInstanceDescriptors(Register map,
Register temp = descriptors;
lw(temp, FieldMemOperand(map, Map::kTransitionsOrBackPointerOffset));
Label ok, fail;
Label ok, fail, load_from_back_pointer;
CheckMap(temp,
scratch,
isolate()->factory()->fixed_array_map(),
&fail,
DONT_DO_SMI_CHECK);
lw(descriptors, FieldMemOperand(temp, TransitionArray::kDescriptorsOffset));
lw(temp, FieldMemOperand(temp, TransitionArray::kDescriptorsPointerOffset));
lw(descriptors, FieldMemOperand(temp, JSGlobalPropertyCell::kValueOffset));
jmp(&ok);
bind(&fail);
LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
Branch(&load_from_back_pointer, ne, temp, Operand(scratch));
LoadRoot(descriptors, Heap::kEmptyDescriptorArrayRootIndex);
jmp(&ok);
bind(&load_from_back_pointer);
lw(temp, FieldMemOperand(temp, Map::kTransitionsOrBackPointerOffset));
lw(temp, FieldMemOperand(temp, TransitionArray::kDescriptorsPointerOffset));
lw(descriptors, FieldMemOperand(temp, JSGlobalPropertyCell::kValueOffset));
bind(&ok);
}
void MacroAssembler::NumberOfOwnDescriptors(Register dst, Register map) {
lbu(dst, FieldMemOperand(map, Map::kBitFieldOffset));
DecodeField<Map::NumberOfOwnDescriptorsBits>(dst);
}
void MacroAssembler::EnumLength(Register dst, Register map) {
STATIC_ASSERT(Map::EnumLengthBits::kShift == 0);
lw(dst, FieldMemOperand(map, Map::kBitField3Offset));
......
......@@ -1400,7 +1400,15 @@ class MacroAssembler: public Assembler {
Register descriptors,
Register scratch);
void EnumLength(Register dst, Register map);
void NumberOfOwnDescriptors(Register dst, Register map);
template<typename Field>
void DecodeField(Register reg) {
static const int shift = Field::kShift;
static const int mask = (Field::kMask >> shift) << kSmiTagSize;
srl(reg, reg, shift);
And(reg, reg, Operand(mask));
}
// Activation support.
void EnterFrame(StackFrame::Type type);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment