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

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

Issue 2686263002: [crankshaft] Fix Smi overflow in {HMaybeGrowElements}. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/crankshaft/ia32/lithium-codegen-ia32.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/crankshaft/arm/lithium-codegen-arm.h" 5 #include "src/crankshaft/arm/lithium-codegen-arm.h"
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/builtins/builtins-constructor.h" 8 #include "src/builtins/builtins-constructor.h"
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 4027 matching lines...) Expand 10 before | Expand all | Expand 10 after
4038 __ ldr(result, ToMemOperand(instr->object())); 4038 __ ldr(result, ToMemOperand(instr->object()));
4039 } 4039 }
4040 4040
4041 LOperand* key = instr->key(); 4041 LOperand* key = instr->key();
4042 if (key->IsConstantOperand()) { 4042 if (key->IsConstantOperand()) {
4043 LConstantOperand* constant_key = LConstantOperand::cast(key); 4043 LConstantOperand* constant_key = LConstantOperand::cast(key);
4044 int32_t int_key = ToInteger32(constant_key); 4044 int32_t int_key = ToInteger32(constant_key);
4045 if (Smi::IsValid(int_key)) { 4045 if (Smi::IsValid(int_key)) {
4046 __ mov(r3, Operand(Smi::FromInt(int_key))); 4046 __ mov(r3, Operand(Smi::FromInt(int_key)));
4047 } else { 4047 } else {
4048 // We should never get here at runtime because there is a smi check on 4048 Abort(kArrayIndexConstantValueTooBig);
4049 // the key before this point.
4050 __ stop("expected smi");
4051 } 4049 }
4052 } else { 4050 } else {
4053 __ Move(r3, ToRegister(key)); 4051 Label is_smi;
4054 __ SmiTag(r3); 4052 __ SmiTag(r3, ToRegister(key), SetCC);
4053 // Deopt if the key is outside Smi range. The stub expects Smi and would
4054 // bump the elements into dictionary mode (and trigger a deopt) anyways.
4055 __ b(vc, &is_smi);
4056 __ PopSafepointRegisters();
4057 DeoptimizeIf(al, instr, DeoptimizeReason::kOverflow);
4058 __ bind(&is_smi);
4055 } 4059 }
4056 4060
4057 GrowArrayElementsStub stub(isolate(), instr->hydrogen()->kind()); 4061 GrowArrayElementsStub stub(isolate(), instr->hydrogen()->kind());
4058 __ CallStub(&stub); 4062 __ CallStub(&stub);
4059 RecordSafepointWithLazyDeopt( 4063 RecordSafepointWithLazyDeopt(
4060 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); 4064 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS);
4061 __ StoreToSafepointRegisterSlot(result, result); 4065 __ StoreToSafepointRegisterSlot(result, result);
4062 } 4066 }
4063 4067
4064 // Deopt on smi, which means the elements array changed to dictionary mode. 4068 // Deopt on smi, which means the elements array changed to dictionary mode.
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after
5398 __ ldr(result, FieldMemOperand(scratch, 5402 __ ldr(result, FieldMemOperand(scratch,
5399 FixedArray::kHeaderSize - kPointerSize)); 5403 FixedArray::kHeaderSize - kPointerSize));
5400 __ bind(deferred->exit()); 5404 __ bind(deferred->exit());
5401 __ bind(&done); 5405 __ bind(&done);
5402 } 5406 }
5403 5407
5404 #undef __ 5408 #undef __
5405 5409
5406 } // namespace internal 5410 } // namespace internal
5407 } // namespace v8 5411 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/crankshaft/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698