| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 void ToNumberStub::InitializeInterfaceDescriptor( | 53 void ToNumberStub::InitializeInterfaceDescriptor( |
| 54 Isolate* isolate, | 54 Isolate* isolate, |
| 55 CodeStubInterfaceDescriptor* descriptor) { | 55 CodeStubInterfaceDescriptor* descriptor) { |
| 56 static Register registers[] = { a0 }; | 56 static Register registers[] = { a0 }; |
| 57 descriptor->register_param_count_ = 1; | 57 descriptor->register_param_count_ = 1; |
| 58 descriptor->register_params_ = registers; | 58 descriptor->register_params_ = registers; |
| 59 descriptor->deoptimization_handler_ = NULL; | 59 descriptor->deoptimization_handler_ = NULL; |
| 60 } | 60 } |
| 61 | 61 |
| 62 | 62 |
| 63 void NumberToStringStub::InitializeInterfaceDescriptor( |
| 64 Isolate* isolate, |
| 65 CodeStubInterfaceDescriptor* descriptor) { |
| 66 static Register registers[] = { a0 }; |
| 67 descriptor->register_param_count_ = 1; |
| 68 descriptor->register_params_ = registers; |
| 69 descriptor->deoptimization_handler_ = NULL; |
| 70 } |
| 71 |
| 72 |
| 63 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( | 73 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( |
| 64 Isolate* isolate, | 74 Isolate* isolate, |
| 65 CodeStubInterfaceDescriptor* descriptor) { | 75 CodeStubInterfaceDescriptor* descriptor) { |
| 66 static Register registers[] = { a3, a2, a1 }; | 76 static Register registers[] = { a3, a2, a1 }; |
| 67 descriptor->register_param_count_ = 3; | 77 descriptor->register_param_count_ = 3; |
| 68 descriptor->register_params_ = registers; | 78 descriptor->register_params_ = registers; |
| 69 descriptor->deoptimization_handler_ = | 79 descriptor->deoptimization_handler_ = |
| 70 Runtime::FunctionForId(Runtime::kCreateArrayLiteralShallow)->entry; | 80 Runtime::FunctionForId(Runtime::kCreateArrayLiteralShallow)->entry; |
| 71 } | 81 } |
| 72 | 82 |
| (...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 __ lw(a3, FieldMemOperand(lhs, HeapObject::kMapOffset)); | 997 __ lw(a3, FieldMemOperand(lhs, HeapObject::kMapOffset)); |
| 988 __ lbu(a2, FieldMemOperand(a2, Map::kBitFieldOffset)); | 998 __ lbu(a2, FieldMemOperand(a2, Map::kBitFieldOffset)); |
| 989 __ lbu(a3, FieldMemOperand(a3, Map::kBitFieldOffset)); | 999 __ lbu(a3, FieldMemOperand(a3, Map::kBitFieldOffset)); |
| 990 __ and_(a0, a2, a3); | 1000 __ and_(a0, a2, a3); |
| 991 __ And(a0, a0, Operand(1 << Map::kIsUndetectable)); | 1001 __ And(a0, a0, Operand(1 << Map::kIsUndetectable)); |
| 992 __ Ret(USE_DELAY_SLOT); | 1002 __ Ret(USE_DELAY_SLOT); |
| 993 __ xori(v0, a0, 1 << Map::kIsUndetectable); | 1003 __ xori(v0, a0, 1 << Map::kIsUndetectable); |
| 994 } | 1004 } |
| 995 | 1005 |
| 996 | 1006 |
| 997 void NumberToStringStub::Generate(MacroAssembler* masm) { | |
| 998 Label runtime; | |
| 999 | |
| 1000 __ lw(a1, MemOperand(sp, 0)); | |
| 1001 | |
| 1002 // Generate code to lookup number in the number string cache. | |
| 1003 __ LookupNumberStringCache(a1, v0, a2, a3, t0, &runtime); | |
| 1004 __ DropAndRet(1); | |
| 1005 | |
| 1006 __ bind(&runtime); | |
| 1007 // Handle number to string in the runtime system if not found in the cache. | |
| 1008 __ TailCallRuntime(Runtime::kNumberToString, 1, 1); | |
| 1009 } | |
| 1010 | |
| 1011 | |
| 1012 static void ICCompareStub_CheckInputType(MacroAssembler* masm, | 1007 static void ICCompareStub_CheckInputType(MacroAssembler* masm, |
| 1013 Register input, | 1008 Register input, |
| 1014 Register scratch, | 1009 Register scratch, |
| 1015 CompareIC::State expected, | 1010 CompareIC::State expected, |
| 1016 Label* fail) { | 1011 Label* fail) { |
| 1017 Label ok; | 1012 Label ok; |
| 1018 if (expected == CompareIC::SMI) { | 1013 if (expected == CompareIC::SMI) { |
| 1019 __ JumpIfNotSmi(input, fail); | 1014 __ JumpIfNotSmi(input, fail); |
| 1020 } else if (expected == CompareIC::NUMBER) { | 1015 } else if (expected == CompareIC::NUMBER) { |
| 1021 __ JumpIfSmi(input, &ok); | 1016 __ JumpIfSmi(input, &ok); |
| (...skipping 5102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6124 // Compute the entry point of the rewritten stub. | 6119 // Compute the entry point of the rewritten stub. |
| 6125 __ Addu(a2, v0, Operand(Code::kHeaderSize - kHeapObjectTag)); | 6120 __ Addu(a2, v0, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 6126 // Restore registers. | 6121 // Restore registers. |
| 6127 __ Pop(a1, a0, ra); | 6122 __ Pop(a1, a0, ra); |
| 6128 } | 6123 } |
| 6129 __ Jump(a2); | 6124 __ Jump(a2); |
| 6130 } | 6125 } |
| 6131 | 6126 |
| 6132 | 6127 |
| 6133 void DirectCEntryStub::Generate(MacroAssembler* masm) { | 6128 void DirectCEntryStub::Generate(MacroAssembler* masm) { |
| 6134 // No need to pop or drop anything, LeaveExitFrame will restore the old | 6129 // Make place for arguments to fit C calling convention. Most of the callers |
| 6135 // stack, thus dropping the allocated space for the return value. | 6130 // of DirectCEntryStub::GenerateCall are using EnterExitFrame/LeaveExitFrame |
| 6136 // The saved ra is after the reserved stack space for the 4 args. | 6131 // so they handle stack restoring and we don't have to do that here. |
| 6132 // Any caller of DirectCEntryStub::GenerateCall must take care of dropping |
| 6133 // kCArgsSlotsSize stack space after the call. |
| 6134 __ Subu(sp, sp, Operand(kCArgsSlotsSize)); |
| 6135 // Place the return address on the stack, making the call |
| 6136 // GC safe. The RegExp backend also relies on this. |
| 6137 __ sw(ra, MemOperand(sp, kCArgsSlotsSize)); |
| 6138 __ Call(t9); // Call the C++ function. |
| 6137 __ lw(t9, MemOperand(sp, kCArgsSlotsSize)); | 6139 __ lw(t9, MemOperand(sp, kCArgsSlotsSize)); |
| 6138 | 6140 |
| 6139 if (FLAG_debug_code && FLAG_enable_slow_asserts) { | 6141 if (FLAG_debug_code && FLAG_enable_slow_asserts) { |
| 6140 // In case of an error the return address may point to a memory area | 6142 // In case of an error the return address may point to a memory area |
| 6141 // filled with kZapValue by the GC. | 6143 // filled with kZapValue by the GC. |
| 6142 // Dereference the address and check for this. | 6144 // Dereference the address and check for this. |
| 6143 __ lw(t0, MemOperand(t9)); | 6145 __ lw(t0, MemOperand(t9)); |
| 6144 __ Assert(ne, kReceivedInvalidReturnAddress, t0, | 6146 __ Assert(ne, kReceivedInvalidReturnAddress, t0, |
| 6145 Operand(reinterpret_cast<uint32_t>(kZapValue))); | 6147 Operand(reinterpret_cast<uint32_t>(kZapValue))); |
| 6146 } | 6148 } |
| 6147 __ Jump(t9); | 6149 __ Jump(t9); |
| 6148 } | 6150 } |
| 6149 | 6151 |
| 6150 | 6152 |
| 6151 void DirectCEntryStub::GenerateCall(MacroAssembler* masm, | 6153 void DirectCEntryStub::GenerateCall(MacroAssembler* masm, |
| 6152 Register target) { | 6154 Register target) { |
| 6153 __ Move(t9, target); | |
| 6154 __ AssertStackIsAligned(); | |
| 6155 // Allocate space for arg slots. | |
| 6156 __ Subu(sp, sp, kCArgsSlotsSize); | |
| 6157 | |
| 6158 // Block the trampoline pool through the whole function to make sure the | |
| 6159 // number of generated instructions is constant. | |
| 6160 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm); | |
| 6161 | |
| 6162 // We need to get the current 'pc' value, which is not available on MIPS. | |
| 6163 Label find_ra; | |
| 6164 masm->bal(&find_ra); // ra = pc + 8. | |
| 6165 masm->nop(); // Branch delay slot nop. | |
| 6166 masm->bind(&find_ra); | |
| 6167 | |
| 6168 const int kNumInstructionsToJump = 6; | |
| 6169 masm->addiu(ra, ra, kNumInstructionsToJump * kPointerSize); | |
| 6170 // Push return address (accessible to GC through exit frame pc). | |
| 6171 // This spot for ra was reserved in EnterExitFrame. | |
| 6172 masm->sw(ra, MemOperand(sp, kCArgsSlotsSize)); | |
| 6173 intptr_t loc = | 6155 intptr_t loc = |
| 6174 reinterpret_cast<intptr_t>(GetCode(masm->isolate()).location()); | 6156 reinterpret_cast<intptr_t>(GetCode(masm->isolate()).location()); |
| 6175 masm->li(ra, Operand(loc, RelocInfo::CODE_TARGET), CONSTANT_SIZE); | 6157 __ Move(t9, target); |
| 6176 // Call the function. | 6158 __ li(ra, Operand(loc, RelocInfo::CODE_TARGET), CONSTANT_SIZE); |
| 6177 masm->Jump(t9); | 6159 __ Call(ra); |
| 6178 // Make sure the stored 'ra' points to this position. | |
| 6179 ASSERT_EQ(kNumInstructionsToJump, masm->InstructionsGeneratedSince(&find_ra)); | |
| 6180 } | 6160 } |
| 6181 | 6161 |
| 6182 | 6162 |
| 6183 void NameDictionaryLookupStub::GenerateNegativeLookup(MacroAssembler* masm, | 6163 void NameDictionaryLookupStub::GenerateNegativeLookup(MacroAssembler* masm, |
| 6184 Label* miss, | 6164 Label* miss, |
| 6185 Label* done, | 6165 Label* done, |
| 6186 Register receiver, | 6166 Register receiver, |
| 6187 Register properties, | 6167 Register properties, |
| 6188 Handle<Name> name, | 6168 Handle<Name> name, |
| 6189 Register scratch0) { | 6169 Register scratch0) { |
| (...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7190 __ bind(&fast_elements_case); | 7170 __ bind(&fast_elements_case); |
| 7191 GenerateCase(masm, FAST_ELEMENTS); | 7171 GenerateCase(masm, FAST_ELEMENTS); |
| 7192 } | 7172 } |
| 7193 | 7173 |
| 7194 | 7174 |
| 7195 #undef __ | 7175 #undef __ |
| 7196 | 7176 |
| 7197 } } // namespace v8::internal | 7177 } } // namespace v8::internal |
| 7198 | 7178 |
| 7199 #endif // V8_TARGET_ARCH_MIPS | 7179 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |