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

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

Issue 15937009: MIPS: Replace tagged keys for fast access by smi, and use smi in boundscheck. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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 | « no previous file | src/mips/lithium-mips.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 2896 matching lines...) Expand 10 before | Expand all | Expand 10 after
2907 int constant_key = 0; 2907 int constant_key = 0;
2908 if (key_is_constant) { 2908 if (key_is_constant) {
2909 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); 2909 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
2910 if (constant_key & 0xF0000000) { 2910 if (constant_key & 0xF0000000) {
2911 Abort("array index constant value too big."); 2911 Abort("array index constant value too big.");
2912 } 2912 }
2913 } else { 2913 } else {
2914 key = ToRegister(instr->key()); 2914 key = ToRegister(instr->key());
2915 } 2915 }
2916 int element_size_shift = ElementsKindToShiftSize(elements_kind); 2916 int element_size_shift = ElementsKindToShiftSize(elements_kind);
2917 int shift_size = (instr->hydrogen()->key()->representation().IsTagged()) 2917 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
2918 ? (element_size_shift - kSmiTagSize) : element_size_shift; 2918 ? (element_size_shift - kSmiTagSize) : element_size_shift;
2919 int additional_offset = instr->additional_index() << element_size_shift; 2919 int additional_offset = instr->additional_index() << element_size_shift;
2920 2920
2921 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || 2921 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
2922 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { 2922 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) {
2923 FPURegister result = ToDoubleRegister(instr->result()); 2923 FPURegister result = ToDoubleRegister(instr->result());
2924 if (key_is_constant) { 2924 if (key_is_constant) {
2925 __ Addu(scratch0(), external_pointer, constant_key << element_size_shift); 2925 __ Addu(scratch0(), external_pointer, constant_key << element_size_shift);
2926 } else { 2926 } else {
2927 __ sll(scratch0(), key, shift_size); 2927 __ sll(scratch0(), key, shift_size);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2981 2981
2982 2982
2983 void LCodeGen::DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr) { 2983 void LCodeGen::DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr) {
2984 Register elements = ToRegister(instr->elements()); 2984 Register elements = ToRegister(instr->elements());
2985 bool key_is_constant = instr->key()->IsConstantOperand(); 2985 bool key_is_constant = instr->key()->IsConstantOperand();
2986 Register key = no_reg; 2986 Register key = no_reg;
2987 DoubleRegister result = ToDoubleRegister(instr->result()); 2987 DoubleRegister result = ToDoubleRegister(instr->result());
2988 Register scratch = scratch0(); 2988 Register scratch = scratch0();
2989 2989
2990 int element_size_shift = ElementsKindToShiftSize(FAST_DOUBLE_ELEMENTS); 2990 int element_size_shift = ElementsKindToShiftSize(FAST_DOUBLE_ELEMENTS);
2991 int shift_size = (instr->hydrogen()->key()->representation().IsTagged()) 2991 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
2992 ? (element_size_shift - kSmiTagSize) : element_size_shift; 2992 ? (element_size_shift - kSmiTagSize) : element_size_shift;
2993 int constant_key = 0; 2993 int constant_key = 0;
2994 if (key_is_constant) { 2994 if (key_is_constant) {
2995 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); 2995 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
2996 if (constant_key & 0xF0000000) { 2996 if (constant_key & 0xF0000000) {
2997 Abort("array index constant value too big."); 2997 Abort("array index constant value too big.");
2998 } 2998 }
2999 } else { 2999 } else {
3000 key = ToRegister(instr->key()); 3000 key = ToRegister(instr->key());
3001 } 3001 }
(...skipping 24 matching lines...) Expand all
3026 LConstantOperand* const_operand = LConstantOperand::cast(instr->key()); 3026 LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
3027 offset = FixedArray::OffsetOfElementAt(ToInteger32(const_operand) + 3027 offset = FixedArray::OffsetOfElementAt(ToInteger32(const_operand) +
3028 instr->additional_index()); 3028 instr->additional_index());
3029 store_base = elements; 3029 store_base = elements;
3030 } else { 3030 } else {
3031 Register key = EmitLoadRegister(instr->key(), scratch0()); 3031 Register key = EmitLoadRegister(instr->key(), scratch0());
3032 // Even though the HLoadKeyed instruction forces the input 3032 // Even though the HLoadKeyed instruction forces the input
3033 // representation for the key to be an integer, the input gets replaced 3033 // representation for the key to be an integer, the input gets replaced
3034 // during bound check elimination with the index argument to the bounds 3034 // during bound check elimination with the index argument to the bounds
3035 // check, which can be tagged, so that case must be handled here, too. 3035 // check, which can be tagged, so that case must be handled here, too.
3036 if (instr->hydrogen()->key()->representation().IsTagged()) { 3036 if (instr->hydrogen()->key()->representation().IsSmi()) {
3037 __ sll(scratch, key, kPointerSizeLog2 - kSmiTagSize); 3037 __ sll(scratch, key, kPointerSizeLog2 - kSmiTagSize);
3038 __ addu(scratch, elements, scratch); 3038 __ addu(scratch, elements, scratch);
3039 } else { 3039 } else {
3040 __ sll(scratch, key, kPointerSizeLog2); 3040 __ sll(scratch, key, kPointerSizeLog2);
3041 __ addu(scratch, elements, scratch); 3041 __ addu(scratch, elements, scratch);
3042 } 3042 }
3043 offset = FixedArray::OffsetOfElementAt(instr->additional_index()); 3043 offset = FixedArray::OffsetOfElementAt(instr->additional_index());
3044 } 3044 }
3045 __ lw(result, FieldMemOperand(store_base, offset)); 3045 __ lw(result, FieldMemOperand(store_base, offset));
3046 3046
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
4012 CallCode(ic, RelocInfo::CODE_TARGET, instr); 4012 CallCode(ic, RelocInfo::CODE_TARGET, instr);
4013 } 4013 }
4014 4014
4015 4015
4016 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { 4016 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
4017 if (instr->hydrogen()->skip_check()) return; 4017 if (instr->hydrogen()->skip_check()) return;
4018 4018
4019 if (instr->index()->IsConstantOperand()) { 4019 if (instr->index()->IsConstantOperand()) {
4020 int constant_index = 4020 int constant_index =
4021 ToInteger32(LConstantOperand::cast(instr->index())); 4021 ToInteger32(LConstantOperand::cast(instr->index()));
4022 if (instr->hydrogen()->length()->representation().IsTagged()) { 4022 if (instr->hydrogen()->length()->representation().IsSmi()) {
4023 __ li(at, Operand(Smi::FromInt(constant_index))); 4023 __ li(at, Operand(Smi::FromInt(constant_index)));
4024 } else { 4024 } else {
4025 __ li(at, Operand(constant_index)); 4025 __ li(at, Operand(constant_index));
4026 } 4026 }
4027 DeoptimizeIf(hs, 4027 DeoptimizeIf(hs,
4028 instr->environment(), 4028 instr->environment(),
4029 at, 4029 at,
4030 Operand(ToRegister(instr->length()))); 4030 Operand(ToRegister(instr->length())));
4031 } else { 4031 } else {
4032 DeoptimizeIf(hs, 4032 DeoptimizeIf(hs,
(...skipping 12 matching lines...) Expand all
4045 int constant_key = 0; 4045 int constant_key = 0;
4046 if (key_is_constant) { 4046 if (key_is_constant) {
4047 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); 4047 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
4048 if (constant_key & 0xF0000000) { 4048 if (constant_key & 0xF0000000) {
4049 Abort("array index constant value too big."); 4049 Abort("array index constant value too big.");
4050 } 4050 }
4051 } else { 4051 } else {
4052 key = ToRegister(instr->key()); 4052 key = ToRegister(instr->key());
4053 } 4053 }
4054 int element_size_shift = ElementsKindToShiftSize(elements_kind); 4054 int element_size_shift = ElementsKindToShiftSize(elements_kind);
4055 int shift_size = (instr->hydrogen()->key()->representation().IsTagged()) 4055 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
4056 ? (element_size_shift - kSmiTagSize) : element_size_shift; 4056 ? (element_size_shift - kSmiTagSize) : element_size_shift;
4057 int additional_offset = instr->additional_index() << element_size_shift; 4057 int additional_offset = instr->additional_index() << element_size_shift;
4058 4058
4059 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || 4059 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
4060 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { 4060 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) {
4061 FPURegister value(ToDoubleRegister(instr->value())); 4061 FPURegister value(ToDoubleRegister(instr->value()));
4062 if (key_is_constant) { 4062 if (key_is_constant) {
4063 __ Addu(scratch0(), external_pointer, constant_key << 4063 __ Addu(scratch0(), external_pointer, constant_key <<
4064 element_size_shift); 4064 element_size_shift);
4065 } else { 4065 } else {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
4123 // double value. 4123 // double value.
4124 if (key_is_constant) { 4124 if (key_is_constant) {
4125 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); 4125 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
4126 if (constant_key & 0xF0000000) { 4126 if (constant_key & 0xF0000000) {
4127 Abort("array index constant value too big."); 4127 Abort("array index constant value too big.");
4128 } 4128 }
4129 } else { 4129 } else {
4130 key = ToRegister(instr->key()); 4130 key = ToRegister(instr->key());
4131 } 4131 }
4132 int element_size_shift = ElementsKindToShiftSize(FAST_DOUBLE_ELEMENTS); 4132 int element_size_shift = ElementsKindToShiftSize(FAST_DOUBLE_ELEMENTS);
4133 int shift_size = (instr->hydrogen()->key()->representation().IsTagged()) 4133 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
4134 ? (element_size_shift - kSmiTagSize) : element_size_shift; 4134 ? (element_size_shift - kSmiTagSize) : element_size_shift;
4135 if (key_is_constant) { 4135 if (key_is_constant) {
4136 __ Addu(scratch, elements, Operand((constant_key << element_size_shift) + 4136 __ Addu(scratch, elements, Operand((constant_key << element_size_shift) +
4137 FixedDoubleArray::kHeaderSize - kHeapObjectTag)); 4137 FixedDoubleArray::kHeaderSize - kHeapObjectTag));
4138 } else { 4138 } else {
4139 __ sll(scratch, key, shift_size); 4139 __ sll(scratch, key, shift_size);
4140 __ Addu(scratch, elements, Operand(scratch)); 4140 __ Addu(scratch, elements, Operand(scratch));
4141 __ Addu(scratch, scratch, 4141 __ Addu(scratch, scratch,
4142 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag)); 4142 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag));
4143 } 4143 }
(...skipping 29 matching lines...) Expand all
4173 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); 4173 ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
4174 LConstantOperand* const_operand = LConstantOperand::cast(instr->key()); 4174 LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
4175 offset = FixedArray::OffsetOfElementAt(ToInteger32(const_operand) + 4175 offset = FixedArray::OffsetOfElementAt(ToInteger32(const_operand) +
4176 instr->additional_index()); 4176 instr->additional_index());
4177 store_base = elements; 4177 store_base = elements;
4178 } else { 4178 } else {
4179 // Even though the HLoadKeyed instruction forces the input 4179 // Even though the HLoadKeyed instruction forces the input
4180 // representation for the key to be an integer, the input gets replaced 4180 // representation for the key to be an integer, the input gets replaced
4181 // during bound check elimination with the index argument to the bounds 4181 // during bound check elimination with the index argument to the bounds
4182 // check, which can be tagged, so that case must be handled here, too. 4182 // check, which can be tagged, so that case must be handled here, too.
4183 if (instr->hydrogen()->key()->representation().IsTagged()) { 4183 if (instr->hydrogen()->key()->representation().IsSmi()) {
4184 __ sll(scratch, key, kPointerSizeLog2 - kSmiTagSize); 4184 __ sll(scratch, key, kPointerSizeLog2 - kSmiTagSize);
4185 __ addu(scratch, elements, scratch); 4185 __ addu(scratch, elements, scratch);
4186 } else { 4186 } else {
4187 __ sll(scratch, key, kPointerSizeLog2); 4187 __ sll(scratch, key, kPointerSizeLog2);
4188 __ addu(scratch, elements, scratch); 4188 __ addu(scratch, elements, scratch);
4189 } 4189 }
4190 offset = FixedArray::OffsetOfElementAt(instr->additional_index()); 4190 offset = FixedArray::OffsetOfElementAt(instr->additional_index());
4191 } 4191 }
4192 __ sw(value, FieldMemOperand(store_base, offset)); 4192 __ sw(value, FieldMemOperand(store_base, offset));
4193 4193
(...skipping 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after
5765 __ Subu(scratch, result, scratch); 5765 __ Subu(scratch, result, scratch);
5766 __ lw(result, FieldMemOperand(scratch, 5766 __ lw(result, FieldMemOperand(scratch,
5767 FixedArray::kHeaderSize - kPointerSize)); 5767 FixedArray::kHeaderSize - kPointerSize));
5768 __ bind(&done); 5768 __ bind(&done);
5769 } 5769 }
5770 5770
5771 5771
5772 #undef __ 5772 #undef __
5773 5773
5774 } } // namespace v8::internal 5774 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/mips/lithium-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698