Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(415)

Side by Side Diff: src/full-codegen/mips/full-codegen-mips.cc

Issue 1434263003: MIPS: Use BOVC/BNVC for overflow checking on r6. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/crankshaft/mips/lithium-codegen-mips.cc ('k') | src/mips/assembler-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2279 matching lines...) Expand 10 before | Expand all | Expand 10 after
2290 case Token::SHR: { 2290 case Token::SHR: {
2291 __ SmiUntag(scratch1, left); 2291 __ SmiUntag(scratch1, left);
2292 __ GetLeastBitsFromSmi(scratch2, right, 5); 2292 __ GetLeastBitsFromSmi(scratch2, right, 5);
2293 __ srlv(scratch1, scratch1, scratch2); 2293 __ srlv(scratch1, scratch1, scratch2);
2294 __ And(scratch2, scratch1, 0xc0000000); 2294 __ And(scratch2, scratch1, 0xc0000000);
2295 __ Branch(&stub_call, ne, scratch2, Operand(zero_reg)); 2295 __ Branch(&stub_call, ne, scratch2, Operand(zero_reg));
2296 __ SmiTag(v0, scratch1); 2296 __ SmiTag(v0, scratch1);
2297 break; 2297 break;
2298 } 2298 }
2299 case Token::ADD: 2299 case Token::ADD:
2300 __ AdduAndCheckForOverflow(v0, left, right, scratch1); 2300 __ AddBranchOvf(v0, left, Operand(right), &stub_call);
2301 __ BranchOnOverflow(&stub_call, scratch1);
2302 break; 2301 break;
2303 case Token::SUB: 2302 case Token::SUB:
2304 __ SubuAndCheckForOverflow(v0, left, right, scratch1); 2303 __ SubBranchOvf(v0, left, Operand(right), &stub_call);
2305 __ BranchOnOverflow(&stub_call, scratch1); 2304 __ BranchOnOverflow(&stub_call, scratch1);
paul.l... 2015/12/04 20:04:12 No need for this macro-instr anymore, handled in p
balazs.kilvady 2015/12/05 11:58:44 Thanks for catching it. Done.
2306 break; 2305 break;
2307 case Token::MUL: { 2306 case Token::MUL: {
2308 __ SmiUntag(scratch1, right); 2307 __ SmiUntag(scratch1, right);
2309 __ Mul(scratch2, v0, left, scratch1); 2308 __ Mul(scratch2, v0, left, scratch1);
2310 __ sra(scratch1, v0, 31); 2309 __ sra(scratch1, v0, 31);
2311 __ Branch(&stub_call, ne, scratch1, Operand(scratch2)); 2310 __ Branch(&stub_call, ne, scratch1, Operand(scratch2));
2312 __ Branch(&done, ne, v0, Operand(zero_reg)); 2311 __ Branch(&done, ne, v0, Operand(zero_reg));
2313 __ Addu(scratch2, right, left); 2312 __ Addu(scratch2, right, left);
2314 __ Branch(&stub_call, lt, scratch2, Operand(zero_reg)); 2313 __ Branch(&stub_call, lt, scratch2, Operand(zero_reg));
2315 DCHECK(Smi::FromInt(0) == 0); 2314 DCHECK(Smi::FromInt(0) == 0);
(...skipping 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after
3950 Operand(zero_reg)); 3949 Operand(zero_reg));
3951 } 3950 }
3952 __ bind(&loop); 3951 __ bind(&loop);
3953 __ lw(string, MemOperand(element)); 3952 __ lw(string, MemOperand(element));
3954 __ Addu(element, element, kPointerSize); 3953 __ Addu(element, element, kPointerSize);
3955 __ JumpIfSmi(string, &bailout); 3954 __ JumpIfSmi(string, &bailout);
3956 __ lw(scratch1, FieldMemOperand(string, HeapObject::kMapOffset)); 3955 __ lw(scratch1, FieldMemOperand(string, HeapObject::kMapOffset));
3957 __ lbu(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset)); 3956 __ lbu(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset));
3958 __ JumpIfInstanceTypeIsNotSequentialOneByte(scratch1, scratch2, &bailout); 3957 __ JumpIfInstanceTypeIsNotSequentialOneByte(scratch1, scratch2, &bailout);
3959 __ lw(scratch1, FieldMemOperand(string, SeqOneByteString::kLengthOffset)); 3958 __ lw(scratch1, FieldMemOperand(string, SeqOneByteString::kLengthOffset));
3960 __ AdduAndCheckForOverflow(string_length, string_length, scratch1, scratch3); 3959 __ AddBranchOvf(string_length, string_length, Operand(scratch1), &bailout);
3961 __ BranchOnOverflow(&bailout, scratch3);
3962 __ Branch(&loop, lt, element, Operand(elements_end)); 3960 __ Branch(&loop, lt, element, Operand(elements_end));
3963 3961
3964 // If array_length is 1, return elements[0], a string. 3962 // If array_length is 1, return elements[0], a string.
3965 __ Branch(&not_size_one_array, ne, array_length, Operand(1)); 3963 __ Branch(&not_size_one_array, ne, array_length, Operand(1));
3966 __ lw(v0, FieldMemOperand(elements, FixedArray::kHeaderSize)); 3964 __ lw(v0, FieldMemOperand(elements, FixedArray::kHeaderSize));
3967 __ Branch(&done); 3965 __ Branch(&done);
3968 3966
3969 __ bind(&not_size_one_array); 3967 __ bind(&not_size_one_array);
3970 3968
3971 // Live values in registers: 3969 // Live values in registers:
(...skipping 12 matching lines...) Expand all
3984 // string_length to get the length of the result string. array_length is not 3982 // string_length to get the length of the result string. array_length is not
3985 // smi but the other values are, so the result is a smi. 3983 // smi but the other values are, so the result is a smi.
3986 __ lw(scratch1, FieldMemOperand(separator, SeqOneByteString::kLengthOffset)); 3984 __ lw(scratch1, FieldMemOperand(separator, SeqOneByteString::kLengthOffset));
3987 __ Subu(string_length, string_length, Operand(scratch1)); 3985 __ Subu(string_length, string_length, Operand(scratch1));
3988 __ Mul(scratch3, scratch2, array_length, scratch1); 3986 __ Mul(scratch3, scratch2, array_length, scratch1);
3989 // Check for smi overflow. No overflow if higher 33 bits of 64-bit result are 3987 // Check for smi overflow. No overflow if higher 33 bits of 64-bit result are
3990 // zero. 3988 // zero.
3991 __ Branch(&bailout, ne, scratch3, Operand(zero_reg)); 3989 __ Branch(&bailout, ne, scratch3, Operand(zero_reg));
3992 __ And(scratch3, scratch2, Operand(0x80000000)); 3990 __ And(scratch3, scratch2, Operand(0x80000000));
3993 __ Branch(&bailout, ne, scratch3, Operand(zero_reg)); 3991 __ Branch(&bailout, ne, scratch3, Operand(zero_reg));
3994 __ AdduAndCheckForOverflow(string_length, string_length, scratch2, scratch3); 3992 __ AddBranchOvf(string_length, string_length, Operand(scratch2), &bailout);
3995 __ BranchOnOverflow(&bailout, scratch3);
3996 __ SmiUntag(string_length); 3993 __ SmiUntag(string_length);
3997 3994
3998 // Bailout for large object allocations. 3995 // Bailout for large object allocations.
3999 __ Branch(&bailout, gt, string_length, 3996 __ Branch(&bailout, gt, string_length,
4000 Operand(Page::kMaxRegularHeapObjectSize)); 3997 Operand(Page::kMaxRegularHeapObjectSize));
4001 3998
4002 // Get first element in the array to free up the elements register to be used 3999 // Get first element in the array to free up the elements register to be used
4003 // for the result. 4000 // for the result.
4004 __ Addu(element, 4001 __ Addu(element,
4005 elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 4002 elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
4451 __ sw(v0, MemOperand(sp, 2 * kPointerSize)); 4448 __ sw(v0, MemOperand(sp, 2 * kPointerSize));
4452 break; 4449 break;
4453 case KEYED_SUPER_PROPERTY: 4450 case KEYED_SUPER_PROPERTY:
4454 __ sw(v0, MemOperand(sp, 3 * kPointerSize)); 4451 __ sw(v0, MemOperand(sp, 3 * kPointerSize));
4455 break; 4452 break;
4456 } 4453 }
4457 } 4454 }
4458 } 4455 }
4459 4456
4460 Register scratch1 = a1; 4457 Register scratch1 = a1;
4461 Register scratch2 = t0;
4462 __ li(scratch1, Operand(Smi::FromInt(count_value))); 4458 __ li(scratch1, Operand(Smi::FromInt(count_value)));
4463 __ AdduAndCheckForOverflow(v0, v0, scratch1, scratch2); 4459 __ AddBranchNoOvf(v0, v0, Operand(scratch1), &done);
4464 __ BranchOnNoOverflow(&done, scratch2);
4465 // Call stub. Undo operation first. 4460 // Call stub. Undo operation first.
4466 __ Move(v0, a0); 4461 __ Move(v0, a0);
4467 __ jmp(&stub_call); 4462 __ jmp(&stub_call);
4468 __ bind(&slow); 4463 __ bind(&slow);
4469 } 4464 }
4470 if (!is_strong(language_mode())) { 4465 if (!is_strong(language_mode())) {
4471 ToNumberStub convert_stub(isolate()); 4466 ToNumberStub convert_stub(isolate());
4472 __ CallStub(&convert_stub); 4467 __ CallStub(&convert_stub);
4473 PrepareForBailoutForId(expr->ToNumberId(), TOS_REG); 4468 PrepareForBailoutForId(expr->ToNumberId(), TOS_REG);
4474 } 4469 }
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
4969 reinterpret_cast<uint32_t>( 4964 reinterpret_cast<uint32_t>(
4970 isolate->builtins()->OsrAfterStackCheck()->entry())); 4965 isolate->builtins()->OsrAfterStackCheck()->entry()));
4971 return OSR_AFTER_STACK_CHECK; 4966 return OSR_AFTER_STACK_CHECK;
4972 } 4967 }
4973 4968
4974 4969
4975 } // namespace internal 4970 } // namespace internal
4976 } // namespace v8 4971 } // namespace v8
4977 4972
4978 #endif // V8_TARGET_ARCH_MIPS 4973 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/crankshaft/mips/lithium-codegen-mips.cc ('k') | src/mips/assembler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698