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

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

Issue 246423005: Improve code generation for bounds checks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
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 | Annotate | Revision Log
« no previous file with comments | « src/arm/lithium-codegen-arm.h ('k') | src/arm64/lithium-arm64.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 4170 matching lines...) Expand 10 before | Expand all | Expand 10 after
4181 ASSERT(ToRegister(instr->object()).is(r1)); 4181 ASSERT(ToRegister(instr->object()).is(r1));
4182 ASSERT(ToRegister(instr->value()).is(r0)); 4182 ASSERT(ToRegister(instr->value()).is(r0));
4183 4183
4184 // Name is always in r2. 4184 // Name is always in r2.
4185 __ mov(r2, Operand(instr->name())); 4185 __ mov(r2, Operand(instr->name()));
4186 Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->strict_mode()); 4186 Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->strict_mode());
4187 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); 4187 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
4188 } 4188 }
4189 4189
4190 4190
4191 void LCodeGen::ApplyCheckIf(Condition condition, LBoundsCheck* check) { 4191 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
4192 if (FLAG_debug_code && check->hydrogen()->skip_check()) { 4192 Condition cc = instr->hydrogen()->allow_equality() ? hi : hs;
4193 if (instr->index()->IsConstantOperand()) {
4194 Operand index = ToOperand(instr->index());
4195 Register length = ToRegister(instr->length());
4196 __ cmp(length, index);
4197 cc = ReverseCondition(cc);
4198 } else {
4199 Register index = ToRegister(instr->index());
4200 Operand length = ToOperand(instr->length());
4201 __ cmp(index, length);
4202 }
4203 if (FLAG_debug_code && instr->hydrogen()->skip_check()) {
4193 Label done; 4204 Label done;
4194 __ b(NegateCondition(condition), &done); 4205 __ b(NegateCondition(cc), &done);
4195 __ stop("eliminated bounds check failed"); 4206 __ stop("eliminated bounds check failed");
4196 __ bind(&done); 4207 __ bind(&done);
4197 } else { 4208 } else {
4198 DeoptimizeIf(condition, check->environment()); 4209 DeoptimizeIf(cc, instr->environment());
4199 } 4210 }
4200 } 4211 }
4201 4212
4202 4213
4203 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
4204 if (instr->hydrogen()->skip_check()) return;
4205
4206 if (instr->index()->IsConstantOperand()) {
4207 int constant_index =
4208 ToInteger32(LConstantOperand::cast(instr->index()));
4209 if (instr->hydrogen()->length()->representation().IsSmi()) {
4210 __ mov(ip, Operand(Smi::FromInt(constant_index)));
4211 } else {
4212 __ mov(ip, Operand(constant_index));
4213 }
4214 __ cmp(ip, ToRegister(instr->length()));
4215 } else {
4216 __ cmp(ToRegister(instr->index()), ToRegister(instr->length()));
4217 }
4218 Condition condition = instr->hydrogen()->allow_equality() ? hi : hs;
4219 ApplyCheckIf(condition, instr);
4220 }
4221
4222
4223 void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) { 4214 void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
4224 Register external_pointer = ToRegister(instr->elements()); 4215 Register external_pointer = ToRegister(instr->elements());
4225 Register key = no_reg; 4216 Register key = no_reg;
4226 ElementsKind elements_kind = instr->elements_kind(); 4217 ElementsKind elements_kind = instr->elements_kind();
4227 bool key_is_constant = instr->key()->IsConstantOperand(); 4218 bool key_is_constant = instr->key()->IsConstantOperand();
4228 int constant_key = 0; 4219 int constant_key = 0;
4229 if (key_is_constant) { 4220 if (key_is_constant) {
4230 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); 4221 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
4231 if (constant_key & 0xF0000000) { 4222 if (constant_key & 0xF0000000) {
4232 Abort(kArrayIndexConstantValueTooBig); 4223 Abort(kArrayIndexConstantValueTooBig);
(...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after
5864 __ ldr(result, FieldMemOperand(scratch, 5855 __ ldr(result, FieldMemOperand(scratch,
5865 FixedArray::kHeaderSize - kPointerSize)); 5856 FixedArray::kHeaderSize - kPointerSize));
5866 __ bind(deferred->exit()); 5857 __ bind(deferred->exit());
5867 __ bind(&done); 5858 __ bind(&done);
5868 } 5859 }
5869 5860
5870 5861
5871 #undef __ 5862 #undef __
5872 5863
5873 } } // namespace v8::internal 5864 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.h ('k') | src/arm64/lithium-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698