OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1265 | 1265 |
1266 // Restore callee-saved fpu registers. | 1266 // Restore callee-saved fpu registers. |
1267 __ MultiPopFPU(kCalleeSavedFPU); | 1267 __ MultiPopFPU(kCalleeSavedFPU); |
1268 | 1268 |
1269 // Restore callee saved registers from the stack. | 1269 // Restore callee saved registers from the stack. |
1270 __ MultiPop(kCalleeSaved | ra.bit()); | 1270 __ MultiPop(kCalleeSaved | ra.bit()); |
1271 // Return. | 1271 // Return. |
1272 __ Jump(ra); | 1272 __ Jump(ra); |
1273 } | 1273 } |
1274 | 1274 |
1275 | |
1276 void LoadIndexedStringStub::Generate(MacroAssembler* masm) { | |
1277 // Return address is in ra. | |
1278 Label miss; | |
1279 | |
1280 Register receiver = LoadDescriptor::ReceiverRegister(); | |
1281 Register index = LoadDescriptor::NameRegister(); | |
1282 Register scratch = a5; | |
1283 Register result = v0; | |
1284 DCHECK(!scratch.is(receiver) && !scratch.is(index)); | |
1285 DCHECK(!scratch.is(LoadWithVectorDescriptor::VectorRegister())); | |
1286 | |
1287 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, | |
1288 &miss, // When not a string. | |
1289 &miss, // When not a number. | |
1290 &miss, // When index out of range. | |
1291 RECEIVER_IS_STRING); | |
1292 char_at_generator.GenerateFast(masm); | |
1293 __ Ret(); | |
1294 | |
1295 StubRuntimeCallHelper call_helper; | |
1296 char_at_generator.GenerateSlow(masm, PART_OF_IC_HANDLER, call_helper); | |
1297 | |
1298 __ bind(&miss); | |
1299 PropertyAccessCompiler::TailCallBuiltin( | |
1300 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); | |
1301 } | |
1302 | |
1303 | |
1304 void FunctionPrototypeStub::Generate(MacroAssembler* masm) { | 1275 void FunctionPrototypeStub::Generate(MacroAssembler* masm) { |
1305 Label miss; | 1276 Label miss; |
1306 Register receiver = LoadDescriptor::ReceiverRegister(); | 1277 Register receiver = LoadDescriptor::ReceiverRegister(); |
1307 // Ensure that the vector and slot registers won't be clobbered before | 1278 // Ensure that the vector and slot registers won't be clobbered before |
1308 // calling the miss handler. | 1279 // calling the miss handler. |
1309 DCHECK(!AreAliased(a4, a5, LoadWithVectorDescriptor::VectorRegister(), | 1280 DCHECK(!AreAliased(a4, a5, LoadWithVectorDescriptor::VectorRegister(), |
1310 LoadWithVectorDescriptor::SlotRegister())); | 1281 LoadWithVectorDescriptor::SlotRegister())); |
1311 | 1282 |
1312 NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(masm, receiver, a4, | 1283 NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(masm, receiver, a4, |
1313 a5, &miss); | 1284 a5, &miss); |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1991 __ CallRuntime(Runtime::kStringCharCodeAtRT); | 1962 __ CallRuntime(Runtime::kStringCharCodeAtRT); |
1992 | 1963 |
1993 __ Move(result_, v0); | 1964 __ Move(result_, v0); |
1994 | 1965 |
1995 call_helper.AfterCall(masm); | 1966 call_helper.AfterCall(masm); |
1996 __ jmp(&exit_); | 1967 __ jmp(&exit_); |
1997 | 1968 |
1998 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase); | 1969 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase); |
1999 } | 1970 } |
2000 | 1971 |
2001 | |
2002 // ------------------------------------------------------------------------- | |
2003 // StringCharFromCodeGenerator | |
2004 | |
2005 void StringCharFromCodeGenerator::GenerateFast(MacroAssembler* masm) { | |
2006 // Fast case of Heap::LookupSingleCharacterStringFromCode. | |
2007 __ JumpIfNotSmi(code_, &slow_case_); | |
2008 __ Branch(&slow_case_, hi, code_, | |
2009 Operand(Smi::FromInt(String::kMaxOneByteCharCode))); | |
2010 | |
2011 __ LoadRoot(result_, Heap::kSingleCharacterStringCacheRootIndex); | |
2012 // At this point code register contains smi tagged one_byte char code. | |
2013 __ SmiScale(at, code_, kPointerSizeLog2); | |
2014 __ Daddu(result_, result_, at); | |
2015 __ ld(result_, FieldMemOperand(result_, FixedArray::kHeaderSize)); | |
2016 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | |
2017 __ Branch(&slow_case_, eq, result_, Operand(at)); | |
2018 __ bind(&exit_); | |
2019 } | |
2020 | |
2021 | |
2022 void StringCharFromCodeGenerator::GenerateSlow( | |
2023 MacroAssembler* masm, | |
2024 const RuntimeCallHelper& call_helper) { | |
2025 __ Abort(kUnexpectedFallthroughToCharFromCodeSlowCase); | |
2026 | |
2027 __ bind(&slow_case_); | |
2028 call_helper.BeforeCall(masm); | |
2029 __ push(code_); | |
2030 __ CallRuntime(Runtime::kStringCharFromCode); | |
2031 __ Move(result_, v0); | |
2032 | |
2033 call_helper.AfterCall(masm); | |
2034 __ Branch(&exit_); | |
2035 | |
2036 __ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase); | |
2037 } | |
2038 | |
2039 void StringHelper::GenerateFlatOneByteStringEquals( | 1972 void StringHelper::GenerateFlatOneByteStringEquals( |
2040 MacroAssembler* masm, Register left, Register right, Register scratch1, | 1973 MacroAssembler* masm, Register left, Register right, Register scratch1, |
2041 Register scratch2, Register scratch3) { | 1974 Register scratch2, Register scratch3) { |
2042 Register length = scratch1; | 1975 Register length = scratch1; |
2043 | 1976 |
2044 // Compare lengths. | 1977 // Compare lengths. |
2045 Label strings_not_equal, check_zero_length; | 1978 Label strings_not_equal, check_zero_length; |
2046 __ ld(length, FieldMemOperand(left, String::kLengthOffset)); | 1979 __ ld(length, FieldMemOperand(left, String::kLengthOffset)); |
2047 __ ld(scratch2, FieldMemOperand(right, String::kLengthOffset)); | 1980 __ ld(scratch2, FieldMemOperand(right, String::kLengthOffset)); |
2048 __ Branch(&check_zero_length, eq, length, Operand(scratch2)); | 1981 __ Branch(&check_zero_length, eq, length, Operand(scratch2)); |
(...skipping 1570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3619 kStackUnwindSpace, kInvalidStackOffset, | 3552 kStackUnwindSpace, kInvalidStackOffset, |
3620 return_value_operand, NULL); | 3553 return_value_operand, NULL); |
3621 } | 3554 } |
3622 | 3555 |
3623 #undef __ | 3556 #undef __ |
3624 | 3557 |
3625 } // namespace internal | 3558 } // namespace internal |
3626 } // namespace v8 | 3559 } // namespace v8 |
3627 | 3560 |
3628 #endif // V8_TARGET_ARCH_MIPS64 | 3561 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |