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

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

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