| OLD | NEW |
| 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 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1356 const Immediate node_id_as_smi = Immediate(Smi::RawValue(node_id)); | 1356 const Immediate node_id_as_smi = Immediate(Smi::RawValue(node_id)); |
| 1357 __ pushq(location); // Push the source location. | 1357 __ pushq(location); // Push the source location. |
| 1358 __ pushq(node_id_as_smi); | 1358 __ pushq(node_id_as_smi); |
| 1359 __ pushq(RAX); // Push the instance. | 1359 __ pushq(RAX); // Push the instance. |
| 1360 __ PushObject(type); // Push the type. | 1360 __ PushObject(type); // Push the type. |
| 1361 if (!type.IsInstantiated()) { | 1361 if (!type.IsInstantiated()) { |
| 1362 GenerateInstantiatorTypeArguments(token_index); | 1362 GenerateInstantiatorTypeArguments(token_index); |
| 1363 } else { | 1363 } else { |
| 1364 __ pushq(raw_null); // Null instantiator. | 1364 __ pushq(raw_null); // Null instantiator. |
| 1365 } | 1365 } |
| 1366 __ pushq(raw_null); // SubtypeTestCache not yet supported. |
| 1366 GenerateCallRuntime(node_id, token_index, kInstanceofRuntimeEntry); | 1367 GenerateCallRuntime(node_id, token_index, kInstanceofRuntimeEntry); |
| 1367 // Pop the two parameters supplied to the runtime entry. The result of the | 1368 // Pop the two parameters supplied to the runtime entry. The result of the |
| 1368 // instanceof runtime call will be left as the result of the operation. | 1369 // instanceof runtime call will be left as the result of the operation. |
| 1369 __ addq(RSP, Immediate(5 * kWordSize)); | 1370 __ addq(RSP, Immediate(6 * kWordSize)); |
| 1370 if (negate_result) { | 1371 if (negate_result) { |
| 1371 Label negate_done; | 1372 Label negate_done; |
| 1372 __ popq(RDX); | 1373 __ popq(RDX); |
| 1373 __ LoadObject(RAX, bool_true); | 1374 __ LoadObject(RAX, bool_true); |
| 1374 __ cmpq(RDX, RAX); | 1375 __ cmpq(RDX, RAX); |
| 1375 __ j(NOT_EQUAL, &negate_done, Assembler::kNearJump); | 1376 __ j(NOT_EQUAL, &negate_done, Assembler::kNearJump); |
| 1376 __ LoadObject(RAX, bool_false); | 1377 __ LoadObject(RAX, bool_false); |
| 1377 __ Bind(&negate_done); | 1378 __ Bind(&negate_done); |
| 1378 __ pushq(RAX); | 1379 __ pushq(RAX); |
| 1379 } | 1380 } |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1579 __ pushq(Immediate(Smi::RawValue(token_index))); // Source location. | 1580 __ pushq(Immediate(Smi::RawValue(token_index))); // Source location. |
| 1580 __ pushq(Immediate(Smi::RawValue(node_id))); // node-id. | 1581 __ pushq(Immediate(Smi::RawValue(node_id))); // node-id. |
| 1581 __ pushq(RAX); // Push the source object. | 1582 __ pushq(RAX); // Push the source object. |
| 1582 __ PushObject(dst_type); // Push the type of the destination. | 1583 __ PushObject(dst_type); // Push the type of the destination. |
| 1583 if (!dst_type.IsInstantiated()) { | 1584 if (!dst_type.IsInstantiated()) { |
| 1584 GenerateInstantiatorTypeArguments(token_index); | 1585 GenerateInstantiatorTypeArguments(token_index); |
| 1585 } else { | 1586 } else { |
| 1586 __ pushq(raw_null); // Null instantiator. | 1587 __ pushq(raw_null); // Null instantiator. |
| 1587 } | 1588 } |
| 1588 __ PushObject(dst_name); // Push the name of the destination. | 1589 __ PushObject(dst_name); // Push the name of the destination. |
| 1590 __ pushq(raw_null); // SubtypeTestCache not yet supported. |
| 1589 GenerateCallRuntime(node_id, token_index, kTypeCheckRuntimeEntry); | 1591 GenerateCallRuntime(node_id, token_index, kTypeCheckRuntimeEntry); |
| 1590 // Pop the parameters supplied to the runtime entry. The result of the | 1592 // Pop the parameters supplied to the runtime entry. The result of the |
| 1591 // type check runtime call is the checked value. | 1593 // type check runtime call is the checked value. |
| 1592 __ addq(RSP, Immediate(6 * kWordSize)); | 1594 __ addq(RSP, Immediate(7 * kWordSize)); |
| 1593 __ popq(RAX); | 1595 __ popq(RAX); |
| 1594 | 1596 |
| 1595 __ Bind(&done); | 1597 __ Bind(&done); |
| 1596 } | 1598 } |
| 1597 | 1599 |
| 1598 | 1600 |
| 1599 void CodeGenerator::GenerateArgumentTypeChecks() { | 1601 void CodeGenerator::GenerateArgumentTypeChecks() { |
| 1600 const Function& function = parsed_function_.function(); | 1602 const Function& function = parsed_function_.function(); |
| 1601 const SequenceNode& sequence_node = *parsed_function_.node_sequence(); | 1603 const SequenceNode& sequence_node = *parsed_function_.node_sequence(); |
| 1602 LocalScope* scope = sequence_node.scope(); | 1604 LocalScope* scope = sequence_node.scope(); |
| (...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2729 const Error& error = Error::Handle( | 2731 const Error& error = Error::Handle( |
| 2730 Parser::FormatError(script, token_index, "Error", format, args)); | 2732 Parser::FormatError(script, token_index, "Error", format, args)); |
| 2731 va_end(args); | 2733 va_end(args); |
| 2732 Isolate::Current()->long_jump_base()->Jump(1, error); | 2734 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2733 UNREACHABLE(); | 2735 UNREACHABLE(); |
| 2734 } | 2736 } |
| 2735 | 2737 |
| 2736 } // namespace dart | 2738 } // namespace dart |
| 2737 | 2739 |
| 2738 #endif // defined TARGET_ARCH_X64 | 2740 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |