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

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

Issue 346823003: VM: Optimized context allocation on all platforms. (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/assembler_arm.h ('k') | runtime/vm/assembler_arm64.h » ('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" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/longjump.h" 10 #include "vm/longjump.h"
(...skipping 3163 matching lines...) Expand 10 before | Expand all | Expand 10 after
3174 ASSERT(cls.id() != kIllegalCid); 3174 ASSERT(cls.id() != kIllegalCid);
3175 tags = RawObject::ClassIdTag::update(cls.id(), tags); 3175 tags = RawObject::ClassIdTag::update(cls.id(), tags);
3176 LoadImmediate(IP, tags); 3176 LoadImmediate(IP, tags);
3177 str(IP, FieldAddress(instance_reg, Object::tags_offset())); 3177 str(IP, FieldAddress(instance_reg, Object::tags_offset()));
3178 } else { 3178 } else {
3179 b(failure); 3179 b(failure);
3180 } 3180 }
3181 } 3181 }
3182 3182
3183 3183
3184 void Assembler::TryAllocateArray(intptr_t cid,
3185 intptr_t instance_size,
3186 Label* failure,
3187 Register instance,
3188 Register end_address,
3189 Register temp1,
3190 Register temp2) {
3191 if (FLAG_inline_alloc) {
3192 Isolate* isolate = Isolate::Current();
3193 Heap* heap = isolate->heap();
3194 LoadImmediate(temp1, heap->TopAddress());
3195 ldr(instance, Address(temp1, 0)); // Potential new object start.
3196 AddImmediate(end_address, instance, instance_size);
3197 b(failure, VS);
3198
3199 // Check if the allocation fits into the remaining space.
3200 // instance: potential new object start.
3201 // end_address: potential next object start.
3202 LoadImmediate(temp2, heap->EndAddress());
3203 ldr(temp2, Address(temp2, 0));
3204 cmp(end_address, Operand(temp2));
3205 b(failure, CS);
3206
3207 // Successfully allocated the object(s), now update top to point to
3208 // next object start and initialize the object.
3209 str(end_address, Address(temp1, 0));
3210 add(instance, instance, Operand(kHeapObjectTag));
3211 LoadImmediate(temp2, instance_size);
3212 UpdateAllocationStatsWithSize(cid, temp2, temp1);
3213
3214 // Initialize the tags.
3215 // instance: new object start as a tagged pointer.
3216 uword tags = 0;
3217 tags = RawObject::ClassIdTag::update(cid, tags);
3218 tags = RawObject::SizeTag::update(instance_size, tags);
3219 LoadImmediate(temp2, tags);
3220 str(temp2, FieldAddress(instance, Array::tags_offset())); // Store tags.
3221 } else {
3222 b(failure);
3223 }
3224 }
3225
3226
3184 void Assembler::Stop(const char* message) { 3227 void Assembler::Stop(const char* message) {
3185 if (FLAG_print_stop_message) { 3228 if (FLAG_print_stop_message) {
3186 StubCode* stub_code = Isolate::Current()->stub_code(); 3229 StubCode* stub_code = Isolate::Current()->stub_code();
3187 PushList((1 << R0) | (1 << IP) | (1 << LR)); // Preserve R0, IP, LR. 3230 PushList((1 << R0) | (1 << IP) | (1 << LR)); // Preserve R0, IP, LR.
3188 LoadImmediate(R0, reinterpret_cast<int32_t>(message)); 3231 LoadImmediate(R0, reinterpret_cast<int32_t>(message));
3189 // PrintStopMessage() preserves all registers. 3232 // PrintStopMessage() preserves all registers.
3190 BranchLink(&stub_code->PrintStopMessageLabel()); // Passing message in R0. 3233 BranchLink(&stub_code->PrintStopMessageLabel()); // Passing message in R0.
3191 PopList((1 << R0) | (1 << IP) | (1 << LR)); // Restore R0, IP, LR. 3234 PopList((1 << R0) | (1 << IP) | (1 << LR)); // Restore R0, IP, LR.
3192 } 3235 }
3193 // Emit the message address before the svc instruction, so that we can 3236 // Emit the message address before the svc instruction, so that we can
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
3324 3367
3325 3368
3326 const char* Assembler::FpuRegisterName(FpuRegister reg) { 3369 const char* Assembler::FpuRegisterName(FpuRegister reg) {
3327 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); 3370 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters));
3328 return fpu_reg_names[reg]; 3371 return fpu_reg_names[reg];
3329 } 3372 }
3330 3373
3331 } // namespace dart 3374 } // namespace dart
3332 3375
3333 #endif // defined TARGET_ARCH_ARM 3376 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/assembler_arm.h ('k') | runtime/vm/assembler_arm64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698