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

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

Issue 294223003: Last cross-platform cleanup in preparation of improved ARM code for indexed (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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/flow_graph_compiler.h ('k') | runtime/vm/flow_graph_compiler_arm.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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_XXX. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX.
6 6
7 #include "vm/flow_graph_compiler.h" 7 #include "vm/flow_graph_compiler.h"
8 8
9 #include "vm/cha.h" 9 #include "vm/cha.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 } 1282 }
1283 1283
1284 1284
1285 ParallelMoveResolver::ScratchRegisterScope::~ScratchRegisterScope() { 1285 ParallelMoveResolver::ScratchRegisterScope::~ScratchRegisterScope() {
1286 if (spilled_) { 1286 if (spilled_) {
1287 resolver_->RestoreScratch(reg_); 1287 resolver_->RestoreScratch(reg_);
1288 } 1288 }
1289 } 1289 }
1290 1290
1291 1291
1292 intptr_t FlowGraphCompiler::ElementSizeFor(intptr_t cid) {
1293 if (RawObject::IsExternalTypedDataClassId(cid)) {
1294 return ExternalTypedData::ElementSizeInBytes(cid);
1295 } else if (RawObject::IsTypedDataClassId(cid)) {
1296 return TypedData::ElementSizeInBytes(cid);
1297 }
1298 switch (cid) {
1299 case kArrayCid:
1300 case kImmutableArrayCid:
1301 return Array::kBytesPerElement;
1302 case kOneByteStringCid:
1303 return OneByteString::kBytesPerElement;
1304 case kTwoByteStringCid:
1305 return TwoByteString::kBytesPerElement;
1306 default:
1307 UNIMPLEMENTED();
1308 return 0;
1309 }
1310 }
1311
1312
1313 intptr_t FlowGraphCompiler::DataOffsetFor(intptr_t cid) {
1314 if (RawObject::IsExternalTypedDataClassId(cid)) {
1315 // Elements start at offset 0 of the external data.
1316 return 0;
1317 }
1318 if (RawObject::IsTypedDataClassId(cid)) {
1319 return TypedData::data_offset();
1320 }
1321 switch (cid) {
1322 case kArrayCid:
1323 case kImmutableArrayCid:
1324 return Array::data_offset();
1325 case kOneByteStringCid:
1326 return OneByteString::data_offset();
1327 case kTwoByteStringCid:
1328 return TwoByteString::data_offset();
1329 default:
1330 UNIMPLEMENTED();
1331 return Array::data_offset();
1332 }
1333 }
1334
1335
1336 static int HighestCountFirst(const CidTarget* a, const CidTarget* b) { 1292 static int HighestCountFirst(const CidTarget* a, const CidTarget* b) {
1337 // Negative if 'a' should sort before 'b'. 1293 // Negative if 'a' should sort before 'b'.
1338 return b->count - a->count; 1294 return b->count - a->count;
1339 } 1295 }
1340 1296
1341 1297
1342 // Returns 'sorted' array in decreasing count order. 1298 // Returns 'sorted' array in decreasing count order.
1343 // The expected number of elements to sort is less than 10. 1299 // The expected number of elements to sort is less than 10.
1344 void FlowGraphCompiler::SortICDataByCount(const ICData& ic_data, 1300 void FlowGraphCompiler::SortICDataByCount(const ICData& ic_data,
1345 GrowableArray<CidTarget>* sorted) { 1301 GrowableArray<CidTarget>* sorted) {
1346 ASSERT(ic_data.NumArgsTested() == 1); 1302 ASSERT(ic_data.NumArgsTested() == 1);
1347 const intptr_t len = ic_data.NumberOfChecks(); 1303 const intptr_t len = ic_data.NumberOfChecks();
1348 sorted->Clear(); 1304 sorted->Clear();
1349 1305
1350 for (int i = 0; i < len; i++) { 1306 for (int i = 0; i < len; i++) {
1351 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), 1307 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i),
1352 &Function::ZoneHandle(ic_data.GetTargetAt(i)), 1308 &Function::ZoneHandle(ic_data.GetTargetAt(i)),
1353 ic_data.GetCountAt(i))); 1309 ic_data.GetCountAt(i)));
1354 } 1310 }
1355 sorted->Sort(HighestCountFirst); 1311 sorted->Sort(HighestCountFirst);
1356 } 1312 }
1357 1313
1358 } // namespace dart 1314 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/flow_graph_compiler_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698