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

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

Issue 1192103004: VM: New calling convention for generated code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fixed comments Created 5 years, 3 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 | « runtime/vm/intermediate_language.cc ('k') | runtime/vm/intermediate_language_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/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 // Load arguments descriptor in R4. 216 // Load arguments descriptor in R4.
217 int argument_count = ArgumentCount(); 217 int argument_count = ArgumentCount();
218 const Array& arguments_descriptor = 218 const Array& arguments_descriptor =
219 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count, 219 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count,
220 argument_names())); 220 argument_names()));
221 __ LoadObject(R4, arguments_descriptor); 221 __ LoadObject(R4, arguments_descriptor);
222 222
223 // R4: Arguments descriptor. 223 // R4: Arguments descriptor.
224 // R0: Function. 224 // R0: Function.
225 ASSERT(locs()->in(0).reg() == R0); 225 ASSERT(locs()->in(0).reg() == R0);
226 __ ldr(CODE_REG, FieldAddress(R0, Function::code_offset()));
226 __ ldr(R2, FieldAddress(R0, Function::entry_point_offset())); 227 __ ldr(R2, FieldAddress(R0, Function::entry_point_offset()));
227 228
228 // R2: instructions entry point. 229 // R2: instructions entry point.
229 // R5: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). 230 // R5: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value).
230 __ LoadImmediate(R5, 0); 231 __ LoadImmediate(R5, 0);
231 __ blx(R2); 232 __ blx(R2);
232 compiler->RecordSafepoint(locs()); 233 compiler->RecordSafepoint(locs());
233 // Marks either the continuation point in unoptimized code or the 234 // Marks either the continuation point in unoptimized code or the
234 // deoptimization point in optimized code, after call. 235 // deoptimization point in optimized code, after call.
235 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id()); 236 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id());
(...skipping 2086 matching lines...) Expand 10 before | Expand all | Expand 10 after
2322 Label* done) { 2323 Label* done) {
2323 const int kInlineArraySize = 12; // Same as kInlineInstanceSize. 2324 const int kInlineArraySize = 12; // Same as kInlineInstanceSize.
2324 const Register kLengthReg = R2; 2325 const Register kLengthReg = R2;
2325 const Register kElemTypeReg = R1; 2326 const Register kElemTypeReg = R1;
2326 const intptr_t instance_size = Array::InstanceSize(num_elements); 2327 const intptr_t instance_size = Array::InstanceSize(num_elements);
2327 2328
2328 __ TryAllocateArray(kArrayCid, instance_size, slow_path, 2329 __ TryAllocateArray(kArrayCid, instance_size, slow_path,
2329 R0, // instance 2330 R0, // instance
2330 R3, // end address 2331 R3, // end address
2331 R6, 2332 R6,
2332 R9); 2333 R10);
2333 // R0: new object start as a tagged pointer. 2334 // R0: new object start as a tagged pointer.
2334 // R3: new object end address. 2335 // R3: new object end address.
2335 2336
2336 // Store the type argument field. 2337 // Store the type argument field.
2337 __ InitializeFieldNoBarrier(R0, 2338 __ InitializeFieldNoBarrier(R0,
2338 FieldAddress(R0, Array::type_arguments_offset()), 2339 FieldAddress(R0, Array::type_arguments_offset()),
2339 kElemTypeReg); 2340 kElemTypeReg);
2340 2341
2341 // Set the length field. 2342 // Set the length field.
2342 __ InitializeFieldNoBarrier(R0, 2343 __ InitializeFieldNoBarrier(R0,
2343 FieldAddress(R0, Array::length_offset()), 2344 FieldAddress(R0, Array::length_offset()),
2344 kLengthReg); 2345 kLengthReg);
2345 2346
2346 // Initialize all array elements to raw_null. 2347 // Initialize all array elements to raw_null.
2347 // R0: new object start as a tagged pointer. 2348 // R0: new object start as a tagged pointer.
2348 // R3: new object end address. 2349 // R3: new object end address.
2349 // R9: iterator which initially points to the start of the variable 2350 // R10: iterator which initially points to the start of the variable
2350 // data area to be initialized. 2351 // data area to be initialized.
2351 // R6: null 2352 // R6: null
2352 if (num_elements > 0) { 2353 if (num_elements > 0) {
2353 const intptr_t array_size = instance_size - sizeof(RawArray); 2354 const intptr_t array_size = instance_size - sizeof(RawArray);
2354 __ LoadObject(R6, Object::null_object()); 2355 __ LoadObject(R6, Object::null_object());
2355 if (num_elements >= 2) { 2356 if (num_elements >= 2) {
2356 __ mov(R7, Operand(R6)); 2357 __ mov(R7, Operand(R6));
2357 } else { 2358 } else {
2358 #if defined(DEBUG) 2359 #if defined(DEBUG)
2359 // Clobber R7 with an invalid pointer. 2360 // Clobber R7 with an invalid pointer.
2360 __ LoadImmediate(R7, 0x1); 2361 __ LoadImmediate(R7, 0x1);
2361 #endif // DEBUG 2362 #endif // DEBUG
2362 } 2363 }
2363 __ AddImmediate(R9, R0, sizeof(RawArray) - kHeapObjectTag); 2364 __ AddImmediate(R10, R0, sizeof(RawArray) - kHeapObjectTag);
2364 if (array_size < (kInlineArraySize * kWordSize)) { 2365 if (array_size < (kInlineArraySize * kWordSize)) {
2365 __ InitializeFieldsNoBarrierUnrolled(R0, R9, 0, num_elements * kWordSize, 2366 __ InitializeFieldsNoBarrierUnrolled(R0, R10, 0, num_elements * kWordSize,
2366 R6, R7); 2367 R6, R7);
2367 } else { 2368 } else {
2368 __ InitializeFieldsNoBarrier(R0, R9, R3, R6, R7); 2369 __ InitializeFieldsNoBarrier(R0, R10, R3, R6, R7);
2369 } 2370 }
2370 } 2371 }
2371 __ b(done); 2372 __ b(done);
2372 } 2373 }
2373 2374
2374 2375
2375 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2376 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2376 const Register kLengthReg = R2; 2377 const Register kLengthReg = R2;
2377 const Register kElemTypeReg = R1; 2378 const Register kElemTypeReg = R1;
2378 const Register kResultReg = R0; 2379 const Register kResultReg = R0;
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
2830 } 2831 }
2831 2832
2832 2833
2833 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2834 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2834 __ Bind(compiler->GetJumpLabel(this)); 2835 __ Bind(compiler->GetJumpLabel(this));
2835 compiler->AddExceptionHandler(catch_try_index(), 2836 compiler->AddExceptionHandler(catch_try_index(),
2836 try_index(), 2837 try_index(),
2837 compiler->assembler()->CodeSize(), 2838 compiler->assembler()->CodeSize(),
2838 catch_handler_types_, 2839 catch_handler_types_,
2839 needs_stacktrace()); 2840 needs_stacktrace());
2840
2841 // Restore the pool pointer. 2841 // Restore the pool pointer.
2842 __ RestoreCodePointer();
2842 __ LoadPoolPointer(); 2843 __ LoadPoolPointer();
2843 2844
2844 if (HasParallelMove()) { 2845 if (HasParallelMove()) {
2845 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 2846 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
2846 } 2847 }
2847 2848
2848 // Restore SP from FP as we are coming from a throw and the code for 2849 // Restore SP from FP as we are coming from a throw and the code for
2849 // popping arguments has not been run. 2850 // popping arguments has not been run.
2850 const intptr_t fp_sp_dist = 2851 const intptr_t fp_sp_dist =
2851 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; 2852 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize;
(...skipping 3827 matching lines...) Expand 10 before | Expand all | Expand 10 after
6679 summary->set_in(0, Location::RequiresRegister()); 6680 summary->set_in(0, Location::RequiresRegister());
6680 summary->set_temp(0, Location::RequiresRegister()); 6681 summary->set_temp(0, Location::RequiresRegister());
6681 6682
6682 return summary; 6683 return summary;
6683 } 6684 }
6684 6685
6685 6686
6686 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 6687 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6687 Register target_address_reg = locs()->temp_slot(0)->reg(); 6688 Register target_address_reg = locs()->temp_slot(0)->reg();
6688 6689
6689 // Load from [current frame pointer] + kPcMarkerSlotFromFp. 6690 // Offset is relative to entry pc.
6690 __ ldr(target_address_reg, Address(FP, kPcMarkerSlotFromFp * kWordSize)); 6691 const intptr_t entry_to_pc_offset = __ CodeSize() + Instr::kPCReadOffset;
6691 6692 __ mov(target_address_reg, Operand(PC));
6693 __ AddImmediate(target_address_reg, target_address_reg, -entry_to_pc_offset);
6692 // Add the offset. 6694 // Add the offset.
6693 Register offset_reg = locs()->in(0).reg(); 6695 Register offset_reg = locs()->in(0).reg();
6694 Operand offset_opr = 6696 Operand offset_opr =
6695 (offset()->definition()->representation() == kTagged) ? 6697 (offset()->definition()->representation() == kTagged) ?
6696 Operand(offset_reg, ASR, kSmiTagSize) : 6698 Operand(offset_reg, ASR, kSmiTagSize) :
6697 Operand(offset_reg); 6699 Operand(offset_reg);
6698 __ add(target_address_reg, target_address_reg, offset_opr); 6700 __ add(target_address_reg, target_address_reg, offset_opr);
6699 6701
6700 // Jump to the absolute address. 6702 // Jump to the absolute address.
6701 __ bx(target_address_reg); 6703 __ bx(target_address_reg);
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
6862 1, 6864 1,
6863 locs()); 6865 locs());
6864 __ Drop(1); 6866 __ Drop(1);
6865 __ Pop(result); 6867 __ Pop(result);
6866 } 6868 }
6867 6869
6868 6870
6869 } // namespace dart 6871 } // namespace dart
6870 6872
6871 #endif // defined TARGET_ARCH_ARM 6873 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | runtime/vm/intermediate_language_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698