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

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

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) 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 #ifndef VM_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 6224 matching lines...) Expand 10 before | Expand all | Expand 10 after
6235 // Return an Array object that contains all the elements currently present 6235 // Return an Array object that contains all the elements currently present
6236 // in the specified Growable Object Array. This is done by first truncating 6236 // in the specified Growable Object Array. This is done by first truncating
6237 // the Growable Object Array's backing array to the currently used size and 6237 // the Growable Object Array's backing array to the currently used size and
6238 // returning the truncated backing array. 6238 // returning the truncated backing array.
6239 // The remaining unused part of the backing array is marked as an Array 6239 // The remaining unused part of the backing array is marked as an Array
6240 // object or a regular Object so that it can be traversed during garbage 6240 // object or a regular Object so that it can be traversed during garbage
6241 // collection. The backing array of the original Growable Object Array is 6241 // collection. The backing array of the original Growable Object Array is
6242 // set to an empty array. 6242 // set to an empty array.
6243 static RawArray* MakeArray(const GrowableObjectArray& growable_array); 6243 static RawArray* MakeArray(const GrowableObjectArray& growable_array);
6244 6244
6245 RawArray* Slice(intptr_t start,
6246 intptr_t count,
6247 bool with_type_argument) const;
6248
6245 protected: 6249 protected:
6246 static RawArray* New(intptr_t class_id, 6250 static RawArray* New(intptr_t class_id,
6247 intptr_t len, 6251 intptr_t len,
6248 Heap::Space space = Heap::kNew); 6252 Heap::Space space = Heap::kNew);
6249 6253
6250 private: 6254 private:
6251 RawObject** ObjectAddr(intptr_t index) const { 6255 RawObject** ObjectAddr(intptr_t index) const {
6252 // TODO(iposva): Determine if we should throw an exception here. 6256 // TODO(iposva): Determine if we should throw an exception here.
6253 ASSERT((index >= 0) && (index < Length())); 6257 ASSERT((index >= 0) && (index < Length()));
6254 return &raw_ptr()->data()[index]; 6258 return &raw_ptr()->data()[index];
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after
7416 7420
7417 7421
7418 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 7422 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
7419 intptr_t index) { 7423 intptr_t index) {
7420 return array.At((index * kEntryLength) + kTargetFunctionIndex); 7424 return array.At((index * kEntryLength) + kTargetFunctionIndex);
7421 } 7425 }
7422 7426
7423 } // namespace dart 7427 } // namespace dart
7424 7428
7425 #endif // VM_OBJECT_H_ 7429 #endif // VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698