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

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

Issue 275633002: Grow a class's field array into old space when bulk adding. (Closed) Base URL: https://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 | « no previous file | no next file » | 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/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 2789 matching lines...) Expand 10 before | Expand all | Expand 10 after
2800 new_arr.SetAt(arr.Length(), field); 2800 new_arr.SetAt(arr.Length(), field);
2801 SetFields(new_arr); 2801 SetFields(new_arr);
2802 } 2802 }
2803 2803
2804 2804
2805 void Class::AddFields(const GrowableObjectArray& new_fields) const { 2805 void Class::AddFields(const GrowableObjectArray& new_fields) const {
2806 const intptr_t num_new_fields = new_fields.Length(); 2806 const intptr_t num_new_fields = new_fields.Length();
2807 if (num_new_fields == 0) return; 2807 if (num_new_fields == 0) return;
2808 const Array& arr = Array::Handle(fields()); 2808 const Array& arr = Array::Handle(fields());
2809 const intptr_t num_old_fields = arr.Length(); 2809 const intptr_t num_old_fields = arr.Length();
2810 const Array& new_arr = 2810 const Array& new_arr = Array::Handle(
2811 Array::Handle(Array::Grow(arr, num_old_fields + num_new_fields)); 2811 Array::Grow(arr, num_old_fields + num_new_fields, Heap::kOld));
2812 Field& field = Field::Handle(); 2812 Field& field = Field::Handle();
2813 for (intptr_t i = 0; i < num_new_fields; i++) { 2813 for (intptr_t i = 0; i < num_new_fields; i++) {
2814 field ^= new_fields.At(i); 2814 field ^= new_fields.At(i);
2815 new_arr.SetAt(i + num_old_fields, field); 2815 new_arr.SetAt(i + num_old_fields, field);
2816 } 2816 }
2817 SetFields(new_arr); 2817 SetFields(new_arr);
2818 } 2818 }
2819 2819
2820 2820
2821 intptr_t Class::FindFieldIndex(const Field& needle) const { 2821 intptr_t Class::FindFieldIndex(const Field& needle) const {
(...skipping 15991 matching lines...) Expand 10 before | Expand all | Expand 10 after
18813 return tag_label.ToCString(); 18813 return tag_label.ToCString();
18814 } 18814 }
18815 18815
18816 18816
18817 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 18817 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
18818 Instance::PrintJSONImpl(stream, ref); 18818 Instance::PrintJSONImpl(stream, ref);
18819 } 18819 }
18820 18820
18821 18821
18822 } // namespace dart 18822 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698