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

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

Issue 10541069: Add more intrinsics, enable new compiler's optimized mode for ia32. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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
« runtime/vm/compiler.cc ('K') | « runtime/vm/flow_graph_optimizer.cc ('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/globals.h" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/intrinsifier.h" 8 #include "vm/intrinsifier.h"
9 9
10 #include "vm/assembler.h" 10 #include "vm/assembler.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 bool Intrinsifier::GrowableArray_getCapacity(Assembler* assembler) { 110 bool Intrinsifier::GrowableArray_getCapacity(Assembler* assembler) {
111 __ movq(RAX, Address(RSP, + 1 * kWordSize)); 111 __ movq(RAX, Address(RSP, + 1 * kWordSize));
112 __ movq(RAX, FieldAddress(RAX, GrowableObjectArray::data_offset())); 112 __ movq(RAX, FieldAddress(RAX, GrowableObjectArray::data_offset()));
113 __ movq(RAX, FieldAddress(RAX, Array::length_offset())); 113 __ movq(RAX, FieldAddress(RAX, Array::length_offset()));
114 __ ret(); 114 __ ret();
115 return true; 115 return true;
116 } 116 }
117 117
118 118
119 // Access growable object array at specified index.
120 // On stack: growable array (+2), index (+1), return-address (+0).
119 bool Intrinsifier::GrowableArray_getIndexed(Assembler* assembler) { 121 bool Intrinsifier::GrowableArray_getIndexed(Assembler* assembler) {
122 Label fall_through;
123 __ movq(RCX, Address(RSP, + 1 * kWordSize)); // Index.
124 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // GrowableArray.
125 __ testq(RCX, Immediate(kSmiTagMask));
126 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index.
127 // Range check using _length field.
128 __ cmpq(RCX, FieldAddress(RAX, GrowableObjectArray::length_offset()));
129 // Runtime throws exception.
130 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump);
131 __ movq(RAX, FieldAddress(RAX, GrowableObjectArray::data_offset())); // data.
132
133 // Note that RCX is Smi, i.e, times 2.
Vyacheslav Egorov (Google) 2012/06/08 11:32:53 times 4
srdjan 2012/06/08 14:55:24 Done.
134 ASSERT(kSmiTagShift == 1);
135 __ movq(RAX, FieldAddress(RAX, RCX, TIMES_4, sizeof(RawArray)));
136 __ ret();
137 __ Bind(&fall_through);
120 return false; 138 return false;
121 } 139 }
122 140
123 141
142 // Set value into growable object array at specified index.
143 // On stack: growable array (+3), index (+2), value (+1), return-address (+0).
124 bool Intrinsifier::GrowableArray_setIndexed(Assembler* assembler) { 144 bool Intrinsifier::GrowableArray_setIndexed(Assembler* assembler) {
145 if (FLAG_enable_type_checks) {
146 return false;
147 }
148 __ movq(RDX, Address(RSP, + 1 * kWordSize)); // Value.
149 __ movq(RCX, Address(RSP, + 2 * kWordSize)); // Index.
150 __ movq(RAX, Address(RSP, + 3 * kWordSize)); // GrowableArray.
151 Label fall_through;
152 __ testq(RCX, Immediate(kSmiTagMask));
153 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index.
154 // Range check using _length field.
155 __ cmpq(RCX, FieldAddress(RAX, GrowableObjectArray::length_offset()));
156 // Runtime throws exception.
157 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump);
158 __ movq(RAX, FieldAddress(RAX, GrowableObjectArray::data_offset())); // data.
159 // Note that EBX is Smi, i.e, times 2.
Vyacheslav Egorov (Google) 2012/06/08 11:32:53 times 4
srdjan 2012/06/08 14:55:24 Done.
160 ASSERT(kSmiTagShift == 1);
161 __ StoreIntoObject(RAX,
162 FieldAddress(RAX, RCX, TIMES_4, sizeof(RawArray)),
163 RDX);
164 __ ret();
165 __ Bind(&fall_through);
125 return false; 166 return false;
126 } 167 }
127 168
128 169
170 // Set length of growable object array.
171 // On stack: growable array (+2), length (+1), return-address (+0).
129 bool Intrinsifier::GrowableArray_setLength(Assembler* assembler) { 172 bool Intrinsifier::GrowableArray_setLength(Assembler* assembler) {
173 Label fall_through;
174 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Growable array.
175 __ movq(RCX, Address(RSP, + 1 * kWordSize)); // Length.
176 __ movq(RDX, FieldAddress(RAX, GrowableObjectArray::data_offset()));
177 __ cmpq(RCX, FieldAddress(RDX, Array::length_offset()));
178 __ j(ABOVE, &fall_through, Assembler::kNearJump);
179 __ movq(FieldAddress(RAX, GrowableObjectArray::length_offset()), RCX);
180 __ ret();
181 __ Bind(&fall_through);
130 return false; 182 return false;
131 } 183 }
132 184
133 185
134 // Set data of growable object array. 186 // Set data of growable object array.
135 // On stack: growable array (+2), data (+1), return-address (+0). 187 // On stack: growable array (+2), data (+1), return-address (+0).
136 bool Intrinsifier::GrowableArray_setData(Assembler* assembler) { 188 bool Intrinsifier::GrowableArray_setData(Assembler* assembler) {
137 if (FLAG_enable_type_checks) { 189 if (FLAG_enable_type_checks) {
138 return false; 190 return false;
139 } 191 }
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 569
518 bool Intrinsifier::String_isEmpty(Assembler* assembler) { 570 bool Intrinsifier::String_isEmpty(Assembler* assembler) {
519 return false; 571 return false;
520 } 572 }
521 573
522 #undef __ 574 #undef __
523 575
524 } // namespace dart 576 } // namespace dart
525 577
526 #endif // defined TARGET_ARCH_X64 578 #endif // defined TARGET_ARCH_X64
OLDNEW
« runtime/vm/compiler.cc ('K') | « runtime/vm/flow_graph_optimizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698