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

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

Issue 11791051: Support immediate and memory operands for PushArgumentInstr in optimized code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: really handle constant operands Created 7 years, 11 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/locations.h ('k') | no next file » | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/locations.h" 5 #include "vm/locations.h"
6 6
7 #include "vm/assembler.h"
7 #include "vm/il_printer.h" 8 #include "vm/il_printer.h"
8 #include "vm/intermediate_language.h" 9 #include "vm/intermediate_language.h"
9 #include "vm/flow_graph_compiler.h" 10 #include "vm/flow_graph_compiler.h"
10 11
11 namespace dart { 12 namespace dart {
12 13
13 LocationSummary::LocationSummary(intptr_t input_count, 14 LocationSummary::LocationSummary(intptr_t input_count,
14 intptr_t temp_count, 15 intptr_t temp_count,
15 LocationSummary::ContainsCall contains_call) 16 LocationSummary::ContainsCall contains_call)
16 : input_locations_(input_count), 17 : input_locations_(input_count),
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 71
71 72
72 Location Location::FixedRegisterOrSmiConstant(Value* value, Register reg) { 73 Location Location::FixedRegisterOrSmiConstant(Value* value, Register reg) {
73 ConstantInstr* constant = value->definition()->AsConstant(); 74 ConstantInstr* constant = value->definition()->AsConstant();
74 return ((constant != NULL) && constant->value().IsSmi()) 75 return ((constant != NULL) && constant->value().IsSmi())
75 ? Location::Constant(constant->value()) 76 ? Location::Constant(constant->value())
76 : Location::RegisterLocation(reg); 77 : Location::RegisterLocation(reg);
77 } 78 }
78 79
79 80
81 Location Location::AnyOrConstant(Value* value) {
82 ConstantInstr* constant = value->definition()->AsConstant();
83 return (constant != NULL)
84 ? Location::Constant(constant->value())
85 : Location::Any();
86 }
87
88
89 Address Location::ToStackSlotAddress() const {
90 const intptr_t index = stack_index();
91 if (index < 0) {
92 const intptr_t offset = (1 - index) * kWordSize;
93 return Address(FPREG, offset);
94 } else {
95 const intptr_t offset =
96 (ParsedFunction::kFirstLocalSlotIndex - index) * kWordSize;
97 return Address(FPREG, offset);
98 }
99 }
100
101
80 const char* Location::Name() const { 102 const char* Location::Name() const {
81 switch (kind()) { 103 switch (kind()) {
82 case kInvalid: return "?"; 104 case kInvalid: return "?";
83 case kRegister: return Assembler::RegisterName(reg()); 105 case kRegister: return Assembler::RegisterName(reg());
84 case kXmmRegister: return Assembler::XmmRegisterName(xmm_reg()); 106 case kXmmRegister: return Assembler::XmmRegisterName(xmm_reg());
85 case kStackSlot: return "S"; 107 case kStackSlot: return "S";
86 case kDoubleStackSlot: return "DS"; 108 case kDoubleStackSlot: return "DS";
87 case kUnallocated: 109 case kUnallocated:
88 switch (policy()) { 110 switch (policy()) {
89 case kAny: 111 case kAny:
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 171
150 if (!out().IsInvalid()) { 172 if (!out().IsInvalid()) {
151 f->Print(" => "); 173 f->Print(" => ");
152 out().PrintTo(f); 174 out().PrintTo(f);
153 } 175 }
154 176
155 if (always_calls()) f->Print(" C"); 177 if (always_calls()) f->Print(" C");
156 } 178 }
157 179
158 } // namespace dart 180 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/locations.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698