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

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

Issue 145893004: A64: Fix handling of Smis in lithium Load/Store. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Add static asserts. Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/a64/lithium-a64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 3454 matching lines...) Expand 10 before | Expand all | Expand 10 after
3465 instr->additional_index()); 3465 instr->additional_index());
3466 load_base = elements; 3466 load_base = elements;
3467 } else { 3467 } else {
3468 load_base = ToRegister(instr->temp()); 3468 load_base = ToRegister(instr->temp());
3469 Register key = ToRegister(instr->key()); 3469 Register key = ToRegister(instr->key());
3470 bool key_is_tagged = instr->hydrogen()->key()->representation().IsSmi(); 3470 bool key_is_tagged = instr->hydrogen()->key()->representation().IsSmi();
3471 CalcKeyedArrayBaseRegister(load_base, elements, key, key_is_tagged, 3471 CalcKeyedArrayBaseRegister(load_base, elements, key, key_is_tagged,
3472 instr->hydrogen()->elements_kind()); 3472 instr->hydrogen()->elements_kind());
3473 offset = FixedArray::OffsetOfElementAt(instr->additional_index()); 3473 offset = FixedArray::OffsetOfElementAt(instr->additional_index());
3474 } 3474 }
3475 __ Ldr(result, FieldMemOperand(load_base, offset)); 3475 Representation representation = instr->hydrogen()->representation();
3476
3477 if (representation.IsInteger32() &&
3478 instr->hydrogen()->elements_kind() == FAST_SMI_ELEMENTS) {
3479 STATIC_ASSERT(kSmiValueSize == 32 && kSmiShift == 32 && kSmiTag == 0);
3480 __ Load(result, UntagSmiFieldMemOperand(load_base, offset),
3481 Representation::Integer32());
3482 } else {
3483 __ Load(result, FieldMemOperand(load_base, offset),
3484 representation);
3485 }
3476 3486
3477 if (instr->hydrogen()->RequiresHoleCheck()) { 3487 if (instr->hydrogen()->RequiresHoleCheck()) {
3478 if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) { 3488 if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) {
3479 DeoptimizeIfNotSmi(result, instr->environment()); 3489 DeoptimizeIfNotSmi(result, instr->environment());
3480 } else { 3490 } else {
3481 DeoptimizeIfRoot(result, Heap::kTheHoleValueRootIndex, 3491 DeoptimizeIfRoot(result, Heap::kTheHoleValueRootIndex,
3482 instr->environment()); 3492 instr->environment());
3483 } 3493 }
3484 } 3494 }
3485 } 3495 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
3519 source = object; 3529 source = object;
3520 } else { 3530 } else {
3521 // Load the properties array, using result as a scratch register. 3531 // Load the properties array, using result as a scratch register.
3522 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); 3532 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
3523 source = result; 3533 source = result;
3524 } 3534 }
3525 3535
3526 if (access.representation().IsSmi() && 3536 if (access.representation().IsSmi() &&
3527 instr->hydrogen()->representation().IsInteger32()) { 3537 instr->hydrogen()->representation().IsInteger32()) {
3528 // Read int value directly from upper half of the smi. 3538 // Read int value directly from upper half of the smi.
3539 STATIC_ASSERT(kSmiValueSize == 32 && kSmiShift == 32 && kSmiTag == 0);
3529 __ Load(result, UntagSmiFieldMemOperand(source, offset), 3540 __ Load(result, UntagSmiFieldMemOperand(source, offset),
3530 Representation::Integer32()); 3541 Representation::Integer32());
3531 } else { 3542 } else {
3532 __ Load(result, FieldMemOperand(source, offset), access.representation()); 3543 __ Load(result, FieldMemOperand(source, offset), access.representation());
3533 } 3544 }
3534 } 3545 }
3535 3546
3536 3547
3537 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { 3548 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
3538 // LoadIC expects x2 to hold the name, and x0 to hold the receiver. 3549 // LoadIC expects x2 to hold the name, and x0 to hold the receiver.
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after
4907 offset = FixedArray::OffsetOfElementAt(ToInteger32(const_operand) + 4918 offset = FixedArray::OffsetOfElementAt(ToInteger32(const_operand) +
4908 instr->additional_index()); 4919 instr->additional_index());
4909 store_base = elements; 4920 store_base = elements;
4910 } else { 4921 } else {
4911 key = ToRegister(instr->key()); 4922 key = ToRegister(instr->key());
4912 bool key_is_tagged = instr->hydrogen()->key()->representation().IsSmi(); 4923 bool key_is_tagged = instr->hydrogen()->key()->representation().IsSmi();
4913 CalcKeyedArrayBaseRegister(store_base, elements, key, key_is_tagged, 4924 CalcKeyedArrayBaseRegister(store_base, elements, key, key_is_tagged,
4914 instr->hydrogen()->elements_kind()); 4925 instr->hydrogen()->elements_kind());
4915 offset = FixedArray::OffsetOfElementAt(instr->additional_index()); 4926 offset = FixedArray::OffsetOfElementAt(instr->additional_index());
4916 } 4927 }
4917 __ Str(value, FieldMemOperand(store_base, offset)); 4928 Representation representation = instr->hydrogen()->value()->representation();
4929 if (representation.IsInteger32()) {
4930 ASSERT(instr->hydrogen()->store_mode() == STORE_TO_INITIALIZED_ENTRY);
4931 ASSERT(instr->hydrogen()->elements_kind() == FAST_SMI_ELEMENTS);
4932 STATIC_ASSERT(kSmiValueSize == 32 && kSmiShift == 32 && kSmiTag == 0);
4933 __ Store(value, UntagSmiFieldMemOperand(store_base, offset),
4934 Representation::Integer32());
4935 } else {
4936 __ Store(value, FieldMemOperand(store_base, offset), representation);
4937 }
4918 4938
4919 if (instr->hydrogen()->NeedsWriteBarrier()) { 4939 if (instr->hydrogen()->NeedsWriteBarrier()) {
4920 SmiCheck check_needed = 4940 SmiCheck check_needed =
4921 instr->hydrogen()->value()->IsHeapObject() 4941 instr->hydrogen()->value()->IsHeapObject()
4922 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; 4942 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
4923 // Compute address of modified element and store it into key register. 4943 // Compute address of modified element and store it into key register.
4924 __ Add(key, store_base, offset - kHeapObjectTag); 4944 __ Add(key, store_base, offset - kHeapObjectTag);
4925 __ RecordWrite(elements, key, value, GetLinkRegisterState(), kSaveFPRegs, 4945 __ RecordWrite(elements, key, value, GetLinkRegisterState(), kSaveFPRegs,
4926 EMIT_REMEMBERED_SET, check_needed); 4946 EMIT_REMEMBERED_SET, check_needed);
4927 } 4947 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
4996 Register destination; 5016 Register destination;
4997 SmiCheck check_needed = 5017 SmiCheck check_needed =
4998 instr->hydrogen()->value()->IsHeapObject() 5018 instr->hydrogen()->value()->IsHeapObject()
4999 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; 5019 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
5000 if (access.IsInobject()) { 5020 if (access.IsInobject()) {
5001 destination = object; 5021 destination = object;
5002 } else { 5022 } else {
5003 __ Ldr(temp0, FieldMemOperand(object, JSObject::kPropertiesOffset)); 5023 __ Ldr(temp0, FieldMemOperand(object, JSObject::kPropertiesOffset));
5004 destination = temp0; 5024 destination = temp0;
5005 } 5025 }
5006 __ Store(value, FieldMemOperand(destination, offset), representation); 5026
5027 if (representation.IsSmi() &&
5028 instr->hydrogen()->value()->representation().IsInteger32()) {
5029 ASSERT(instr->hydrogen()->store_mode() == STORE_TO_INITIALIZED_ENTRY);
5030 STATIC_ASSERT(kSmiValueSize == 32 && kSmiShift == 32 && kSmiTag == 0);
5031 __ Store(value, UntagSmiFieldMemOperand(destination, offset),
5032 Representation::Integer32());
5033 } else {
5034 __ Store(value, FieldMemOperand(destination, offset), representation);
5035 }
5007 if (instr->hydrogen()->NeedsWriteBarrier()) { 5036 if (instr->hydrogen()->NeedsWriteBarrier()) {
5008 __ RecordWriteField(destination, 5037 __ RecordWriteField(destination,
5009 offset, 5038 offset,
5010 value, // Clobbered. 5039 value, // Clobbered.
5011 temp1, // Clobbered. 5040 temp1, // Clobbered.
5012 GetLinkRegisterState(), 5041 GetLinkRegisterState(),
5013 kSaveFPRegs, 5042 kSaveFPRegs,
5014 EMIT_REMEMBERED_SET, 5043 EMIT_REMEMBERED_SET,
5015 check_needed); 5044 check_needed);
5016 } 5045 }
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
5629 __ Bind(&out_of_object); 5658 __ Bind(&out_of_object);
5630 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); 5659 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
5631 // Index is equal to negated out of object property index plus 1. 5660 // Index is equal to negated out of object property index plus 1.
5632 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); 5661 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2));
5633 __ Ldr(result, FieldMemOperand(result, 5662 __ Ldr(result, FieldMemOperand(result,
5634 FixedArray::kHeaderSize - kPointerSize)); 5663 FixedArray::kHeaderSize - kPointerSize));
5635 __ Bind(&done); 5664 __ Bind(&done);
5636 } 5665 }
5637 5666
5638 } } // namespace v8::internal 5667 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/a64/lithium-a64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698