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

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

Issue 10317026: Inline type checks for complex uninstantiated types, e.g., List<T>. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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 "vm/code_generator.h" 8 #include "vm/code_generator.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 } 1285 }
1286 } 1286 }
1287 } 1287 }
1288 __ PushObject(Object::ZoneHandle()); // Make room for the result. 1288 __ PushObject(Object::ZoneHandle()); // Make room for the result.
1289 const Immediate location = Immediate(Smi::RawValue(token_index)); 1289 const Immediate location = Immediate(Smi::RawValue(token_index));
1290 const Immediate node_id_as_smi = Immediate(Smi::RawValue(node_id)); 1290 const Immediate node_id_as_smi = Immediate(Smi::RawValue(node_id));
1291 __ pushq(location); // Push the source location. 1291 __ pushq(location); // Push the source location.
1292 __ pushq(node_id_as_smi); 1292 __ pushq(node_id_as_smi);
1293 __ pushq(RAX); // Push the instance. 1293 __ pushq(RAX); // Push the instance.
1294 __ PushObject(type); // Push the type. 1294 __ PushObject(type); // Push the type.
1295 __ pushq(raw_null); // No type arguments pushed (obsolete code).
regis 2012/05/04 21:53:39 obsolete code? TODO?
srdjan 2012/05/04 23:01:58 Code goes away with your submit.
1295 if (!type.IsInstantiated()) { 1296 if (!type.IsInstantiated()) {
1296 GenerateInstantiatorTypeArguments(token_index); 1297 GenerateInstantiatorTypeArguments(token_index);
1297 } else { 1298 } else {
1298 __ pushq(raw_null); // Null instantiator. 1299 __ pushq(raw_null); // Null instantiator type arguments.
1299 } 1300 }
1300 __ pushq(raw_null); // SubtypeTestCache not yet supported. 1301 __ pushq(raw_null); // SubtypeTestCache not yet supported.
1301 GenerateCallRuntime(node_id, token_index, kInstanceofRuntimeEntry); 1302 GenerateCallRuntime(node_id, token_index, kInstanceofRuntimeEntry);
1302 // Pop the two parameters supplied to the runtime entry. The result of the 1303 // Pop the two parameters supplied to the runtime entry. The result of the
1303 // instanceof runtime call will be left as the result of the operation. 1304 // instanceof runtime call will be left as the result of the operation.
1304 __ addq(RSP, Immediate(6 * kWordSize)); 1305 __ addq(RSP, Immediate(7 * kWordSize));
1305 if (negate_result) { 1306 if (negate_result) {
1306 Label negate_done; 1307 Label negate_done;
1307 __ popq(RDX); 1308 __ popq(RDX);
1308 __ LoadObject(RAX, bool_true); 1309 __ LoadObject(RAX, bool_true);
1309 __ cmpq(RDX, RAX); 1310 __ cmpq(RDX, RAX);
1310 __ j(NOT_EQUAL, &negate_done, Assembler::kNearJump); 1311 __ j(NOT_EQUAL, &negate_done, Assembler::kNearJump);
1311 __ LoadObject(RAX, bool_false); 1312 __ LoadObject(RAX, bool_false);
1312 __ Bind(&negate_done); 1313 __ Bind(&negate_done);
1313 __ pushq(RAX); 1314 __ pushq(RAX);
1314 } 1315 }
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1508 } 1509 }
1509 } 1510 }
1510 } 1511 }
1511 } 1512 }
1512 __ Bind(&runtime_call); 1513 __ Bind(&runtime_call);
1513 __ PushObject(Object::ZoneHandle()); // Make room for the result. 1514 __ PushObject(Object::ZoneHandle()); // Make room for the result.
1514 __ pushq(Immediate(Smi::RawValue(token_index))); // Source location. 1515 __ pushq(Immediate(Smi::RawValue(token_index))); // Source location.
1515 __ pushq(Immediate(Smi::RawValue(node_id))); // node-id. 1516 __ pushq(Immediate(Smi::RawValue(node_id))); // node-id.
1516 __ pushq(RAX); // Push the source object. 1517 __ pushq(RAX); // Push the source object.
1517 __ PushObject(dst_type); // Push the type of the destination. 1518 __ PushObject(dst_type); // Push the type of the destination.
1519 __ pushq(raw_null); // null instantiator (obsolete code).
regis 2012/05/04 21:53:39 ditto
srdjan 2012/05/04 23:01:58 Code is dead :-)!
1518 if (!dst_type.IsInstantiated()) { 1520 if (!dst_type.IsInstantiated()) {
1519 GenerateInstantiatorTypeArguments(token_index); 1521 GenerateInstantiatorTypeArguments(token_index);
1520 } else { 1522 } else {
1521 __ pushq(raw_null); // Null instantiator. 1523 __ pushq(raw_null); // Null instantiator type arguments.
1522 } 1524 }
1523 __ PushObject(dst_name); // Push the name of the destination. 1525 __ PushObject(dst_name); // Push the name of the destination.
1524 __ pushq(raw_null); // SubtypeTestCache not yet supported. 1526 __ pushq(raw_null); // SubtypeTestCache not yet supported.
1525 GenerateCallRuntime(node_id, token_index, kTypeCheckRuntimeEntry); 1527 GenerateCallRuntime(node_id, token_index, kTypeCheckRuntimeEntry);
1526 // Pop the parameters supplied to the runtime entry. The result of the 1528 // Pop the parameters supplied to the runtime entry. The result of the
1527 // type check runtime call is the checked value. 1529 // type check runtime call is the checked value.
1528 __ addq(RSP, Immediate(7 * kWordSize)); 1530 __ addq(RSP, Immediate(8 * kWordSize));
1529 __ popq(RAX); 1531 __ popq(RAX);
1530 1532
1531 __ Bind(&done); 1533 __ Bind(&done);
1532 } 1534 }
1533 1535
1534 1536
1535 void CodeGenerator::GenerateArgumentTypeChecks() { 1537 void CodeGenerator::GenerateArgumentTypeChecks() {
1536 const Function& function = parsed_function_.function(); 1538 const Function& function = parsed_function_.function();
1537 const SequenceNode& sequence_node = *parsed_function_.node_sequence(); 1539 const SequenceNode& sequence_node = *parsed_function_.node_sequence();
1538 LocalScope* scope = sequence_node.scope(); 1540 LocalScope* scope = sequence_node.scope();
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2662 const Error& error = Error::Handle( 2664 const Error& error = Error::Handle(
2663 Parser::FormatError(script, token_index, "Error", format, args)); 2665 Parser::FormatError(script, token_index, "Error", format, args));
2664 va_end(args); 2666 va_end(args);
2665 Isolate::Current()->long_jump_base()->Jump(1, error); 2667 Isolate::Current()->long_jump_base()->Jump(1, error);
2666 UNREACHABLE(); 2668 UNREACHABLE();
2667 } 2669 }
2668 2670
2669 } // namespace dart 2671 } // namespace dart
2670 2672
2671 #endif // defined TARGET_ARCH_X64 2673 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698