| Index: src/mips/macro-assembler-mips.cc
|
| diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc
|
| index 7b85688a4d9cf3835900c063b77b48a1af3e7944..cb336f3b0b9262b3c2d12628bec9ec9679a43799 100644
|
| --- a/src/mips/macro-assembler-mips.cc
|
| +++ b/src/mips/macro-assembler-mips.cc
|
| @@ -510,8 +510,7 @@ void MacroAssembler::LoadFromNumberDictionary(Label* miss,
|
| Subu(reg1, reg1, Operand(1));
|
|
|
| // Generate an unrolled loop that performs a few probes before giving up.
|
| - static const int kProbes = 4;
|
| - for (int i = 0; i < kProbes; i++) {
|
| + for (int i = 0; i < kNumberDictionaryProbes; i++) {
|
| // Use reg2 for index calculations and keep the hash intact in reg0.
|
| mov(reg2, reg0);
|
| // Compute the masked index: (hash + i + i * i) & mask.
|
| @@ -530,7 +529,7 @@ void MacroAssembler::LoadFromNumberDictionary(Label* miss,
|
| addu(reg2, elements, at);
|
|
|
| lw(at, FieldMemOperand(reg2, SeededNumberDictionary::kElementsStartOffset));
|
| - if (i != kProbes - 1) {
|
| + if (i != kNumberDictionaryProbes - 1) {
|
| Branch(&done, eq, key, Operand(at));
|
| } else {
|
| Branch(miss, ne, key, Operand(at));
|
| @@ -4512,122 +4511,12 @@ void MacroAssembler::LoadGlobalFunctionInitialMap(Register function,
|
| }
|
|
|
|
|
| -void MacroAssembler::LoadNumber(Register object,
|
| - FPURegister dst,
|
| - Register heap_number_map,
|
| - Register scratch,
|
| - Label* not_number) {
|
| - Label is_smi, done;
|
| -
|
| - UntagAndJumpIfSmi(scratch, object, &is_smi);
|
| - JumpIfNotHeapNumber(object, heap_number_map, scratch, not_number);
|
| -
|
| - ldc1(dst, FieldMemOperand(object, HeapNumber::kValueOffset));
|
| - Branch(&done);
|
| -
|
| - bind(&is_smi);
|
| - mtc1(scratch, dst);
|
| - cvt_d_w(dst, dst);
|
| -
|
| - bind(&done);
|
| -}
|
| -
|
| -
|
| -void MacroAssembler::LoadNumberAsInt32Double(Register object,
|
| - DoubleRegister double_dst,
|
| - Register heap_number_map,
|
| - Register scratch1,
|
| - Register scratch2,
|
| - FPURegister double_scratch,
|
| - Label* not_int32) {
|
| - ASSERT(!scratch1.is(object) && !scratch2.is(object));
|
| - ASSERT(!scratch1.is(scratch2));
|
| - ASSERT(!heap_number_map.is(object) &&
|
| - !heap_number_map.is(scratch1) &&
|
| - !heap_number_map.is(scratch2));
|
| -
|
| - Label done, obj_is_not_smi;
|
| -
|
| - UntagAndJumpIfNotSmi(scratch1, object, &obj_is_not_smi);
|
| - mtc1(scratch1, double_scratch);
|
| - cvt_d_w(double_dst, double_scratch);
|
| - Branch(&done);
|
| -
|
| - bind(&obj_is_not_smi);
|
| - JumpIfNotHeapNumber(object, heap_number_map, scratch1, not_int32);
|
| -
|
| - // Load the number.
|
| - // Load the double value.
|
| - ldc1(double_dst, FieldMemOperand(object, HeapNumber::kValueOffset));
|
| -
|
| - Register except_flag = scratch2;
|
| - EmitFPUTruncate(kRoundToZero,
|
| - scratch1,
|
| - double_dst,
|
| - at,
|
| - double_scratch,
|
| - except_flag,
|
| - kCheckForInexactConversion);
|
| -
|
| - // Jump to not_int32 if the operation did not succeed.
|
| - Branch(not_int32, ne, except_flag, Operand(zero_reg));
|
| - bind(&done);
|
| -}
|
| -
|
| -
|
| -void MacroAssembler::LoadNumberAsInt32(Register object,
|
| - Register dst,
|
| - Register heap_number_map,
|
| - Register scratch1,
|
| - Register scratch2,
|
| - FPURegister double_scratch0,
|
| - FPURegister double_scratch1,
|
| - Label* not_int32) {
|
| - ASSERT(!dst.is(object));
|
| - ASSERT(!scratch1.is(object) && !scratch2.is(object));
|
| - ASSERT(!scratch1.is(scratch2));
|
| -
|
| - Label done, maybe_undefined;
|
| -
|
| - UntagAndJumpIfSmi(dst, object, &done);
|
| -
|
| - JumpIfNotHeapNumber(object, heap_number_map, scratch1, &maybe_undefined);
|
| -
|
| - // Object is a heap number.
|
| - // Convert the floating point value to a 32-bit integer.
|
| - // Load the double value.
|
| - ldc1(double_scratch0, FieldMemOperand(object, HeapNumber::kValueOffset));
|
| -
|
| - Register except_flag = scratch2;
|
| - EmitFPUTruncate(kRoundToZero,
|
| - dst,
|
| - double_scratch0,
|
| - scratch1,
|
| - double_scratch1,
|
| - except_flag,
|
| - kCheckForInexactConversion);
|
| -
|
| - // Jump to not_int32 if the operation did not succeed.
|
| - Branch(not_int32, ne, except_flag, Operand(zero_reg));
|
| - Branch(&done);
|
| -
|
| - bind(&maybe_undefined);
|
| - LoadRoot(at, Heap::kUndefinedValueRootIndex);
|
| - Branch(not_int32, ne, object, Operand(at));
|
| - // |undefined| is truncated to 0.
|
| - li(dst, Operand(Smi::FromInt(0)));
|
| - // Fall through.
|
| -
|
| - bind(&done);
|
| -}
|
| -
|
| -
|
| void MacroAssembler::Prologue(PrologueFrameMode frame_mode) {
|
| if (frame_mode == BUILD_STUB_FRAME) {
|
| Push(ra, fp, cp);
|
| Push(Smi::FromInt(StackFrame::STUB));
|
| // Adjust FP to point to saved FP.
|
| - Addu(fp, sp, Operand(2 * kPointerSize));
|
| + Addu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
|
| } else {
|
| PredictableCodeSizeScope predictible_code_size_scope(
|
| this, kNoCodeAgeSequenceLength * Assembler::kInstrSize);
|
| @@ -4650,7 +4539,7 @@ void MacroAssembler::Prologue(PrologueFrameMode frame_mode) {
|
| Push(ra, fp, cp, a1);
|
| nop(Assembler::CODE_AGE_SEQUENCE_NOP);
|
| // Adjust fp to point to caller's fp.
|
| - Addu(fp, sp, Operand(2 * kPointerSize));
|
| + Addu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
|
| }
|
| }
|
| }
|
| @@ -4665,7 +4554,9 @@ void MacroAssembler::EnterFrame(StackFrame::Type type) {
|
| sw(cp, MemOperand(sp, 2 * kPointerSize));
|
| sw(t8, MemOperand(sp, 1 * kPointerSize));
|
| sw(t9, MemOperand(sp, 0 * kPointerSize));
|
| - addiu(fp, sp, 3 * kPointerSize);
|
| + // Adjust FP to point to saved FP.
|
| + Addu(fp, sp,
|
| + Operand(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize));
|
| }
|
|
|
|
|
| @@ -4954,7 +4845,7 @@ void MacroAssembler::AssertSmi(Register object) {
|
| void MacroAssembler::AssertString(Register object) {
|
| if (emit_debug_code()) {
|
| STATIC_ASSERT(kSmiTag == 0);
|
| - And(t0, object, Operand(kSmiTagMask));
|
| + SmiTst(object, t0);
|
| Check(ne, kOperandIsASmiAndNotAString, t0, Operand(zero_reg));
|
| push(object);
|
| lw(object, FieldMemOperand(object, HeapObject::kMapOffset));
|
| @@ -4968,7 +4859,7 @@ void MacroAssembler::AssertString(Register object) {
|
| void MacroAssembler::AssertName(Register object) {
|
| if (emit_debug_code()) {
|
| STATIC_ASSERT(kSmiTag == 0);
|
| - And(t0, object, Operand(kSmiTagMask));
|
| + SmiTst(object, t0);
|
| Check(ne, kOperandIsASmiAndNotAName, t0, Operand(zero_reg));
|
| push(object);
|
| lw(object, FieldMemOperand(object, HeapObject::kMapOffset));
|
| @@ -5162,6 +5053,42 @@ int MacroAssembler::CalculateStackPassedWords(int num_reg_arguments,
|
| }
|
|
|
|
|
| +void MacroAssembler::EmitSeqStringSetCharCheck(Register string,
|
| + Register index,
|
| + Register value,
|
| + Register scratch,
|
| + uint32_t encoding_mask) {
|
| + Label is_object;
|
| + SmiTst(string, at);
|
| + ThrowIf(eq, kNonObject, at, Operand(zero_reg));
|
| +
|
| + lw(at, FieldMemOperand(string, HeapObject::kMapOffset));
|
| + lbu(at, FieldMemOperand(at, Map::kInstanceTypeOffset));
|
| +
|
| + andi(at, at, kStringRepresentationMask | kStringEncodingMask);
|
| + li(scratch, Operand(encoding_mask));
|
| + ThrowIf(ne, kUnexpectedStringType, at, Operand(scratch));
|
| +
|
| + // The index is assumed to be untagged coming in, tag it to compare with the
|
| + // string length without using a temp register, it is restored at the end of
|
| + // this function.
|
| + Label index_tag_ok, index_tag_bad;
|
| + TrySmiTag(index, scratch, &index_tag_bad);
|
| + Branch(&index_tag_ok);
|
| + bind(&index_tag_bad);
|
| + Throw(kIndexIsTooLarge);
|
| + bind(&index_tag_ok);
|
| +
|
| + lw(at, FieldMemOperand(string, String::kLengthOffset));
|
| + ThrowIf(ge, kIndexIsTooLarge, index, Operand(at));
|
| +
|
| + ASSERT(Smi::FromInt(0) == 0);
|
| + ThrowIf(lt, kIndexIsNegative, index, Operand(zero_reg));
|
| +
|
| + SmiUntag(index, index);
|
| +}
|
| +
|
| +
|
| void MacroAssembler::PrepareCallCFunction(int num_reg_arguments,
|
| int num_double_arguments,
|
| Register scratch) {
|
| @@ -5542,6 +5469,57 @@ void MacroAssembler::EnsureNotWhite(
|
| }
|
|
|
|
|
| +void MacroAssembler::Throw(BailoutReason reason) {
|
| + Label throw_start;
|
| + bind(&throw_start);
|
| +#ifdef DEBUG
|
| + const char* msg = GetBailoutReason(reason);
|
| + if (msg != NULL) {
|
| + RecordComment("Throw message: ");
|
| + RecordComment(msg);
|
| + }
|
| +#endif
|
| +
|
| + li(a0, Operand(Smi::FromInt(reason)));
|
| + push(a0);
|
| + // Disable stub call restrictions to always allow calls to throw.
|
| + if (!has_frame_) {
|
| + // We don't actually want to generate a pile of code for this, so just
|
| + // claim there is a stack frame, without generating one.
|
| + FrameScope scope(this, StackFrame::NONE);
|
| + CallRuntime(Runtime::kThrowMessage, 1);
|
| + } else {
|
| + CallRuntime(Runtime::kThrowMessage, 1);
|
| + }
|
| + // will not return here
|
| + if (is_trampoline_pool_blocked()) {
|
| + // If the calling code cares throw the exact number of
|
| + // instructions generated, we insert padding here to keep the size
|
| + // of the ThrowMessage macro constant.
|
| + // Currently in debug mode with debug_code enabled the number of
|
| + // generated instructions is 14, so we use this as a maximum value.
|
| + static const int kExpectedThrowMessageInstructions = 14;
|
| + int throw_instructions = InstructionsGeneratedSince(&throw_start);
|
| + ASSERT(throw_instructions <= kExpectedThrowMessageInstructions);
|
| + while (throw_instructions++ < kExpectedThrowMessageInstructions) {
|
| + nop();
|
| + }
|
| + }
|
| +}
|
| +
|
| +
|
| +void MacroAssembler::ThrowIf(Condition cc,
|
| + BailoutReason reason,
|
| + Register rs,
|
| + Operand rt) {
|
| + Label L;
|
| + Branch(&L, NegateCondition(cc), rs, rt);
|
| + Throw(reason);
|
| + // will not return here
|
| + bind(&L);
|
| +}
|
| +
|
| +
|
| void MacroAssembler::LoadInstanceDescriptors(Register map,
|
| Register descriptors) {
|
| lw(descriptors, FieldMemOperand(map, Map::kDescriptorsOffset));
|
| @@ -5572,7 +5550,8 @@ void MacroAssembler::CheckEnumCache(Register null_value, Label* call_runtime) {
|
| lw(a1, FieldMemOperand(a2, HeapObject::kMapOffset));
|
|
|
| EnumLength(a3, a1);
|
| - Branch(call_runtime, eq, a3, Operand(Smi::FromInt(Map::kInvalidEnumCache)));
|
| + Branch(
|
| + call_runtime, eq, a3, Operand(Smi::FromInt(kInvalidEnumCacheSentinel)));
|
|
|
| jmp(&start);
|
|
|
|
|