Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index d2b7ea1c6383b6c883bbd22d37fbc508f7db133c..f8771d11b1bc36be311f1c02a6987d5d3269f084 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -593,11 +593,10 @@ void HGraph::Verify(bool do_full_verify) const { |
#endif |
-HConstant* HGraph::GetConstantInt32(SetOncePointer<HConstant>* pointer, |
- int32_t value) { |
+HConstant* HGraph::GetConstant(SetOncePointer<HConstant>* pointer, |
+ int32_t value) { |
if (!pointer->is_set()) { |
- HConstant* constant = |
- new(zone()) HConstant(value, Representation::Integer32()); |
+ HConstant* constant = new(zone()) HConstant(value); |
constant->InsertAfter(GetConstantUndefined()); |
pointer->set(constant); |
} |
@@ -606,17 +605,17 @@ HConstant* HGraph::GetConstantInt32(SetOncePointer<HConstant>* pointer, |
HConstant* HGraph::GetConstant0() { |
- return GetConstantInt32(&constant_0_, 0); |
+ return GetConstant(&constant_0_, 0); |
} |
HConstant* HGraph::GetConstant1() { |
- return GetConstantInt32(&constant_1_, 1); |
+ return GetConstant(&constant_1_, 1); |
} |
HConstant* HGraph::GetConstantMinus1() { |
- return GetConstantInt32(&constant_minus1_, -1); |
+ return GetConstant(&constant_minus1_, -1); |
} |
@@ -648,7 +647,7 @@ DEFINE_GET_CONSTANT(Null, null, HType::Tagged(), false) |
HConstant* HGraph::GetInvalidContext() { |
- return GetConstantInt32(&constant_invalid_context_, 0xFFFFC0C7); |
+ return GetConstant(&constant_invalid_context_, 0xFFFFC0C7); |
} |
@@ -979,11 +978,8 @@ void HGraphBuilder::AddSimulate(BailoutId id, |
} |
-HBoundsCheck* HGraphBuilder::AddBoundsCheck(HValue* index, |
- HValue* length, |
- BoundsCheckKeyMode key_mode) { |
- HBoundsCheck* result = new(graph()->zone()) HBoundsCheck( |
- index, length, key_mode); |
+HBoundsCheck* HGraphBuilder::AddBoundsCheck(HValue* index, HValue* length) { |
+ HBoundsCheck* result = new(graph()->zone()) HBoundsCheck(index, length); |
AddInstruction(result); |
return result; |
} |
@@ -1169,7 +1165,7 @@ HValue* HGraphBuilder::BuildCheckForCapacityGrow(HValue* object, |
length_checker.Else(); |
- AddBoundsCheck(key, length, ALLOW_SMI_KEY); |
+ AddBoundsCheck(key, length); |
environment()->Push(elements); |
length_checker.End(); |
@@ -1274,7 +1270,7 @@ HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess( |
return result; |
} else { |
ASSERT(store_mode == STANDARD_STORE); |
- checked_key = AddBoundsCheck(key, length, ALLOW_SMI_KEY); |
+ checked_key = AddBoundsCheck(key, length); |
HLoadExternalArrayPointer* external_elements = |
new(zone) HLoadExternalArrayPointer(elements); |
AddInstruction(external_elements); |
@@ -1302,7 +1298,7 @@ HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess( |
length, key, is_js_array); |
checked_key = key; |
} else { |
- checked_key = AddBoundsCheck(key, length, ALLOW_SMI_KEY); |
+ checked_key = AddBoundsCheck(key, length); |
if (is_store && (fast_elements || fast_smi_only_elements)) { |
if (store_mode == STORE_NO_TRANSITION_HANDLE_COW) { |
@@ -1470,13 +1466,11 @@ void HGraphBuilder::BuildNewSpaceArrayCheck(HValue* length, ElementsKind kind) { |
: kPointerSize; |
int max_size = heap->MaxRegularSpaceAllocationSize() / element_size; |
max_size -= JSArray::kSize / element_size; |
- HConstant* max_size_constant = |
- new(zone) HConstant(max_size, Representation::Integer32()); |
+ HConstant* max_size_constant = new(zone) HConstant(max_size); |
AddInstruction(max_size_constant); |
// Since we're forcing Integer32 representation for this HBoundsCheck, |
// there's no need to Smi-check the index. |
- AddInstruction(new(zone) HBoundsCheck( |
- length, max_size_constant, DONT_ALLOW_SMI_KEY)); |
+ AddInstruction(new(zone) HBoundsCheck(length, max_size_constant)); |
} |
@@ -1544,8 +1538,7 @@ void HGraphBuilder::BuildFillElementsWithHole(HValue* context, |
if (unfold_loop) { |
for (int i = 0; i < initial_capacity; i++) { |
- HInstruction* key = AddInstruction(new(zone) |
- HConstant(i, Representation::Integer32())); |
+ HInstruction* key = AddInstruction(new(zone) HConstant(i)); |
AddInstruction(new(zone) HStoreKeyed(elements, key, hole, elements_kind)); |
} |
} else { |
@@ -1668,8 +1661,7 @@ HValue* HGraphBuilder::BuildCloneShallowArray(HContext* context, |
// copying loops with constant length up to a given boundary and use this |
// helper here instead. |
for (int i = 0; i < length; i++) { |
- HValue* key_constant = |
- AddInstruction(new(zone) HConstant(i, Representation::Integer32())); |
+ HValue* key_constant = AddInstruction(new(zone) HConstant(i)); |
HInstruction* value = |
AddInstruction(new(zone) HLoadKeyed(boilerplate_elements, |
key_constant, |
@@ -5347,8 +5339,7 @@ void HOptimizedGraphBuilder::VisitForInStatement(ForInStatement* stmt) { |
HInstruction* enum_length = AddInstruction(new(zone()) HMapEnumLength(map)); |
- HInstruction* start_index = AddInstruction(new(zone()) HConstant( |
- Handle<Object>(Smi::FromInt(0), isolate()), Representation::Integer32())); |
+ HInstruction* start_index = AddInstruction(new(zone()) HConstant(0)); |
Push(map); |
Push(array); |
@@ -6085,9 +6076,7 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { |
elements = AddLoadElements(literal); |
- HValue* key = AddInstruction( |
- new(zone()) HConstant(Handle<Object>(Smi::FromInt(i), isolate()), |
- Representation::Integer32())); |
+ HValue* key = AddInstruction(new(zone()) HConstant(i)); |
switch (boilerplate_elements_kind) { |
case FAST_SMI_ELEMENTS: |
@@ -7282,7 +7271,7 @@ HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess( |
typecheck, Representation::Smi()); |
length->set_type(HType::Smi()); |
- checked_key = AddBoundsCheck(key, length, ALLOW_SMI_KEY); |
+ checked_key = AddBoundsCheck(key, length); |
access = AddInstruction(BuildFastElementAccess( |
elements, checked_key, val, elements_kind_branch, |
elements_kind, is_store, NEVER_RETURN_HOLE, STANDARD_STORE)); |
@@ -7300,7 +7289,7 @@ HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess( |
set_current_block(if_fastobject); |
length = AddInstruction(new(zone()) HFixedArrayBaseLength(elements)); |
- checked_key = AddBoundsCheck(key, length, ALLOW_SMI_KEY); |
+ checked_key = AddBoundsCheck(key, length); |
access = AddInstruction(BuildFastElementAccess( |
elements, checked_key, val, elements_kind_branch, |
elements_kind, is_store, NEVER_RETURN_HOLE, STANDARD_STORE)); |
@@ -7438,9 +7427,7 @@ bool HOptimizedGraphBuilder::TryArgumentsAccess(Property* expr) { |
// Number of arguments without receiver. |
int argument_count = environment()-> |
arguments_environment()->parameter_count() - 1; |
- result = new(zone()) HConstant( |
- Handle<Object>(Smi::FromInt(argument_count), isolate()), |
- Representation::Integer32()); |
+ result = new(zone()) HConstant(argument_count); |
} |
} else { |
Push(graph()->GetArgumentsObject()); |
@@ -7463,8 +7450,7 @@ bool HOptimizedGraphBuilder::TryArgumentsAccess(Property* expr) { |
int argument_count = environment()-> |
arguments_environment()->parameter_count() - 1; |
HInstruction* length = AddInstruction(new(zone()) HConstant( |
- Handle<Object>(Smi::FromInt(argument_count), isolate()), |
- Representation::Integer32())); |
+ argument_count)); |
HInstruction* checked_key = AddBoundsCheck(key, length); |
result = new(zone()) HAccessArgumentsAt(elements, length, checked_key); |
} |
@@ -8334,10 +8320,8 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall( |
result = |
HUnaryMathOperation::New(zone(), context, left, kMathPowHalf); |
} else if (exponent == -0.5) { |
- HConstant* double_one = |
- new(zone()) HConstant(Handle<Object>(Smi::FromInt(1), |
- isolate()), |
- Representation::Double()); |
+ HConstant* double_one = new(zone()) HConstant( |
+ 1, Representation::Double()); |
AddInstruction(double_one); |
HInstruction* sqrt = |
HUnaryMathOperation::New(zone(), context, left, kMathPowHalf); |
@@ -9291,7 +9275,7 @@ HInstruction* HOptimizedGraphBuilder::BuildStringCharCodeAt( |
if (i < 0 || i >= s->length()) { |
return new(zone()) HConstant(OS::nan_value(), Representation::Double()); |
} |
- return new(zone()) HConstant(s->Get(i), Representation::Integer32()); |
+ return new(zone()) HConstant(s->Get(i)); |
} |
} |
BuildCheckNonSmi(string); |
@@ -10093,8 +10077,7 @@ void HOptimizedGraphBuilder::BuildEmitElements( |
int elements_length = elements->length(); |
HValue* object_elements_length = |
- AddInstruction(new(zone) HConstant( |
- elements_length, Representation::Integer32())); |
+ AddInstruction(new(zone) HConstant(elements_length)); |
BuildInitializeElementsHeader(object_elements, kind, object_elements_length); |
@@ -10119,8 +10102,7 @@ void HOptimizedGraphBuilder::BuildEmitFixedDoubleArray( |
elements, Representation::Tagged())); |
int elements_length = elements->length(); |
for (int i = 0; i < elements_length; i++) { |
- HValue* key_constant = |
- AddInstruction(new(zone) HConstant(i, Representation::Integer32())); |
+ HValue* key_constant = AddInstruction(new(zone) HConstant(i)); |
HInstruction* value_instruction = |
AddInstruction(new(zone) HLoadKeyed( |
boilerplate_elements, key_constant, NULL, kind, ALLOW_RETURN_HOLE)); |
@@ -10147,8 +10129,7 @@ void HOptimizedGraphBuilder::BuildEmitFixedArray( |
Handle<FixedArray>::cast(original_elements); |
for (int i = 0; i < elements_length; i++) { |
Handle<Object> value(fast_elements->get(i), isolate()); |
- HValue* key_constant = |
- AddInstruction(new(zone) HConstant(i, Representation::Integer32())); |
+ HValue* key_constant = AddInstruction(new(zone) HConstant(i)); |
if (value->IsJSObject()) { |
Handle<JSObject> value_object = Handle<JSObject>::cast(value); |
Handle<JSObject> original_value_object = Handle<JSObject>::cast( |