Allow boundscheck elimination to work on Smi keys.

R=jkummerow@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15001 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
verwaest@chromium.org 2013-06-07 11:00:39 +00:00
parent b3282c290e
commit 8afeaabe57
3 changed files with 6 additions and 8 deletions

View File

@ -1058,6 +1058,7 @@ void HBoundsCheck::ApplyIndexChange() {
block()->graph()->GetInvalidContext(), current_index, add_offset);
add->InsertBefore(this);
add->AssumeRepresentation(index()->representation());
add->ClearFlag(kCanOverflow);
current_index = add;
}

View File

@ -3660,9 +3660,6 @@ class HBoundsCheck: public HTemplateInstruction<2> {
virtual Representation RequiredInputRepresentation(int arg_index) {
return representation();
}
virtual Representation observed_input_representation(int index) {
return Representation::Integer32();
}
virtual bool IsRelationTrueInternal(NumericRelation relation,
HValue* related_value,

View File

@ -4115,7 +4115,7 @@ class BoundsCheckKey : public ZoneObject {
static BoundsCheckKey* Create(Zone* zone,
HBoundsCheck* check,
int32_t* offset) {
if (!check->index()->representation().IsInteger32()) return NULL;
if (!check->index()->representation().IsSmiOrInteger32()) return NULL;
HValue* index_base = NULL;
HConstant* constant = NULL;
@ -4211,7 +4211,7 @@ class BoundsCheckBbData: public ZoneObject {
// returns false, otherwise it returns true.
bool CoverCheck(HBoundsCheck* new_check,
int32_t new_offset) {
ASSERT(new_check->index()->representation().IsInteger32());
ASSERT(new_check->index()->representation().IsSmiOrInteger32());
bool keep_new_check = false;
if (new_offset > upper_offset_) {
@ -4320,8 +4320,8 @@ class BoundsCheckBbData: public ZoneObject {
HValue* index_context = IndexContext(*add, check);
if (index_context == NULL) return false;
HConstant* new_constant = new(BasicBlock()->zone())
HConstant(new_offset, Representation::Integer32());
HConstant* new_constant = new(BasicBlock()->zone()) HConstant(
new_offset, representation);
if (*add == NULL) {
new_constant->InsertBefore(check);
(*add) = HAdd::New(
@ -4453,7 +4453,7 @@ void HGraph::EliminateRedundantBoundsChecks() {
static void DehoistArrayIndex(ArrayInstructionInterface* array_operation) {
HValue* index = array_operation->GetKey()->ActualValue();
if (!index->representation().IsInteger32()) return;
if (!index->representation().IsSmiOrInteger32()) return;
HConstant* constant;
HValue* subexpression;