Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: src/hydrogen-instructions.cc

Issue 15932011: Don't explicitly pass requested representations to constants; implement ConstantS (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 } 1135 }
1136 if (skip_check()) { 1136 if (skip_check()) {
1137 stream->Add(" [DISABLED]"); 1137 stream->Add(" [DISABLED]");
1138 } 1138 }
1139 } 1139 }
1140 1140
1141 1141
1142 void HBoundsCheck::InferRepresentation(HInferRepresentation* h_infer) { 1142 void HBoundsCheck::InferRepresentation(HInferRepresentation* h_infer) {
1143 ASSERT(CheckFlag(kFlexibleRepresentation)); 1143 ASSERT(CheckFlag(kFlexibleRepresentation));
1144 Representation r; 1144 Representation r;
1145 HValue* actual_index = index()->ActualValue();
1145 HValue* actual_length = length()->ActualValue(); 1146 HValue* actual_length = length()->ActualValue();
1146 HValue* actual_index = index()->ActualValue(); 1147 Representation index_rep = actual_index->representation();
1147 if (key_mode_ == DONT_ALLOW_SMI_KEY || 1148 if (!actual_length->representation().IsSmiOrTagged()) {
1148 !actual_length->representation().IsSmiOrTagged()) {
1149 r = Representation::Integer32(); 1149 r = Representation::Integer32();
1150 } else if (actual_index->representation().IsSmiOrTagged() || 1150 } else if ((index_rep.IsTagged() && actual_index->type().IsSmi()) ||
1151 (actual_index->IsConstant() && 1151 index_rep.IsSmi()) {
1152 HConstant::cast(actual_index)->HasSmiValue())) { 1152 // If the index is smi, allow the length to be smi, since it is usually
1153 // If the index is smi, or a constant that holds a Smi, allow the length to 1153 // already smi from loading it out of the length field of a JSArray. This
1154 // be smi, since it is usually already smi from loading it out of the length 1154 // allows for direct comparison without untagging.
1155 // field of a JSArray. This allows for direct comparison without untagging.
1156 r = Representation::Smi(); 1155 r = Representation::Smi();
1157 } else { 1156 } else {
1158 r = Representation::Integer32(); 1157 r = Representation::Integer32();
1159 } 1158 }
1160 UpdateRepresentation(r, h_infer, "boundscheck"); 1159 UpdateRepresentation(r, h_infer, "boundscheck");
1161 } 1160 }
1162 1161
1163 1162
1164 bool HBoundsCheckBaseIndexInformation::IsRelationTrueInternal( 1163 bool HBoundsCheckBaseIndexInformation::IsRelationTrueInternal(
1165 NumericRelation relation, 1164 NumericRelation relation,
(...skipping 2077 matching lines...) Expand 10 before | Expand all | Expand 10 after
3243 } 3242 }
3244 } 3243 }
3245 return new(zone) HStringCharFromCode(context, char_code); 3244 return new(zone) HStringCharFromCode(context, char_code);
3246 } 3245 }
3247 3246
3248 3247
3249 HInstruction* HStringLength::New(Zone* zone, HValue* string) { 3248 HInstruction* HStringLength::New(Zone* zone, HValue* string) {
3250 if (FLAG_fold_constants && string->IsConstant()) { 3249 if (FLAG_fold_constants && string->IsConstant()) {
3251 HConstant* c_string = HConstant::cast(string); 3250 HConstant* c_string = HConstant::cast(string);
3252 if (c_string->HasStringValue()) { 3251 if (c_string->HasStringValue()) {
3253 return H_CONSTANT_INT32(c_string->StringValue()->length()); 3252 return new(zone) HConstant(c_string->StringValue()->length());
3254 } 3253 }
3255 } 3254 }
3256 return new(zone) HStringLength(string); 3255 return new(zone) HStringLength(string);
3257 } 3256 }
3258 3257
3259 3258
3260 HInstruction* HUnaryMathOperation::New( 3259 HInstruction* HUnaryMathOperation::New(
3261 Zone* zone, HValue* context, HValue* value, BuiltinFunctionId op) { 3260 Zone* zone, HValue* context, HValue* value, BuiltinFunctionId op) {
3262 do { 3261 do {
3263 if (!FLAG_fold_constants) break; 3262 if (!FLAG_fold_constants) break;
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
3797 case kBackingStore: 3796 case kBackingStore:
3798 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); 3797 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString());
3799 stream->Add("[backing-store]"); 3798 stream->Add("[backing-store]");
3800 break; 3799 break;
3801 } 3800 }
3802 3801
3803 stream->Add("@%d", offset()); 3802 stream->Add("@%d", offset());
3804 } 3803 }
3805 3804
3806 } } // namespace v8::internal 3805 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698