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

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

Issue 10446019: - Port AssertBool and AssertAssigneable to new location template. (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
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 "lib/error.h"
8 #include "vm/flow_graph_compiler.h" 9 #include "vm/flow_graph_compiler.h"
9 #include "vm/locations.h" 10 #include "vm/locations.h"
10 #include "vm/object_store.h" 11 #include "vm/object_store.h"
11 #include "vm/stub_code.h" 12 #include "vm/stub_code.h"
12 13
13 #define __ compiler->assembler()-> 14 #define __ compiler->assembler()->
14 15
15 namespace dart { 16 namespace dart {
16 17
17 18
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 return NULL; 218 return NULL;
218 } 219 }
219 220
220 221
221 void UseVal::EmitNativeCode(FlowGraphCompiler* compiler) { 222 void UseVal::EmitNativeCode(FlowGraphCompiler* compiler) {
222 UNIMPLEMENTED(); 223 UNIMPLEMENTED();
223 } 224 }
224 225
225 226
226 LocationSummary* AssertAssignableComp::MakeLocationSummary() const { 227 LocationSummary* AssertAssignableComp::MakeLocationSummary() const {
227 return NULL; 228 LocationSummary* summary = new LocationSummary(3);
229 summary->set_in(0, Location::RegisterLocation(RAX));
230 summary->set_in(1, Location::RegisterLocation(RCX));
231 summary->set_in(2, Location::RegisterLocation(RDX));
232 summary->set_out(Location::RegisterLocation(RAX));
Florian Schneider 2012/05/24 20:04:58 I'm not sure which is preferable, but you could al
srdjan 2012/05/24 20:24:44 In this case, the special inlined code returns res
233 return summary;
228 } 234 }
229 235
230 236
231 void AssertAssignableComp::EmitNativeCode(FlowGraphCompiler* compiler) { 237 void AssertAssignableComp::EmitNativeCode(FlowGraphCompiler* compiler) {
232 UNIMPLEMENTED(); 238 ASSERT(locs()->in(0).reg() == RAX); // Value.
239 ASSERT(locs()->in(1).reg() == RCX); // Instantiator.
240 ASSERT(locs()->in(2).reg() == RDX); // Instantiator type arguments.
241
242 compiler->GenerateAssertAssignable(cid(),
243 token_index(),
244 try_index(),
245 dst_type(),
246 dst_name());
247 ASSERT(locs()->in(0).reg() == locs()->out().reg());
233 } 248 }
234 249
235 250
236 LocationSummary* AssertBooleanComp::MakeLocationSummary() const { 251 LocationSummary* AssertBooleanComp::MakeLocationSummary() const {
237 return NULL; 252 return MakeSimpleLocationSummary(1, Location::SameAsFirstInput());
238 } 253 }
239 254
240 255
241 void AssertBooleanComp::EmitNativeCode(FlowGraphCompiler* compiler) { 256 void AssertBooleanComp::EmitNativeCode(FlowGraphCompiler* compiler) {
242 UNIMPLEMENTED(); 257 Register obj = locs()->in(0).reg();
258 Register result = locs()->out().reg();
259
260 // Check that the type of the value is allowed in conditional context.
261 // Call the runtime if the object is not bool::true or bool::false.
262 Label done;
263 __ CompareObject(obj, Bool::ZoneHandle(Bool::True()));
264 __ j(EQUAL, &done, Assembler::kNearJump);
265 __ CompareObject(obj, Bool::ZoneHandle(Bool::False()));
266 __ j(EQUAL, &done, Assembler::kNearJump);
267
268 __ pushq(Immediate(Smi::RawValue(token_index()))); // Source location.
269 __ pushq(obj); // Push the source object.
270 compiler->GenerateCallRuntime(cid(),
271 token_index(),
272 try_index(),
273 kConditionTypeErrorRuntimeEntry);
274 // We should never return here.
275 __ int3();
276
277 __ Bind(&done);
278 ASSERT(obj == result);
243 } 279 }
244 280
245 281
246 LocationSummary* EqualityCompareComp::MakeLocationSummary() const { 282 LocationSummary* EqualityCompareComp::MakeLocationSummary() const {
247 return NULL; 283 return NULL;
248 } 284 }
249 285
250 286
251 void EqualityCompareComp::EmitNativeCode(FlowGraphCompiler* compiler) { 287 void EqualityCompareComp::EmitNativeCode(FlowGraphCompiler* compiler) {
252 UNIMPLEMENTED(); 288 UNIMPLEMENTED();
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 if (locs()->out().reg() != RAX) { 627 if (locs()->out().reg() != RAX) {
592 __ movq(locs()->out().reg(), RAX); 628 __ movq(locs()->out().reg(), RAX);
593 } 629 }
594 } 630 }
595 631
596 } // namespace dart 632 } // namespace dart
597 633
598 #undef __ 634 #undef __
599 635
600 #endif // defined TARGET_ARCH_X64 636 #endif // defined TARGET_ARCH_X64
OLDNEW
« runtime/vm/flow_graph_builder.cc ('K') | « runtime/vm/intermediate_language.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698