| 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 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 operator_name, | 1108 operator_name, |
| 1109 kNumberOfArguments, | 1109 kNumberOfArguments, |
| 1110 kNoArgumentNames, | 1110 kNoArgumentNames, |
| 1111 kNumArgumentsChecked); | 1111 kNumArgumentsChecked); |
| 1112 if (IsResultNeeded(node)) { | 1112 if (IsResultNeeded(node)) { |
| 1113 __ pushq(RAX); | 1113 __ pushq(RAX); |
| 1114 } | 1114 } |
| 1115 } | 1115 } |
| 1116 | 1116 |
| 1117 | 1117 |
| 1118 void CodeGenerator::VisitIncrOpLocalNode(IncrOpLocalNode* node) { | |
| 1119 ASSERT((node->kind() == Token::kINCR) || (node->kind() == Token::kDECR)); | |
| 1120 MarkDeoptPoint(node->id(), node->token_index()); | |
| 1121 GenerateLoadVariable(RAX, node->local()); | |
| 1122 if (!node->prefix() && IsResultNeeded(node)) { | |
| 1123 // Preserve as result. | |
| 1124 __ pushq(RAX); | |
| 1125 } | |
| 1126 const char* operator_name = (node->kind() == Token::kINCR) ? "+" : "-"; | |
| 1127 __ pushq(RAX); | |
| 1128 __ pushq(Immediate(Smi::RawValue(1))); | |
| 1129 GenerateBinaryOperatorCall(node->id(), node->token_index(), operator_name); | |
| 1130 // result is in RAX. | |
| 1131 if (FLAG_enable_type_checks) { | |
| 1132 GenerateAssertAssignable(node->id(), | |
| 1133 node->token_index(), | |
| 1134 NULL, | |
| 1135 node->local().type(), | |
| 1136 node->local().name()); | |
| 1137 } | |
| 1138 GenerateStoreVariable(node->local(), RAX, RDX); | |
| 1139 if (node->prefix() && IsResultNeeded(node)) { | |
| 1140 __ pushq(RAX); | |
| 1141 } | |
| 1142 } | |
| 1143 | |
| 1144 | |
| 1145 void CodeGenerator::VisitIncrOpInstanceFieldNode( | 1118 void CodeGenerator::VisitIncrOpInstanceFieldNode( |
| 1146 IncrOpInstanceFieldNode* node) { | 1119 IncrOpInstanceFieldNode* node) { |
| 1147 ASSERT((node->kind() == Token::kINCR) || (node->kind() == Token::kDECR)); | 1120 ASSERT((node->kind() == Token::kINCR) || (node->kind() == Token::kDECR)); |
| 1148 node->receiver()->Visit(this); | 1121 node->receiver()->Visit(this); |
| 1149 __ pushq(Address(RSP, 0)); // Duplicate receiver (preserve for setter). | 1122 __ pushq(Address(RSP, 0)); // Duplicate receiver (preserve for setter). |
| 1150 MarkDeoptPoint(node->getter_id(), node->token_index()); | 1123 MarkDeoptPoint(node->getter_id(), node->token_index()); |
| 1151 GenerateInstanceGetterCall(node->getter_id(), | 1124 GenerateInstanceGetterCall(node->getter_id(), |
| 1152 node->token_index(), | 1125 node->token_index(), |
| 1153 node->field_name()); | 1126 node->field_name()); |
| 1154 // result is in RAX. | 1127 // result is in RAX. |
| (...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2756 const Error& error = Error::Handle( | 2729 const Error& error = Error::Handle( |
| 2757 Parser::FormatError(script, token_index, "Error", format, args)); | 2730 Parser::FormatError(script, token_index, "Error", format, args)); |
| 2758 va_end(args); | 2731 va_end(args); |
| 2759 Isolate::Current()->long_jump_base()->Jump(1, error); | 2732 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2760 UNREACHABLE(); | 2733 UNREACHABLE(); |
| 2761 } | 2734 } |
| 2762 | 2735 |
| 2763 } // namespace dart | 2736 } // namespace dart |
| 2764 | 2737 |
| 2765 #endif // defined TARGET_ARCH_X64 | 2738 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |