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 // Note on Mips implementation: | 7 // Note on Mips implementation: |
8 // | 8 // |
9 // The result_register() for mips is the 'v0' register, which is defined | 9 // The result_register() for mips is the 'v0' register, which is defined |
10 // by the ABI to contain function return values. However, the first | 10 // by the ABI to contain function return values. However, the first |
(...skipping 2345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2356 case Token::SHR: { | 2356 case Token::SHR: { |
2357 __ SmiUntag(scratch1, left); | 2357 __ SmiUntag(scratch1, left); |
2358 __ GetLeastBitsFromSmi(scratch2, right, 5); | 2358 __ GetLeastBitsFromSmi(scratch2, right, 5); |
2359 __ srlv(scratch1, scratch1, scratch2); | 2359 __ srlv(scratch1, scratch1, scratch2); |
2360 __ And(scratch2, scratch1, 0xc0000000); | 2360 __ And(scratch2, scratch1, 0xc0000000); |
2361 __ Branch(&stub_call, ne, scratch2, Operand(zero_reg)); | 2361 __ Branch(&stub_call, ne, scratch2, Operand(zero_reg)); |
2362 __ SmiTag(v0, scratch1); | 2362 __ SmiTag(v0, scratch1); |
2363 break; | 2363 break; |
2364 } | 2364 } |
2365 case Token::ADD: | 2365 case Token::ADD: |
2366 __ AdduAndCheckForOverflow(v0, left, right, scratch1); | 2366 __ AdduAndCheckForOverflow(v0, left, right, &stub_call, nullptr); |
2367 __ BranchOnOverflow(&stub_call, scratch1); | |
2368 break; | 2367 break; |
2369 case Token::SUB: | 2368 case Token::SUB: |
2370 __ SubuAndCheckForOverflow(v0, left, right, scratch1); | 2369 __ SubuAndCheckForOverflow(v0, left, right, scratch1); |
2371 __ BranchOnOverflow(&stub_call, scratch1); | 2370 __ BranchOnOverflow(&stub_call, scratch1); |
2372 break; | 2371 break; |
2373 case Token::MUL: { | 2372 case Token::MUL: { |
2374 __ SmiUntag(scratch1, right); | 2373 __ SmiUntag(scratch1, right); |
2375 __ Mul(scratch2, v0, left, scratch1); | 2374 __ Mul(scratch2, v0, left, scratch1); |
2376 __ sra(scratch1, v0, 31); | 2375 __ sra(scratch1, v0, 31); |
2377 __ Branch(&stub_call, ne, scratch1, Operand(scratch2)); | 2376 __ Branch(&stub_call, ne, scratch1, Operand(scratch2)); |
(...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4024 Operand(zero_reg)); | 4023 Operand(zero_reg)); |
4025 } | 4024 } |
4026 __ bind(&loop); | 4025 __ bind(&loop); |
4027 __ lw(string, MemOperand(element)); | 4026 __ lw(string, MemOperand(element)); |
4028 __ Addu(element, element, kPointerSize); | 4027 __ Addu(element, element, kPointerSize); |
4029 __ JumpIfSmi(string, &bailout); | 4028 __ JumpIfSmi(string, &bailout); |
4030 __ lw(scratch1, FieldMemOperand(string, HeapObject::kMapOffset)); | 4029 __ lw(scratch1, FieldMemOperand(string, HeapObject::kMapOffset)); |
4031 __ lbu(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset)); | 4030 __ lbu(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset)); |
4032 __ JumpIfInstanceTypeIsNotSequentialOneByte(scratch1, scratch2, &bailout); | 4031 __ JumpIfInstanceTypeIsNotSequentialOneByte(scratch1, scratch2, &bailout); |
4033 __ lw(scratch1, FieldMemOperand(string, SeqOneByteString::kLengthOffset)); | 4032 __ lw(scratch1, FieldMemOperand(string, SeqOneByteString::kLengthOffset)); |
4034 __ AdduAndCheckForOverflow(string_length, string_length, scratch1, scratch3); | 4033 __ AdduAndCheckForOverflow(string_length, string_length, scratch1, &bailout, |
4035 __ BranchOnOverflow(&bailout, scratch3); | 4034 nullptr); |
4036 __ Branch(&loop, lt, element, Operand(elements_end)); | 4035 __ Branch(&loop, lt, element, Operand(elements_end)); |
4037 | 4036 |
4038 // If array_length is 1, return elements[0], a string. | 4037 // If array_length is 1, return elements[0], a string. |
4039 __ Branch(¬_size_one_array, ne, array_length, Operand(1)); | 4038 __ Branch(¬_size_one_array, ne, array_length, Operand(1)); |
4040 __ lw(v0, FieldMemOperand(elements, FixedArray::kHeaderSize)); | 4039 __ lw(v0, FieldMemOperand(elements, FixedArray::kHeaderSize)); |
4041 __ Branch(&done); | 4040 __ Branch(&done); |
4042 | 4041 |
4043 __ bind(¬_size_one_array); | 4042 __ bind(¬_size_one_array); |
4044 | 4043 |
4045 // Live values in registers: | 4044 // Live values in registers: |
(...skipping 12 matching lines...) Expand all Loading... |
4058 // string_length to get the length of the result string. array_length is not | 4057 // string_length to get the length of the result string. array_length is not |
4059 // smi but the other values are, so the result is a smi. | 4058 // smi but the other values are, so the result is a smi. |
4060 __ lw(scratch1, FieldMemOperand(separator, SeqOneByteString::kLengthOffset)); | 4059 __ lw(scratch1, FieldMemOperand(separator, SeqOneByteString::kLengthOffset)); |
4061 __ Subu(string_length, string_length, Operand(scratch1)); | 4060 __ Subu(string_length, string_length, Operand(scratch1)); |
4062 __ Mul(scratch3, scratch2, array_length, scratch1); | 4061 __ Mul(scratch3, scratch2, array_length, scratch1); |
4063 // Check for smi overflow. No overflow if higher 33 bits of 64-bit result are | 4062 // Check for smi overflow. No overflow if higher 33 bits of 64-bit result are |
4064 // zero. | 4063 // zero. |
4065 __ Branch(&bailout, ne, scratch3, Operand(zero_reg)); | 4064 __ Branch(&bailout, ne, scratch3, Operand(zero_reg)); |
4066 __ And(scratch3, scratch2, Operand(0x80000000)); | 4065 __ And(scratch3, scratch2, Operand(0x80000000)); |
4067 __ Branch(&bailout, ne, scratch3, Operand(zero_reg)); | 4066 __ Branch(&bailout, ne, scratch3, Operand(zero_reg)); |
4068 __ AdduAndCheckForOverflow(string_length, string_length, scratch2, scratch3); | 4067 __ AdduAndCheckForOverflow(string_length, string_length, scratch2, &bailout, |
4069 __ BranchOnOverflow(&bailout, scratch3); | 4068 nullptr); |
4070 __ SmiUntag(string_length); | 4069 __ SmiUntag(string_length); |
4071 | 4070 |
4072 // Bailout for large object allocations. | 4071 // Bailout for large object allocations. |
4073 __ Branch(&bailout, gt, string_length, | 4072 __ Branch(&bailout, gt, string_length, |
4074 Operand(Page::kMaxRegularHeapObjectSize)); | 4073 Operand(Page::kMaxRegularHeapObjectSize)); |
4075 | 4074 |
4076 // Get first element in the array to free up the elements register to be used | 4075 // Get first element in the array to free up the elements register to be used |
4077 // for the result. | 4076 // for the result. |
4078 __ Addu(element, | 4077 __ Addu(element, |
4079 elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 4078 elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4529 __ sw(v0, MemOperand(sp, 2 * kPointerSize)); | 4528 __ sw(v0, MemOperand(sp, 2 * kPointerSize)); |
4530 break; | 4529 break; |
4531 case KEYED_SUPER_PROPERTY: | 4530 case KEYED_SUPER_PROPERTY: |
4532 __ sw(v0, MemOperand(sp, 3 * kPointerSize)); | 4531 __ sw(v0, MemOperand(sp, 3 * kPointerSize)); |
4533 break; | 4532 break; |
4534 } | 4533 } |
4535 } | 4534 } |
4536 } | 4535 } |
4537 | 4536 |
4538 Register scratch1 = a1; | 4537 Register scratch1 = a1; |
4539 Register scratch2 = t0; | |
4540 __ li(scratch1, Operand(Smi::FromInt(count_value))); | 4538 __ li(scratch1, Operand(Smi::FromInt(count_value))); |
4541 __ AdduAndCheckForOverflow(v0, v0, scratch1, scratch2); | 4539 __ AdduAndCheckForOverflow(v0, v0, scratch1, nullptr, &done); |
4542 __ BranchOnNoOverflow(&done, scratch2); | |
4543 // Call stub. Undo operation first. | 4540 // Call stub. Undo operation first. |
4544 __ Move(v0, a0); | 4541 __ Move(v0, a0); |
4545 __ jmp(&stub_call); | 4542 __ jmp(&stub_call); |
4546 __ bind(&slow); | 4543 __ bind(&slow); |
4547 } | 4544 } |
4548 if (!is_strong(language_mode())) { | 4545 if (!is_strong(language_mode())) { |
4549 ToNumberStub convert_stub(isolate()); | 4546 ToNumberStub convert_stub(isolate()); |
4550 __ CallStub(&convert_stub); | 4547 __ CallStub(&convert_stub); |
4551 PrepareForBailoutForId(expr->ToNumberId(), TOS_REG); | 4548 PrepareForBailoutForId(expr->ToNumberId(), TOS_REG); |
4552 } | 4549 } |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5055 reinterpret_cast<uint32_t>( | 5052 reinterpret_cast<uint32_t>( |
5056 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5053 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5057 return OSR_AFTER_STACK_CHECK; | 5054 return OSR_AFTER_STACK_CHECK; |
5058 } | 5055 } |
5059 | 5056 |
5060 | 5057 |
5061 } // namespace internal | 5058 } // namespace internal |
5062 } // namespace v8 | 5059 } // namespace v8 |
5063 | 5060 |
5064 #endif // V8_TARGET_ARCH_MIPS | 5061 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |