OLD | NEW |
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 4148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4159 ASSERT(ToRegister(instr->value()).is(eax)); | 4159 ASSERT(ToRegister(instr->value()).is(eax)); |
4160 | 4160 |
4161 __ mov(ecx, instr->name()); | 4161 __ mov(ecx, instr->name()); |
4162 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) | 4162 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) |
4163 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 4163 ? isolate()->builtins()->StoreIC_Initialize_Strict() |
4164 : isolate()->builtins()->StoreIC_Initialize(); | 4164 : isolate()->builtins()->StoreIC_Initialize(); |
4165 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4165 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4166 } | 4166 } |
4167 | 4167 |
4168 | 4168 |
4169 void LCodeGen::DeoptIfTaggedButNotSmi(LEnvironment* environment, | |
4170 HValue* value, | |
4171 LOperand* operand) { | |
4172 if (value->representation().IsTagged() && !value->type().IsSmi()) { | |
4173 if (operand->IsRegister()) { | |
4174 __ test(ToRegister(operand), Immediate(kSmiTagMask)); | |
4175 } else { | |
4176 __ test(ToOperand(operand), Immediate(kSmiTagMask)); | |
4177 } | |
4178 DeoptimizeIf(not_zero, environment); | |
4179 } | |
4180 } | |
4181 | |
4182 | |
4183 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4169 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
4184 DeoptIfTaggedButNotSmi(instr->environment(), | 4170 if (instr->hydrogen()->skip_check()) return; |
4185 instr->hydrogen()->length(), | 4171 |
4186 instr->length()); | |
4187 DeoptIfTaggedButNotSmi(instr->environment(), | |
4188 instr->hydrogen()->index(), | |
4189 instr->index()); | |
4190 if (instr->index()->IsConstantOperand()) { | 4172 if (instr->index()->IsConstantOperand()) { |
4191 int constant_index = | 4173 int constant_index = |
4192 ToInteger32(LConstantOperand::cast(instr->index())); | 4174 ToInteger32(LConstantOperand::cast(instr->index())); |
4193 if (instr->hydrogen()->length()->representation().IsTagged()) { | 4175 if (instr->hydrogen()->length()->representation().IsTagged()) { |
4194 __ cmp(ToOperand(instr->length()), | 4176 __ cmp(ToOperand(instr->length()), |
4195 Immediate(Smi::FromInt(constant_index))); | 4177 Immediate(Smi::FromInt(constant_index))); |
4196 } else { | 4178 } else { |
4197 __ cmp(ToOperand(instr->length()), Immediate(constant_index)); | 4179 __ cmp(ToOperand(instr->length()), Immediate(constant_index)); |
4198 } | 4180 } |
4199 DeoptimizeIf(below_equal, instr->environment()); | 4181 DeoptimizeIf(below_equal, instr->environment()); |
(...skipping 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6178 FixedArray::kHeaderSize - kPointerSize)); | 6160 FixedArray::kHeaderSize - kPointerSize)); |
6179 __ bind(&done); | 6161 __ bind(&done); |
6180 } | 6162 } |
6181 | 6163 |
6182 | 6164 |
6183 #undef __ | 6165 #undef __ |
6184 | 6166 |
6185 } } // namespace v8::internal | 6167 } } // namespace v8::internal |
6186 | 6168 |
6187 #endif // V8_TARGET_ARCH_IA32 | 6169 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |