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

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

Issue 536043002: Merge array allocation and List._copyFromObjectArray to provide fast path for large arrays. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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
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/intermediate_language.h" 5 #include "vm/intermediate_language.h"
6 6
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/bit_vector.h" 8 #include "vm/bit_vector.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 1583 matching lines...) Expand 10 before | Expand all | Expand 10 after
1594 StaticCallInstr* call = instance()->definition()->AsStaticCall(); 1594 StaticCallInstr* call = instance()->definition()->AsStaticCall();
1595 if (call != NULL) { 1595 if (call != NULL) {
1596 if (call->is_known_list_constructor() && 1596 if (call->is_known_list_constructor() &&
1597 IsFixedLengthArrayCid(call->Type()->ToCid())) { 1597 IsFixedLengthArrayCid(call->Type()->ToCid())) {
1598 return call->ArgumentAt(1); 1598 return call->ArgumentAt(1);
1599 } 1599 }
1600 if (call->is_native_list_factory()) { 1600 if (call->is_native_list_factory()) {
1601 return call->ArgumentAt(0); 1601 return call->ArgumentAt(0);
1602 } 1602 }
1603 } 1603 }
1604
1605 CreateArrayInstr* create_array = instance()->definition()->AsCreateArray();
1606 if ((create_array != NULL) &&
1607 (recognized_kind() == MethodRecognizer::kObjectArrayLength)) {
1608 return create_array->num_elements()->definition();
1609 }
1610
1604 // For arrays with guarded lengths, replace the length load 1611 // For arrays with guarded lengths, replace the length load
1605 // with a constant. 1612 // with a constant.
1606 LoadFieldInstr* load_array = instance()->definition()->AsLoadField(); 1613 LoadFieldInstr* load_array = instance()->definition()->AsLoadField();
1607 if (load_array != NULL) { 1614 if (load_array != NULL) {
1608 const Field* field = load_array->field(); 1615 const Field* field = load_array->field();
1609 if ((field != NULL) && (field->guarded_list_length() >= 0)) { 1616 if ((field != NULL) && (field->guarded_list_length() >= 0)) {
1610 return flow_graph->GetConstant( 1617 return flow_graph->GetConstant(
1611 Smi::Handle(Smi::New(field->guarded_list_length()))); 1618 Smi::Handle(Smi::New(field->guarded_list_length())));
1612 } 1619 }
1613 } 1620 }
(...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after
3088 case Token::kTRUNCDIV: return 0; 3095 case Token::kTRUNCDIV: return 0;
3089 case Token::kMOD: return 1; 3096 case Token::kMOD: return 1;
3090 default: UNIMPLEMENTED(); return -1; 3097 default: UNIMPLEMENTED(); return -1;
3091 } 3098 }
3092 } 3099 }
3093 3100
3094 3101
3095 #undef __ 3102 #undef __
3096 3103
3097 } // namespace dart 3104 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698