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

Side by Side Diff: src/crankshaft/ia32/lithium-codegen-ia32.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/crankshaft/arm/lithium-codegen-arm.cc ('k') | src/crankshaft/mips/lithium-codegen-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. 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 #if V8_TARGET_ARCH_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h" 7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h"
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/builtins/builtins-constructor.h" 10 #include "src/builtins/builtins-constructor.h"
(...skipping 3841 matching lines...) Expand 10 before | Expand all | Expand 10 after
3852 __ mov(result, ToOperand(instr->object())); 3852 __ mov(result, ToOperand(instr->object()));
3853 } 3853 }
3854 3854
3855 LOperand* key = instr->key(); 3855 LOperand* key = instr->key();
3856 if (key->IsConstantOperand()) { 3856 if (key->IsConstantOperand()) {
3857 LConstantOperand* constant_key = LConstantOperand::cast(key); 3857 LConstantOperand* constant_key = LConstantOperand::cast(key);
3858 int32_t int_key = ToInteger32(constant_key); 3858 int32_t int_key = ToInteger32(constant_key);
3859 if (Smi::IsValid(int_key)) { 3859 if (Smi::IsValid(int_key)) {
3860 __ mov(ebx, Immediate(Smi::FromInt(int_key))); 3860 __ mov(ebx, Immediate(Smi::FromInt(int_key)));
3861 } else { 3861 } else {
3862 // We should never get here at runtime because there is a smi check on 3862 Abort(kArrayIndexConstantValueTooBig);
3863 // the key before this point.
3864 __ int3();
3865 } 3863 }
3866 } else { 3864 } else {
3865 Label is_smi;
3867 __ Move(ebx, ToRegister(key)); 3866 __ Move(ebx, ToRegister(key));
3868 __ SmiTag(ebx); 3867 __ SmiTag(ebx);
3868 // Deopt if the key is outside Smi range. The stub expects Smi and would
3869 // bump the elements into dictionary mode (and trigger a deopt) anyways.
3870 __ j(no_overflow, &is_smi);
3871 __ PopSafepointRegisters();
3872 DeoptimizeIf(no_condition, instr, DeoptimizeReason::kOverflow);
3873 __ bind(&is_smi);
3869 } 3874 }
3870 3875
3871 GrowArrayElementsStub stub(isolate(), instr->hydrogen()->kind()); 3876 GrowArrayElementsStub stub(isolate(), instr->hydrogen()->kind());
3872 __ CallStub(&stub); 3877 __ CallStub(&stub);
3873 RecordSafepointWithLazyDeopt( 3878 RecordSafepointWithLazyDeopt(
3874 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); 3879 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS);
3875 __ StoreToSafepointRegisterSlot(result, result); 3880 __ StoreToSafepointRegisterSlot(result, result);
3876 } 3881 }
3877 3882
3878 // Deopt on smi, which means the elements array changed to dictionary mode. 3883 // Deopt on smi, which means the elements array changed to dictionary mode.
(...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after
5166 __ bind(deferred->exit()); 5171 __ bind(deferred->exit());
5167 __ bind(&done); 5172 __ bind(&done);
5168 } 5173 }
5169 5174
5170 #undef __ 5175 #undef __
5171 5176
5172 } // namespace internal 5177 } // namespace internal
5173 } // namespace v8 5178 } // namespace v8
5174 5179
5175 #endif // V8_TARGET_ARCH_IA32 5180 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/crankshaft/arm/lithium-codegen-arm.cc ('k') | src/crankshaft/mips/lithium-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698