| Index: src/mips/code-stubs-mips.cc
|
| diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc
|
| index 3d0577eb1e540761ecbbfb1831bb1d8ccbbbb4aa..cb597792a8d3557f02e5a4d889b6a790b99f5431 100644
|
| --- a/src/mips/code-stubs-mips.cc
|
| +++ b/src/mips/code-stubs-mips.cc
|
| @@ -2488,47 +2488,36 @@ void BinaryOpStub::GenerateInt32Stub(MacroAssembler* masm) {
|
| UNREACHABLE();
|
| }
|
|
|
| - if (op_ != Token::DIV) {
|
| - // These operations produce an integer result.
|
| - // Try to return a smi if we can.
|
| - // Otherwise return a heap number if allowed, or jump to type
|
| - // transition.
|
| -
|
| + if (result_type_ <= BinaryOpIC::INT32) {
|
| Register except_flag = scratch2;
|
| - __ EmitFPUTruncate(kRoundToZero,
|
| + const FPURoundingMode kRoundingMode = op_ == Token::DIV ?
|
| + kRoundToMinusInf : kRoundToZero;
|
| + const CheckForInexactConversion kConversion = op_ == Token::DIV ?
|
| + kCheckForInexactConversion : kDontCheckForInexactConversion;
|
| + __ EmitFPUTruncate(kRoundingMode,
|
| scratch1,
|
| f10,
|
| at,
|
| f16,
|
| - except_flag);
|
| -
|
| - if (result_type_ <= BinaryOpIC::INT32) {
|
| - // If except_flag != 0, result does not fit in a 32-bit integer.
|
| - __ Branch(&transition, ne, except_flag, Operand(zero_reg));
|
| - }
|
| -
|
| - // Check if the result fits in a smi.
|
| - __ Addu(scratch2, scratch1, Operand(0x40000000));
|
| - // If not try to return a heap number.
|
| + except_flag,
|
| + kConversion);
|
| + // If except_flag != 0, result does not fit in a 32-bit integer.
|
| + __ Branch(&transition, ne, except_flag, Operand(zero_reg));
|
| + // Try to tag the result as a Smi, return heap number on overflow.
|
| + __ SmiTagCheckOverflow(scratch1, scratch1, scratch2);
|
| __ Branch(&return_heap_number, lt, scratch2, Operand(zero_reg));
|
| - // Check for minus zero. Return heap number for minus zero if
|
| - // double results are allowed; otherwise transition.
|
| + // Check for minus zero, transition in that case (because we need
|
| + // to return a heap number).
|
| Label not_zero;
|
| + ASSERT(kSmiTag == 0);
|
| __ Branch(¬_zero, ne, scratch1, Operand(zero_reg));
|
| __ mfc1(scratch2, f11);
|
| __ And(scratch2, scratch2, HeapNumber::kSignMask);
|
| - __ Branch(result_type_ <= BinaryOpIC::INT32 ? &transition
|
| - : &return_heap_number,
|
| - ne,
|
| - scratch2,
|
| - Operand(zero_reg));
|
| + __ Branch(&transition, ne, scratch2, Operand(zero_reg));
|
| __ bind(¬_zero);
|
|
|
| - // Tag the result and return.
|
| __ Ret(USE_DELAY_SLOT);
|
| - __ SmiTag(v0, scratch1); // SmiTag emits one instruction.
|
| - } else {
|
| - // DIV just falls through to allocating a heap number.
|
| + __ mov(v0, scratch1);
|
| }
|
|
|
| __ bind(&return_heap_number);
|
| @@ -3860,7 +3849,7 @@ void InstanceofStub::Generate(MacroAssembler* masm) {
|
| __ Subu(inline_site, ra, scratch);
|
| // Get the map location in scratch and patch it.
|
| __ GetRelocatedValue(inline_site, scratch, v1); // v1 used as scratch.
|
| - __ sw(map, FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset));
|
| + __ sw(map, FieldMemOperand(scratch, Cell::kValueOffset));
|
| }
|
|
|
| // Register mapping: a3 is object map and t0 is function prototype.
|
| @@ -5043,7 +5032,7 @@ static void GenerateRecordCallTargetNoArray(MacroAssembler* masm) {
|
| masm->isolate()->heap()->the_hole_value());
|
|
|
| // Load the cache state into a3.
|
| - __ lw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset));
|
| + __ lw(a3, FieldMemOperand(a2, Cell::kValueOffset));
|
|
|
| // A monomorphic cache hit or an already megamorphic state: invoke the
|
| // function without changing the state.
|
| @@ -5059,13 +5048,13 @@ static void GenerateRecordCallTargetNoArray(MacroAssembler* masm) {
|
| // An uninitialized cache is patched with the function.
|
| // Store a1 in the delay slot. This may or may not get overwritten depending
|
| // on the result of the comparison.
|
| - __ sw(a1, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset));
|
| + __ sw(a1, FieldMemOperand(a2, Cell::kValueOffset));
|
| // No need for a write barrier here - cells are rescanned.
|
|
|
| // MegamorphicSentinel is an immortal immovable object (undefined) so no
|
| // write-barrier is needed.
|
| __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
|
| - __ sw(at, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset));
|
| + __ sw(at, FieldMemOperand(a2, Cell::kValueOffset));
|
|
|
| __ bind(&done);
|
| }
|
| @@ -5086,7 +5075,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) {
|
| masm->isolate()->heap()->the_hole_value());
|
|
|
| // Load the cache state into a3.
|
| - __ lw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset));
|
| + __ lw(a3, FieldMemOperand(a2, Cell::kValueOffset));
|
|
|
| // A monomorphic cache hit or an already megamorphic state: invoke the
|
| // function without changing the state.
|
| @@ -5117,7 +5106,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) {
|
| // write-barrier is needed.
|
| __ bind(&megamorphic);
|
| __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
|
| - __ sw(at, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset));
|
| + __ sw(at, FieldMemOperand(a2, Cell::kValueOffset));
|
| __ jmp(&done);
|
|
|
| // An uninitialized cache is patched with the function or sentinel to
|
| @@ -5134,11 +5123,11 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) {
|
| TypeFeedbackCells::MonomorphicArraySentinel(masm->isolate(),
|
| GetInitialFastElementsKind());
|
| __ li(a3, Operand(initial_kind_sentinel));
|
| - __ sw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset));
|
| + __ sw(a3, FieldMemOperand(a2, Cell::kValueOffset));
|
| __ Branch(&done);
|
|
|
| __ bind(¬_array_function);
|
| - __ sw(a1, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset));
|
| + __ sw(a1, FieldMemOperand(a2, Cell::kValueOffset));
|
| // No need for a write barrier here - cells are rescanned.
|
|
|
| __ bind(&done);
|
| @@ -5214,7 +5203,7 @@ void CallFunctionStub::Generate(MacroAssembler* masm) {
|
| ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()),
|
| masm->isolate()->heap()->undefined_value());
|
| __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
|
| - __ sw(at, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset));
|
| + __ sw(at, FieldMemOperand(a2, Cell::kValueOffset));
|
| }
|
| // Check for function proxy.
|
| __ Branch(&non_function, ne, a3, Operand(JS_FUNCTION_PROXY_TYPE));
|
| @@ -6912,13 +6901,6 @@ void DirectCEntryStub::Generate(MacroAssembler* masm) {
|
|
|
|
|
| void DirectCEntryStub::GenerateCall(MacroAssembler* masm,
|
| - ExternalReference function) {
|
| - __ li(t9, Operand(function));
|
| - this->GenerateCall(masm, t9);
|
| -}
|
| -
|
| -
|
| -void DirectCEntryStub::GenerateCall(MacroAssembler* masm,
|
| Register target) {
|
| __ Move(t9, target);
|
| __ AssertStackIsAligned();
|
| @@ -7500,10 +7482,10 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
|
| void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) {
|
| // ----------- S t a t e -------------
|
| // -- a0 : element value to store
|
| - // -- a1 : array literal
|
| - // -- a2 : map of array literal
|
| // -- a3 : element index as smi
|
| - // -- t0 : array literal index in function as smi
|
| + // -- sp[0] : array literal index in function as smi
|
| + // -- sp[4] : array literal
|
| + // clobbers a1, a2, t0
|
| // -----------------------------------
|
|
|
| Label element_done;
|
| @@ -7512,6 +7494,11 @@ void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) {
|
| Label slow_elements;
|
| Label fast_elements;
|
|
|
| + // Get array literal index, array literal and its map.
|
| + __ lw(t0, MemOperand(sp, 0 * kPointerSize));
|
| + __ lw(a1, MemOperand(sp, 1 * kPointerSize));
|
| + __ lw(a2, FieldMemOperand(a1, JSObject::kMapOffset));
|
| +
|
| __ CheckFastElements(a2, t1, &double_elements);
|
| // Check for FAST_*_SMI_ELEMENTS or FAST_*_ELEMENTS elements
|
| __ JumpIfSmi(a0, &smi_element);
|
| @@ -7776,14 +7763,13 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
|
| __ Assert(eq, "Unexpected initial map for Array function",
|
| t0, Operand(MAP_TYPE));
|
|
|
| - // We should either have undefined in ebx or a valid jsglobalpropertycell
|
| + // We should either have undefined in a2 or a valid cell
|
| Label okay_here;
|
| - Handle<Map> global_property_cell_map(
|
| - masm->isolate()->heap()->global_property_cell_map());
|
| + Handle<Map> cell_map = masm->isolate()->factory()->cell_map();
|
| __ Branch(&okay_here, eq, a2, Operand(undefined_sentinel));
|
| __ lw(a3, FieldMemOperand(a2, 0));
|
| - __ Assert(eq, "Expected property cell in register ebx",
|
| - a3, Operand(global_property_cell_map));
|
| + __ Assert(eq, "Expected property cell in register a2",
|
| + a3, Operand(cell_map));
|
| __ bind(&okay_here);
|
| }
|
|
|
| @@ -7791,7 +7777,7 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
|
| Label no_info, switch_ready;
|
| // Get the elements kind and case on that.
|
| __ Branch(&no_info, eq, a2, Operand(undefined_sentinel));
|
| - __ lw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset));
|
| + __ lw(a3, FieldMemOperand(a2, PropertyCell::kValueOffset));
|
| __ JumpIfNotSmi(a3, &no_info);
|
| __ SmiUntag(a3);
|
| __ jmp(&switch_ready);
|
|
|