| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1200 __ pushl(EDX); // Receiver. | 1200 __ pushl(EDX); // Receiver. |
| 1201 __ pushl(EAX); // Value. | 1201 __ pushl(EAX); // Value. |
| 1202 // It is not necessary to generate a type test of the assigned value here, | 1202 // It is not necessary to generate a type test of the assigned value here, |
| 1203 // because the setter will check the type of its incoming arguments. | 1203 // because the setter will check the type of its incoming arguments. |
| 1204 GenerateInstanceSetterCall(node->setter_id(), | 1204 GenerateInstanceSetterCall(node->setter_id(), |
| 1205 node->token_index(), | 1205 node->token_index(), |
| 1206 node->field_name()); | 1206 node->field_name()); |
| 1207 } | 1207 } |
| 1208 | 1208 |
| 1209 | 1209 |
| 1210 void CodeGenerator::VisitIncrOpStaticFieldNode(IncrOpStaticFieldNode* node) { | |
| 1211 ASSERT((node->kind() == Token::kINCR) || (node->kind() == Token::kDECR)); | |
| 1212 MarkDeoptPoint(node->id(), node->token_index()); | |
| 1213 if (node->field().IsNull()) { | |
| 1214 GenerateStaticGetterCall(node->token_index(), | |
| 1215 node->field_class(), | |
| 1216 node->field_name()); | |
| 1217 } else { | |
| 1218 __ LoadObject(EDX, node->field()); | |
| 1219 __ movl(EAX, FieldAddress(EDX, Field::value_offset())); | |
| 1220 } | |
| 1221 // Value in EAX. | |
| 1222 if (!node->prefix() && IsResultNeeded(node)) { | |
| 1223 // Preserve as result. | |
| 1224 __ pushl(EAX); | |
| 1225 } | |
| 1226 const Immediate value = Immediate(reinterpret_cast<int32_t>(Smi::New(1))); | |
| 1227 const char* operator_name = (node->kind() == Token::kINCR) ? "+" : "-"; | |
| 1228 __ pushl(EAX); // Left operand. | |
| 1229 __ pushl(value); // Right operand. | |
| 1230 GenerateBinaryOperatorCall(node->id(), node->token_index(), operator_name); | |
| 1231 // result is in EAX. | |
| 1232 if (node->prefix() && IsResultNeeded(node)) { | |
| 1233 __ pushl(EAX); | |
| 1234 } | |
| 1235 if (node->field().IsNull()) { | |
| 1236 __ pushl(EAX); | |
| 1237 // It is not necessary to generate a type test of the assigned value here, | |
| 1238 // because the setter will check the type of its incoming arguments. | |
| 1239 GenerateStaticSetterCall(node->token_index(), | |
| 1240 node->field_class(), | |
| 1241 node->field_name()); | |
| 1242 } else { | |
| 1243 if (FLAG_enable_type_checks) { | |
| 1244 GenerateAssertAssignable(node->id(), | |
| 1245 node->token_index(), | |
| 1246 AbstractType::ZoneHandle(node->field().type()), | |
| 1247 String::ZoneHandle(node->field().name())); | |
| 1248 } | |
| 1249 __ LoadObject(EDX, node->field()); | |
| 1250 __ StoreIntoObject(EDX, FieldAddress(EDX, Field::value_offset()), EAX); | |
| 1251 } | |
| 1252 } | |
| 1253 | |
| 1254 | |
| 1255 void CodeGenerator::VisitIncrOpIndexedNode(IncrOpIndexedNode* node) { | 1210 void CodeGenerator::VisitIncrOpIndexedNode(IncrOpIndexedNode* node) { |
| 1256 ASSERT((node->kind() == Token::kINCR) || (node->kind() == Token::kDECR)); | 1211 ASSERT((node->kind() == Token::kINCR) || (node->kind() == Token::kDECR)); |
| 1257 node->array()->Visit(this); | 1212 node->array()->Visit(this); |
| 1258 node->index()->Visit(this); | 1213 node->index()->Visit(this); |
| 1259 MarkDeoptPoint(node->id(), node->token_index()); | 1214 MarkDeoptPoint(node->id(), node->token_index()); |
| 1260 // Preserve array and index for GenerateStoreIndex. | 1215 // Preserve array and index for GenerateStoreIndex. |
| 1261 __ pushl(Address(ESP, kWordSize)); // Copy array. | 1216 __ pushl(Address(ESP, kWordSize)); // Copy array. |
| 1262 __ pushl(Address(ESP, kWordSize)); // Copy index. | 1217 __ pushl(Address(ESP, kWordSize)); // Copy index. |
| 1263 GenerateLoadIndexed(node->load_id(), node->token_index()); | 1218 GenerateLoadIndexed(node->load_id(), node->token_index()); |
| 1264 // Result is in EAX. | 1219 // Result is in EAX. |
| (...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2716 const Error& error = Error::Handle( | 2671 const Error& error = Error::Handle( |
| 2717 Parser::FormatError(script, token_index, "Error", format, args)); | 2672 Parser::FormatError(script, token_index, "Error", format, args)); |
| 2718 va_end(args); | 2673 va_end(args); |
| 2719 Isolate::Current()->long_jump_base()->Jump(1, error); | 2674 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2720 UNREACHABLE(); | 2675 UNREACHABLE(); |
| 2721 } | 2676 } |
| 2722 | 2677 |
| 2723 } // namespace dart | 2678 } // namespace dart |
| 2724 | 2679 |
| 2725 #endif // defined TARGET_ARCH_IA32 | 2680 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |