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

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

Issue 12208013: Separated smi check from HBoundsCheck. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 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
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 4148 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 969 matching lines...) Expand 10 before | Expand all | Expand 10 after
5169 } 5151 }
5170 5152
5171 5153
5172 void LCodeGen::DoCheckSmi(LCheckSmi* instr) { 5154 void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
5173 LOperand* input = instr->value(); 5155 LOperand* input = instr->value();
5174 __ test(ToOperand(input), Immediate(kSmiTagMask)); 5156 __ test(ToOperand(input), Immediate(kSmiTagMask));
5175 DeoptimizeIf(not_zero, instr->environment()); 5157 DeoptimizeIf(not_zero, instr->environment());
5176 } 5158 }
5177 5159
5178 5160
5161 void LCodeGen::DoDeoptimizeIfTaggedIsNotSmi(
5162 LDeoptimizeIfTaggedIsNotSmi* instr) {
5163 if (instr->hydrogen_value()->representation().IsTagged() &&
5164 !instr->hydrogen_value()->type().IsSmi()) {
5165 LOperand* operand = instr->value();
5166 if (operand->IsRegister()) {
5167 __ test(ToRegister(operand), Immediate(kSmiTagMask));
5168 } else {
5169 __ test(ToOperand(operand), Immediate(kSmiTagMask));
5170 }
5171 DeoptimizeIf(not_zero, instr->environment());
5172 }
5173 }
5174
5175
5179 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) { 5176 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) {
5180 LOperand* input = instr->value(); 5177 LOperand* input = instr->value();
5181 __ test(ToOperand(input), Immediate(kSmiTagMask)); 5178 __ test(ToOperand(input), Immediate(kSmiTagMask));
5182 DeoptimizeIf(zero, instr->environment()); 5179 DeoptimizeIf(zero, instr->environment());
5183 } 5180 }
5184 5181
5185 5182
5186 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) { 5183 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) {
5187 Register input = ToRegister(instr->value()); 5184 Register input = ToRegister(instr->value());
5188 Register temp = ToRegister(instr->temp()); 5185 Register temp = ToRegister(instr->temp());
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after
6178 FixedArray::kHeaderSize - kPointerSize)); 6175 FixedArray::kHeaderSize - kPointerSize));
6179 __ bind(&done); 6176 __ bind(&done);
6180 } 6177 }
6181 6178
6182 6179
6183 #undef __ 6180 #undef __
6184 6181
6185 } } // namespace v8::internal 6182 } } // namespace v8::internal
6186 6183
6187 #endif // V8_TARGET_ARCH_IA32 6184 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698