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

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

Issue 9592031: Eliminate IncrOpStaticFieldNode, replace a set of nodes. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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
« no previous file with comments | « runtime/vm/code_generator_ia32.cc ('k') | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 __ pushq(RDX); // Receiver. 1188 __ pushq(RDX); // Receiver.
1189 __ pushq(RAX); // Value. 1189 __ pushq(RAX); // Value.
1190 // It is not necessary to generate a type test of the assigned value here, 1190 // It is not necessary to generate a type test of the assigned value here,
1191 // because the setter will check the type of its incoming arguments. 1191 // because the setter will check the type of its incoming arguments.
1192 GenerateInstanceSetterCall(node->setter_id(), 1192 GenerateInstanceSetterCall(node->setter_id(),
1193 node->token_index(), 1193 node->token_index(),
1194 node->field_name()); 1194 node->field_name());
1195 } 1195 }
1196 1196
1197 1197
1198 void CodeGenerator::VisitIncrOpStaticFieldNode(IncrOpStaticFieldNode* node) {
1199 ASSERT((node->kind() == Token::kINCR) || (node->kind() == Token::kDECR));
1200 MarkDeoptPoint(node->id(), node->token_index());
1201 if (node->field().IsNull()) {
1202 GenerateStaticGetterCall(node->token_index(),
1203 node->field_class(),
1204 node->field_name());
1205 } else {
1206 __ LoadObject(RDX, node->field());
1207 __ movq(RAX, FieldAddress(RDX, Field::value_offset()));
1208 }
1209 // Value in RAX.
1210 if (!node->prefix() && IsResultNeeded(node)) {
1211 // Preserve as result.
1212 __ pushq(RAX);
1213 }
1214 const Immediate value = Immediate(reinterpret_cast<int64_t>(Smi::New(1)));
1215 const char* operator_name = (node->kind() == Token::kINCR) ? "+" : "-";
1216 __ pushq(RAX); // Left operand.
1217 __ pushq(value); // Right operand.
1218 GenerateBinaryOperatorCall(node->id(), node->token_index(), operator_name);
1219 // result is in RAX.
1220 if (node->prefix() && IsResultNeeded(node)) {
1221 __ pushq(RAX);
1222 }
1223 if (node->field().IsNull()) {
1224 __ pushq(RAX);
1225 // It is not necessary to generate a type test of the assigned value here,
1226 // because the setter will check the type of its incoming arguments.
1227 GenerateStaticSetterCall(node->token_index(),
1228 node->field_class(),
1229 node->field_name());
1230 } else {
1231 if (FLAG_enable_type_checks) {
1232 GenerateAssertAssignable(node->id(),
1233 node->token_index(),
1234 AbstractType::ZoneHandle(node->field().type()),
1235 String::ZoneHandle(node->field().name()));
1236 }
1237 __ LoadObject(RDX, node->field());
1238 __ StoreIntoObject(RDX, FieldAddress(RDX, Field::value_offset()), RAX);
1239 }
1240 }
1241
1242
1243 void CodeGenerator::VisitIncrOpIndexedNode(IncrOpIndexedNode* node) { 1198 void CodeGenerator::VisitIncrOpIndexedNode(IncrOpIndexedNode* node) {
1244 ASSERT((node->kind() == Token::kINCR) || (node->kind() == Token::kDECR)); 1199 ASSERT((node->kind() == Token::kINCR) || (node->kind() == Token::kDECR));
1245 node->array()->Visit(this); 1200 node->array()->Visit(this);
1246 node->index()->Visit(this); 1201 node->index()->Visit(this);
1247 MarkDeoptPoint(node->id(), node->token_index()); 1202 MarkDeoptPoint(node->id(), node->token_index());
1248 // Preserve array and index for GenerateStoreIndex. 1203 // Preserve array and index for GenerateStoreIndex.
1249 __ pushq(Address(RSP, kWordSize)); // Copy array. 1204 __ pushq(Address(RSP, kWordSize)); // Copy array.
1250 __ pushq(Address(RSP, kWordSize)); // Copy index. 1205 __ pushq(Address(RSP, kWordSize)); // Copy index.
1251 GenerateLoadIndexed(node->load_id(), node->token_index()); 1206 GenerateLoadIndexed(node->load_id(), node->token_index());
1252 // Result is in RAX. 1207 // Result is in RAX.
(...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after
2704 const Error& error = Error::Handle( 2659 const Error& error = Error::Handle(
2705 Parser::FormatError(script, token_index, "Error", format, args)); 2660 Parser::FormatError(script, token_index, "Error", format, args));
2706 va_end(args); 2661 va_end(args);
2707 Isolate::Current()->long_jump_base()->Jump(1, error); 2662 Isolate::Current()->long_jump_base()->Jump(1, error);
2708 UNREACHABLE(); 2663 UNREACHABLE();
2709 } 2664 }
2710 2665
2711 } // namespace dart 2666 } // namespace dart
2712 2667
2713 #endif // defined TARGET_ARCH_X64 2668 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/code_generator_ia32.cc ('k') | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698