Support non-deoptimizing version of UnboxInt32 for integer definitions.

If range analysis infered that integer definition is within Int32 range then it is guaranteed to be either Smi or Mint.

BUG=http://dartbug.com/21763
R=fschneider@google.com

Review URL: https://codereview.chromium.org//770303002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42065 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
vegorov@google.com
2014-12-02 13:19:03 +00:00
parent e8428aa507
commit bfa152df59
4 changed files with 23 additions and 0 deletions
+4
View File
@@ -1202,6 +1202,10 @@ bool UnboxInt32Instr::CanDeoptimize() const {
return !is_truncating() &&
!RangeUtils::Fits(value()->definition()->range(),
RangeBoundary::kRangeBoundaryInt32);
} else if ((kSmiBits < 32) && value()->Type()->IsInt()) {
// Note: we don't support truncation of Bigint values.
return !RangeUtils::Fits(value()->definition()->range(),
RangeBoundary::kRangeBoundaryInt32);
} else {
return true;
}
+5
View File
@@ -3986,6 +3986,11 @@ void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
__ SmiUntag(out, value);
} else if (value_cid == kMintCid) {
LoadInt32FromMint(compiler, value, out, temp, out_of_range);
} else if (!CanDeoptimize()) {
Label done;
__ SmiUntag(out, value, &done);
LoadInt32FromMint(compiler, value, out, kNoRegister, NULL);
__ Bind(&done);
} else {
Label done;
__ SmiUntag(out, value, &done);
+7
View File
@@ -3673,6 +3673,13 @@ void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
FieldAddress(value, hi_offset),
temp,
out_of_range);
} else if (!CanDeoptimize()) {
ASSERT(value == result);
Label done;
__ SmiUntag(value);
__ j(NOT_CARRY, &done);
__ movl(value, Address(value, TIMES_2, lo_offset));
__ Bind(&done);
} else {
ASSERT(value == result);
Label done;
+7
View File
@@ -3347,6 +3347,13 @@ void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
__ SmiUntag(out, value);
} else if (value_cid == kMintCid) {
LoadInt32FromMint(compiler, value, out, out_of_range);
} else if (!CanDeoptimize()) {
Label done;
__ SmiUntag(out, value);
__ andi(CMPRES1, value, Immediate(kSmiTagMask));
__ beq(CMPRES1, ZR, &done);
LoadInt32FromMint(compiler, value, out, NULL);
__ Bind(&done);
} else {
Label done;
__ SmiUntag(out, value);