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

Side by Side Diff: runtime/vm/intrinsifier_arm.cc

Issue 475763002: VM: Small cleanup in optimizer and intrinsics code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 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 | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/intrinsifier_arm64.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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/intrinsifier.h" 8 #include "vm/intrinsifier.h"
9 9
10 #include "vm/assembler.h" 10 #include "vm/assembler.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 136
137 137
138 // Allocate a GrowableObjectArray using the backing array specified. 138 // Allocate a GrowableObjectArray using the backing array specified.
139 // On stack: type argument (+1), data (+0). 139 // On stack: type argument (+1), data (+0).
140 void Intrinsifier::GrowableList_Allocate(Assembler* assembler) { 140 void Intrinsifier::GrowableList_Allocate(Assembler* assembler) {
141 // The newly allocated object is returned in R0. 141 // The newly allocated object is returned in R0.
142 const intptr_t kTypeArgumentsOffset = 1 * kWordSize; 142 const intptr_t kTypeArgumentsOffset = 1 * kWordSize;
143 const intptr_t kArrayOffset = 0 * kWordSize; 143 const intptr_t kArrayOffset = 0 * kWordSize;
144 Label fall_through; 144 Label fall_through;
145 145
146 // Compute the size to be allocated, it is based on the array length 146 // Try allocating in new space.
147 // and is computed as:
148 // RoundedAllocationSize(sizeof(RawGrowableObjectArray)) +
149 intptr_t fixed_size = GrowableObjectArray::InstanceSize();
150
151 Isolate* isolate = Isolate::Current();
152 Heap* heap = isolate->heap();
153
154 __ LoadImmediate(R2, heap->TopAddress());
155 __ ldr(R0, Address(R2, 0));
156 __ AddImmediate(R1, R0, fixed_size);
157
158 // Check if the allocation fits into the remaining space.
159 // R0: potential new backing array object start.
160 // R1: potential next object start.
161 __ LoadImmediate(R3, heap->EndAddress());
162 __ ldr(R3, Address(R3, 0));
163 __ cmp(R1, Operand(R3));
164 __ b(&fall_through, CS);
165
166 // Successfully allocated the object(s), now update top to point to
167 // next object start and initialize the object.
168 __ str(R1, Address(R2, 0));
169 __ AddImmediate(R0, kHeapObjectTag);
170
171 // Initialize the tags.
172 // R0: new growable array object start as a tagged pointer.
173 const Class& cls = Class::Handle( 147 const Class& cls = Class::Handle(
174 isolate->object_store()->growable_object_array_class()); 148 Isolate::Current()->object_store()->growable_object_array_class());
175 uword tags = 0; 149 __ TryAllocate(cls, &fall_through, R0, R1);
176 tags = RawObject::SizeTag::update(fixed_size, tags);
177 tags = RawObject::ClassIdTag::update(cls.id(), tags);
178 __ LoadImmediate(R1, tags);
179 __ str(R1, FieldAddress(R0, GrowableObjectArray::tags_offset()));
180 150
181 // Store backing array object in growable array object. 151 // Store backing array object in growable array object.
182 __ ldr(R1, Address(SP, kArrayOffset)); // Data argument. 152 __ ldr(R1, Address(SP, kArrayOffset)); // Data argument.
183 // R0 is new, no barrier needed. 153 // R0 is new, no barrier needed.
184 __ StoreIntoObjectNoBarrier( 154 __ StoreIntoObjectNoBarrier(
185 R0, 155 R0,
186 FieldAddress(R0, GrowableObjectArray::data_offset()), 156 FieldAddress(R0, GrowableObjectArray::data_offset()),
187 R1); 157 R1);
188 158
189 // R0: new growable array object start as a tagged pointer. 159 // R0: new growable array object start as a tagged pointer.
(...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1767 Isolate* isolate = Isolate::Current(); 1737 Isolate* isolate = Isolate::Current();
1768 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); 1738 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate));
1769 // Set return value to Isolate::current_tag_. 1739 // Set return value to Isolate::current_tag_.
1770 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); 1740 __ ldr(R0, Address(R1, Isolate::current_tag_offset()));
1771 __ Ret(); 1741 __ Ret();
1772 } 1742 }
1773 1743
1774 } // namespace dart 1744 } // namespace dart
1775 1745
1776 #endif // defined TARGET_ARCH_ARM 1746 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/intrinsifier_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698