| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 2904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2915 void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) { | 2915 void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) { |
| 2916 ElementsKind elements_kind = instr->elements_kind(); | 2916 ElementsKind elements_kind = instr->elements_kind(); |
| 2917 LOperand* key = instr->key(); | 2917 LOperand* key = instr->key(); |
| 2918 if (!key->IsConstantOperand()) { | 2918 if (!key->IsConstantOperand()) { |
| 2919 Register key_reg = ToRegister(key); | 2919 Register key_reg = ToRegister(key); |
| 2920 // Even though the HLoad/StoreKeyed (in this case) instructions force | 2920 // Even though the HLoad/StoreKeyed (in this case) instructions force |
| 2921 // the input representation for the key to be an integer, the input | 2921 // the input representation for the key to be an integer, the input |
| 2922 // gets replaced during bound check elimination with the index argument | 2922 // gets replaced during bound check elimination with the index argument |
| 2923 // to the bounds check, which can be tagged, so that case must be | 2923 // to the bounds check, which can be tagged, so that case must be |
| 2924 // handled here, too. | 2924 // handled here, too. |
| 2925 if (instr->hydrogen()->key()->representation().IsTagged()) { | 2925 if (instr->hydrogen()->key()->representation().IsSmi()) { |
| 2926 __ SmiToInteger64(key_reg, key_reg); | 2926 __ SmiToInteger64(key_reg, key_reg); |
| 2927 } else if (instr->hydrogen()->IsDehoisted()) { | 2927 } else if (instr->hydrogen()->IsDehoisted()) { |
| 2928 // Sign extend key because it could be a 32 bit negative value | 2928 // Sign extend key because it could be a 32 bit negative value |
| 2929 // and the dehoisted address computation happens in 64 bits | 2929 // and the dehoisted address computation happens in 64 bits |
| 2930 __ movsxlq(key_reg, key_reg); | 2930 __ movsxlq(key_reg, key_reg); |
| 2931 } | 2931 } |
| 2932 } | 2932 } |
| 2933 Operand operand(BuildFastArrayOperand( | 2933 Operand operand(BuildFastArrayOperand( |
| 2934 instr->elements(), | 2934 instr->elements(), |
| 2935 key, | 2935 key, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2988 | 2988 |
| 2989 void LCodeGen::DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr) { | 2989 void LCodeGen::DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr) { |
| 2990 XMMRegister result(ToDoubleRegister(instr->result())); | 2990 XMMRegister result(ToDoubleRegister(instr->result())); |
| 2991 LOperand* key = instr->key(); | 2991 LOperand* key = instr->key(); |
| 2992 if (!key->IsConstantOperand()) { | 2992 if (!key->IsConstantOperand()) { |
| 2993 Register key_reg = ToRegister(key); | 2993 Register key_reg = ToRegister(key); |
| 2994 // Even though the HLoad/StoreKeyed instructions force the input | 2994 // Even though the HLoad/StoreKeyed instructions force the input |
| 2995 // representation for the key to be an integer, the input gets replaced | 2995 // representation for the key to be an integer, the input gets replaced |
| 2996 // during bound check elimination with the index argument to the bounds | 2996 // during bound check elimination with the index argument to the bounds |
| 2997 // check, which can be tagged, so that case must be handled here, too. | 2997 // check, which can be tagged, so that case must be handled here, too. |
| 2998 if (instr->hydrogen()->key()->representation().IsTagged()) { | 2998 if (instr->hydrogen()->key()->representation().IsSmi()) { |
| 2999 __ SmiToInteger64(key_reg, key_reg); | 2999 __ SmiToInteger64(key_reg, key_reg); |
| 3000 } else if (instr->hydrogen()->IsDehoisted()) { | 3000 } else if (instr->hydrogen()->IsDehoisted()) { |
| 3001 // Sign extend key because it could be a 32 bit negative value | 3001 // Sign extend key because it could be a 32 bit negative value |
| 3002 // and the dehoisted address computation happens in 64 bits | 3002 // and the dehoisted address computation happens in 64 bits |
| 3003 __ movsxlq(key_reg, key_reg); | 3003 __ movsxlq(key_reg, key_reg); |
| 3004 } | 3004 } |
| 3005 } | 3005 } |
| 3006 | 3006 |
| 3007 if (instr->hydrogen()->RequiresHoleCheck()) { | 3007 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 3008 int offset = FixedDoubleArray::kHeaderSize - kHeapObjectTag + | 3008 int offset = FixedDoubleArray::kHeaderSize - kHeapObjectTag + |
| (...skipping 21 matching lines...) Expand all Loading... |
| 3030 void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) { | 3030 void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) { |
| 3031 Register result = ToRegister(instr->result()); | 3031 Register result = ToRegister(instr->result()); |
| 3032 LOperand* key = instr->key(); | 3032 LOperand* key = instr->key(); |
| 3033 if (!key->IsConstantOperand()) { | 3033 if (!key->IsConstantOperand()) { |
| 3034 Register key_reg = ToRegister(key); | 3034 Register key_reg = ToRegister(key); |
| 3035 // Even though the HLoad/StoreKeyedFastElement instructions force | 3035 // Even though the HLoad/StoreKeyedFastElement instructions force |
| 3036 // the input representation for the key to be an integer, the input | 3036 // the input representation for the key to be an integer, the input |
| 3037 // gets replaced during bound check elimination with the index | 3037 // gets replaced during bound check elimination with the index |
| 3038 // argument to the bounds check, which can be tagged, so that | 3038 // argument to the bounds check, which can be tagged, so that |
| 3039 // case must be handled here, too. | 3039 // case must be handled here, too. |
| 3040 if (instr->hydrogen()->key()->representation().IsTagged()) { | 3040 if (instr->hydrogen()->key()->representation().IsSmi()) { |
| 3041 __ SmiToInteger64(key_reg, key_reg); | 3041 __ SmiToInteger64(key_reg, key_reg); |
| 3042 } else if (instr->hydrogen()->IsDehoisted()) { | 3042 } else if (instr->hydrogen()->IsDehoisted()) { |
| 3043 // Sign extend key because it could be a 32 bit negative value | 3043 // Sign extend key because it could be a 32 bit negative value |
| 3044 // and the dehoisted address computation happens in 64 bits | 3044 // and the dehoisted address computation happens in 64 bits |
| 3045 __ movsxlq(key_reg, key_reg); | 3045 __ movsxlq(key_reg, key_reg); |
| 3046 } | 3046 } |
| 3047 } | 3047 } |
| 3048 | 3048 |
| 3049 // Load the result. | 3049 // Load the result. |
| 3050 __ movq(result, | 3050 __ movq(result, |
| (...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4035 : isolate()->builtins()->StoreIC_Initialize(); | 4035 : isolate()->builtins()->StoreIC_Initialize(); |
| 4036 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4036 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 4037 } | 4037 } |
| 4038 | 4038 |
| 4039 | 4039 |
| 4040 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4040 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
| 4041 if (instr->hydrogen()->skip_check()) return; | 4041 if (instr->hydrogen()->skip_check()) return; |
| 4042 | 4042 |
| 4043 if (instr->length()->IsRegister()) { | 4043 if (instr->length()->IsRegister()) { |
| 4044 Register reg = ToRegister(instr->length()); | 4044 Register reg = ToRegister(instr->length()); |
| 4045 if (!instr->hydrogen()->length()->representation().IsTagged()) { | 4045 if (!instr->hydrogen()->length()->representation().IsSmi()) { |
| 4046 __ AssertZeroExtended(reg); | 4046 __ AssertZeroExtended(reg); |
| 4047 } | 4047 } |
| 4048 if (instr->index()->IsConstantOperand()) { | 4048 if (instr->index()->IsConstantOperand()) { |
| 4049 int constant_index = | 4049 int constant_index = |
| 4050 ToInteger32(LConstantOperand::cast(instr->index())); | 4050 ToInteger32(LConstantOperand::cast(instr->index())); |
| 4051 if (instr->hydrogen()->length()->representation().IsTagged()) { | 4051 if (instr->hydrogen()->length()->representation().IsSmi()) { |
| 4052 __ Cmp(reg, Smi::FromInt(constant_index)); | 4052 __ Cmp(reg, Smi::FromInt(constant_index)); |
| 4053 } else { | 4053 } else { |
| 4054 __ cmpq(reg, Immediate(constant_index)); | 4054 __ cmpq(reg, Immediate(constant_index)); |
| 4055 } | 4055 } |
| 4056 } else { | 4056 } else { |
| 4057 Register reg2 = ToRegister(instr->index()); | 4057 Register reg2 = ToRegister(instr->index()); |
| 4058 if (!instr->hydrogen()->index()->representation().IsTagged()) { | 4058 if (!instr->hydrogen()->index()->representation().IsSmi()) { |
| 4059 __ AssertZeroExtended(reg2); | 4059 __ AssertZeroExtended(reg2); |
| 4060 } | 4060 } |
| 4061 __ cmpq(reg, reg2); | 4061 __ cmpq(reg, reg2); |
| 4062 } | 4062 } |
| 4063 } else { | 4063 } else { |
| 4064 Operand length = ToOperand(instr->length()); | 4064 Operand length = ToOperand(instr->length()); |
| 4065 if (instr->index()->IsConstantOperand()) { | 4065 if (instr->index()->IsConstantOperand()) { |
| 4066 int constant_index = | 4066 int constant_index = |
| 4067 ToInteger32(LConstantOperand::cast(instr->index())); | 4067 ToInteger32(LConstantOperand::cast(instr->index())); |
| 4068 if (instr->hydrogen()->length()->representation().IsTagged()) { | 4068 if (instr->hydrogen()->length()->representation().IsSmi()) { |
| 4069 __ Cmp(length, Smi::FromInt(constant_index)); | 4069 __ Cmp(length, Smi::FromInt(constant_index)); |
| 4070 } else { | 4070 } else { |
| 4071 __ cmpq(length, Immediate(constant_index)); | 4071 __ cmpq(length, Immediate(constant_index)); |
| 4072 } | 4072 } |
| 4073 } else { | 4073 } else { |
| 4074 __ cmpq(length, ToRegister(instr->index())); | 4074 __ cmpq(length, ToRegister(instr->index())); |
| 4075 } | 4075 } |
| 4076 } | 4076 } |
| 4077 DeoptimizeIf(below_equal, instr->environment()); | 4077 DeoptimizeIf(below_equal, instr->environment()); |
| 4078 } | 4078 } |
| 4079 | 4079 |
| 4080 | 4080 |
| 4081 void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) { | 4081 void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) { |
| 4082 ElementsKind elements_kind = instr->elements_kind(); | 4082 ElementsKind elements_kind = instr->elements_kind(); |
| 4083 LOperand* key = instr->key(); | 4083 LOperand* key = instr->key(); |
| 4084 if (!key->IsConstantOperand()) { | 4084 if (!key->IsConstantOperand()) { |
| 4085 Register key_reg = ToRegister(key); | 4085 Register key_reg = ToRegister(key); |
| 4086 // Even though the HLoad/StoreKeyedFastElement instructions force | 4086 // Even though the HLoad/StoreKeyedFastElement instructions force |
| 4087 // the input representation for the key to be an integer, the input | 4087 // the input representation for the key to be an integer, the input |
| 4088 // gets replaced during bound check elimination with the index | 4088 // gets replaced during bound check elimination with the index |
| 4089 // argument to the bounds check, which can be tagged, so that case | 4089 // argument to the bounds check, which can be tagged, so that case |
| 4090 // must be handled here, too. | 4090 // must be handled here, too. |
| 4091 if (instr->hydrogen()->key()->representation().IsTagged()) { | 4091 if (instr->hydrogen()->key()->representation().IsSmi()) { |
| 4092 __ SmiToInteger64(key_reg, key_reg); | 4092 __ SmiToInteger64(key_reg, key_reg); |
| 4093 } else if (instr->hydrogen()->IsDehoisted()) { | 4093 } else if (instr->hydrogen()->IsDehoisted()) { |
| 4094 // Sign extend key because it could be a 32 bit negative value | 4094 // Sign extend key because it could be a 32 bit negative value |
| 4095 // and the dehoisted address computation happens in 64 bits | 4095 // and the dehoisted address computation happens in 64 bits |
| 4096 __ movsxlq(key_reg, key_reg); | 4096 __ movsxlq(key_reg, key_reg); |
| 4097 } | 4097 } |
| 4098 } | 4098 } |
| 4099 Operand operand(BuildFastArrayOperand( | 4099 Operand operand(BuildFastArrayOperand( |
| 4100 instr->elements(), | 4100 instr->elements(), |
| 4101 key, | 4101 key, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4145 void LCodeGen::DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr) { | 4145 void LCodeGen::DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr) { |
| 4146 XMMRegister value = ToDoubleRegister(instr->value()); | 4146 XMMRegister value = ToDoubleRegister(instr->value()); |
| 4147 LOperand* key = instr->key(); | 4147 LOperand* key = instr->key(); |
| 4148 if (!key->IsConstantOperand()) { | 4148 if (!key->IsConstantOperand()) { |
| 4149 Register key_reg = ToRegister(key); | 4149 Register key_reg = ToRegister(key); |
| 4150 // Even though the HLoad/StoreKeyedFastElement instructions force | 4150 // Even though the HLoad/StoreKeyedFastElement instructions force |
| 4151 // the input representation for the key to be an integer, the | 4151 // the input representation for the key to be an integer, the |
| 4152 // input gets replaced during bound check elimination with the index | 4152 // input gets replaced during bound check elimination with the index |
| 4153 // argument to the bounds check, which can be tagged, so that case | 4153 // argument to the bounds check, which can be tagged, so that case |
| 4154 // must be handled here, too. | 4154 // must be handled here, too. |
| 4155 if (instr->hydrogen()->key()->representation().IsTagged()) { | 4155 if (instr->hydrogen()->key()->representation().IsSmi()) { |
| 4156 __ SmiToInteger64(key_reg, key_reg); | 4156 __ SmiToInteger64(key_reg, key_reg); |
| 4157 } else if (instr->hydrogen()->IsDehoisted()) { | 4157 } else if (instr->hydrogen()->IsDehoisted()) { |
| 4158 // Sign extend key because it could be a 32 bit negative value | 4158 // Sign extend key because it could be a 32 bit negative value |
| 4159 // and the dehoisted address computation happens in 64 bits | 4159 // and the dehoisted address computation happens in 64 bits |
| 4160 __ movsxlq(key_reg, key_reg); | 4160 __ movsxlq(key_reg, key_reg); |
| 4161 } | 4161 } |
| 4162 } | 4162 } |
| 4163 | 4163 |
| 4164 if (instr->NeedsCanonicalization()) { | 4164 if (instr->NeedsCanonicalization()) { |
| 4165 Label have_value; | 4165 Label have_value; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 4188 void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) { | 4188 void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) { |
| 4189 Register elements = ToRegister(instr->elements()); | 4189 Register elements = ToRegister(instr->elements()); |
| 4190 LOperand* key = instr->key(); | 4190 LOperand* key = instr->key(); |
| 4191 if (!key->IsConstantOperand()) { | 4191 if (!key->IsConstantOperand()) { |
| 4192 Register key_reg = ToRegister(key); | 4192 Register key_reg = ToRegister(key); |
| 4193 // Even though the HLoad/StoreKeyedFastElement instructions force | 4193 // Even though the HLoad/StoreKeyedFastElement instructions force |
| 4194 // the input representation for the key to be an integer, the | 4194 // the input representation for the key to be an integer, the |
| 4195 // input gets replaced during bound check elimination with the index | 4195 // input gets replaced during bound check elimination with the index |
| 4196 // argument to the bounds check, which can be tagged, so that case | 4196 // argument to the bounds check, which can be tagged, so that case |
| 4197 // must be handled here, too. | 4197 // must be handled here, too. |
| 4198 if (instr->hydrogen()->key()->representation().IsTagged()) { | 4198 if (instr->hydrogen()->key()->representation().IsSmi()) { |
| 4199 __ SmiToInteger64(key_reg, key_reg); | 4199 __ SmiToInteger64(key_reg, key_reg); |
| 4200 } else if (instr->hydrogen()->IsDehoisted()) { | 4200 } else if (instr->hydrogen()->IsDehoisted()) { |
| 4201 // Sign extend key because it could be a 32 bit negative value | 4201 // Sign extend key because it could be a 32 bit negative value |
| 4202 // and the dehoisted address computation happens in 64 bits | 4202 // and the dehoisted address computation happens in 64 bits |
| 4203 __ movsxlq(key_reg, key_reg); | 4203 __ movsxlq(key_reg, key_reg); |
| 4204 } | 4204 } |
| 4205 } | 4205 } |
| 4206 | 4206 |
| 4207 Operand operand = | 4207 Operand operand = |
| 4208 BuildFastArrayOperand(instr->elements(), | 4208 BuildFastArrayOperand(instr->elements(), |
| (...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5690 FixedArray::kHeaderSize - kPointerSize)); | 5690 FixedArray::kHeaderSize - kPointerSize)); |
| 5691 __ bind(&done); | 5691 __ bind(&done); |
| 5692 } | 5692 } |
| 5693 | 5693 |
| 5694 | 5694 |
| 5695 #undef __ | 5695 #undef __ |
| 5696 | 5696 |
| 5697 } } // namespace v8::internal | 5697 } } // namespace v8::internal |
| 5698 | 5698 |
| 5699 #endif // V8_TARGET_ARCH_X64 | 5699 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |