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

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

Issue 190783002: A64: Improve constraints on StoreKeyed instructions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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 5041 matching lines...) Expand 10 before | Expand all | Expand 10 after
5052 UNREACHABLE(); 5052 UNREACHABLE();
5053 break; 5053 break;
5054 } 5054 }
5055 } 5055 }
5056 } 5056 }
5057 5057
5058 5058
5059 void LCodeGen::DoStoreKeyedFixedDouble(LStoreKeyedFixedDouble* instr) { 5059 void LCodeGen::DoStoreKeyedFixedDouble(LStoreKeyedFixedDouble* instr) {
5060 Register elements = ToRegister(instr->elements()); 5060 Register elements = ToRegister(instr->elements());
5061 DoubleRegister value = ToDoubleRegister(instr->value()); 5061 DoubleRegister value = ToDoubleRegister(instr->value());
5062 Register store_base = ToRegister(instr->temp()); 5062 Register store_base = no_reg;
5063 int offset = 0; 5063 int offset = 0;
5064 5064
5065 if (instr->key()->IsConstantOperand()) { 5065 if (instr->key()->IsConstantOperand()) {
5066 int constant_key = ToInteger32(LConstantOperand::cast(instr->key())); 5066 int constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
5067 if (constant_key & 0xf0000000) { 5067 if (constant_key & 0xf0000000) {
5068 Abort(kArrayIndexConstantValueTooBig); 5068 Abort(kArrayIndexConstantValueTooBig);
5069 } 5069 }
5070 offset = FixedDoubleArray::OffsetOfElementAt(constant_key + 5070 offset = FixedDoubleArray::OffsetOfElementAt(constant_key +
5071 instr->additional_index()); 5071 instr->additional_index());
5072 store_base = elements; 5072 store_base = elements;
5073 } else { 5073 } else {
5074 store_base = ToRegister(instr->temp());
5074 Register key = ToRegister(instr->key()); 5075 Register key = ToRegister(instr->key());
5075 bool key_is_tagged = instr->hydrogen()->key()->representation().IsSmi(); 5076 bool key_is_tagged = instr->hydrogen()->key()->representation().IsSmi();
5076 CalcKeyedArrayBaseRegister(store_base, elements, key, key_is_tagged, 5077 CalcKeyedArrayBaseRegister(store_base, elements, key, key_is_tagged,
5077 instr->hydrogen()->elements_kind()); 5078 instr->hydrogen()->elements_kind());
5078 offset = FixedDoubleArray::OffsetOfElementAt(instr->additional_index()); 5079 offset = FixedDoubleArray::OffsetOfElementAt(instr->additional_index());
5079 } 5080 }
5080 5081
5081 if (instr->NeedsCanonicalization()) { 5082 if (instr->NeedsCanonicalization()) {
5082 DoubleRegister dbl_scratch = double_scratch(); 5083 DoubleRegister dbl_scratch = double_scratch();
5083 __ Fmov(dbl_scratch, 5084 __ Fmov(dbl_scratch,
5084 FixedDoubleArray::canonical_not_the_hole_nan_as_double()); 5085 FixedDoubleArray::canonical_not_the_hole_nan_as_double());
5085 __ Fmaxnm(dbl_scratch, dbl_scratch, value); 5086 __ Fmaxnm(dbl_scratch, dbl_scratch, value);
5086 __ Str(dbl_scratch, FieldMemOperand(store_base, offset)); 5087 __ Str(dbl_scratch, FieldMemOperand(store_base, offset));
5087 } else { 5088 } else {
5088 __ Str(value, FieldMemOperand(store_base, offset)); 5089 __ Str(value, FieldMemOperand(store_base, offset));
5089 } 5090 }
5090 } 5091 }
5091 5092
5092 5093
5093 void LCodeGen::DoStoreKeyedFixed(LStoreKeyedFixed* instr) { 5094 void LCodeGen::DoStoreKeyedFixed(LStoreKeyedFixed* instr) {
5094 Register value = ToRegister(instr->value()); 5095 Register value = ToRegister(instr->value());
5095 Register elements = ToRegister(instr->elements()); 5096 Register elements = ToRegister(instr->elements());
5096 Register store_base = ToRegister(instr->temp()); 5097 Register scratch = no_reg;
5098 Register store_base = no_reg;
5097 Register key = no_reg; 5099 Register key = no_reg;
5098 int offset = 0; 5100 int offset = 0;
5099 5101
5102 if (!instr->key()->IsConstantOperand() ||
5103 instr->hydrogen()->NeedsWriteBarrier()) {
5104 scratch = ToRegister(instr->temp());
5105 }
5106
5100 if (instr->key()->IsConstantOperand()) { 5107 if (instr->key()->IsConstantOperand()) {
5101 ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
5102 LConstantOperand* const_operand = LConstantOperand::cast(instr->key()); 5108 LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
5103 offset = FixedArray::OffsetOfElementAt(ToInteger32(const_operand) + 5109 offset = FixedArray::OffsetOfElementAt(ToInteger32(const_operand) +
5104 instr->additional_index()); 5110 instr->additional_index());
5105 store_base = elements; 5111 store_base = elements;
5106 } else { 5112 } else {
5113 store_base = scratch;
5107 key = ToRegister(instr->key()); 5114 key = ToRegister(instr->key());
5108 bool key_is_tagged = instr->hydrogen()->key()->representation().IsSmi(); 5115 bool key_is_tagged = instr->hydrogen()->key()->representation().IsSmi();
5109 CalcKeyedArrayBaseRegister(store_base, elements, key, key_is_tagged, 5116 CalcKeyedArrayBaseRegister(store_base, elements, key, key_is_tagged,
5110 instr->hydrogen()->elements_kind()); 5117 instr->hydrogen()->elements_kind());
5111 offset = FixedArray::OffsetOfElementAt(instr->additional_index()); 5118 offset = FixedArray::OffsetOfElementAt(instr->additional_index());
5112 } 5119 }
5113 Representation representation = instr->hydrogen()->value()->representation(); 5120 Representation representation = instr->hydrogen()->value()->representation();
5114 if (representation.IsInteger32()) { 5121 if (representation.IsInteger32()) {
5115 ASSERT(instr->hydrogen()->store_mode() == STORE_TO_INITIALIZED_ENTRY); 5122 ASSERT(instr->hydrogen()->store_mode() == STORE_TO_INITIALIZED_ENTRY);
5116 ASSERT(instr->hydrogen()->elements_kind() == FAST_SMI_ELEMENTS); 5123 ASSERT(instr->hydrogen()->elements_kind() == FAST_SMI_ELEMENTS);
5117 STATIC_ASSERT(kSmiValueSize == 32 && kSmiShift == 32 && kSmiTag == 0); 5124 STATIC_ASSERT(kSmiValueSize == 32 && kSmiShift == 32 && kSmiTag == 0);
5118 __ Store(value, UntagSmiFieldMemOperand(store_base, offset), 5125 __ Store(value, UntagSmiFieldMemOperand(store_base, offset),
5119 Representation::Integer32()); 5126 Representation::Integer32());
5120 } else { 5127 } else {
5121 __ Store(value, FieldMemOperand(store_base, offset), representation); 5128 __ Store(value, FieldMemOperand(store_base, offset), representation);
5122 } 5129 }
5123 5130
5124 if (instr->hydrogen()->NeedsWriteBarrier()) { 5131 if (instr->hydrogen()->NeedsWriteBarrier()) {
5132 ASSERT(representation.IsTagged());
5133 // This assignment may cause element_addr to alias store_base.
5134 Register element_addr = scratch;
5125 SmiCheck check_needed = 5135 SmiCheck check_needed =
5126 instr->hydrogen()->value()->IsHeapObject() 5136 instr->hydrogen()->value()->IsHeapObject()
5127 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; 5137 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
5128 // Compute address of modified element and store it into key register. 5138 // Compute address of modified element and store it into key register.
5129 __ Add(key, store_base, offset - kHeapObjectTag); 5139 __ Add(element_addr, store_base, offset - kHeapObjectTag);
5130 __ RecordWrite(elements, key, value, GetLinkRegisterState(), kSaveFPRegs, 5140 __ RecordWrite(elements, element_addr, value, GetLinkRegisterState(),
5131 EMIT_REMEMBERED_SET, check_needed); 5141 kSaveFPRegs, EMIT_REMEMBERED_SET, check_needed);
5132 } 5142 }
5133 } 5143 }
5134 5144
5135 5145
5136 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { 5146 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
5137 ASSERT(ToRegister(instr->context()).is(cp)); 5147 ASSERT(ToRegister(instr->context()).is(cp));
5138 ASSERT(ToRegister(instr->object()).Is(x2)); 5148 ASSERT(ToRegister(instr->object()).Is(x2));
5139 ASSERT(ToRegister(instr->key()).Is(x1)); 5149 ASSERT(ToRegister(instr->key()).Is(x1));
5140 ASSERT(ToRegister(instr->value()).Is(x0)); 5150 ASSERT(ToRegister(instr->value()).Is(x0));
5141 5151
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
5801 __ Bind(&out_of_object); 5811 __ Bind(&out_of_object);
5802 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); 5812 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
5803 // Index is equal to negated out of object property index plus 1. 5813 // Index is equal to negated out of object property index plus 1.
5804 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); 5814 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2));
5805 __ Ldr(result, FieldMemOperand(result, 5815 __ Ldr(result, FieldMemOperand(result,
5806 FixedArray::kHeaderSize - kPointerSize)); 5816 FixedArray::kHeaderSize - kPointerSize));
5807 __ Bind(&done); 5817 __ Bind(&done);
5808 } 5818 }
5809 5819
5810 } } // namespace v8::internal 5820 } } // 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