| OLD | NEW |
| 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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 | 401 |
| 402 ASSERT(class_class() != null_); | 402 ASSERT(class_class() != null_); |
| 403 | 403 |
| 404 // Pre-allocate the Array and OneByteString class in the vm isolate so that | 404 // Pre-allocate the Array and OneByteString class in the vm isolate so that |
| 405 // we can create a symbol table and populate it with some frequently used | 405 // we can create a symbol table and populate it with some frequently used |
| 406 // strings as symbols. | 406 // strings as symbols. |
| 407 cls = Class::New<Array>(); | 407 cls = Class::New<Array>(); |
| 408 isolate->object_store()->set_array_class(cls); | 408 isolate->object_store()->set_array_class(cls); |
| 409 cls = Class::NewStringClass(kOneByteStringCid); | 409 cls = Class::NewStringClass(kOneByteStringCid); |
| 410 isolate->object_store()->set_one_byte_string_class(cls); | 410 isolate->object_store()->set_one_byte_string_class(cls); |
| 411 cls = Class::NewStringClass(kTwoByteStringCid); |
| 412 isolate->object_store()->set_two_byte_string_class(cls); |
| 411 | 413 |
| 412 // Allocate and initialize the empty_array instance. | 414 // Allocate and initialize the empty_array instance. |
| 413 { | 415 { |
| 414 uword address = heap->Allocate(Array::InstanceSize(0), Heap::kOld); | 416 uword address = heap->Allocate(Array::InstanceSize(0), Heap::kOld); |
| 415 empty_array_ = reinterpret_cast<RawArray*>(address + kHeapObjectTag); | 417 empty_array_ = reinterpret_cast<RawArray*>(address + kHeapObjectTag); |
| 416 InitializeObject(address, kArrayCid, Array::InstanceSize(0)); | 418 InitializeObject(address, kArrayCid, Array::InstanceSize(0)); |
| 417 empty_array_->ptr()->length_ = Smi::New(0); | 419 empty_array_->ptr()->length_ = Smi::New(0); |
| 418 } | 420 } |
| 419 } | 421 } |
| 420 | 422 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 cls = Class::New<Type>(); | 585 cls = Class::New<Type>(); |
| 584 object_store->set_type_class(cls); | 586 object_store->set_type_class(cls); |
| 585 | 587 |
| 586 cls = Class::New<TypeParameter>(); | 588 cls = Class::New<TypeParameter>(); |
| 587 object_store->set_type_parameter_class(cls); | 589 object_store->set_type_parameter_class(cls); |
| 588 | 590 |
| 589 // Pre-allocate the OneByteString class needed by the symbol table. | 591 // Pre-allocate the OneByteString class needed by the symbol table. |
| 590 cls = Class::NewStringClass(kOneByteStringCid); | 592 cls = Class::NewStringClass(kOneByteStringCid); |
| 591 object_store->set_one_byte_string_class(cls); | 593 object_store->set_one_byte_string_class(cls); |
| 592 | 594 |
| 595 // Pre-allocate the TwoByteString class needed by the symbol table. |
| 596 cls = Class::NewStringClass(kTwoByteStringCid); |
| 597 object_store->set_two_byte_string_class(cls); |
| 598 |
| 593 // Setup the symbol table for the symbols created in the isolate. | 599 // Setup the symbol table for the symbols created in the isolate. |
| 594 Symbols::SetupSymbolTable(isolate); | 600 Symbols::SetupSymbolTable(isolate); |
| 595 | 601 |
| 596 // Set up the libraries array before initializing the core library. | 602 // Set up the libraries array before initializing the core library. |
| 597 const GrowableObjectArray& libraries = | 603 const GrowableObjectArray& libraries = |
| 598 GrowableObjectArray::Handle(GrowableObjectArray::New(Heap::kOld)); | 604 GrowableObjectArray::Handle(GrowableObjectArray::New(Heap::kOld)); |
| 599 object_store->set_libraries(libraries); | 605 object_store->set_libraries(libraries); |
| 600 | 606 |
| 601 // Basic infrastructure has been setup, initialize the class dictionary. | 607 // Basic infrastructure has been setup, initialize the class dictionary. |
| 602 Library::InitCoreLibrary(isolate); | 608 Library::InitCoreLibrary(isolate); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 ASSERT(object_store->immutable_array_class() != object_store->array_class()); | 649 ASSERT(object_store->immutable_array_class() != object_store->array_class()); |
| 644 name = Symbols::ImmutableArray(); | 650 name = Symbols::ImmutableArray(); |
| 645 RegisterPrivateClass(cls, name, core_lib); | 651 RegisterPrivateClass(cls, name, core_lib); |
| 646 pending_classes.Add(cls, Heap::kOld); | 652 pending_classes.Add(cls, Heap::kOld); |
| 647 | 653 |
| 648 cls = object_store->one_byte_string_class(); // Was allocated above. | 654 cls = object_store->one_byte_string_class(); // Was allocated above. |
| 649 name = Symbols::OneByteString(); | 655 name = Symbols::OneByteString(); |
| 650 RegisterPrivateClass(cls, name, core_lib); | 656 RegisterPrivateClass(cls, name, core_lib); |
| 651 pending_classes.Add(cls, Heap::kOld); | 657 pending_classes.Add(cls, Heap::kOld); |
| 652 | 658 |
| 653 cls = Class::NewStringClass(kTwoByteStringCid); | 659 cls = object_store->two_byte_string_class(); // Was allocated above. |
| 654 object_store->set_two_byte_string_class(cls); | |
| 655 name = Symbols::TwoByteString(); | 660 name = Symbols::TwoByteString(); |
| 656 RegisterPrivateClass(cls, name, core_lib); | 661 RegisterPrivateClass(cls, name, core_lib); |
| 657 pending_classes.Add(cls, Heap::kOld); | 662 pending_classes.Add(cls, Heap::kOld); |
| 658 | 663 |
| 659 cls = Class::NewStringClass(kExternalOneByteStringCid); | 664 cls = Class::NewStringClass(kExternalOneByteStringCid); |
| 660 object_store->set_external_one_byte_string_class(cls); | 665 object_store->set_external_one_byte_string_class(cls); |
| 661 name = Symbols::ExternalOneByteString(); | 666 name = Symbols::ExternalOneByteString(); |
| 662 RegisterPrivateClass(cls, name, core_lib); | 667 RegisterPrivateClass(cls, name, core_lib); |
| 663 pending_classes.Add(cls, Heap::kOld); | 668 pending_classes.Add(cls, Heap::kOld); |
| 664 | 669 |
| (...skipping 11421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12086 } | 12091 } |
| 12087 return result.raw(); | 12092 return result.raw(); |
| 12088 } | 12093 } |
| 12089 | 12094 |
| 12090 | 12095 |
| 12091 const char* WeakProperty::ToCString() const { | 12096 const char* WeakProperty::ToCString() const { |
| 12092 return "_WeakProperty"; | 12097 return "_WeakProperty"; |
| 12093 } | 12098 } |
| 12094 | 12099 |
| 12095 } // namespace dart | 12100 } // namespace dart |
| OLD | NEW |