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

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

Issue 2697473004: PPC/s390: [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 | « no previous file | src/crankshaft/s390/lithium-codegen-s390.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/ppc/lithium-codegen-ppc.h" 5 #include "src/crankshaft/ppc/lithium-codegen-ppc.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 4336 matching lines...) Expand 10 before | Expand all | Expand 10 after
4347 __ LoadP(result, ToMemOperand(instr->object())); 4347 __ LoadP(result, ToMemOperand(instr->object()));
4348 } 4348 }
4349 4349
4350 LOperand* key = instr->key(); 4350 LOperand* key = instr->key();
4351 if (key->IsConstantOperand()) { 4351 if (key->IsConstantOperand()) {
4352 LConstantOperand* constant_key = LConstantOperand::cast(key); 4352 LConstantOperand* constant_key = LConstantOperand::cast(key);
4353 int32_t int_key = ToInteger32(constant_key); 4353 int32_t int_key = ToInteger32(constant_key);
4354 if (Smi::IsValid(int_key)) { 4354 if (Smi::IsValid(int_key)) {
4355 __ LoadSmiLiteral(r6, Smi::FromInt(int_key)); 4355 __ LoadSmiLiteral(r6, Smi::FromInt(int_key));
4356 } else { 4356 } else {
4357 // We should never get here at runtime because there is a smi check on 4357 Abort(kArrayIndexConstantValueTooBig);
4358 // the key before this point.
4359 __ stop("expected smi");
4360 } 4358 }
4361 } else { 4359 } else {
4360 Label is_smi;
4361 #if V8_TARGET_ARCH_PPC64
4362 __ SmiTag(r6, ToRegister(key)); 4362 __ SmiTag(r6, ToRegister(key));
4363 #else
4364 // Deopt if the key is outside Smi range. The stub expects Smi and would
4365 // bump the elements into dictionary mode (and trigger a deopt) anyways.
4366 __ SmiTagCheckOverflow(r6, ToRegister(key), r0);
4367 __ BranchOnNoOverflow(&is_smi);
4368 __ PopSafepointRegisters();
4369 DeoptimizeIf(al, instr, DeoptimizeReason::kOverflow, cr0);
4370 __ bind(&is_smi);
4371 #endif
4363 } 4372 }
4364 4373
4365 GrowArrayElementsStub stub(isolate(), instr->hydrogen()->kind()); 4374 GrowArrayElementsStub stub(isolate(), instr->hydrogen()->kind());
4366 __ CallStub(&stub); 4375 __ CallStub(&stub);
4367 RecordSafepointWithLazyDeopt( 4376 RecordSafepointWithLazyDeopt(
4368 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); 4377 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS);
4369 __ StoreToSafepointRegisterSlot(result, result); 4378 __ StoreToSafepointRegisterSlot(result, result);
4370 } 4379 }
4371 4380
4372 // Deopt on smi, which means the elements array changed to dictionary mode. 4381 // Deopt on smi, which means the elements array changed to dictionary mode.
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after
5688 __ LoadP(result, 5697 __ LoadP(result,
5689 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); 5698 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize));
5690 __ bind(deferred->exit()); 5699 __ bind(deferred->exit());
5691 __ bind(&done); 5700 __ bind(&done);
5692 } 5701 }
5693 5702
5694 #undef __ 5703 #undef __
5695 5704
5696 } // namespace internal 5705 } // namespace internal
5697 } // namespace v8 5706 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/crankshaft/s390/lithium-codegen-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698