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

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

Issue 10831049: Improve constant element index access code generation (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 8 years, 4 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/x64/lithium-codegen-x64.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 2687 matching lines...) Expand 10 before | Expand all | Expand 10 after
2698 2698
2699 Operand LCodeGen::BuildFastArrayOperand( 2699 Operand LCodeGen::BuildFastArrayOperand(
2700 LOperand* elements_pointer, 2700 LOperand* elements_pointer,
2701 LOperand* key, 2701 LOperand* key,
2702 Representation key_representation, 2702 Representation key_representation,
2703 ElementsKind elements_kind, 2703 ElementsKind elements_kind,
2704 uint32_t offset, 2704 uint32_t offset,
2705 uint32_t additional_index) { 2705 uint32_t additional_index) {
2706 Register elements_pointer_reg = ToRegister(elements_pointer); 2706 Register elements_pointer_reg = ToRegister(elements_pointer);
2707 int shift_size = ElementsKindToShiftSize(elements_kind); 2707 int shift_size = ElementsKindToShiftSize(elements_kind);
2708 // Even though the HLoad/StoreKeyedFastElement instructions force the input
2709 // representation for the key to be an integer, the input gets replaced during
2710 // bound check elimination with the index argument to the bounds check, which
2711 // can be tagged, so that case must be handled here, too.
2708 if (key_representation.IsTagged() && (shift_size >= 1)) { 2712 if (key_representation.IsTagged() && (shift_size >= 1)) {
2709 shift_size -= kSmiTagSize; 2713 shift_size -= kSmiTagSize;
2710 } 2714 }
2711 if (key->IsConstantOperand()) { 2715 if (key->IsConstantOperand()) {
2712 int constant_value = ToInteger32(LConstantOperand::cast(key)); 2716 int constant_value = ToInteger32(LConstantOperand::cast(key));
2713 if (constant_value & 0xF0000000) { 2717 if (constant_value & 0xF0000000) {
2714 Abort("array index constant value too big"); 2718 Abort("array index constant value too big");
2715 } 2719 }
2716 return Operand(elements_pointer_reg, 2720 return Operand(elements_pointer_reg,
2717 ((constant_value + additional_index) << shift_size) 2721 ((constant_value + additional_index) << shift_size)
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
3674 __ mov(ecx, instr->name()); 3678 __ mov(ecx, instr->name());
3675 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) 3679 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode)
3676 ? isolate()->builtins()->StoreIC_Initialize_Strict() 3680 ? isolate()->builtins()->StoreIC_Initialize_Strict()
3677 : isolate()->builtins()->StoreIC_Initialize(); 3681 : isolate()->builtins()->StoreIC_Initialize();
3678 CallCode(ic, RelocInfo::CODE_TARGET, instr); 3682 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3679 } 3683 }
3680 3684
3681 3685
3682 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { 3686 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
3683 if (instr->index()->IsConstantOperand()) { 3687 if (instr->index()->IsConstantOperand()) {
3684 __ cmp(ToOperand(instr->length()), 3688 int constant_index =
3685 Immediate(ToInteger32(LConstantOperand::cast(instr->index())))); 3689 ToInteger32(LConstantOperand::cast(instr->index()));
3690 if (instr->hydrogen()->length()->representation().IsTagged()) {
3691 __ cmp(ToOperand(instr->length()),
3692 Immediate(Smi::FromInt(constant_index)));
3693 } else {
3694 __ cmp(ToOperand(instr->length()), Immediate(constant_index));
3695 }
3686 DeoptimizeIf(below_equal, instr->environment()); 3696 DeoptimizeIf(below_equal, instr->environment());
3687 } else { 3697 } else {
3688 __ cmp(ToRegister(instr->index()), ToOperand(instr->length())); 3698 __ cmp(ToRegister(instr->index()), ToOperand(instr->length()));
3689 DeoptimizeIf(above_equal, instr->environment()); 3699 DeoptimizeIf(above_equal, instr->environment());
3690 } 3700 }
3691 } 3701 }
3692 3702
3693 3703
3694 void LCodeGen::DoStoreKeyedSpecializedArrayElement( 3704 void LCodeGen::DoStoreKeyedSpecializedArrayElement(
3695 LStoreKeyedSpecializedArrayElement* instr) { 3705 LStoreKeyedSpecializedArrayElement* instr) {
(...skipping 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after
5359 FixedArray::kHeaderSize - kPointerSize)); 5369 FixedArray::kHeaderSize - kPointerSize));
5360 __ bind(&done); 5370 __ bind(&done);
5361 } 5371 }
5362 5372
5363 5373
5364 #undef __ 5374 #undef __
5365 5375
5366 } } // namespace v8::internal 5376 } } // namespace v8::internal
5367 5377
5368 #endif // V8_TARGET_ARCH_IA32 5378 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698