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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
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/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1270 | 1270 |
1271 // Restore callee-saved fpu registers. | 1271 // Restore callee-saved fpu registers. |
1272 __ MultiPopFPU(kCalleeSavedFPU); | 1272 __ MultiPopFPU(kCalleeSavedFPU); |
1273 | 1273 |
1274 // Restore callee saved registers from the stack. | 1274 // Restore callee saved registers from the stack. |
1275 __ MultiPop(kCalleeSaved | ra.bit()); | 1275 __ MultiPop(kCalleeSaved | ra.bit()); |
1276 // Return. | 1276 // Return. |
1277 __ Jump(ra); | 1277 __ Jump(ra); |
1278 } | 1278 } |
1279 | 1279 |
1280 | |
1281 void LoadIndexedStringStub::Generate(MacroAssembler* masm) { | |
1282 // Return address is in ra. | |
1283 Label miss; | |
1284 | |
1285 Register receiver = LoadDescriptor::ReceiverRegister(); | |
1286 Register index = LoadDescriptor::NameRegister(); | |
1287 Register scratch = t1; | |
1288 Register result = v0; | |
1289 DCHECK(!scratch.is(receiver) && !scratch.is(index)); | |
1290 DCHECK(!scratch.is(LoadWithVectorDescriptor::VectorRegister())); | |
1291 | |
1292 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, | |
1293 &miss, // When not a string. | |
1294 &miss, // When not a number. | |
1295 &miss, // When index out of range. | |
1296 RECEIVER_IS_STRING); | |
1297 char_at_generator.GenerateFast(masm); | |
1298 __ Ret(); | |
1299 | |
1300 StubRuntimeCallHelper call_helper; | |
1301 char_at_generator.GenerateSlow(masm, PART_OF_IC_HANDLER, call_helper); | |
1302 | |
1303 __ bind(&miss); | |
1304 PropertyAccessCompiler::TailCallBuiltin( | |
1305 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); | |
1306 } | |
1307 | |
1308 | |
1309 void FunctionPrototypeStub::Generate(MacroAssembler* masm) { | 1280 void FunctionPrototypeStub::Generate(MacroAssembler* masm) { |
1310 Label miss; | 1281 Label miss; |
1311 Register receiver = LoadDescriptor::ReceiverRegister(); | 1282 Register receiver = LoadDescriptor::ReceiverRegister(); |
1312 // Ensure that the vector and slot registers won't be clobbered before | 1283 // Ensure that the vector and slot registers won't be clobbered before |
1313 // calling the miss handler. | 1284 // calling the miss handler. |
1314 DCHECK(!AreAliased(t0, t1, LoadWithVectorDescriptor::VectorRegister(), | 1285 DCHECK(!AreAliased(t0, t1, LoadWithVectorDescriptor::VectorRegister(), |
1315 LoadWithVectorDescriptor::SlotRegister())); | 1286 LoadWithVectorDescriptor::SlotRegister())); |
1316 | 1287 |
1317 NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(masm, receiver, t0, | 1288 NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(masm, receiver, t0, |
1318 t1, &miss); | 1289 t1, &miss); |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1983 __ CallRuntime(Runtime::kStringCharCodeAtRT); | 1954 __ CallRuntime(Runtime::kStringCharCodeAtRT); |
1984 | 1955 |
1985 __ Move(result_, v0); | 1956 __ Move(result_, v0); |
1986 | 1957 |
1987 call_helper.AfterCall(masm); | 1958 call_helper.AfterCall(masm); |
1988 __ jmp(&exit_); | 1959 __ jmp(&exit_); |
1989 | 1960 |
1990 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase); | 1961 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase); |
1991 } | 1962 } |
1992 | 1963 |
1993 | |
1994 // ------------------------------------------------------------------------- | |
1995 // StringCharFromCodeGenerator | |
1996 | |
1997 void StringCharFromCodeGenerator::GenerateFast(MacroAssembler* masm) { | |
1998 // Fast case of Heap::LookupSingleCharacterStringFromCode. | |
1999 | |
2000 DCHECK(!t0.is(result_)); | |
2001 DCHECK(!t0.is(code_)); | |
2002 | |
2003 STATIC_ASSERT(kSmiTag == 0); | |
2004 STATIC_ASSERT(kSmiShiftSize == 0); | |
2005 DCHECK(base::bits::IsPowerOfTwo32(String::kMaxOneByteCharCodeU + 1)); | |
2006 __ And(t0, code_, Operand(kSmiTagMask | | |
2007 ((~String::kMaxOneByteCharCodeU) << kSmiTagSize))); | |
2008 __ Branch(&slow_case_, ne, t0, Operand(zero_reg)); | |
2009 | |
2010 __ LoadRoot(result_, Heap::kSingleCharacterStringCacheRootIndex); | |
2011 // At this point code register contains smi tagged one-byte char code. | |
2012 STATIC_ASSERT(kSmiTag == 0); | |
2013 __ Lsa(result_, result_, code_, kPointerSizeLog2 - kSmiTagSize); | |
2014 __ lw(result_, FieldMemOperand(result_, FixedArray::kHeaderSize)); | |
2015 __ LoadRoot(t0, Heap::kUndefinedValueRootIndex); | |
2016 __ Branch(&slow_case_, eq, result_, Operand(t0)); | |
2017 __ bind(&exit_); | |
2018 } | |
2019 | |
2020 | |
2021 void StringCharFromCodeGenerator::GenerateSlow( | |
2022 MacroAssembler* masm, | |
2023 const RuntimeCallHelper& call_helper) { | |
2024 __ Abort(kUnexpectedFallthroughToCharFromCodeSlowCase); | |
2025 | |
2026 __ bind(&slow_case_); | |
2027 call_helper.BeforeCall(masm); | |
2028 __ push(code_); | |
2029 __ CallRuntime(Runtime::kStringCharFromCode); | |
2030 __ Move(result_, v0); | |
2031 | |
2032 call_helper.AfterCall(masm); | |
2033 __ Branch(&exit_); | |
2034 | |
2035 __ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase); | |
2036 } | |
2037 | |
2038 void StringHelper::GenerateFlatOneByteStringEquals( | 1964 void StringHelper::GenerateFlatOneByteStringEquals( |
2039 MacroAssembler* masm, Register left, Register right, Register scratch1, | 1965 MacroAssembler* masm, Register left, Register right, Register scratch1, |
2040 Register scratch2, Register scratch3) { | 1966 Register scratch2, Register scratch3) { |
2041 Register length = scratch1; | 1967 Register length = scratch1; |
2042 | 1968 |
2043 // Compare lengths. | 1969 // Compare lengths. |
2044 Label strings_not_equal, check_zero_length; | 1970 Label strings_not_equal, check_zero_length; |
2045 __ lw(length, FieldMemOperand(left, String::kLengthOffset)); | 1971 __ lw(length, FieldMemOperand(left, String::kLengthOffset)); |
2046 __ lw(scratch2, FieldMemOperand(right, String::kLengthOffset)); | 1972 __ lw(scratch2, FieldMemOperand(right, String::kLengthOffset)); |
2047 __ Branch(&check_zero_length, eq, length, Operand(scratch2)); | 1973 __ Branch(&check_zero_length, eq, length, Operand(scratch2)); |
(...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3612 kStackUnwindSpace, kInvalidStackOffset, | 3538 kStackUnwindSpace, kInvalidStackOffset, |
3613 return_value_operand, NULL); | 3539 return_value_operand, NULL); |
3614 } | 3540 } |
3615 | 3541 |
3616 #undef __ | 3542 #undef __ |
3617 | 3543 |
3618 } // namespace internal | 3544 } // namespace internal |
3619 } // namespace v8 | 3545 } // namespace v8 |
3620 | 3546 |
3621 #endif // V8_TARGET_ARCH_MIPS | 3547 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |