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

Side by Side Diff: vm/object.cc

Issue 11293031: Remove some unnecessary class handle creations. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 1 month 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 | « vm/object.h ('k') | vm/raw_object_snapshot.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/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/bigint_operations.h" 10 #include "vm/bigint_operations.h"
(...skipping 11038 matching lines...) Expand 10 before | Expand all | Expand 10 after
11049 for (intptr_t i = 0; i < len; i++) { 11049 for (intptr_t i = 0; i < len; i++) {
11050 if (this->At(i) != other_arr.At(i)) { 11050 if (this->At(i) != other_arr.At(i)) {
11051 return false; 11051 return false;
11052 } 11052 }
11053 } 11053 }
11054 return true; 11054 return true;
11055 } 11055 }
11056 11056
11057 11057
11058 RawArray* Array::New(intptr_t len, Heap::Space space) { 11058 RawArray* Array::New(intptr_t len, Heap::Space space) {
11059 ObjectStore* object_store = Isolate::Current()->object_store(); 11059 ASSERT(Isolate::Current()->object_store()->array_class() != Class::null());
11060 ASSERT(object_store->array_class() != Class::null()); 11060 return New(kClassId, len, space);
11061 Class& cls = Class::Handle(object_store->array_class());
11062 return New(cls, len, space);
11063 } 11061 }
11064 11062
11065 11063
11066 RawArray* Array::New(const Class& cls, intptr_t len, Heap::Space space) { 11064 RawArray* Array::New(intptr_t class_id, intptr_t len, Heap::Space space) {
11067 if (len < 0 || len > Array::kMaxElements) { 11065 if (len < 0 || len > Array::kMaxElements) {
11068 // This should be caught before we reach here. 11066 // This should be caught before we reach here.
11069 FATAL1("Fatal error in Array::New: invalid len %"Pd"\n", len); 11067 FATAL1("Fatal error in Array::New: invalid len %"Pd"\n", len);
11070 } 11068 }
11071 Array& result = Array::Handle(); 11069 Array& result = Array::Handle();
11072 { 11070 {
11073 RawObject* raw = Object::Allocate(cls.id(), 11071 RawObject* raw = Object::Allocate(class_id,
11074 Array::InstanceSize(len), 11072 Array::InstanceSize(len),
11075 space); 11073 space);
11076 NoGCScope no_gc; 11074 NoGCScope no_gc;
11077 result ^= raw; 11075 result ^= raw;
11078 result.SetLength(len); 11076 result.SetLength(len);
11079 } 11077 }
11080 return result.raw(); 11078 return result.raw();
11081 } 11079 }
11082 11080
11083 11081
11084 void Array::MakeImmutable() const { 11082 void Array::MakeImmutable() const {
11085 Isolate* isolate = Isolate::Current(); 11083 NoGCScope no_gc;
11086 const Class& cls = Class::Handle( 11084 uword tags = raw_ptr()->tags_;
11087 isolate, isolate->object_store()->immutable_array_class()); 11085 tags = RawObject::ClassIdTag::update(kImmutableArrayCid, tags);
11088 { 11086 raw_ptr()->tags_ = tags;
11089 NoGCScope no_gc;
11090 uword tags = raw_ptr()->tags_;
11091 tags = RawObject::ClassIdTag::update(cls.id(), tags);
11092 raw_ptr()->tags_ = tags;
11093 }
11094 } 11087 }
11095 11088
11096 11089
11097 const char* Array::ToCString() const { 11090 const char* Array::ToCString() const {
11098 return "Array"; 11091 return "Array";
11099 } 11092 }
11100 11093
11101 11094
11102 RawArray* Array::Grow(const Array& source, int new_length, Heap::Space space) { 11095 RawArray* Array::Grow(const Array& source, int new_length, Heap::Space space) {
11103 const Array& result = Array::Handle(Array::New(new_length, space)); 11096 const Array& result = Array::Handle(Array::New(new_length, space));
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
11144 // that it can be traversed over successfully during garbage collection. 11137 // that it can be traversed over successfully during garbage collection.
11145 if (capacity_size != used_size) { 11138 if (capacity_size != used_size) {
11146 ASSERT(capacity_len > used_len); 11139 ASSERT(capacity_len > used_len);
11147 intptr_t leftover_size = capacity_size - used_size; 11140 intptr_t leftover_size = capacity_size - used_size;
11148 11141
11149 uword addr = RawObject::ToAddr(array.raw()) + used_size; 11142 uword addr = RawObject::ToAddr(array.raw()) + used_size;
11150 if (leftover_size >= Array::InstanceSize(0)) { 11143 if (leftover_size >= Array::InstanceSize(0)) {
11151 // As we have enough space to use an array object, update the leftover 11144 // As we have enough space to use an array object, update the leftover
11152 // space as an Array object. 11145 // space as an Array object.
11153 RawArray* raw = reinterpret_cast<RawArray*>(RawObject::FromAddr(addr)); 11146 RawArray* raw = reinterpret_cast<RawArray*>(RawObject::FromAddr(addr));
11154 const Class& cls = Class::Handle(isolate->object_store()->array_class());
11155 tags = 0; 11147 tags = 0;
11156 tags = RawObject::SizeTag::update(leftover_size, tags); 11148 tags = RawObject::SizeTag::update(leftover_size, tags);
11157 tags = RawObject::ClassIdTag::update(cls.id(), tags); 11149 tags = RawObject::ClassIdTag::update(kArrayCid, tags);
11158 raw->ptr()->tags_ = tags; 11150 raw->ptr()->tags_ = tags;
11159 intptr_t leftover_len = 11151 intptr_t leftover_len =
11160 ((leftover_size - Array::InstanceSize(0)) / kWordSize); 11152 ((leftover_size - Array::InstanceSize(0)) / kWordSize);
11161 raw->ptr()->tags_ = tags; 11153 raw->ptr()->tags_ = tags;
11162 raw->ptr()->length_ = Smi::New(leftover_len); 11154 raw->ptr()->length_ = Smi::New(leftover_len);
11163 } else { 11155 } else {
11164 // Update the leftover space as a basic object. 11156 // Update the leftover space as a basic object.
11165 ASSERT(leftover_size == Object::InstanceSize()); 11157 ASSERT(leftover_size == Object::InstanceSize());
11166 RawObject* raw = reinterpret_cast<RawObject*>(RawObject::FromAddr(addr)); 11158 RawObject* raw = reinterpret_cast<RawObject*>(RawObject::FromAddr(addr));
11167 tags = 0; 11159 tags = 0;
11168 tags = RawObject::SizeTag::update(leftover_size, tags); 11160 tags = RawObject::SizeTag::update(leftover_size, tags);
11169 tags = RawObject::ClassIdTag::update(kInstanceCid, tags); 11161 tags = RawObject::ClassIdTag::update(kInstanceCid, tags);
11170 raw->ptr()->tags_ = tags; 11162 raw->ptr()->tags_ = tags;
11171 } 11163 }
11172 } 11164 }
11173 return array.raw(); 11165 return array.raw();
11174 } 11166 }
11175 11167
11176 11168
11177 RawImmutableArray* ImmutableArray::New(intptr_t len, 11169 RawImmutableArray* ImmutableArray::New(intptr_t len,
11178 Heap::Space space) { 11170 Heap::Space space) {
11179 ObjectStore* object_store = Isolate::Current()->object_store(); 11171 ASSERT(Isolate::Current()->object_store()->immutable_array_class() !=
11180 ASSERT(object_store->immutable_array_class() != Class::null()); 11172 Class::null());
11181 Class& cls = Class::Handle(object_store->immutable_array_class()); 11173 return reinterpret_cast<RawImmutableArray*>(Array::New(kClassId, len, space));
11182 return reinterpret_cast<RawImmutableArray*>(Array::New(cls, len, space));
11183 } 11174 }
11184 11175
11185 11176
11186 const char* ImmutableArray::ToCString() const { 11177 const char* ImmutableArray::ToCString() const {
11187 return "ImmutableArray"; 11178 return "ImmutableArray";
11188 } 11179 }
11189 11180
11190 11181
11191 void GrowableObjectArray::Add(const Object& value, Heap::Space space) const { 11182 void GrowableObjectArray::Add(const Object& value, Heap::Space space) const {
11192 ASSERT(!IsNull()); 11183 ASSERT(!IsNull());
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
11348 11339
11349 11340
11350 template<typename T> 11341 template<typename T>
11351 static void ExternalByteArrayFinalize(Dart_Handle handle, void* peer) { 11342 static void ExternalByteArrayFinalize(Dart_Handle handle, void* peer) {
11352 delete reinterpret_cast<ExternalByteArrayData<T>*>(peer); 11343 delete reinterpret_cast<ExternalByteArrayData<T>*>(peer);
11353 DeleteWeakPersistentHandle(handle); 11344 DeleteWeakPersistentHandle(handle);
11354 } 11345 }
11355 11346
11356 11347
11357 template<typename HandleT, typename RawT, typename ElementT> 11348 template<typename HandleT, typename RawT, typename ElementT>
11358 RawT* ByteArray::NewExternalImpl(const Class& cls, 11349 RawT* ByteArray::NewExternalImpl(intptr_t class_id,
11359 ElementT* data, 11350 ElementT* data,
11360 intptr_t len, 11351 intptr_t len,
11361 void* peer, 11352 void* peer,
11362 Dart_PeerFinalizer callback, 11353 Dart_PeerFinalizer callback,
11363 Heap::Space space) { 11354 Heap::Space space) {
11364 if (len < 0 || len > HandleT::kMaxElements) { 11355 if (len < 0 || len > HandleT::kMaxElements) {
11365 // This should be caught before we reach here. 11356 // This should be caught before we reach here.
11366 FATAL1("Fatal error in ByteArray::NewExternalImpl: invalid len %"Pd"\n", 11357 FATAL1("Fatal error in ByteArray::NewExternalImpl: invalid len %"Pd"\n",
11367 len); 11358 len);
11368 } 11359 }
11369 HandleT& result = HandleT::Handle(); 11360 HandleT& result = HandleT::Handle();
11370 ExternalByteArrayData<ElementT>* external_data = 11361 ExternalByteArrayData<ElementT>* external_data =
11371 new ExternalByteArrayData<ElementT>(data, peer, callback); 11362 new ExternalByteArrayData<ElementT>(data, peer, callback);
11372 { 11363 {
11373 RawObject* raw = Object::Allocate(cls.id(), HandleT::InstanceSize(), space); 11364 RawObject* raw = Object::Allocate(class_id, HandleT::InstanceSize(), space);
11374 NoGCScope no_gc; 11365 NoGCScope no_gc;
11375 result ^= raw; 11366 result ^= raw;
11376 result.SetLength(len); 11367 result.SetLength(len);
11377 result.SetExternalData(external_data); 11368 result.SetExternalData(external_data);
11378 } 11369 }
11379 AddFinalizer(result, external_data, ExternalByteArrayFinalize<ElementT>); 11370 AddFinalizer(result, external_data, ExternalByteArrayFinalize<ElementT>);
11380 return result.raw(); 11371 return result.raw();
11381 } 11372 }
11382 11373
11383 11374
(...skipping 12 matching lines...) Expand all
11396 11387
11397 11388
11398 const char* ByteArray::ToCString() const { 11389 const char* ByteArray::ToCString() const {
11399 // ByteArray is an abstract class. 11390 // ByteArray is an abstract class.
11400 UNREACHABLE(); 11391 UNREACHABLE();
11401 return "ByteArray"; 11392 return "ByteArray";
11402 } 11393 }
11403 11394
11404 11395
11405 template<typename HandleT, typename RawT> 11396 template<typename HandleT, typename RawT>
11406 RawT* ByteArray::NewImpl(const Class& cls, intptr_t len, Heap::Space space) { 11397 RawT* ByteArray::NewImpl(intptr_t class_id, intptr_t len, Heap::Space space) {
11407 if (len < 0 || len > HandleT::kMaxElements) { 11398 if (len < 0 || len > HandleT::kMaxElements) {
11408 // This should be caught before we reach here. 11399 // This should be caught before we reach here.
11409 FATAL1("Fatal error in ByteArray::NewImpl: invalid len %"Pd"\n", len); 11400 FATAL1("Fatal error in ByteArray::NewImpl: invalid len %"Pd"\n", len);
11410 } 11401 }
11411 HandleT& result = HandleT::Handle(); 11402 HandleT& result = HandleT::Handle();
11412 { 11403 {
11413 RawObject* raw = Object::Allocate(cls.id(), 11404 RawObject* raw = Object::Allocate(class_id,
11414 HandleT::InstanceSize(len), 11405 HandleT::InstanceSize(len),
11415 space); 11406 space);
11416 NoGCScope no_gc; 11407 NoGCScope no_gc;
11417 result ^= raw; 11408 result ^= raw;
11418 result.SetLength(len); 11409 result.SetLength(len);
11419 if (len > 0) { 11410 if (len > 0) {
11420 memset(result.ByteAddr(0), 0, result.ByteLength()); 11411 memset(result.ByteAddr(0), 0, result.ByteLength());
11421 } 11412 }
11422 } 11413 }
11423 return result.raw(); 11414 return result.raw();
11424 } 11415 }
11425 11416
11426 11417
11427 template<typename HandleT, typename RawT, typename ElementT> 11418 template<typename HandleT, typename RawT, typename ElementT>
11428 RawT* ByteArray::NewImpl(const Class& cls, 11419 RawT* ByteArray::NewImpl(intptr_t class_id,
11429 const ElementT* data, 11420 const ElementT* data,
11430 intptr_t len, 11421 intptr_t len,
11431 Heap::Space space) { 11422 Heap::Space space) {
11432 if (len < 0 || len > HandleT::kMaxElements) { 11423 if (len < 0 || len > HandleT::kMaxElements) {
11433 // This should be caught before we reach here. 11424 // This should be caught before we reach here.
11434 FATAL1("Fatal error in ByteArray::NewImpl: invalid len %"Pd"\n", len); 11425 FATAL1("Fatal error in ByteArray::NewImpl: invalid len %"Pd"\n", len);
11435 } 11426 }
11436 HandleT& result = HandleT::Handle(); 11427 HandleT& result = HandleT::Handle();
11437 { 11428 {
11438 RawObject* raw = Object::Allocate(cls.id(), 11429 RawObject* raw = Object::Allocate(class_id,
11439 HandleT::InstanceSize(len), 11430 HandleT::InstanceSize(len),
11440 space); 11431 space);
11441 NoGCScope no_gc; 11432 NoGCScope no_gc;
11442 result ^= raw; 11433 result ^= raw;
11443 result.SetLength(len); 11434 result.SetLength(len);
11444 if (len > 0) { 11435 if (len > 0) {
11445 memmove(result.ByteAddr(0), data, result.ByteLength()); 11436 memmove(result.ByteAddr(0), data, result.ByteLength());
11446 } 11437 }
11447 } 11438 }
11448 return result.raw(); 11439 return result.raw();
11449 } 11440 }
11450 11441
11451 11442
11452 RawInt8Array* Int8Array::New(intptr_t len, Heap::Space space) { 11443 RawInt8Array* Int8Array::New(intptr_t len, Heap::Space space) {
11453 Isolate* isolate = Isolate::Current(); 11444 ASSERT(Isolate::Current()->object_store()->int8_array_class() !=
11454 ASSERT(isolate->object_store()->int8_array_class() != Class::null()); 11445 Class::null());
11455 const Class& cls = 11446 return NewImpl<Int8Array, RawInt8Array>(kClassId, len, space);
11456 Class::Handle(isolate->object_store()->int8_array_class());
11457 return NewImpl<Int8Array, RawInt8Array>(cls, len, space);
11458 } 11447 }
11459 11448
11460 11449
11461 RawInt8Array* Int8Array::New(const int8_t* data, 11450 RawInt8Array* Int8Array::New(const int8_t* data,
11462 intptr_t len, 11451 intptr_t len,
11463 Heap::Space space) { 11452 Heap::Space space) {
11464 Isolate* isolate = Isolate::Current(); 11453 ASSERT(Isolate::Current()->object_store()->int8_array_class() !=
11465 ASSERT(isolate->object_store()->int8_array_class() != Class::null()); 11454 Class::null());
11466 const Class& cls = 11455 return NewImpl<Int8Array, RawInt8Array>(kClassId, data, len, space);
11467 Class::Handle(isolate->object_store()->int8_array_class());
11468 return NewImpl<Int8Array, RawInt8Array>(cls, data, len, space);
11469 } 11456 }
11470 11457
11471 11458
11472 const char* Int8Array::ToCString() const { 11459 const char* Int8Array::ToCString() const {
11473 return "_Int8Array"; 11460 return "_Int8Array";
11474 } 11461 }
11475 11462
11476 11463
11477 RawUint8Array* Uint8Array::New(intptr_t len, Heap::Space space) { 11464 RawUint8Array* Uint8Array::New(intptr_t len, Heap::Space space) {
11478 Isolate* isolate = Isolate::Current(); 11465 ASSERT(Isolate::Current()->object_store()->uint8_array_class() !=
11479 ASSERT(isolate->object_store()->uint8_array_class() != Class::null()); 11466 Class::null());
11480 const Class& cls = 11467 return NewImpl<Uint8Array, RawUint8Array>(kClassId, len, space);
11481 Class::Handle(isolate->object_store()->uint8_array_class());
11482 return NewImpl<Uint8Array, RawUint8Array>(cls, len, space);
11483 } 11468 }
11484 11469
11485 11470
11486 RawUint8Array* Uint8Array::New(const uint8_t* data, 11471 RawUint8Array* Uint8Array::New(const uint8_t* data,
11487 intptr_t len, 11472 intptr_t len,
11488 Heap::Space space) { 11473 Heap::Space space) {
11489 Isolate* isolate = Isolate::Current(); 11474 ASSERT(Isolate::Current()->object_store()->uint8_array_class() !=
11490 ASSERT(isolate->object_store()->uint8_array_class() != Class::null()); 11475 Class::null());
11491 const Class& cls = 11476 return NewImpl<Uint8Array, RawUint8Array>(kClassId, data, len, space);
11492 Class::Handle(isolate->object_store()->uint8_array_class());
11493 return NewImpl<Uint8Array, RawUint8Array>(cls, data, len, space);
11494 } 11477 }
11495 11478
11496 11479
11497 const char* Uint8Array::ToCString() const { 11480 const char* Uint8Array::ToCString() const {
11498 return "_Uint8Array"; 11481 return "_Uint8Array";
11499 } 11482 }
11500 11483
11501 11484
11502 RawInt16Array* Int16Array::New(intptr_t len, Heap::Space space) { 11485 RawInt16Array* Int16Array::New(intptr_t len, Heap::Space space) {
11503 Isolate* isolate = Isolate::Current(); 11486 ASSERT(Isolate::Current()->object_store()->int16_array_class() !=
11504 ASSERT(isolate->object_store()->int16_array_class() != Class::null()); 11487 Class::null());
11505 const Class& cls = 11488 return NewImpl<Int16Array, RawInt16Array>(kClassId, len, space);
11506 Class::Handle(isolate->object_store()->int16_array_class());
11507 return NewImpl<Int16Array, RawInt16Array>(cls, len, space);
11508 } 11489 }
11509 11490
11510 11491
11511 RawInt16Array* Int16Array::New(const int16_t* data, 11492 RawInt16Array* Int16Array::New(const int16_t* data,
11512 intptr_t len, 11493 intptr_t len,
11513 Heap::Space space) { 11494 Heap::Space space) {
11514 Isolate* isolate = Isolate::Current(); 11495 ASSERT(Isolate::Current()->object_store()->int16_array_class() !=
11515 ASSERT(isolate->object_store()->int16_array_class() != Class::null()); 11496 Class::null());
11516 const Class& cls = 11497 return NewImpl<Int16Array, RawInt16Array>(kClassId, data, len, space);
11517 Class::Handle(isolate->object_store()->int16_array_class());
11518 return NewImpl<Int16Array, RawInt16Array>(cls, data, len, space);
11519 } 11498 }
11520 11499
11521 11500
11522 const char* Int16Array::ToCString() const { 11501 const char* Int16Array::ToCString() const {
11523 return "_Int16Array"; 11502 return "_Int16Array";
11524 } 11503 }
11525 11504
11526 11505
11527 RawUint16Array* Uint16Array::New(intptr_t len, Heap::Space space) { 11506 RawUint16Array* Uint16Array::New(intptr_t len, Heap::Space space) {
11528 Isolate* isolate = Isolate::Current(); 11507 ASSERT(Isolate::Current()->object_store()->uint16_array_class() !=
11529 ASSERT(isolate->object_store()->uint16_array_class() != Class::null()); 11508 Class::null());
11530 const Class& cls = 11509 return NewImpl<Uint16Array, RawUint16Array>(kClassId, len, space);
11531 Class::Handle(isolate->object_store()->uint16_array_class());
11532 return NewImpl<Uint16Array, RawUint16Array>(cls, len, space);
11533 } 11510 }
11534 11511
11535 11512
11536 RawUint16Array* Uint16Array::New(const uint16_t* data, 11513 RawUint16Array* Uint16Array::New(const uint16_t* data,
11537 intptr_t len, 11514 intptr_t len,
11538 Heap::Space space) { 11515 Heap::Space space) {
11539 Isolate* isolate = Isolate::Current(); 11516 ASSERT(Isolate::Current()->object_store()->uint16_array_class() !=
11540 ASSERT(isolate->object_store()->uint16_array_class() != Class::null()); 11517 Class::null());
11541 const Class& cls = 11518 return NewImpl<Uint16Array, RawUint16Array>(kClassId, data, len, space);
11542 Class::Handle(isolate->object_store()->uint16_array_class());
11543 return NewImpl<Uint16Array, RawUint16Array>(cls, data, len, space);
11544 } 11519 }
11545 11520
11546 11521
11547 const char* Uint16Array::ToCString() const { 11522 const char* Uint16Array::ToCString() const {
11548 return "_Uint16Array"; 11523 return "_Uint16Array";
11549 } 11524 }
11550 11525
11551 11526
11552 RawInt32Array* Int32Array::New(intptr_t len, Heap::Space space) { 11527 RawInt32Array* Int32Array::New(intptr_t len, Heap::Space space) {
11553 Isolate* isolate = Isolate::Current(); 11528 ASSERT(Isolate::Current()->object_store()->int32_array_class() !=
11554 ASSERT(isolate->object_store()->int32_array_class() != Class::null()); 11529 Class::null());
11555 const Class& cls = 11530 return NewImpl<Int32Array, RawInt32Array>(kClassId, len, space);
11556 Class::Handle(isolate->object_store()->int32_array_class());
11557 return NewImpl<Int32Array, RawInt32Array>(cls, len, space);
11558 } 11531 }
11559 11532
11560 11533
11561 RawInt32Array* Int32Array::New(const int32_t* data, 11534 RawInt32Array* Int32Array::New(const int32_t* data,
11562 intptr_t len, 11535 intptr_t len,
11563 Heap::Space space) { 11536 Heap::Space space) {
11564 Isolate* isolate = Isolate::Current(); 11537 ASSERT(Isolate::Current()->object_store()->int32_array_class() !=
11565 ASSERT(isolate->object_store()->int32_array_class() != Class::null()); 11538 Class::null());
11566 const Class& cls = 11539 return NewImpl<Int32Array, RawInt32Array>(kClassId, data, len, space);
11567 Class::Handle(isolate->object_store()->int32_array_class());
11568 return NewImpl<Int32Array, RawInt32Array>(cls, data, len, space);
11569 } 11540 }
11570 11541
11571 11542
11572 const char* Int32Array::ToCString() const { 11543 const char* Int32Array::ToCString() const {
11573 return "_Int32Array"; 11544 return "_Int32Array";
11574 } 11545 }
11575 11546
11576 11547
11577 RawUint32Array* Uint32Array::New(intptr_t len, Heap::Space space) { 11548 RawUint32Array* Uint32Array::New(intptr_t len, Heap::Space space) {
11578 Isolate* isolate = Isolate::Current(); 11549 ASSERT(Isolate::Current()->object_store()->uint32_array_class() !=
11579 ASSERT(isolate->object_store()->uint32_array_class() != Class::null()); 11550 Class::null());
11580 const Class& cls = 11551 return NewImpl<Uint32Array, RawUint32Array>(kClassId, len, space);
11581 Class::Handle(isolate->object_store()->uint32_array_class());
11582 return NewImpl<Uint32Array, RawUint32Array>(cls, len, space);
11583 } 11552 }
11584 11553
11585 11554
11586 RawUint32Array* Uint32Array::New(const uint32_t* data, 11555 RawUint32Array* Uint32Array::New(const uint32_t* data,
11587 intptr_t len, 11556 intptr_t len,
11588 Heap::Space space) { 11557 Heap::Space space) {
11589 Isolate* isolate = Isolate::Current(); 11558 ASSERT(Isolate::Current()->object_store()->uint32_array_class() !=
11590 ASSERT(isolate->object_store()->uint32_array_class() != Class::null()); 11559 Class::null());
11591 const Class& cls = 11560 return NewImpl<Uint32Array, RawUint32Array>(kClassId, data, len, space);
11592 Class::Handle(isolate->object_store()->uint32_array_class());
11593 return NewImpl<Uint32Array, RawUint32Array>(cls, data, len, space);
11594 } 11561 }
11595 11562
11596 11563
11597 const char* Uint32Array::ToCString() const { 11564 const char* Uint32Array::ToCString() const {
11598 return "_Uint32Array"; 11565 return "_Uint32Array";
11599 } 11566 }
11600 11567
11601 11568
11602 RawInt64Array* Int64Array::New(intptr_t len, Heap::Space space) { 11569 RawInt64Array* Int64Array::New(intptr_t len, Heap::Space space) {
11603 Isolate* isolate = Isolate::Current(); 11570 ASSERT(Isolate::Current()->object_store()->int64_array_class() !=
11604 ASSERT(isolate->object_store()->int64_array_class() != Class::null()); 11571 Class::null());
11605 const Class& cls = 11572 return NewImpl<Int64Array, RawInt64Array>(kClassId, len, space);
11606 Class::Handle(isolate->object_store()->int64_array_class());
11607 return NewImpl<Int64Array, RawInt64Array>(cls, len, space);
11608 } 11573 }
11609 11574
11610 11575
11611 RawInt64Array* Int64Array::New(const int64_t* data, 11576 RawInt64Array* Int64Array::New(const int64_t* data,
11612 intptr_t len, 11577 intptr_t len,
11613 Heap::Space space) { 11578 Heap::Space space) {
11614 Isolate* isolate = Isolate::Current(); 11579 ASSERT(Isolate::Current()->object_store()->int64_array_class() !=
11615 ASSERT(isolate->object_store()->int64_array_class() != Class::null()); 11580 Class::null());
11616 const Class& cls = 11581 return NewImpl<Int64Array, RawInt64Array>(kClassId, data, len, space);
11617 Class::Handle(isolate->object_store()->int64_array_class());
11618 return NewImpl<Int64Array, RawInt64Array>(cls, data, len, space);
11619 } 11582 }
11620 11583
11621 11584
11622 const char* Int64Array::ToCString() const { 11585 const char* Int64Array::ToCString() const {
11623 return "_Int64Array"; 11586 return "_Int64Array";
11624 } 11587 }
11625 11588
11626 11589
11627 RawUint64Array* Uint64Array::New(intptr_t len, Heap::Space space) { 11590 RawUint64Array* Uint64Array::New(intptr_t len, Heap::Space space) {
11628 Isolate* isolate = Isolate::Current(); 11591 ASSERT(Isolate::Current()->object_store()->uint64_array_class() !=
11629 ASSERT(isolate->object_store()->uint64_array_class() != Class::null()); 11592 Class::null());
11630 const Class& cls = 11593 return NewImpl<Uint64Array, RawUint64Array>(kClassId, len, space);
11631 Class::Handle(isolate->object_store()->uint64_array_class());
11632 return NewImpl<Uint64Array, RawUint64Array>(cls, len, space);
11633 } 11594 }
11634 11595
11635 11596
11636 RawUint64Array* Uint64Array::New(const uint64_t* data, 11597 RawUint64Array* Uint64Array::New(const uint64_t* data,
11637 intptr_t len, 11598 intptr_t len,
11638 Heap::Space space) { 11599 Heap::Space space) {
11639 Isolate* isolate = Isolate::Current(); 11600 ASSERT(Isolate::Current()->object_store()->uint64_array_class() !=
11640 ASSERT(isolate->object_store()->uint64_array_class() != Class::null()); 11601 Class::null());
11641 const Class& cls = 11602 return NewImpl<Uint64Array, RawUint64Array>(kClassId, data, len, space);
11642 Class::Handle(isolate->object_store()->uint64_array_class());
11643 return NewImpl<Uint64Array, RawUint64Array>(cls, data, len, space);
11644 } 11603 }
11645 11604
11646 11605
11647 const char* Uint64Array::ToCString() const { 11606 const char* Uint64Array::ToCString() const {
11648 return "_Uint64Array"; 11607 return "_Uint64Array";
11649 } 11608 }
11650 11609
11651 11610
11652 RawFloat32Array* Float32Array::New(intptr_t len, Heap::Space space) { 11611 RawFloat32Array* Float32Array::New(intptr_t len, Heap::Space space) {
11653 Isolate* isolate = Isolate::Current(); 11612 ASSERT(Isolate::Current()->object_store()->float32_array_class() !=
11654 ASSERT(isolate->object_store()->float32_array_class() != Class::null()); 11613 Class::null());
11655 const Class& cls = 11614 return NewImpl<Float32Array, RawFloat32Array>(kClassId, len, space);
11656 Class::Handle(isolate->object_store()->float32_array_class());
11657 return NewImpl<Float32Array, RawFloat32Array>(cls, len, space);
11658 } 11615 }
11659 11616
11660 11617
11661 RawFloat32Array* Float32Array::New(const float* data, 11618 RawFloat32Array* Float32Array::New(const float* data,
11662 intptr_t len, 11619 intptr_t len,
11663 Heap::Space space) { 11620 Heap::Space space) {
11664 Isolate* isolate = Isolate::Current(); 11621 ASSERT(Isolate::Current()->object_store()->float32_array_class() !=
11665 ASSERT(isolate->object_store()->float32_array_class() != Class::null()); 11622 Class::null());
11666 const Class& cls = 11623 return NewImpl<Float32Array, RawFloat32Array>(kClassId, data, len, space);
11667 Class::Handle(isolate->object_store()->float32_array_class());
11668 return NewImpl<Float32Array, RawFloat32Array>(cls, data, len, space);
11669 } 11624 }
11670 11625
11671 11626
11672 const char* Float32Array::ToCString() const { 11627 const char* Float32Array::ToCString() const {
11673 return "_Float32Array"; 11628 return "_Float32Array";
11674 } 11629 }
11675 11630
11676 11631
11677 RawFloat64Array* Float64Array::New(intptr_t len, Heap::Space space) { 11632 RawFloat64Array* Float64Array::New(intptr_t len, Heap::Space space) {
11678 Isolate* isolate = Isolate::Current(); 11633 ASSERT(Isolate::Current()->object_store()->float64_array_class() !=
11679 ASSERT(isolate->object_store()->float64_array_class() != Class::null()); 11634 Class::null());
11680 const Class& cls = 11635 return NewImpl<Float64Array, RawFloat64Array>(kClassId, len, space);
11681 Class::Handle(isolate->object_store()->float64_array_class());
11682 return NewImpl<Float64Array, RawFloat64Array>(cls, len, space);
11683 } 11636 }
11684 11637
11685 11638
11686 RawFloat64Array* Float64Array::New(const double* data, 11639 RawFloat64Array* Float64Array::New(const double* data,
11687 intptr_t len, 11640 intptr_t len,
11688 Heap::Space space) { 11641 Heap::Space space) {
11689 Isolate* isolate = Isolate::Current(); 11642 ASSERT(Isolate::Current()->object_store()->float64_array_class() !=
11690 ASSERT(isolate->object_store()->float64_array_class() != Class::null()); 11643 Class::null());
11691 const Class& cls = 11644 return NewImpl<Float64Array, RawFloat64Array>(kClassId, data, len, space);
11692 Class::Handle(isolate->object_store()->float64_array_class());
11693 return NewImpl<Float64Array, RawFloat64Array>(cls, data, len, space);
11694 } 11645 }
11695 11646
11696 11647
11697 const char* Float64Array::ToCString() const { 11648 const char* Float64Array::ToCString() const {
11698 return "_Float64Array"; 11649 return "_Float64Array";
11699 } 11650 }
11700 11651
11701 11652
11702 RawExternalInt8Array* ExternalInt8Array::New(int8_t* data, 11653 RawExternalInt8Array* ExternalInt8Array::New(int8_t* data,
11703 intptr_t len, 11654 intptr_t len,
11704 void* peer, 11655 void* peer,
11705 Dart_PeerFinalizer callback, 11656 Dart_PeerFinalizer callback,
11706 Heap::Space space) { 11657 Heap::Space space) {
11707 Isolate* isolate = Isolate::Current(); 11658 ASSERT(Isolate::Current()->object_store()->external_int8_array_class() !=
11708 ASSERT(isolate->object_store()->external_int8_array_class() != Class::null()); 11659 Class::null());
11709 const Class& cls =
11710 Class::Handle(isolate->object_store()->external_int8_array_class());
11711 return NewExternalImpl<ExternalInt8Array, RawExternalInt8Array>( 11660 return NewExternalImpl<ExternalInt8Array, RawExternalInt8Array>(
11712 cls, data, len, peer, callback, space); 11661 kClassId, data, len, peer, callback, space);
11713 } 11662 }
11714 11663
11715 11664
11716 const char* ExternalInt8Array::ToCString() const { 11665 const char* ExternalInt8Array::ToCString() const {
11717 return "_ExternalInt8Array"; 11666 return "_ExternalInt8Array";
11718 } 11667 }
11719 11668
11720 11669
11721 RawExternalUint8Array* ExternalUint8Array::New(uint8_t* data, 11670 RawExternalUint8Array* ExternalUint8Array::New(uint8_t* data,
11722 intptr_t len, 11671 intptr_t len,
11723 void* peer, 11672 void* peer,
11724 Dart_PeerFinalizer callback, 11673 Dart_PeerFinalizer callback,
11725 Heap::Space space) { 11674 Heap::Space space) {
11726 Isolate* isolate = Isolate::Current(); 11675 ASSERT(Isolate::Current()->object_store()->external_uint8_array_class() !=
11727 ASSERT(isolate->object_store()->external_uint8_array_class() !=
11728 Class::null()); 11676 Class::null());
11729 const Class& cls =
11730 Class::Handle(isolate->object_store()->external_uint8_array_class());
11731 return NewExternalImpl<ExternalUint8Array, RawExternalUint8Array>( 11677 return NewExternalImpl<ExternalUint8Array, RawExternalUint8Array>(
11732 cls, data, len, peer, callback, space); 11678 kClassId, data, len, peer, callback, space);
11733 } 11679 }
11734 11680
11735 11681
11736 const char* ExternalUint8Array::ToCString() const { 11682 const char* ExternalUint8Array::ToCString() const {
11737 return "_ExternalUint8Array"; 11683 return "_ExternalUint8Array";
11738 } 11684 }
11739 11685
11740 11686
11741 RawExternalInt16Array* ExternalInt16Array::New(int16_t* data, 11687 RawExternalInt16Array* ExternalInt16Array::New(int16_t* data,
11742 intptr_t len, 11688 intptr_t len,
11743 void* peer, 11689 void* peer,
11744 Dart_PeerFinalizer callback, 11690 Dart_PeerFinalizer callback,
11745 Heap::Space space) { 11691 Heap::Space space) {
11746 Isolate* isolate = Isolate::Current(); 11692 ASSERT(Isolate::Current()->object_store()->external_int16_array_class() !=
11747 ASSERT(isolate->object_store()->external_int16_array_class() !=
11748 Class::null()); 11693 Class::null());
11749 const Class& cls =
11750 Class::Handle(isolate->object_store()->external_int16_array_class());
11751 return NewExternalImpl<ExternalInt16Array, RawExternalInt16Array>( 11694 return NewExternalImpl<ExternalInt16Array, RawExternalInt16Array>(
11752 cls, data, len, peer, callback, space); 11695 kClassId, data, len, peer, callback, space);
11753 } 11696 }
11754 11697
11755 11698
11756 const char* ExternalInt16Array::ToCString() const { 11699 const char* ExternalInt16Array::ToCString() const {
11757 return "_ExternalInt16Array"; 11700 return "_ExternalInt16Array";
11758 } 11701 }
11759 11702
11760 11703
11761 RawExternalUint16Array* ExternalUint16Array::New(uint16_t* data, 11704 RawExternalUint16Array* ExternalUint16Array::New(uint16_t* data,
11762 intptr_t len, 11705 intptr_t len,
11763 void* peer, 11706 void* peer,
11764 Dart_PeerFinalizer callback, 11707 Dart_PeerFinalizer callback,
11765 Heap::Space space) { 11708 Heap::Space space) {
11766 Isolate* isolate = Isolate::Current(); 11709 ASSERT(Isolate::Current()->object_store()->external_uint16_array_class() !=
11767 ASSERT(isolate->object_store()->external_uint16_array_class() !=
11768 Class::null()); 11710 Class::null());
11769 const Class& cls =
11770 Class::Handle(isolate->object_store()->external_uint16_array_class());
11771 return NewExternalImpl<ExternalUint16Array, RawExternalUint16Array>( 11711 return NewExternalImpl<ExternalUint16Array, RawExternalUint16Array>(
11772 cls, data, len, peer, callback, space); 11712 kClassId, data, len, peer, callback, space);
11773 } 11713 }
11774 11714
11775 11715
11776 const char* ExternalUint16Array::ToCString() const { 11716 const char* ExternalUint16Array::ToCString() const {
11777 return "_ExternalUint16Array"; 11717 return "_ExternalUint16Array";
11778 } 11718 }
11779 11719
11780 11720
11781 RawExternalInt32Array* ExternalInt32Array::New(int32_t* data, 11721 RawExternalInt32Array* ExternalInt32Array::New(int32_t* data,
11782 intptr_t len, 11722 intptr_t len,
11783 void* peer, 11723 void* peer,
11784 Dart_PeerFinalizer callback, 11724 Dart_PeerFinalizer callback,
11785 Heap::Space space) { 11725 Heap::Space space) {
11786 Isolate* isolate = Isolate::Current(); 11726 ASSERT(Isolate::Current()->object_store()->external_int32_array_class() !=
11787 ASSERT(isolate->object_store()->external_int32_array_class() !=
11788 Class::null()); 11727 Class::null());
11789 const Class& cls =
11790 Class::Handle(isolate->object_store()->external_int32_array_class());
11791 return NewExternalImpl<ExternalInt32Array, RawExternalInt32Array>( 11728 return NewExternalImpl<ExternalInt32Array, RawExternalInt32Array>(
11792 cls, data, len, peer, callback, space); 11729 kClassId, data, len, peer, callback, space);
11793 } 11730 }
11794 11731
11795 11732
11796 const char* ExternalInt32Array::ToCString() const { 11733 const char* ExternalInt32Array::ToCString() const {
11797 return "_ExternalInt32Array"; 11734 return "_ExternalInt32Array";
11798 } 11735 }
11799 11736
11800 11737
11801 RawExternalUint32Array* ExternalUint32Array::New(uint32_t* data, 11738 RawExternalUint32Array* ExternalUint32Array::New(uint32_t* data,
11802 intptr_t len, 11739 intptr_t len,
11803 void* peer, 11740 void* peer,
11804 Dart_PeerFinalizer callback, 11741 Dart_PeerFinalizer callback,
11805 Heap::Space space) { 11742 Heap::Space space) {
11806 Isolate* isolate = Isolate::Current(); 11743 ASSERT(Isolate::Current()->object_store()->external_uint32_array_class() !=
11807 ASSERT(isolate->object_store()->external_uint32_array_class() !=
11808 Class::null()); 11744 Class::null());
11809 const Class& cls =
11810 Class::Handle(isolate->object_store()->external_uint32_array_class());
11811 return NewExternalImpl<ExternalUint32Array, RawExternalUint32Array>( 11745 return NewExternalImpl<ExternalUint32Array, RawExternalUint32Array>(
11812 cls, data, len, peer, callback, space); 11746 kClassId, data, len, peer, callback, space);
11813 } 11747 }
11814 11748
11815 11749
11816 const char* ExternalUint32Array::ToCString() const { 11750 const char* ExternalUint32Array::ToCString() const {
11817 return "_ExternalUint32Array"; 11751 return "_ExternalUint32Array";
11818 } 11752 }
11819 11753
11820 11754
11821 RawExternalInt64Array* ExternalInt64Array::New(int64_t* data, 11755 RawExternalInt64Array* ExternalInt64Array::New(int64_t* data,
11822 intptr_t len, 11756 intptr_t len,
11823 void* peer, 11757 void* peer,
11824 Dart_PeerFinalizer callback, 11758 Dart_PeerFinalizer callback,
11825 Heap::Space space) { 11759 Heap::Space space) {
11826 Isolate* isolate = Isolate::Current(); 11760 ASSERT(Isolate::Current()->object_store()->external_int64_array_class() !=
11827 ASSERT(isolate->object_store()->external_int64_array_class() !=
11828 Class::null()); 11761 Class::null());
11829 const Class& cls =
11830 Class::Handle(isolate->object_store()->external_int64_array_class());
11831 return NewExternalImpl<ExternalInt64Array, RawExternalInt64Array>( 11762 return NewExternalImpl<ExternalInt64Array, RawExternalInt64Array>(
11832 cls, data, len, peer, callback, space); 11763 kClassId, data, len, peer, callback, space);
11833 } 11764 }
11834 11765
11835 11766
11836 const char* ExternalInt64Array::ToCString() const { 11767 const char* ExternalInt64Array::ToCString() const {
11837 return "_ExternalInt64Array"; 11768 return "_ExternalInt64Array";
11838 } 11769 }
11839 11770
11840 11771
11841 RawExternalUint64Array* ExternalUint64Array::New(uint64_t* data, 11772 RawExternalUint64Array* ExternalUint64Array::New(uint64_t* data,
11842 intptr_t len, 11773 intptr_t len,
11843 void* peer, 11774 void* peer,
11844 Dart_PeerFinalizer callback, 11775 Dart_PeerFinalizer callback,
11845 Heap::Space space) { 11776 Heap::Space space) {
11846 Isolate* isolate = Isolate::Current(); 11777 ASSERT(Isolate::Current()->object_store()->external_uint64_array_class() !=
11847 ASSERT(isolate->object_store()->external_uint64_array_class() !=
11848 Class::null()); 11778 Class::null());
11849 const Class& cls =
11850 Class::Handle(isolate->object_store()->external_uint64_array_class());
11851 return NewExternalImpl<ExternalUint64Array, RawExternalUint64Array>( 11779 return NewExternalImpl<ExternalUint64Array, RawExternalUint64Array>(
11852 cls, data, len, peer, callback, space); 11780 kClassId, data, len, peer, callback, space);
11853 } 11781 }
11854 11782
11855 11783
11856 const char* ExternalUint64Array::ToCString() const { 11784 const char* ExternalUint64Array::ToCString() const {
11857 return "_ExternalUint64Array"; 11785 return "_ExternalUint64Array";
11858 } 11786 }
11859 11787
11860 11788
11861 RawExternalFloat32Array* ExternalFloat32Array::New(float* data, 11789 RawExternalFloat32Array* ExternalFloat32Array::New(float* data,
11862 intptr_t len, 11790 intptr_t len,
11863 void* peer, 11791 void* peer,
11864 Dart_PeerFinalizer callback, 11792 Dart_PeerFinalizer callback,
11865 Heap::Space space) { 11793 Heap::Space space) {
11866 Isolate* isolate = Isolate::Current(); 11794 ASSERT(Isolate::Current()->object_store()->external_float32_array_class() !=
11867 ASSERT(isolate->object_store()->external_float32_array_class() !=
11868 Class::null()); 11795 Class::null());
11869 const Class& cls =
11870 Class::Handle(isolate->object_store()->external_float32_array_class());
11871 return NewExternalImpl<ExternalFloat32Array, RawExternalFloat32Array>( 11796 return NewExternalImpl<ExternalFloat32Array, RawExternalFloat32Array>(
11872 cls, data, len, peer, callback, space); 11797 kClassId, data, len, peer, callback, space);
11873 } 11798 }
11874 11799
11875 11800
11876 const char* ExternalFloat32Array::ToCString() const { 11801 const char* ExternalFloat32Array::ToCString() const {
11877 return "_ExternalFloat32Array"; 11802 return "_ExternalFloat32Array";
11878 } 11803 }
11879 11804
11880 11805
11881 RawExternalFloat64Array* ExternalFloat64Array::New(double* data, 11806 RawExternalFloat64Array* ExternalFloat64Array::New(double* data,
11882 intptr_t len, 11807 intptr_t len,
11883 void* peer, 11808 void* peer,
11884 Dart_PeerFinalizer callback, 11809 Dart_PeerFinalizer callback,
11885 Heap::Space space) { 11810 Heap::Space space) {
11886 Isolate* isolate = Isolate::Current(); 11811 ASSERT(Isolate::Current()->object_store()->external_float64_array_class() !=
11887 ASSERT(isolate->object_store()->external_float64_array_class() !=
11888 Class::null()); 11812 Class::null());
11889 const Class& cls =
11890 Class::Handle(isolate->object_store()->external_float64_array_class());
11891 return NewExternalImpl<ExternalFloat64Array, RawExternalFloat64Array>( 11813 return NewExternalImpl<ExternalFloat64Array, RawExternalFloat64Array>(
11892 cls, data, len, peer, callback, space); 11814 kClassId, data, len, peer, callback, space);
11893 } 11815 }
11894 11816
11895 11817
11896 const char* ExternalFloat64Array::ToCString() const { 11818 const char* ExternalFloat64Array::ToCString() const {
11897 return "_ExternalFloat64Array"; 11819 return "_ExternalFloat64Array";
11898 } 11820 }
11899 11821
11900 11822
11901 const char* Closure::ToCString(const Instance& closure) { 11823 const char* Closure::ToCString(const Instance& closure) {
11902 const Function& fun = Function::Handle(Closure::function(closure)); 11824 const Function& fun = Function::Handle(Closure::function(closure));
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
12199 } 12121 }
12200 return result.raw(); 12122 return result.raw();
12201 } 12123 }
12202 12124
12203 12125
12204 const char* WeakProperty::ToCString() const { 12126 const char* WeakProperty::ToCString() const {
12205 return "_WeakProperty"; 12127 return "_WeakProperty";
12206 } 12128 }
12207 12129
12208 } // namespace dart 12130 } // namespace dart
OLDNEW
« no previous file with comments | « vm/object.h ('k') | vm/raw_object_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698