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

Side by Side Diff: src/ia32/lithium-codegen-ia32.cc

Issue 11783055: Make the array bounds check elimination phase optional (and set the foundation for introducing SSI … (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments. Created 7 years, 11 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
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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 488
489 489
490 XMMRegister LCodeGen::ToDoubleRegister(LOperand* op) const { 490 XMMRegister LCodeGen::ToDoubleRegister(LOperand* op) const {
491 ASSERT(op->IsDoubleRegister()); 491 ASSERT(op->IsDoubleRegister());
492 return ToDoubleRegister(op->index()); 492 return ToDoubleRegister(op->index());
493 } 493 }
494 494
495 495
496 int LCodeGen::ToInteger32(LConstantOperand* op) const { 496 int LCodeGen::ToInteger32(LConstantOperand* op) const {
497 HConstant* constant = chunk_->LookupConstant(op); 497 HConstant* constant = chunk_->LookupConstant(op);
498 ASSERT(chunk_->LookupLiteralRepresentation(op).IsInteger32());
499 ASSERT(constant->HasInteger32Value());
500 return constant->Integer32Value(); 498 return constant->Integer32Value();
501 } 499 }
502 500
503 501
504 Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const { 502 Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const {
505 HConstant* constant = chunk_->LookupConstant(op); 503 HConstant* constant = chunk_->LookupConstant(op);
506 ASSERT(chunk_->LookupLiteralRepresentation(op).IsTagged()); 504 ASSERT(chunk_->LookupLiteralRepresentation(op).IsTagged());
507 return constant->handle(); 505 return constant->handle();
508 } 506 }
509 507
(...skipping 2683 matching lines...) Expand 10 before | Expand all | Expand 10 after
3193 3191
3194 Operand LCodeGen::BuildFastArrayOperand( 3192 Operand LCodeGen::BuildFastArrayOperand(
3195 LOperand* elements_pointer, 3193 LOperand* elements_pointer,
3196 LOperand* key, 3194 LOperand* key,
3197 Representation key_representation, 3195 Representation key_representation,
3198 ElementsKind elements_kind, 3196 ElementsKind elements_kind,
3199 uint32_t offset, 3197 uint32_t offset,
3200 uint32_t additional_index) { 3198 uint32_t additional_index) {
3201 Register elements_pointer_reg = ToRegister(elements_pointer); 3199 Register elements_pointer_reg = ToRegister(elements_pointer);
3202 int shift_size = ElementsKindToShiftSize(elements_kind); 3200 int shift_size = ElementsKindToShiftSize(elements_kind);
3203 // Even though the HLoad/StoreKeyed instructions force the input
3204 // representation for the key to be an integer, the input gets replaced during
3205 // bound check elimination with the index argument to the bounds check, which
3206 // can be tagged, so that case must be handled here, too.
3207 if (key_representation.IsTagged() && (shift_size >= 1)) {
3208 shift_size -= kSmiTagSize;
3209 }
3210 if (key->IsConstantOperand()) { 3201 if (key->IsConstantOperand()) {
3211 int constant_value = ToInteger32(LConstantOperand::cast(key)); 3202 int constant_value = ToInteger32(LConstantOperand::cast(key));
3212 if (constant_value & 0xF0000000) { 3203 if (constant_value & 0xF0000000) {
3213 Abort("array index constant value too big"); 3204 Abort("array index constant value too big");
3214 } 3205 }
3215 return Operand(elements_pointer_reg, 3206 return Operand(elements_pointer_reg,
3216 ((constant_value + additional_index) << shift_size) 3207 ((constant_value + additional_index) << shift_size)
3217 + offset); 3208 + offset);
3218 } else { 3209 } else {
3210 // Take the tag bit into account while computing the shift size.
3211 if (key_representation.IsTagged() && (shift_size >= 1)) {
3212 shift_size -= kSmiTagSize;
3213 }
3219 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size); 3214 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size);
3220 return Operand(elements_pointer_reg, 3215 return Operand(elements_pointer_reg,
3221 ToRegister(key), 3216 ToRegister(key),
3222 scale_factor, 3217 scale_factor,
3223 offset + (additional_index << shift_size)); 3218 offset + (additional_index << shift_size));
3224 } 3219 }
3225 } 3220 }
3226 3221
3227 3222
3228 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { 3223 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
(...skipping 2726 matching lines...) Expand 10 before | Expand all | Expand 10 after
5955 FixedArray::kHeaderSize - kPointerSize)); 5950 FixedArray::kHeaderSize - kPointerSize));
5956 __ bind(&done); 5951 __ bind(&done);
5957 } 5952 }
5958 5953
5959 5954
5960 #undef __ 5955 #undef __
5961 5956
5962 } } // namespace v8::internal 5957 } } // namespace v8::internal
5963 5958
5964 #endif // V8_TARGET_ARCH_IA32 5959 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698