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

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

Issue 10581014: BoundsCheck should be extended to support array_bounds_checks_elimination (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 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.cc ('k') | src/ia32/lithium-ia32.h » ('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 3539 matching lines...) Expand 10 before | Expand all | Expand 10 after
3550 3550
3551 __ mov(ecx, instr->name()); 3551 __ mov(ecx, instr->name());
3552 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) 3552 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode)
3553 ? isolate()->builtins()->StoreIC_Initialize_Strict() 3553 ? isolate()->builtins()->StoreIC_Initialize_Strict()
3554 : isolate()->builtins()->StoreIC_Initialize(); 3554 : isolate()->builtins()->StoreIC_Initialize();
3555 CallCode(ic, RelocInfo::CODE_TARGET, instr); 3555 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3556 } 3556 }
3557 3557
3558 3558
3559 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { 3559 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
3560 int32_t lower_offset = instr->hydrogen()->lower_offset();
3561 int32_t upper_offset = instr->hydrogen()->upper_offset();
3560 if (instr->index()->IsConstantOperand()) { 3562 if (instr->index()->IsConstantOperand()) {
3561 __ cmp(ToOperand(instr->length()), 3563 int32_t c_index = ToInteger32(LConstantOperand::cast(instr->index()));
3562 Immediate(ToInteger32(LConstantOperand::cast(instr->index())))); 3564 int64_t upper_range = (int64_t)c_index + (int64_t)upper_offset;
3565 if (c_index < -lower_offset || upper_range > ((int64_t)1 << 32)) {
3566 DeoptimizeIf(no_condition, instr->environment());
3567 }
3568 __ cmp(ToOperand(instr->length()), Immediate(c_index + upper_offset));
3563 DeoptimizeIf(below_equal, instr->environment()); 3569 DeoptimizeIf(below_equal, instr->environment());
3564 } else { 3570 } else {
3565 __ cmp(ToRegister(instr->index()), ToOperand(instr->length())); 3571 ASSERT(instr->index()->IsRegister());
3566 DeoptimizeIf(above_equal, instr->environment()); 3572 Register reg_index = ToRegister(instr->index());
3573 if (lower_offset == 0 && upper_offset == 0) {
3574 __ cmp(reg_index, ToOperand(instr->length()));
3575 DeoptimizeIf(above_equal, instr->environment());
3576 } else {
3577 Register temp_length = ToRegister(instr->TempAt(0));
3578 __ mov(temp_length, ToOperand(instr->length()));
3579 __ cmp(reg_index, Immediate(-lower_offset));
3580 DeoptimizeIf(less, instr->environment());
3581 __ sub(temp_length, Immediate(upper_offset));
3582 __ cmp(reg_index, temp_length);
3583 if (upper_offset >= 0) {
3584 DeoptimizeIf(greater_equal, instr->environment());
3585 } else {
3586 DeoptimizeIf(above_equal, instr->environment());
3587 }
3588 }
3567 } 3589 }
3568 } 3590 }
3569 3591
3570 3592
3571 void LCodeGen::DoStoreKeyedSpecializedArrayElement( 3593 void LCodeGen::DoStoreKeyedSpecializedArrayElement(
3572 LStoreKeyedSpecializedArrayElement* instr) { 3594 LStoreKeyedSpecializedArrayElement* instr) {
3573 ElementsKind elements_kind = instr->elements_kind(); 3595 ElementsKind elements_kind = instr->elements_kind();
3574 Operand operand(BuildFastArrayOperand(instr->external_pointer(), 3596 Operand operand(BuildFastArrayOperand(instr->external_pointer(),
3575 instr->key(), 3597 instr->key(),
3576 elements_kind, 3598 elements_kind,
(...skipping 1652 matching lines...) Expand 10 before | Expand all | Expand 10 after
5229 FixedArray::kHeaderSize - kPointerSize)); 5251 FixedArray::kHeaderSize - kPointerSize));
5230 __ bind(&done); 5252 __ bind(&done);
5231 } 5253 }
5232 5254
5233 5255
5234 #undef __ 5256 #undef __
5235 5257
5236 } } // namespace v8::internal 5258 } } // namespace v8::internal
5237 5259
5238 #endif // V8_TARGET_ARCH_IA32 5260 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698