Revision: 14778
Author: [email protected]
Date: Thu May 23 07:38:39 2013
Log: Tag length of FixedArrayBase and smi-array[x] as smi
representation
[email protected]
Review URL: https://chromiumcodereview.appspot.com/15858006
http://code.google.com/p/v8/source/detail?r=14778
Modified:
/branches/bleeding_edge/src/arm/lithium-arm.cc
/branches/bleeding_edge/src/arm/lithium-arm.h
/branches/bleeding_edge/src/arm/lithium-codegen-arm.cc
/branches/bleeding_edge/src/hydrogen-instructions.h
/branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc
/branches/bleeding_edge/src/ia32/lithium-ia32.cc
/branches/bleeding_edge/src/ia32/lithium-ia32.h
/branches/bleeding_edge/src/x64/lithium-codegen-x64.cc
/branches/bleeding_edge/src/x64/lithium-x64.cc
/branches/bleeding_edge/src/x64/lithium-x64.h
=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.cc Thu May 23 01:32:07 2013
+++ /branches/bleeding_edge/src/arm/lithium-arm.cc Thu May 23 07:38:39 2013
@@ -1890,6 +1890,12 @@
if (from.IsSmi()) {
if (to.IsTagged()) {
LOperand* value = UseRegister(instr->value());
+ // For now, always deopt on hole.
+ if (instr->value()->IsLoadKeyed() &&
+ HLoadKeyed::cast(instr->value())->UsesMustHandleHole()) {
+ return AssignEnvironment(
+ DefineSameAsFirst(new(zone()) LCheckSmiAndReturn(value)));
+ }
return DefineSameAsFirst(new(zone()) LDummyUse(value));
}
from = Representation::Tagged();
@@ -1902,9 +1908,9 @@
return AssignEnvironment(DefineAsRegister(res));
} else if (to.IsSmi()) {
HValue* val = instr->value();
- LOperand* value = UseRegisterAtStart(val);
+ LOperand* value = UseRegister(val);
return AssignEnvironment(
- DefineSameAsFirst(new(zone()) LCheckSmi(value)));
+ DefineSameAsFirst(new(zone()) LCheckSmiAndReturn(value)));
} else {
ASSERT(to.IsInteger32());
LOperand* value = NULL;
=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.h Thu May 23 01:32:07 2013
+++ /branches/bleeding_edge/src/arm/lithium-arm.h Thu May 23 07:38:39 2013
@@ -76,6 +76,7 @@
V(CheckMaps) \
V(CheckPrototypeMaps) \
V(CheckSmi) \
+ V(CheckSmiAndReturn) \
V(ClampDToUint8) \
V(ClampIToUint8) \
V(ClampTToUint8) \
@@ -2387,7 +2388,7 @@
};
-class LCheckSmi: public LTemplateInstruction<1, 1, 0> {
+class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
public:
explicit LCheckSmi(LOperand* value) {
inputs_[0] = value;
@@ -2399,6 +2400,18 @@
};
+class LCheckSmiAndReturn: public LTemplateInstruction<1, 1, 0> {
+ public:
+ explicit LCheckSmiAndReturn(LOperand* value) {
+ inputs_[0] = value;
+ }
+
+ LOperand* value() { return inputs_[0]; }
+
+ DECLARE_CONCRETE_INSTRUCTION(CheckSmiAndReturn, "check-smi-and-return")
+};
+
+
class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> {
public:
explicit LCheckNonSmi(LOperand* value) {
=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Thu May 23
02:51:06 2013
+++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Thu May 23
07:38:39 2013
@@ -5222,6 +5222,13 @@
__ SmiTag(result_reg, SetCC);
DeoptimizeIf(vs, instr->environment());
}
+
+
+void LCodeGen::DoCheckSmiAndReturn(LCheckSmiAndReturn* instr) {
+ LOperand* input = instr->value();
+ __ SmiTst(ToRegister(input));
+ DeoptimizeIf(ne, instr->environment());
+}
void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Thu May 23 02:51:06
2013
+++ /branches/bleeding_edge/src/hydrogen-instructions.h Thu May 23 07:38:39
2013
@@ -2422,7 +2422,7 @@
public:
explicit HFixedArrayBaseLength(HValue* value) : HUnaryOperation(value) {
set_type(HType::Smi());
- set_representation(Representation::Tagged());
+ set_representation(Representation::Smi());
SetFlag(kUseGVN);
SetGVNFlag(kDependsOnArrayLengths);
}
@@ -5419,9 +5419,11 @@
if (IsFastSmiOrObjectElementsKind(elements_kind)) {
if (IsFastSmiElementsKind(elements_kind)) {
set_type(HType::Smi());
+ set_representation(Representation::Smi());
+ } else {
+ set_representation(Representation::Tagged());
}
- set_representation(Representation::Tagged());
SetGVNFlag(kDependsOnArrayElements);
} else {
set_representation(Representation::Double());
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Thu May 23
07:06:28 2013
+++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Thu May 23
07:38:39 2013
@@ -5696,6 +5696,13 @@
__ SmiTag(result_reg);
DeoptimizeIf(overflow, instr->environment());
}
+
+
+void LCodeGen::DoCheckSmiAndReturn(LCheckSmiAndReturn* instr) {
+ LOperand* input = instr->value();
+ __ test(ToOperand(input), Immediate(kSmiTagMask));
+ DeoptimizeIf(not_zero, instr->environment());
+}
void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.cc Thu May 23 02:51:06
2013
+++ /branches/bleeding_edge/src/ia32/lithium-ia32.cc Thu May 23 07:38:39
2013
@@ -1910,7 +1910,14 @@
if (from.IsSmi()) {
if (to.IsTagged()) {
LOperand* value = UseRegister(instr->value());
- return DefineSameAsFirst(new(zone()) LDummyUse(value));
+ // For now, always deopt on hole.
+ if (instr->value()->IsLoadKeyed() &&
+ HLoadKeyed::cast(instr->value())->UsesMustHandleHole()) {
+ return AssignEnvironment(
+ DefineSameAsFirst(new(zone()) LCheckSmiAndReturn(value)));
+ } else {
+ return DefineSameAsFirst(new(zone()) LDummyUse(value));
+ }
}
from = Representation::Tagged();
}
@@ -1933,9 +1940,9 @@
}
} else if (to.IsSmi()) {
HValue* val = instr->value();
- LOperand* value = UseRegisterAtStart(val);
+ LOperand* value = UseRegister(val);
return AssignEnvironment(
- DefineSameAsFirst(new(zone()) LCheckSmi(value)));
+ DefineSameAsFirst(new(zone()) LCheckSmiAndReturn(value)));
} else {
ASSERT(to.IsInteger32());
if (instr->value()->type().IsSmi()) {
@@ -2058,13 +2065,13 @@
LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
LOperand* value = UseAtStart(instr->value());
- return AssignEnvironment(DefineSameAsFirst(new(zone())
LCheckSmi(value)));
+ return AssignEnvironment(new(zone()) LCheckSmi(value));
}
LInstruction* LChunkBuilder::DoCheckSmiOrInt32(HCheckSmiOrInt32* instr) {
LOperand* value = UseAtStart(instr->value());
- return AssignEnvironment(DefineSameAsFirst(new(zone())
LCheckSmi(value)));
+ return AssignEnvironment(new(zone()) LCheckSmi(value));
}
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.h Thu May 23 01:32:07 2013
+++ /branches/bleeding_edge/src/ia32/lithium-ia32.h Thu May 23 07:38:39 2013
@@ -70,6 +70,7 @@
V(CheckNonSmi) \
V(CheckPrototypeMaps) \
V(CheckSmi) \
+ V(CheckSmiAndReturn) \
V(ClampDToUint8) \
V(ClampIToUint8) \
V(ClampTToUint8) \
@@ -2461,7 +2462,7 @@
};
-class LCheckSmi: public LTemplateInstruction<1, 1, 0> {
+class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
public:
explicit LCheckSmi(LOperand* value) {
inputs_[0] = value;
@@ -2473,6 +2474,18 @@
};
+class LCheckSmiAndReturn: public LTemplateInstruction<1, 1, 0> {
+ public:
+ explicit LCheckSmiAndReturn(LOperand* value) {
+ inputs_[0] = value;
+ }
+
+ LOperand* value() { return inputs_[0]; }
+
+ DECLARE_CONCRETE_INSTRUCTION(CheckSmiAndReturn, "check-smi-and-return")
+};
+
+
class LClampDToUint8: public LTemplateInstruction<1, 1, 0> {
public:
explicit LClampDToUint8(LOperand* value) {
=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Thu May 23
07:06:28 2013
+++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Thu May 23
07:38:39 2013
@@ -4911,6 +4911,13 @@
__ Integer32ToSmi(result_reg, result_reg);
DeoptimizeIf(overflow, instr->environment());
}
+
+
+void LCodeGen::DoCheckSmiAndReturn(LCheckSmiAndReturn* instr) {
+ LOperand* input = instr->value();
+ Condition cc = masm()->CheckSmi(ToRegister(input));
+ DeoptimizeIf(NegateCondition(cc), instr->environment());
+}
void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.cc Thu May 23 01:32:07 2013
+++ /branches/bleeding_edge/src/x64/lithium-x64.cc Thu May 23 07:38:39 2013
@@ -1815,6 +1815,12 @@
if (from.IsSmi()) {
if (to.IsTagged()) {
LOperand* value = UseRegister(instr->value());
+ // For now, always deopt on hole.
+ if (instr->value()->IsLoadKeyed() &&
+ HLoadKeyed::cast(instr->value())->UsesMustHandleHole()) {
+ return AssignEnvironment(
+ DefineSameAsFirst(new(zone()) LCheckSmiAndReturn(value)));
+ }
return DefineSameAsFirst(new(zone()) LDummyUse(value));
}
from = Representation::Tagged();
@@ -1830,9 +1836,9 @@
return AssignEnvironment(DefineAsRegister(res));
} else if (to.IsSmi()) {
HValue* val = instr->value();
- LOperand* value = UseRegisterAtStart(val);
+ LOperand* value = UseRegister(val);
return AssignEnvironment(
- DefineSameAsFirst(new(zone()) LCheckSmi(value)));
+ DefineSameAsFirst(new(zone()) LCheckSmiAndReturn(value)));
} else {
ASSERT(to.IsInteger32());
LOperand* value = UseRegister(instr->value());
@@ -1937,13 +1943,13 @@
LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
LOperand* value = UseRegisterAtStart(instr->value());
- return AssignEnvironment(DefineSameAsFirst(new(zone())
LCheckSmi(value)));
+ return AssignEnvironment(new(zone()) LCheckSmi(value));
}
LInstruction* LChunkBuilder::DoCheckSmiOrInt32(HCheckSmiOrInt32* instr) {
LOperand* value = UseRegisterAtStart(instr->value());
- return AssignEnvironment(DefineSameAsFirst(new(zone())
LCheckSmi(value)));
+ return AssignEnvironment(new(zone()) LCheckSmi(value));
}
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.h Thu May 23 01:32:07 2013
+++ /branches/bleeding_edge/src/x64/lithium-x64.h Thu May 23 07:38:39 2013
@@ -76,6 +76,7 @@
V(CheckNonSmi) \
V(CheckPrototypeMaps) \
V(CheckSmi) \
+ V(CheckSmiAndReturn) \
V(ClampDToUint8) \
V(ClampIToUint8) \
V(ClampTToUint8) \
@@ -2294,7 +2295,7 @@
};
-class LCheckSmi: public LTemplateInstruction<1, 1, 0> {
+class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
public:
explicit LCheckSmi(LOperand* value) {
inputs_[0] = value;
@@ -2306,6 +2307,18 @@
};
+class LCheckSmiAndReturn: public LTemplateInstruction<1, 1, 0> {
+ public:
+ explicit LCheckSmiAndReturn(LOperand* value) {
+ inputs_[0] = value;
+ }
+
+ LOperand* value() { return inputs_[0]; }
+
+ DECLARE_CONCRETE_INSTRUCTION(CheckSmiAndReturn, "check-smi-and-return")
+};
+
+
class LClampDToUint8: public LTemplateInstruction<1, 1, 0> {
public:
explicit LClampDToUint8(LOperand* unclamped) {
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.