Don't CheckSmi when type is Smi.

R=mvstanton@chromium.org

Review URL: https://chromiumcodereview.appspot.com/14890007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14605 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
verwaest@chromium.org 2013-05-10 08:39:37 +00:00
parent dabcf04670
commit addb8f96c1

View File

@ -1129,8 +1129,10 @@ HInstruction* HGraphBuilder::BuildFastElementAccess(
switch (elements_kind) {
case FAST_SMI_ELEMENTS:
case FAST_HOLEY_SMI_ELEMENTS:
// Smi-only arrays need a smi check.
AddInstruction(new(zone) HCheckSmi(val));
if (!val->type().IsSmi()) {
// Smi-only arrays need a smi check.
AddInstruction(new(zone) HCheckSmi(val));
}
// Fall through.
case FAST_ELEMENTS:
case FAST_HOLEY_ELEMENTS:
@ -6934,9 +6936,11 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
switch (boilerplate_elements_kind) {
case FAST_SMI_ELEMENTS:
case FAST_HOLEY_SMI_ELEMENTS:
// Smi-only arrays need a smi check.
AddInstruction(new(zone()) HCheckSmi(value));
// Fall through.
if (!value->type().IsSmi()) {
// Smi-only arrays need a smi check.
AddInstruction(new(zone()) HCheckSmi(value));
// Fall through.
}
case FAST_ELEMENTS:
case FAST_HOLEY_ELEMENTS:
case FAST_DOUBLE_ELEMENTS: