| 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 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
| 8 | 8 |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 3182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3193 | 3193 |
| 3194 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase); | 3194 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase); |
| 3195 } | 3195 } |
| 3196 | 3196 |
| 3197 | 3197 |
| 3198 // ------------------------------------------------------------------------- | 3198 // ------------------------------------------------------------------------- |
| 3199 // StringCharFromCodeGenerator | 3199 // StringCharFromCodeGenerator |
| 3200 | 3200 |
| 3201 void StringCharFromCodeGenerator::GenerateFast(MacroAssembler* masm) { | 3201 void StringCharFromCodeGenerator::GenerateFast(MacroAssembler* masm) { |
| 3202 // Fast case of Heap::LookupSingleCharacterStringFromCode. | 3202 // Fast case of Heap::LookupSingleCharacterStringFromCode. |
| 3203 | 3203 __ JumpIfNotSmi(code_, &slow_case_); |
| 3204 DCHECK(!a4.is(result_)); | 3204 __ Branch(&slow_case_, hi, code_, |
| 3205 DCHECK(!a4.is(code_)); | 3205 Operand(Smi::FromInt(String::kMaxOneByteCharCode))); |
| 3206 | |
| 3207 STATIC_ASSERT(kSmiTag == 0); | |
| 3208 DCHECK(base::bits::IsPowerOfTwo32(String::kMaxOneByteCharCodeU + 1)); | |
| 3209 __ And(a4, code_, Operand(kSmiTagMask | | |
| 3210 ((~String::kMaxOneByteCharCodeU) << kSmiTagSize))); | |
| 3211 __ Branch(&slow_case_, ne, a4, Operand(zero_reg)); | |
| 3212 | |
| 3213 | 3206 |
| 3214 __ LoadRoot(result_, Heap::kSingleCharacterStringCacheRootIndex); | 3207 __ LoadRoot(result_, Heap::kSingleCharacterStringCacheRootIndex); |
| 3215 // At this point code register contains smi tagged one_byte char code. | 3208 // At this point code register contains smi tagged one_byte char code. |
| 3216 STATIC_ASSERT(kSmiTag == 0); | 3209 __ SmiScale(at, code_, kPointerSizeLog2); |
| 3217 __ SmiScale(a4, code_, kPointerSizeLog2); | 3210 __ Daddu(result_, result_, at); |
| 3218 __ Daddu(result_, result_, a4); | |
| 3219 __ ld(result_, FieldMemOperand(result_, FixedArray::kHeaderSize)); | 3211 __ ld(result_, FieldMemOperand(result_, FixedArray::kHeaderSize)); |
| 3220 __ LoadRoot(a4, Heap::kUndefinedValueRootIndex); | 3212 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
| 3221 __ Branch(&slow_case_, eq, result_, Operand(a4)); | 3213 __ Branch(&slow_case_, eq, result_, Operand(at)); |
| 3222 __ bind(&exit_); | 3214 __ bind(&exit_); |
| 3223 } | 3215 } |
| 3224 | 3216 |
| 3225 | 3217 |
| 3226 void StringCharFromCodeGenerator::GenerateSlow( | 3218 void StringCharFromCodeGenerator::GenerateSlow( |
| 3227 MacroAssembler* masm, | 3219 MacroAssembler* masm, |
| 3228 const RuntimeCallHelper& call_helper) { | 3220 const RuntimeCallHelper& call_helper) { |
| 3229 __ Abort(kUnexpectedFallthroughToCharFromCodeSlowCase); | 3221 __ Abort(kUnexpectedFallthroughToCharFromCodeSlowCase); |
| 3230 | 3222 |
| 3231 __ bind(&slow_case_); | 3223 __ bind(&slow_case_); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3299 // both "from" and "to" are smis, and | 3291 // both "from" and "to" are smis, and |
| 3300 // 0 <= from <= to <= string.length. | 3292 // 0 <= from <= to <= string.length. |
| 3301 // If any of these assumptions fail, we call the runtime system. | 3293 // If any of these assumptions fail, we call the runtime system. |
| 3302 | 3294 |
| 3303 const int kToOffset = 0 * kPointerSize; | 3295 const int kToOffset = 0 * kPointerSize; |
| 3304 const int kFromOffset = 1 * kPointerSize; | 3296 const int kFromOffset = 1 * kPointerSize; |
| 3305 const int kStringOffset = 2 * kPointerSize; | 3297 const int kStringOffset = 2 * kPointerSize; |
| 3306 | 3298 |
| 3307 __ ld(a2, MemOperand(sp, kToOffset)); | 3299 __ ld(a2, MemOperand(sp, kToOffset)); |
| 3308 __ ld(a3, MemOperand(sp, kFromOffset)); | 3300 __ ld(a3, MemOperand(sp, kFromOffset)); |
| 3309 // Does not needed? | 3301 |
| 3310 // STATIC_ASSERT(kFromOffset == kToOffset + 4); | |
| 3311 STATIC_ASSERT(kSmiTag == 0); | 3302 STATIC_ASSERT(kSmiTag == 0); |
| 3312 // Does not needed? | |
| 3313 // STATIC_ASSERT(kSmiTagSize + kSmiShiftSize == 1); | |
| 3314 | 3303 |
| 3315 // Utilize delay slots. SmiUntag doesn't emit a jump, everything else is | 3304 // Utilize delay slots. SmiUntag doesn't emit a jump, everything else is |
| 3316 // safe in this case. | 3305 // safe in this case. |
| 3317 __ JumpIfNotSmi(a2, &runtime); | 3306 __ JumpIfNotSmi(a2, &runtime); |
| 3318 __ JumpIfNotSmi(a3, &runtime); | 3307 __ JumpIfNotSmi(a3, &runtime); |
| 3319 // Both a2 and a3 are untagged integers. | 3308 // Both a2 and a3 are untagged integers. |
| 3320 | 3309 |
| 3321 __ SmiUntag(a2, a2); | 3310 __ SmiUntag(a2, a2); |
| 3322 __ SmiUntag(a3, a3); | 3311 __ SmiUntag(a3, a3); |
| 3323 __ Branch(&runtime, lt, a3, Operand(zero_reg)); // From < 0. | 3312 __ Branch(&runtime, lt, a3, Operand(zero_reg)); // From < 0. |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3496 | 3485 |
| 3497 // Just jump to runtime to create the sub string. | 3486 // Just jump to runtime to create the sub string. |
| 3498 __ bind(&runtime); | 3487 __ bind(&runtime); |
| 3499 __ TailCallRuntime(Runtime::kSubStringRT, 3, 1); | 3488 __ TailCallRuntime(Runtime::kSubStringRT, 3, 1); |
| 3500 | 3489 |
| 3501 __ bind(&single_char); | 3490 __ bind(&single_char); |
| 3502 // v0: original string | 3491 // v0: original string |
| 3503 // a1: instance type | 3492 // a1: instance type |
| 3504 // a2: length | 3493 // a2: length |
| 3505 // a3: from index (untagged) | 3494 // a3: from index (untagged) |
| 3495 __ SmiTag(a3); |
| 3506 StringCharAtGenerator generator(v0, a3, a2, v0, &runtime, &runtime, &runtime, | 3496 StringCharAtGenerator generator(v0, a3, a2, v0, &runtime, &runtime, &runtime, |
| 3507 STRING_INDEX_IS_NUMBER, RECEIVER_IS_STRING); | 3497 STRING_INDEX_IS_NUMBER, RECEIVER_IS_STRING); |
| 3508 generator.GenerateFast(masm); | 3498 generator.GenerateFast(masm); |
| 3509 __ DropAndRet(3); | 3499 __ DropAndRet(3); |
| 3510 generator.SkipSlow(masm, &runtime); | 3500 generator.SkipSlow(masm, &runtime); |
| 3511 } | 3501 } |
| 3512 | 3502 |
| 3513 | 3503 |
| 3514 void ToNumberStub::Generate(MacroAssembler* masm) { | 3504 void ToNumberStub::Generate(MacroAssembler* masm) { |
| 3515 // The ToNumber stub takes one argument in a0. | 3505 // The ToNumber stub takes one argument in a0. |
| (...skipping 2104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5620 MemOperand(fp, 6 * kPointerSize), NULL); | 5610 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5621 } | 5611 } |
| 5622 | 5612 |
| 5623 | 5613 |
| 5624 #undef __ | 5614 #undef __ |
| 5625 | 5615 |
| 5626 } // namespace internal | 5616 } // namespace internal |
| 5627 } // namespace v8 | 5617 } // namespace v8 |
| 5628 | 5618 |
| 5629 #endif // V8_TARGET_ARCH_MIPS64 | 5619 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |