| 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 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1383 const Immediate node_id_as_smi = Immediate(Smi::RawValue(node_id)); | 1383 const Immediate node_id_as_smi = Immediate(Smi::RawValue(node_id)); |
| 1384 __ pushq(location); // Push the source location. | 1384 __ pushq(location); // Push the source location. |
| 1385 __ pushq(node_id_as_smi); | 1385 __ pushq(node_id_as_smi); |
| 1386 __ pushq(RAX); // Push the instance. | 1386 __ pushq(RAX); // Push the instance. |
| 1387 __ PushObject(type); // Push the type. | 1387 __ PushObject(type); // Push the type. |
| 1388 if (!type.IsInstantiated()) { | 1388 if (!type.IsInstantiated()) { |
| 1389 GenerateInstantiatorTypeArguments(token_index); | 1389 GenerateInstantiatorTypeArguments(token_index); |
| 1390 } else { | 1390 } else { |
| 1391 __ pushq(raw_null); // Null instantiator. | 1391 __ pushq(raw_null); // Null instantiator. |
| 1392 } | 1392 } |
| 1393 __ pushq(raw_null); // SubtypeTestCache not yet supported. |
| 1393 GenerateCallRuntime(node_id, token_index, kInstanceofRuntimeEntry); | 1394 GenerateCallRuntime(node_id, token_index, kInstanceofRuntimeEntry); |
| 1394 // Pop the two parameters supplied to the runtime entry. The result of the | 1395 // Pop the two parameters supplied to the runtime entry. The result of the |
| 1395 // instanceof runtime call will be left as the result of the operation. | 1396 // instanceof runtime call will be left as the result of the operation. |
| 1396 __ addq(RSP, Immediate(5 * kWordSize)); | 1397 __ addq(RSP, Immediate(6 * kWordSize)); |
| 1397 if (negate_result) { | 1398 if (negate_result) { |
| 1398 Label negate_done; | 1399 Label negate_done; |
| 1399 __ popq(RDX); | 1400 __ popq(RDX); |
| 1400 __ LoadObject(RAX, bool_true); | 1401 __ LoadObject(RAX, bool_true); |
| 1401 __ cmpq(RDX, RAX); | 1402 __ cmpq(RDX, RAX); |
| 1402 __ j(NOT_EQUAL, &negate_done, Assembler::kNearJump); | 1403 __ j(NOT_EQUAL, &negate_done, Assembler::kNearJump); |
| 1403 __ LoadObject(RAX, bool_false); | 1404 __ LoadObject(RAX, bool_false); |
| 1404 __ Bind(&negate_done); | 1405 __ Bind(&negate_done); |
| 1405 __ pushq(RAX); | 1406 __ pushq(RAX); |
| 1406 } | 1407 } |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1606 __ pushq(Immediate(Smi::RawValue(token_index))); // Source location. | 1607 __ pushq(Immediate(Smi::RawValue(token_index))); // Source location. |
| 1607 __ pushq(Immediate(Smi::RawValue(node_id))); // node-id. | 1608 __ pushq(Immediate(Smi::RawValue(node_id))); // node-id. |
| 1608 __ pushq(RAX); // Push the source object. | 1609 __ pushq(RAX); // Push the source object. |
| 1609 __ PushObject(dst_type); // Push the type of the destination. | 1610 __ PushObject(dst_type); // Push the type of the destination. |
| 1610 if (!dst_type.IsInstantiated()) { | 1611 if (!dst_type.IsInstantiated()) { |
| 1611 GenerateInstantiatorTypeArguments(token_index); | 1612 GenerateInstantiatorTypeArguments(token_index); |
| 1612 } else { | 1613 } else { |
| 1613 __ pushq(raw_null); // Null instantiator. | 1614 __ pushq(raw_null); // Null instantiator. |
| 1614 } | 1615 } |
| 1615 __ PushObject(dst_name); // Push the name of the destination. | 1616 __ PushObject(dst_name); // Push the name of the destination. |
| 1617 __ pushq(raw_null); // SubtypeTestCache not yet supported. |
| 1616 GenerateCallRuntime(node_id, token_index, kTypeCheckRuntimeEntry); | 1618 GenerateCallRuntime(node_id, token_index, kTypeCheckRuntimeEntry); |
| 1617 // Pop the parameters supplied to the runtime entry. The result of the | 1619 // Pop the parameters supplied to the runtime entry. The result of the |
| 1618 // type check runtime call is the checked value. | 1620 // type check runtime call is the checked value. |
| 1619 __ addq(RSP, Immediate(6 * kWordSize)); | 1621 __ addq(RSP, Immediate(7 * kWordSize)); |
| 1620 __ popq(RAX); | 1622 __ popq(RAX); |
| 1621 | 1623 |
| 1622 __ Bind(&done); | 1624 __ Bind(&done); |
| 1623 } | 1625 } |
| 1624 | 1626 |
| 1625 | 1627 |
| 1626 void CodeGenerator::GenerateArgumentTypeChecks() { | 1628 void CodeGenerator::GenerateArgumentTypeChecks() { |
| 1627 const Function& function = parsed_function_.function(); | 1629 const Function& function = parsed_function_.function(); |
| 1628 const SequenceNode& sequence_node = *parsed_function_.node_sequence(); | 1630 const SequenceNode& sequence_node = *parsed_function_.node_sequence(); |
| 1629 LocalScope* scope = sequence_node.scope(); | 1631 LocalScope* scope = sequence_node.scope(); |
| (...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2756 const Error& error = Error::Handle( | 2758 const Error& error = Error::Handle( |
| 2757 Parser::FormatError(script, token_index, "Error", format, args)); | 2759 Parser::FormatError(script, token_index, "Error", format, args)); |
| 2758 va_end(args); | 2760 va_end(args); |
| 2759 Isolate::Current()->long_jump_base()->Jump(1, error); | 2761 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2760 UNREACHABLE(); | 2762 UNREACHABLE(); |
| 2761 } | 2763 } |
| 2762 | 2764 |
| 2763 } // namespace dart | 2765 } // namespace dart |
| 2764 | 2766 |
| 2765 #endif // defined TARGET_ARCH_X64 | 2767 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |