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

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

Issue 513213002: Generate some intrinsics using our IR. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | Annotate | Revision Log
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // where PushArgument is handled by BindInstr::EmitNativeCode. 56 // where PushArgument is handled by BindInstr::EmitNativeCode.
57 if (compiler->is_optimizing()) { 57 if (compiler->is_optimizing()) {
58 Location value = locs()->in(0); 58 Location value = locs()->in(0);
59 if (value.IsRegister()) { 59 if (value.IsRegister()) {
60 __ Push(value.reg()); 60 __ Push(value.reg());
61 } else if (value.IsConstant()) { 61 } else if (value.IsConstant()) {
62 __ PushObject(value.constant()); 62 __ PushObject(value.constant());
63 } else { 63 } else {
64 ASSERT(value.IsStackSlot()); 64 ASSERT(value.IsStackSlot());
65 const intptr_t value_offset = value.ToStackSlotOffset(); 65 const intptr_t value_offset = value.ToStackSlotOffset();
66 __ LoadFromOffset(kWord, IP, FP, value_offset); 66 __ LoadFromOffset(kWord, IP, value.base_reg(), value_offset);
67 __ Push(IP); 67 __ Push(IP);
68 } 68 }
69 } 69 }
70 } 70 }
71 71
72 72
73 LocationSummary* ReturnInstr::MakeLocationSummary(Isolate* isolate, 73 LocationSummary* ReturnInstr::MakeLocationSummary(Isolate* isolate,
74 bool opt) const { 74 bool opt) const {
75 const intptr_t kNumInputs = 1; 75 const intptr_t kNumInputs = 1;
76 const intptr_t kNumTemps = 0; 76 const intptr_t kNumTemps = 0;
77 LocationSummary* locs = new(isolate) LocationSummary( 77 LocationSummary* locs = new(isolate) LocationSummary(
78 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 78 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
79 locs->set_in(0, Location::RegisterLocation(R0)); 79 locs->set_in(0, Location::RegisterLocation(R0));
80 return locs; 80 return locs;
81 } 81 }
82 82
83 83
84 // Attempt optimized compilation at return instruction instead of at the entry. 84 // Attempt optimized compilation at return instruction instead of at the entry.
85 // The entry needs to be patchable, no inlined objects are allowed in the area 85 // The entry needs to be patchable, no inlined objects are allowed in the area
86 // that will be overwritten by the patch instructions: a branch macro sequence. 86 // that will be overwritten by the patch instructions: a branch macro sequence.
87 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 87 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
88 const Register result = locs()->in(0).reg(); 88 const Register result = locs()->in(0).reg();
89 ASSERT(result == R0); 89 ASSERT(result == R0);
90
91 if (is_intrinsic_) {
92 // Intrinsics don't have a frame.
93 __ Ret();
94 return;
95 }
96
90 #if defined(DEBUG) 97 #if defined(DEBUG)
91 Label stack_ok; 98 Label stack_ok;
92 __ Comment("Stack Check"); 99 __ Comment("Stack Check");
93 const intptr_t fp_sp_dist = 100 const intptr_t fp_sp_dist =
94 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; 101 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize;
95 ASSERT(fp_sp_dist <= 0); 102 ASSERT(fp_sp_dist <= 0);
96 __ sub(R2, SP, Operand(FP)); 103 __ sub(R2, SP, Operand(FP));
97 __ CompareImmediate(R2, fp_sp_dist); 104 __ CompareImmediate(R2, fp_sp_dist);
98 __ b(&stack_ok, EQ); 105 __ b(&stack_ok, EQ);
99 __ bkpt(0); 106 __ bkpt(0);
(...skipping 7116 matching lines...) Expand 10 before | Expand all | Expand 10 after
7216 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 7223 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
7217 #if defined(DEBUG) 7224 #if defined(DEBUG)
7218 __ LoadImmediate(R4, kInvalidObjectPointer); 7225 __ LoadImmediate(R4, kInvalidObjectPointer);
7219 __ LoadImmediate(R5, kInvalidObjectPointer); 7226 __ LoadImmediate(R5, kInvalidObjectPointer);
7220 #endif 7227 #endif
7221 } 7228 }
7222 7229
7223 } // namespace dart 7230 } // namespace dart
7224 7231
7225 #endif // defined TARGET_ARCH_ARM 7232 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698