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

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

Issue 246253007: MIPS: Improve code generation for bounds checks. (Closed) Base URL: https://github.com/v8/v8.git@gbl
Patch Set: Created 6 years, 8 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
« no previous file with comments | « src/mips/lithium-codegen-mips.h ('k') | 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.7 1 // Copyright 2012 the V8 project authors. All rights reserved.7
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 4144 matching lines...) Expand 10 before | Expand all | Expand 10 after
4155 ASSERT(ToRegister(instr->object()).is(a1)); 4155 ASSERT(ToRegister(instr->object()).is(a1));
4156 ASSERT(ToRegister(instr->value()).is(a0)); 4156 ASSERT(ToRegister(instr->value()).is(a0));
4157 4157
4158 // Name is always in a2. 4158 // Name is always in a2.
4159 __ li(a2, Operand(instr->name())); 4159 __ li(a2, Operand(instr->name()));
4160 Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->strict_mode()); 4160 Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->strict_mode());
4161 CallCode(ic, RelocInfo::CODE_TARGET, instr); 4161 CallCode(ic, RelocInfo::CODE_TARGET, instr);
4162 } 4162 }
4163 4163
4164 4164
4165 void LCodeGen::ApplyCheckIf(Condition condition,
4166 LBoundsCheck* check,
4167 Register src1,
4168 const Operand& src2) {
4169 if (FLAG_debug_code && check->hydrogen()->skip_check()) {
4170 Label done;
4171 __ Branch(&done, NegateCondition(condition), src1, src2);
4172 __ stop("eliminated bounds check failed");
4173 __ bind(&done);
4174 } else {
4175 DeoptimizeIf(condition, check->environment(), src1, src2);
4176 }
4177 }
4178
4179
4180 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { 4165 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
4181 if (instr->hydrogen()->skip_check()) return; 4166 Condition cc = instr->hydrogen()->allow_equality() ? hi : hs;
4182 4167 Operand operand(0);
4183 Condition condition = instr->hydrogen()->allow_equality() ? hi : hs; 4168 Register reg;
4184 if (instr->index()->IsConstantOperand()) { 4169 if (instr->index()->IsConstantOperand()) {
4185 int constant_index = 4170 operand = ToOperand(instr->index());
4186 ToInteger32(LConstantOperand::cast(instr->index())); 4171 reg = ToRegister(instr->length());
4187 if (instr->hydrogen()->length()->representation().IsSmi()) { 4172 cc = ReverseCondition(cc);
4188 __ li(at, Operand(Smi::FromInt(constant_index)));
4189 } else {
4190 __ li(at, Operand(constant_index));
4191 }
4192 ApplyCheckIf(condition,
4193 instr,
4194 at,
4195 Operand(ToRegister(instr->length())));
4196 } else { 4173 } else {
4197 ApplyCheckIf(condition, 4174 reg = ToRegister(instr->index());
4198 instr, 4175 operand = ToOperand(instr->length());
4199 ToRegister(instr->index()), 4176 }
4200 Operand(ToRegister(instr->length()))); 4177 if (FLAG_debug_code && instr->hydrogen()->skip_check()) {
4178 Label done;
4179 __ Branch(&done, NegateCondition(cc), reg, operand);
4180 __ stop("eliminated bounds check failed");
4181 __ bind(&done);
4182 } else {
4183 DeoptimizeIf(cc, instr->environment(), reg, operand);
4201 } 4184 }
4202 } 4185 }
4203 4186
4204 4187
4205 void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) { 4188 void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
4206 Register external_pointer = ToRegister(instr->elements()); 4189 Register external_pointer = ToRegister(instr->elements());
4207 Register key = no_reg; 4190 Register key = no_reg;
4208 ElementsKind elements_kind = instr->elements_kind(); 4191 ElementsKind elements_kind = instr->elements_kind();
4209 bool key_is_constant = instr->key()->IsConstantOperand(); 4192 bool key_is_constant = instr->key()->IsConstantOperand();
4210 int constant_key = 0; 4193 int constant_key = 0;
(...skipping 1699 matching lines...) Expand 10 before | Expand all | Expand 10 after
5910 __ lw(result, FieldMemOperand(scratch, 5893 __ lw(result, FieldMemOperand(scratch,
5911 FixedArray::kHeaderSize - kPointerSize)); 5894 FixedArray::kHeaderSize - kPointerSize));
5912 __ bind(deferred->exit()); 5895 __ bind(deferred->exit());
5913 __ bind(&done); 5896 __ bind(&done);
5914 } 5897 }
5915 5898
5916 5899
5917 #undef __ 5900 #undef __
5918 5901
5919 } } // namespace v8::internal 5902 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/lithium-codegen-mips.h ('k') | src/mips/lithium-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698