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

Side by Side Diff: src/crankshaft/mips/lithium-codegen-mips.cc

Issue 2452193003: [crankshaft] Support all oddballs for truncating TaggedToI changes. (Closed)
Patch Set: Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved.7 1 // Copyright 2012 the V8 project authors. All rights reserved.7
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 4469 matching lines...) Expand 10 before | Expand all | Expand 10 after
4480 Label done; 4480 Label done;
4481 4481
4482 // The input is a tagged HeapObject. 4482 // The input is a tagged HeapObject.
4483 // Heap number map check. 4483 // Heap number map check.
4484 __ lw(scratch1, FieldMemOperand(input_reg, HeapObject::kMapOffset)); 4484 __ lw(scratch1, FieldMemOperand(input_reg, HeapObject::kMapOffset));
4485 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex); 4485 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex);
4486 // This 'at' value and scratch1 map value are used for tests in both clauses 4486 // This 'at' value and scratch1 map value are used for tests in both clauses
4487 // of the if. 4487 // of the if.
4488 4488
4489 if (instr->truncating()) { 4489 if (instr->truncating()) {
4490 // Performs a truncating conversion of a floating point number as used by 4490 Label truncate;
4491 // the JS bitwise operations. 4491 __ Branch(USE_DELAY_SLOT, &truncate, eq, scratch1, Operand(at));
4492 Label no_heap_number, check_bools, check_false;
4493 // Check HeapNumber map.
4494 __ Branch(USE_DELAY_SLOT, &no_heap_number, ne, scratch1, Operand(at));
4495 __ mov(scratch2, input_reg); // In delay slot. 4492 __ mov(scratch2, input_reg); // In delay slot.
4493 __ lbu(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset));
4494 DeoptimizeIf(ne, instr, DeoptimizeReason::kNotANumberOrOddball, scratch1,
4495 Operand(ODDBALL_TYPE));
4496 __ bind(&truncate);
4496 __ TruncateHeapNumberToI(input_reg, scratch2); 4497 __ TruncateHeapNumberToI(input_reg, scratch2);
4497 __ Branch(&done);
4498
4499 // Check for Oddballs. Undefined/False is converted to zero and True to one
4500 // for truncating conversions.
4501 __ bind(&no_heap_number);
4502 __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
4503 __ Branch(&check_bools, ne, input_reg, Operand(at));
4504 DCHECK(ToRegister(instr->result()).is(input_reg));
4505 __ Branch(USE_DELAY_SLOT, &done);
4506 __ mov(input_reg, zero_reg); // In delay slot.
4507
4508 __ bind(&check_bools);
4509 __ LoadRoot(at, Heap::kTrueValueRootIndex);
4510 __ Branch(&check_false, ne, scratch2, Operand(at));
4511 __ Branch(USE_DELAY_SLOT, &done);
4512 __ li(input_reg, Operand(1)); // In delay slot.
4513
4514 __ bind(&check_false);
4515 __ LoadRoot(at, Heap::kFalseValueRootIndex);
4516 DeoptimizeIf(ne, instr, DeoptimizeReason::kNotAHeapNumberUndefinedBoolean,
4517 scratch2, Operand(at));
4518 __ Branch(USE_DELAY_SLOT, &done);
4519 __ mov(input_reg, zero_reg); // In delay slot.
4520 } else { 4498 } else {
4521 DeoptimizeIf(ne, instr, DeoptimizeReason::kNotAHeapNumber, scratch1, 4499 DeoptimizeIf(ne, instr, DeoptimizeReason::kNotAHeapNumber, scratch1,
4522 Operand(at)); 4500 Operand(at));
4523 4501
4524 // Load the double value. 4502 // Load the double value.
4525 __ ldc1(double_scratch, 4503 __ ldc1(double_scratch,
4526 FieldMemOperand(input_reg, HeapNumber::kValueOffset)); 4504 FieldMemOperand(input_reg, HeapNumber::kValueOffset));
4527 4505
4528 Register except_flag = scratch2; 4506 Register except_flag = scratch2;
4529 __ EmitFPUTruncate(kRoundToZero, 4507 __ EmitFPUTruncate(kRoundToZero,
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
5419 __ lw(result, FieldMemOperand(scratch, 5397 __ lw(result, FieldMemOperand(scratch,
5420 FixedArray::kHeaderSize - kPointerSize)); 5398 FixedArray::kHeaderSize - kPointerSize));
5421 __ bind(deferred->exit()); 5399 __ bind(deferred->exit());
5422 __ bind(&done); 5400 __ bind(&done);
5423 } 5401 }
5424 5402
5425 #undef __ 5403 #undef __
5426 5404
5427 } // namespace internal 5405 } // namespace internal
5428 } // namespace v8 5406 } // namespace v8
OLDNEW
« no previous file with comments | « src/crankshaft/ia32/lithium-codegen-ia32.cc ('k') | src/crankshaft/mips64/lithium-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698