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

Side by Side Diff: vm/object.cc

Issue 9594028: Add a first class GrowableObjectArray type in the VM and use it internally in the VM at all spots w… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 9 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 | « vm/object.h ('k') | vm/object_store.h » ('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 "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 cls.set_type_arguments_instance_field_offset(Array::type_arguments_offset()); 437 cls.set_type_arguments_instance_field_offset(Array::type_arguments_offset());
438 438
439 Array& empty_array = Array::Handle(); 439 Array& empty_array = Array::Handle();
440 empty_array = Array::New(0, Heap::kOld); 440 empty_array = Array::New(0, Heap::kOld);
441 object_store->set_empty_array(empty_array); 441 object_store->set_empty_array(empty_array);
442 442
443 // Re-initialize fields of the array class now that the empty array 443 // Re-initialize fields of the array class now that the empty array
444 // has been created. 444 // has been created.
445 cls.InitEmptyFields(); 445 cls.InitEmptyFields();
446 446
447 // Set up the growable object array class (Has to be done after the array
448 // class is setup as one of its field is an array object).
449 cls = Class::New<GrowableObjectArray>();
450 object_store->set_growable_object_array_class(cls);
451
447 // Setup the symbol table used within the String class. 452 // Setup the symbol table used within the String class.
448 const int kInitialSymbolTableSize = 16; 453 const int kInitialSymbolTableSize = 16;
449 array = Array::New(kInitialSymbolTableSize + 1); 454 array = Array::New(kInitialSymbolTableSize + 1);
450 // Last element contains the count of used slots. 455 // Last element contains the count of used slots.
451 array.SetAt(kInitialSymbolTableSize, Smi::Handle(Smi::New(0))); 456 array.SetAt(kInitialSymbolTableSize, Smi::Handle(Smi::New(0)));
452 object_store->set_symbol_table(array); 457 object_store->set_symbol_table(array);
453 458
454 // canonical_type_arguments_ are NULL terminated. 459 // canonical_type_arguments_ are NULL terminated.
455 array = Array::New(4); 460 array = Array::New(4);
456 object_store->set_canonical_type_arguments(array); 461 object_store->set_canonical_type_arguments(array);
457 462
458 // Pre-allocate the OneByteString class needed by the symbol table. 463 // Pre-allocate the OneByteString class needed by the symbol table.
459 cls = Class::New<OneByteString>(); 464 cls = Class::New<OneByteString>();
460 object_store->set_one_byte_string_class(cls); 465 object_store->set_one_byte_string_class(cls);
461 466
462 // Basic infrastructure has been setup, initialize the class dictionary. 467 // Basic infrastructure has been setup, initialize the class dictionary.
463 Library::InitCoreLibrary(isolate); 468 Library::InitCoreLibrary(isolate);
464 Library& core_lib = Library::Handle(Library::CoreLibrary()); 469 Library& core_lib = Library::Handle(Library::CoreLibrary());
465 ASSERT(!core_lib.IsNull()); 470 ASSERT(!core_lib.IsNull());
466 Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary()); 471 Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary());
467 ASSERT(!core_impl_lib.IsNull()); 472 ASSERT(!core_impl_lib.IsNull());
468 473
469 object_store->set_pending_classes(Array::Handle(Array::Empty())); 474 const GrowableObjectArray& pending_classes =
475 GrowableObjectArray::Handle(GrowableObjectArray::New(Heap::kOld));
476 object_store->set_pending_classes(pending_classes);
470 477
471 Context& context = Context::Handle(Context::New(0)); 478 Context& context = Context::Handle(Context::New(0));
472 object_store->set_empty_context(context); 479 object_store->set_empty_context(context);
473 480
474 // Now that the symbol table is initialized and that the core dictionary as 481 // Now that the symbol table is initialized and that the core dictionary as
475 // well as the core implementation dictionary have been setup, preallocate 482 // well as the core implementation dictionary have been setup, preallocate
476 // remaining classes and register them by name in the dictionaries. 483 // remaining classes and register them by name in the dictionaries.
477 const Script& impl_script = Script::Handle(Bootstrap::LoadImplScript()); 484 const Script& impl_script = Script::Handle(Bootstrap::LoadImplScript());
478 GrowableArray<const Class*> pending_classes;
479 485
480 cls = Class::New<Smi>(); 486 cls = Class::New<Smi>();
481 object_store->set_smi_class(cls); 487 object_store->set_smi_class(cls);
482 RegisterClass(cls, "Smi", impl_script, core_impl_lib); 488 RegisterClass(cls, "Smi", impl_script, core_impl_lib);
483 pending_classes.Add(&Class::ZoneHandle(cls.raw())); 489 pending_classes.Add(cls, Heap::kOld);
484 490
485 cls = Class::New<Mint>(); 491 cls = Class::New<Mint>();
486 object_store->set_mint_class(cls); 492 object_store->set_mint_class(cls);
487 RegisterClass(cls, "Mint", impl_script, core_impl_lib); 493 RegisterClass(cls, "Mint", impl_script, core_impl_lib);
488 pending_classes.Add(&Class::ZoneHandle(cls.raw())); 494 pending_classes.Add(cls, Heap::kOld);
489 495
490 cls = Class::New<Bigint>(); 496 cls = Class::New<Bigint>();
491 object_store->set_bigint_class(cls); 497 object_store->set_bigint_class(cls);
492 RegisterClass(cls, "Bigint", impl_script, core_impl_lib); 498 RegisterClass(cls, "Bigint", impl_script, core_impl_lib);
493 pending_classes.Add(&Class::ZoneHandle(cls.raw())); 499 pending_classes.Add(cls, Heap::kOld);
494 500
495 cls = Class::New<Double>(); 501 cls = Class::New<Double>();
496 object_store->set_double_class(cls); 502 object_store->set_double_class(cls);
497 RegisterClass(cls, "Double", impl_script, core_impl_lib); 503 RegisterClass(cls, "Double", impl_script, core_impl_lib);
498 pending_classes.Add(&Class::ZoneHandle(cls.raw())); 504 pending_classes.Add(cls, Heap::kOld);
499 505
500 cls = Class::New<Bool>(); 506 cls = Class::New<Bool>();
501 object_store->set_bool_class(cls); 507 object_store->set_bool_class(cls);
502 RegisterClass(cls, "Bool", impl_script, core_impl_lib); 508 RegisterClass(cls, "Bool", impl_script, core_impl_lib);
503 pending_classes.Add(&Class::ZoneHandle(cls.raw())); 509 pending_classes.Add(cls, Heap::kOld);
504 510
505 cls = object_store->array_class(); // Was allocated above. 511 cls = object_store->array_class(); // Was allocated above.
506 RegisterClass(cls, "ObjectArray", impl_script, core_impl_lib); 512 RegisterClass(cls, "ObjectArray", impl_script, core_impl_lib);
507 pending_classes.Add(&Class::ZoneHandle(cls.raw())); 513 pending_classes.Add(cls, Heap::kOld);
508 514
509 cls = Class::New<ImmutableArray>(); 515 cls = Class::New<ImmutableArray>();
510 object_store->set_immutable_array_class(cls); 516 object_store->set_immutable_array_class(cls);
511 cls.set_type_arguments_instance_field_offset(Array::type_arguments_offset()); 517 cls.set_type_arguments_instance_field_offset(Array::type_arguments_offset());
512 ASSERT(object_store->immutable_array_class() != object_store->array_class()); 518 ASSERT(object_store->immutable_array_class() != object_store->array_class());
513 RegisterClass(cls, "ImmutableArray", impl_script, core_impl_lib); 519 RegisterClass(cls, "ImmutableArray", impl_script, core_impl_lib);
514 pending_classes.Add(&Class::ZoneHandle(cls.raw())); 520 pending_classes.Add(cls, Heap::kOld);
515 521
516 cls = object_store->one_byte_string_class(); // Was allocated above. 522 cls = object_store->one_byte_string_class(); // Was allocated above.
517 RegisterClass(cls, "OneByteString", impl_script, core_impl_lib); 523 RegisterClass(cls, "OneByteString", impl_script, core_impl_lib);
518 pending_classes.Add(&Class::ZoneHandle(cls.raw())); 524 pending_classes.Add(cls, Heap::kOld);
519 525
520 cls = Class::New<TwoByteString>(); 526 cls = Class::New<TwoByteString>();
521 object_store->set_two_byte_string_class(cls); 527 object_store->set_two_byte_string_class(cls);
522 RegisterClass(cls, "TwoByteString", impl_script, core_impl_lib); 528 RegisterClass(cls, "TwoByteString", impl_script, core_impl_lib);
523 pending_classes.Add(&Class::ZoneHandle(cls.raw())); 529 pending_classes.Add(cls, Heap::kOld);
524 530
525 cls = Class::New<FourByteString>(); 531 cls = Class::New<FourByteString>();
526 object_store->set_four_byte_string_class(cls); 532 object_store->set_four_byte_string_class(cls);
527 RegisterClass(cls, "FourByteString", impl_script, core_impl_lib); 533 RegisterClass(cls, "FourByteString", impl_script, core_impl_lib);
528 pending_classes.Add(&Class::ZoneHandle(cls.raw())); 534 pending_classes.Add(cls, Heap::kOld);
529 535
530 cls = Class::New<ExternalOneByteString>(); 536 cls = Class::New<ExternalOneByteString>();
531 object_store->set_external_one_byte_string_class(cls); 537 object_store->set_external_one_byte_string_class(cls);
532 RegisterClass(cls, "ExternalOneByteString", impl_script, core_impl_lib); 538 RegisterClass(cls, "ExternalOneByteString", impl_script, core_impl_lib);
533 pending_classes.Add(&Class::ZoneHandle(cls.raw())); 539 pending_classes.Add(cls, Heap::kOld);
534 540
535 cls = Class::New<ExternalTwoByteString>(); 541 cls = Class::New<ExternalTwoByteString>();
536 object_store->set_external_two_byte_string_class(cls); 542 object_store->set_external_two_byte_string_class(cls);
537 RegisterClass(cls, "ExternalTwoByteString", impl_script, core_impl_lib); 543 RegisterClass(cls, "ExternalTwoByteString", impl_script, core_impl_lib);
538 pending_classes.Add(&Class::ZoneHandle(cls.raw())); 544 pending_classes.Add(cls, Heap::kOld);
539 545
540 cls = Class::New<ExternalFourByteString>(); 546 cls = Class::New<ExternalFourByteString>();
541 object_store->set_external_four_byte_string_class(cls); 547 object_store->set_external_four_byte_string_class(cls);
542 RegisterClass(cls, "ExternalFourByteString", impl_script, core_impl_lib); 548 RegisterClass(cls, "ExternalFourByteString", impl_script, core_impl_lib);
543 pending_classes.Add(&Class::ZoneHandle(cls.raw())); 549 pending_classes.Add(cls, Heap::kOld);
544 550
545 cls = Class::New<Stacktrace>(); 551 cls = Class::New<Stacktrace>();
546 object_store->set_stacktrace_class(cls); 552 object_store->set_stacktrace_class(cls);
547 RegisterClass(cls, "Stacktrace", impl_script, core_impl_lib); 553 RegisterClass(cls, "Stacktrace", impl_script, core_impl_lib);
548 pending_classes.Add(&Class::ZoneHandle(cls.raw())); 554 pending_classes.Add(cls, Heap::kOld);
549 // Super type set below, after Object is allocated. 555 // Super type set below, after Object is allocated.
550 556
551 cls = Class::New<JSRegExp>(); 557 cls = Class::New<JSRegExp>();
552 object_store->set_jsregexp_class(cls); 558 object_store->set_jsregexp_class(cls);
553 RegisterClass(cls, "JSSyntaxRegExp", impl_script, core_impl_lib); 559 RegisterClass(cls, "JSSyntaxRegExp", impl_script, core_impl_lib);
554 pending_classes.Add(&Class::ZoneHandle(cls.raw())); 560 pending_classes.Add(cls, Heap::kOld);
555 561
556 // Initialize the base interfaces used by the core VM classes. 562 // Initialize the base interfaces used by the core VM classes.
557 const Script& script = Script::Handle(Bootstrap::LoadScript()); 563 const Script& script = Script::Handle(Bootstrap::LoadScript());
558 564
559 // Allocate and initialize the Object class and type. 565 // Allocate and initialize the Object class and type.
560 // The Object and ExternalByteArray classes are the only pre-allocated 566 // The Object and ExternalByteArray classes are the only pre-allocated
561 // non-interface classes in the core library. 567 // non-interface classes in the core library.
562 cls = Class::New<Instance>(); 568 cls = Class::New<Instance>();
563 object_store->set_object_class(cls); 569 object_store->set_object_class(cls);
564 cls.set_name(String::Handle(String::NewSymbol("Object"))); 570 cls.set_name(String::Handle(String::NewSymbol("Object")));
565 cls.set_script(script); 571 cls.set_script(script);
566 core_lib.AddClass(cls); 572 core_lib.AddClass(cls);
567 pending_classes.Add(&Class::ZoneHandle(cls.raw())); 573 pending_classes.Add(cls, Heap::kOld);
568 type = Type::NewNonParameterizedType(cls); 574 type = Type::NewNonParameterizedType(cls);
569 object_store->set_object_type(type); 575 object_store->set_object_type(type);
570 576
571 cls = Class::New<InternalByteArray>(); 577 cls = Class::New<InternalByteArray>();
572 object_store->set_internal_byte_array_class(cls); 578 object_store->set_internal_byte_array_class(cls);
573 cls.set_name(String::Handle(core_lib.PrivateName("_InternalByteArray"))); 579 cls.set_name(String::Handle(core_lib.PrivateName("_InternalByteArray")));
574 cls.set_script(script); 580 cls.set_script(script);
575 core_lib.AddClass(cls); 581 core_lib.AddClass(cls);
576 582
577 cls = Class::New<ExternalByteArray>(); 583 cls = Class::New<ExternalByteArray>();
578 object_store->set_external_byte_array_class(cls); 584 object_store->set_external_byte_array_class(cls);
579 cls.set_name(String::Handle(core_lib.PrivateName("_ExternalByteArray"))); 585 cls.set_name(String::Handle(core_lib.PrivateName("_ExternalByteArray")));
580 cls.set_script(script); 586 cls.set_script(script);
581 core_lib.AddClass(cls); 587 core_lib.AddClass(cls);
582 588
583 // Set the super type of class Stacktrace to Object type so that the 589 // Set the super type of class Stacktrace to Object type so that the
584 // 'toString' method is implemented. 590 // 'toString' method is implemented.
585 cls = object_store->stacktrace_class(); 591 cls = object_store->stacktrace_class();
586 cls.set_super_type(type); 592 cls.set_super_type(type);
587 593
588 cls = CreateAndRegisterInterface("Function", script, core_lib); 594 cls = CreateAndRegisterInterface("Function", script, core_lib);
589 pending_classes.Add(&Class::ZoneHandle(cls.raw())); 595 pending_classes.Add(cls, Heap::kOld);
590 type = Type::NewNonParameterizedType(cls); 596 type = Type::NewNonParameterizedType(cls);
591 object_store->set_function_interface(type); 597 object_store->set_function_interface(type);
592 598
593 cls = CreateAndRegisterInterface("num", script, core_lib); 599 cls = CreateAndRegisterInterface("num", script, core_lib);
594 pending_classes.Add(&Class::ZoneHandle(cls.raw())); 600 pending_classes.Add(cls, Heap::kOld);
595 type = Type::NewNonParameterizedType(cls); 601 type = Type::NewNonParameterizedType(cls);
596 object_store->set_number_interface(type); 602 object_store->set_number_interface(type);
597 603
598 cls = CreateAndRegisterInterface("int", script, core_lib); 604 cls = CreateAndRegisterInterface("int", script, core_lib);
599 pending_classes.Add(&Class::ZoneHandle(cls.raw())); 605 pending_classes.Add(cls, Heap::kOld);
600 type = Type::NewNonParameterizedType(cls); 606 type = Type::NewNonParameterizedType(cls);
601 object_store->set_int_interface(type); 607 object_store->set_int_interface(type);
602 608
603 cls = CreateAndRegisterInterface("double", script, core_lib); 609 cls = CreateAndRegisterInterface("double", script, core_lib);
604 pending_classes.Add(&Class::ZoneHandle(cls.raw())); 610 pending_classes.Add(cls, Heap::kOld);
605 type = Type::NewNonParameterizedType(cls); 611 type = Type::NewNonParameterizedType(cls);
606 object_store->set_double_interface(type); 612 object_store->set_double_interface(type);
607 613
608 cls = CreateAndRegisterInterface("String", script, core_lib); 614 cls = CreateAndRegisterInterface("String", script, core_lib);
609 pending_classes.Add(&Class::ZoneHandle(cls.raw())); 615 pending_classes.Add(cls, Heap::kOld);
610 type = Type::NewNonParameterizedType(cls); 616 type = Type::NewNonParameterizedType(cls);
611 object_store->set_string_interface(type); 617 object_store->set_string_interface(type);
612 618
613 cls = CreateAndRegisterInterface("bool", script, core_lib); 619 cls = CreateAndRegisterInterface("bool", script, core_lib);
614 pending_classes.Add(&Class::ZoneHandle(cls.raw())); 620 pending_classes.Add(cls, Heap::kOld);
615 type = Type::NewNonParameterizedType(cls); 621 type = Type::NewNonParameterizedType(cls);
616 object_store->set_bool_interface(type); 622 object_store->set_bool_interface(type);
617 623
618 cls = CreateAndRegisterInterface("List", script, core_lib); 624 cls = CreateAndRegisterInterface("List", script, core_lib);
619 pending_classes.Add(&Class::ZoneHandle(cls.raw())); 625 pending_classes.Add(cls, Heap::kOld);
620 type = Type::NewNonParameterizedType(cls); 626 type = Type::NewNonParameterizedType(cls);
621 object_store->set_list_interface(type); 627 object_store->set_list_interface(type);
622 628
623 cls = CreateAndRegisterInterface("ByteArray", script, core_lib); 629 cls = CreateAndRegisterInterface("ByteArray", script, core_lib);
624 pending_classes.Add(&Class::ZoneHandle(cls.raw())); 630 pending_classes.Add(cls, Heap::kOld);
625 type = Type::NewNonParameterizedType(cls); 631 type = Type::NewNonParameterizedType(cls);
626 object_store->set_byte_array_interface(type); 632 object_store->set_byte_array_interface(type);
627 633
628 // The classes 'Null' and 'void' are not registered in the class dictionary, 634 // The classes 'Null' and 'void' are not registered in the class dictionary,
629 // because their names are reserved keywords. Their names are not heap 635 // because their names are reserved keywords. Their names are not heap
630 // allocated, because the classes reside in the VM isolate. 636 // allocated, because the classes reside in the VM isolate.
631 // The corresponding types are stored in the object store. 637 // The corresponding types are stored in the object store.
632 cls = null_class_; 638 cls = null_class_;
633 type = Type::NewNonParameterizedType(cls); 639 type = Type::NewNonParameterizedType(cls);
634 object_store->set_null_type(type); 640 object_store->set_null_type(type);
635 641
636 cls = void_class_; 642 cls = void_class_;
637 type = Type::NewNonParameterizedType(cls); 643 type = Type::NewNonParameterizedType(cls);
638 object_store->set_void_type(type); 644 object_store->set_void_type(type);
639 645
640 // The class 'Dynamic' is registered in the class dictionary because its name 646 // The class 'Dynamic' is registered in the class dictionary because its name
641 // is a built-in identifier, rather than a reserved keyword. Its name is not 647 // is a built-in identifier, rather than a reserved keyword. Its name is not
642 // heap allocated, because the class resides in the VM isolate. 648 // heap allocated, because the class resides in the VM isolate.
643 // The corresponding type, the "unknown type", is stored in the object store. 649 // The corresponding type, the "unknown type", is stored in the object store.
644 cls = dynamic_class_; 650 cls = dynamic_class_;
645 type = Type::NewNonParameterizedType(cls); 651 type = Type::NewNonParameterizedType(cls);
646 object_store->set_dynamic_type(type); 652 object_store->set_dynamic_type(type);
647 core_lib.AddClass(cls); 653 core_lib.AddClass(cls);
648 654
649 // Add the preallocated classes to the list of classes to be finalized.
650 ClassFinalizer::AddPendingClasses(pending_classes);
651
652 // Allocate pre-initialized values. 655 // Allocate pre-initialized values.
653 Bool& bool_value = Bool::Handle(); 656 Bool& bool_value = Bool::Handle();
654 bool_value = Bool::New(true); 657 bool_value = Bool::New(true);
655 object_store->set_true_value(bool_value); 658 object_store->set_true_value(bool_value);
656 bool_value = Bool::New(false); 659 bool_value = Bool::New(false);
657 object_store->set_false_value(bool_value); 660 object_store->set_false_value(bool_value);
658 661
659 // Setup some default native field classes which can be extended for 662 // Setup some default native field classes which can be extended for
660 // specifying native fields in dart classes. 663 // specifying native fields in dart classes.
661 Library::InitNativeWrappersLibrary(isolate); 664 Library::InitNativeWrappersLibrary(isolate);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 cls = Class::New<Array>(); 709 cls = Class::New<Array>();
707 object_store->set_array_class(cls); 710 object_store->set_array_class(cls);
708 711
709 Array& empty_array = Array::Handle(); 712 Array& empty_array = Array::Handle();
710 empty_array = Array::New(0); 713 empty_array = Array::New(0);
711 object_store->set_empty_array(empty_array); 714 object_store->set_empty_array(empty_array);
712 715
713 cls = Class::New<ImmutableArray>(); 716 cls = Class::New<ImmutableArray>();
714 object_store->set_immutable_array_class(cls); 717 object_store->set_immutable_array_class(cls);
715 718
719 cls = Class::New<GrowableObjectArray>();
720 object_store->set_growable_object_array_class(cls);
721
716 cls = Class::New<InternalByteArray>(); 722 cls = Class::New<InternalByteArray>();
717 object_store->set_internal_byte_array_class(cls); 723 object_store->set_internal_byte_array_class(cls);
718 724
719 cls = Class::New<ExternalByteArray>(); 725 cls = Class::New<ExternalByteArray>();
720 object_store->set_external_byte_array_class(cls); 726 object_store->set_external_byte_array_class(cls);
721 727
722 cls = Class::New<Instance>(); 728 cls = Class::New<Instance>();
723 object_store->set_object_class(cls); 729 object_store->set_object_class(cls);
724 730
725 cls = Class::New<Smi>(); 731 cls = Class::New<Smi>();
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 return object_store->external_four_byte_string_class(); 1278 return object_store->external_four_byte_string_class();
1273 case kBool: 1279 case kBool:
1274 ASSERT(object_store->bool_class() != Class::null()); 1280 ASSERT(object_store->bool_class() != Class::null());
1275 return object_store->bool_class(); 1281 return object_store->bool_class();
1276 case kArray: 1282 case kArray:
1277 ASSERT(object_store->array_class() != Class::null()); 1283 ASSERT(object_store->array_class() != Class::null());
1278 return object_store->array_class(); 1284 return object_store->array_class();
1279 case kImmutableArray: 1285 case kImmutableArray:
1280 ASSERT(object_store->immutable_array_class() != Class::null()); 1286 ASSERT(object_store->immutable_array_class() != Class::null());
1281 return object_store->immutable_array_class(); 1287 return object_store->immutable_array_class();
1288 case kGrowableObjectArray:
1289 ASSERT(object_store->growable_object_array_class() != Class::null());
1290 return object_store->growable_object_array_class();
1282 case kInternalByteArray: 1291 case kInternalByteArray:
1283 ASSERT(object_store->internal_byte_array_class() != Class::null()); 1292 ASSERT(object_store->internal_byte_array_class() != Class::null());
1284 return object_store->internal_byte_array_class(); 1293 return object_store->internal_byte_array_class();
1285 case kExternalByteArray: 1294 case kExternalByteArray:
1286 ASSERT(object_store->external_byte_array_class() != Class::null()); 1295 ASSERT(object_store->external_byte_array_class() != Class::null());
1287 return object_store->external_byte_array_class(); 1296 return object_store->external_byte_array_class();
1288 case kStacktrace: 1297 case kStacktrace:
1289 ASSERT(object_store->stacktrace_class() != Class::null()); 1298 ASSERT(object_store->stacktrace_class() != Class::null());
1290 return object_store->stacktrace_class(); 1299 return object_store->stacktrace_class();
1291 case kJSRegExp: 1300 case kJSRegExp:
(...skipping 2231 matching lines...) Expand 10 before | Expand all | Expand 10 after
3523 ClassFinalizer::FinalizeType( 3532 ClassFinalizer::FinalizeType(
3524 signature_class, signature_type, ClassFinalizer::kFinalize); 3533 signature_class, signature_type, ClassFinalizer::kFinalize);
3525 } 3534 }
3526 ASSERT(closure_function.signature_class() == signature_class.raw()); 3535 ASSERT(closure_function.signature_class() == signature_class.raw());
3527 set_implicit_closure_function(closure_function); 3536 set_implicit_closure_function(closure_function);
3528 ASSERT(closure_function.IsImplicitClosureFunction()); 3537 ASSERT(closure_function.IsImplicitClosureFunction());
3529 return closure_function.raw(); 3538 return closure_function.raw();
3530 } 3539 }
3531 3540
3532 3541
3533 template<typename T>
3534 static RawArray* NewArray(const GrowableArray<T*>& objs) {
3535 Array& a = Array::Handle(Array::New(objs.length(), Heap::kOld));
3536 for (int i = 0; i < objs.length(); i++) {
3537 a.SetAt(i, *objs[i]);
3538 }
3539 return a.raw();
3540 }
3541
3542
3543 RawString* Function::BuildSignature( 3542 RawString* Function::BuildSignature(
3544 bool instantiate, 3543 bool instantiate,
3545 const AbstractTypeArguments& instantiator) const { 3544 const AbstractTypeArguments& instantiator) const {
3546 GrowableArray<const String*> pieces; 3545 const GrowableObjectArray& pieces =
3546 GrowableObjectArray::Handle(GrowableObjectArray::New());
3547 const String& kCommaSpace = String::Handle(String::NewSymbol(", ")); 3547 const String& kCommaSpace = String::Handle(String::NewSymbol(", "));
3548 const String& kColonSpace = String::Handle(String::NewSymbol(": ")); 3548 const String& kColonSpace = String::Handle(String::NewSymbol(": "));
3549 const String& kLParen = String::Handle(String::NewSymbol("(")); 3549 const String& kLParen = String::Handle(String::NewSymbol("("));
3550 const String& kRParen = String::Handle(String::NewSymbol(") => ")); 3550 const String& kRParen = String::Handle(String::NewSymbol(") => "));
3551 const String& kLBracket = String::Handle(String::NewSymbol("[")); 3551 const String& kLBracket = String::Handle(String::NewSymbol("["));
3552 const String& kRBracket = String::Handle(String::NewSymbol("]")); 3552 const String& kRBracket = String::Handle(String::NewSymbol("]"));
3553 String& name = String::Handle();
3553 if (!instantiate && !is_static()) { 3554 if (!instantiate && !is_static()) {
3554 const String& kSpaceExtendsSpace = 3555 const String& kSpaceExtendsSpace =
3555 String::Handle(String::NewSymbol(" extends ")); 3556 String::Handle(String::NewSymbol(" extends "));
3556 const String& kLAngleBracket = String::Handle(String::NewSymbol("<")); 3557 const String& kLAngleBracket = String::Handle(String::NewSymbol("<"));
3557 const String& kRAngleBracket = String::Handle(String::NewSymbol(">")); 3558 const String& kRAngleBracket = String::Handle(String::NewSymbol(">"));
3558 const Class& function_class = Class::Handle(owner()); 3559 const Class& function_class = Class::Handle(owner());
3559 ASSERT(!function_class.IsNull()); 3560 ASSERT(!function_class.IsNull());
3560 const TypeArguments& type_parameters = TypeArguments::Handle( 3561 const TypeArguments& type_parameters = TypeArguments::Handle(
3561 function_class.type_parameters()); 3562 function_class.type_parameters());
3562 if (!type_parameters.IsNull()) { 3563 if (!type_parameters.IsNull()) {
3563 intptr_t num_type_parameters = type_parameters.Length(); 3564 intptr_t num_type_parameters = type_parameters.Length();
3564 pieces.Add(&kLAngleBracket); 3565 pieces.Add(kLAngleBracket);
3565 const TypeArguments& bounds = TypeArguments::Handle( 3566 const TypeArguments& bounds = TypeArguments::Handle(
3566 function_class.type_parameter_bounds()); 3567 function_class.type_parameter_bounds());
3567 AbstractType& type_parameter = AbstractType::Handle(); 3568 AbstractType& type_parameter = AbstractType::Handle();
3568 AbstractType& bound = AbstractType::Handle(); 3569 AbstractType& bound = AbstractType::Handle();
3569 for (intptr_t i = 0; i < num_type_parameters; i++) { 3570 for (intptr_t i = 0; i < num_type_parameters; i++) {
3570 type_parameter ^= type_parameters.TypeAt(i); 3571 type_parameter ^= type_parameters.TypeAt(i);
3571 pieces.Add(&String::ZoneHandle(type_parameter.Name())); 3572 name = type_parameter.Name();
3573 pieces.Add(name);
3572 bound = bounds.TypeAt(i); 3574 bound = bounds.TypeAt(i);
3573 if (!bound.IsNull() && !bound.IsDynamicType()) { 3575 if (!bound.IsNull() && !bound.IsDynamicType()) {
3574 pieces.Add(&kSpaceExtendsSpace); 3576 pieces.Add(kSpaceExtendsSpace);
3575 pieces.Add(&String::ZoneHandle(bound.Name())); 3577 name = bound.Name();
3578 pieces.Add(name);
3576 } 3579 }
3577 if (i < num_type_parameters - 1) { 3580 if (i < num_type_parameters - 1) {
3578 pieces.Add(&kCommaSpace); 3581 pieces.Add(kCommaSpace);
3579 } 3582 }
3580 } 3583 }
3581 pieces.Add(&kRAngleBracket); 3584 pieces.Add(kRAngleBracket);
3582 } 3585 }
3583 } 3586 }
3584 AbstractType& param_type = AbstractType::Handle(); 3587 AbstractType& param_type = AbstractType::Handle();
3585 const intptr_t num_params = NumberOfParameters(); 3588 const intptr_t num_params = NumberOfParameters();
3586 const intptr_t num_fixed_params = num_fixed_parameters(); 3589 const intptr_t num_fixed_params = num_fixed_parameters();
3587 const intptr_t num_opt_params = num_optional_parameters(); 3590 const intptr_t num_opt_params = num_optional_parameters();
3588 ASSERT((num_fixed_params + num_opt_params) == num_params); 3591 ASSERT((num_fixed_params + num_opt_params) == num_params);
3589 pieces.Add(&kLParen); 3592 pieces.Add(kLParen);
3590 for (intptr_t i = 0; i < num_fixed_params; i++) { 3593 for (intptr_t i = 0; i < num_fixed_params; i++) {
3591 param_type = ParameterTypeAt(i); 3594 param_type = ParameterTypeAt(i);
3592 ASSERT(!param_type.IsNull()); 3595 ASSERT(!param_type.IsNull());
3593 if (instantiate && !param_type.IsInstantiated()) { 3596 if (instantiate && !param_type.IsInstantiated()) {
3594 param_type = param_type.InstantiateFrom(instantiator); 3597 param_type = param_type.InstantiateFrom(instantiator);
3595 } 3598 }
3596 pieces.Add(&String::ZoneHandle(param_type.Name())); 3599 name = param_type.Name();
3600 pieces.Add(name);
3597 if (i != (num_params - 1)) { 3601 if (i != (num_params - 1)) {
3598 pieces.Add(&kCommaSpace); 3602 pieces.Add(kCommaSpace);
3599 } 3603 }
3600 } 3604 }
3601 if (num_opt_params > 0) { 3605 if (num_opt_params > 0) {
3602 pieces.Add(&kLBracket); 3606 pieces.Add(kLBracket);
3603 for (intptr_t i = num_fixed_params; i < num_params; i++) { 3607 for (intptr_t i = num_fixed_params; i < num_params; i++) {
3604 pieces.Add(&String::ZoneHandle(ParameterNameAt(i))); 3608 name = ParameterNameAt(i);
3605 pieces.Add(&kColonSpace); 3609 pieces.Add(name);
3610 pieces.Add(kColonSpace);
3606 param_type = ParameterTypeAt(i); 3611 param_type = ParameterTypeAt(i);
3607 if (instantiate && !param_type.IsInstantiated()) { 3612 if (instantiate && !param_type.IsInstantiated()) {
3608 param_type = param_type.InstantiateFrom(instantiator); 3613 param_type = param_type.InstantiateFrom(instantiator);
3609 } 3614 }
3610 ASSERT(!param_type.IsNull()); 3615 ASSERT(!param_type.IsNull());
3611 pieces.Add(&String::ZoneHandle(param_type.Name())); 3616 name = param_type.Name();
3617 pieces.Add(name);
3612 if (i != (num_params - 1)) { 3618 if (i != (num_params - 1)) {
3613 pieces.Add(&kCommaSpace); 3619 pieces.Add(kCommaSpace);
3614 } 3620 }
3615 } 3621 }
3616 pieces.Add(&kRBracket); 3622 pieces.Add(kRBracket);
3617 } 3623 }
3618 pieces.Add(&kRParen); 3624 pieces.Add(kRParen);
3619 AbstractType& res_type = AbstractType::Handle(result_type()); 3625 AbstractType& res_type = AbstractType::Handle(result_type());
3620 if (instantiate && !res_type.IsInstantiated()) { 3626 if (instantiate && !res_type.IsInstantiated()) {
3621 res_type = res_type.InstantiateFrom(instantiator); 3627 res_type = res_type.InstantiateFrom(instantiator);
3622 } 3628 }
3623 pieces.Add(&String::Handle(res_type.Name())); 3629 name = res_type.Name();
3624 const Array& strings = Array::Handle(NewArray<const String>(pieces)); 3630 pieces.Add(name);
3631 const Array& strings = Array::Handle(Array::MakeArray(pieces));
3625 return String::NewSymbol(String::Handle(String::ConcatAll(strings))); 3632 return String::NewSymbol(String::Handle(String::ConcatAll(strings)));
3626 } 3633 }
3627 3634
3628 3635
3629 bool Function::HasInstantiatedSignature() const { 3636 bool Function::HasInstantiatedSignature() const {
3630 AbstractType& type = AbstractType::Handle(result_type()); 3637 AbstractType& type = AbstractType::Handle(result_type());
3631 if (!type.IsInstantiated()) { 3638 if (!type.IsInstantiated()) {
3632 return false; 3639 return false;
3633 } 3640 }
3634 const intptr_t num_parameters = NumberOfParameters(); 3641 const intptr_t num_parameters = NumberOfParameters();
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
4294 // Link class to this library. 4301 // Link class to this library.
4295 cls.set_library(*this); 4302 cls.set_library(*this);
4296 } 4303 }
4297 4304
4298 4305
4299 RawArray* Library::LoadedScripts() const { 4306 RawArray* Library::LoadedScripts() const {
4300 // We compute the list of loaded scripts lazily. The result is 4307 // We compute the list of loaded scripts lazily. The result is
4301 // cached in loaded_scripts_. 4308 // cached in loaded_scripts_.
4302 if (loaded_scripts() == Array::null()) { 4309 if (loaded_scripts() == Array::null()) {
4303 // Iterate over the library dictionary and collect all scripts. 4310 // Iterate over the library dictionary and collect all scripts.
4304 GrowableArray<Script*> scripts(8); 4311 const GrowableObjectArray& scripts =
4312 GrowableObjectArray::Handle(GrowableObjectArray::New(8));
4305 Object& entry = Object::Handle(); 4313 Object& entry = Object::Handle();
4306 Function& func = Function::Handle(); 4314 Function& func = Function::Handle();
4307 Field& field = Field::Handle(); 4315 Field& field = Field::Handle();
4308 Class& cls = Class::Handle(); 4316 Class& cls = Class::Handle();
4309 Script& owner_script = Script::Handle(); 4317 Script& owner_script = Script::Handle();
4310 DictionaryIterator it(*this); 4318 DictionaryIterator it(*this);
4319 Script& script_obj = Script::Handle();
4311 while (it.HasNext()) { 4320 while (it.HasNext()) {
4312 entry = it.GetNext(); 4321 entry = it.GetNext();
4313 if (entry.IsClass()) { 4322 if (entry.IsClass()) {
4314 cls ^= entry.raw(); 4323 cls ^= entry.raw();
4315 } else if (entry.IsFunction()) { 4324 } else if (entry.IsFunction()) {
4316 func ^= entry.raw(); 4325 func ^= entry.raw();
4317 cls = func.owner(); 4326 cls = func.owner();
4318 } else if (entry.IsField()) { 4327 } else if (entry.IsField()) {
4319 field ^= entry.raw(); 4328 field ^= entry.raw();
4320 cls = field.owner(); 4329 cls = field.owner();
4321 } else { 4330 } else {
4322 continue; 4331 continue;
4323 } 4332 }
4324 owner_script = cls.script(); 4333 owner_script = cls.script();
4325 if (owner_script.IsNull()) { 4334 if (owner_script.IsNull()) {
4326 continue; 4335 continue;
4327 } 4336 }
4328 bool is_unique = true; 4337 bool is_unique = true;
4329 for (int i = 0; i < scripts.length(); i++) { 4338 for (int i = 0; i < scripts.Length(); i++) {
4330 if (scripts[i]->raw() == owner_script.raw()) { 4339 script_obj ^= scripts.At(i);
4340 if (script_obj.raw() == owner_script.raw()) {
4331 // We already have a reference to this script. 4341 // We already have a reference to this script.
4332 is_unique = false; 4342 is_unique = false;
4333 break; 4343 break;
4334 } 4344 }
4335 } 4345 }
4336 if (is_unique) { 4346 if (is_unique) {
4337 // Create a unique script handle and add it to the list of scripts. 4347 // Add script to the list of scripts.
4338 Script& unique_script = Script::Handle(owner_script.raw()); 4348 scripts.Add(owner_script);
4339 scripts.Add(&unique_script);
4340 } 4349 }
4341 } 4350 }
4342 4351
4343 // Create the array of scripts and cache it in loaded_scripts_. 4352 // Create the array of scripts and cache it in loaded_scripts_.
4344 const Array& loaded_scripts = 4353 StorePointer(&raw_ptr()->loaded_scripts_, Array::MakeArray(scripts));
4345 Array::Handle(Array::New(scripts.length(), Heap::kOld));
4346 for (int i = 0; i < scripts.length(); i++) {
4347 loaded_scripts.SetAt(i, *scripts[i]);
4348 }
4349 StorePointer(&raw_ptr()->loaded_scripts_, loaded_scripts.raw());
4350 } 4354 }
4351 return loaded_scripts(); 4355 return loaded_scripts();
4352 } 4356 }
4353 4357
4354 4358
4355 // TODO(hausner): we might want to add a script dictionary to the 4359 // TODO(hausner): we might want to add a script dictionary to the
4356 // library class to make this lookup faster. 4360 // library class to make this lookup faster.
4357 RawScript* Library::LookupScript(const String& url) const { 4361 RawScript* Library::LookupScript(const String& url) const {
4358 const Array& scripts = Array::Handle(LoadedScripts()); 4362 const Array& scripts = Array::Handle(LoadedScripts());
4359 Script& script = Script::Handle(); 4363 Script& script = Script::Handle();
(...skipping 3585 matching lines...) Expand 10 before | Expand all | Expand 10 after
7945 } 7949 }
7946 return result.raw(); 7950 return result.raw();
7947 } 7951 }
7948 7952
7949 7953
7950 RawArray* Array::Empty() { 7954 RawArray* Array::Empty() {
7951 return Isolate::Current()->object_store()->empty_array(); 7955 return Isolate::Current()->object_store()->empty_array();
7952 } 7956 }
7953 7957
7954 7958
7959 RawArray* Array::MakeArray(const GrowableObjectArray& growable_array) {
7960 intptr_t used_len = growable_array.Length();
7961 intptr_t capacity_len = growable_array.Capacity();
7962 Isolate* isolate = Isolate::Current();
7963 Array& array = Array::Handle(isolate, growable_array.data());
7964 Array& new_array = Array::Handle(isolate, Array::Empty());
7965 intptr_t capacity_size = Array::InstanceSize(capacity_len);
7966 intptr_t used_size = Array::InstanceSize(used_len);
7967
7968 // Update the size in the header field and length of the array object.
7969 uword tags = 0;
7970 tags = RawObject::SizeTag::update(used_size, tags);
7971 array.raw_ptr()->tags_ = tags;
7972 array.SetLength(used_len);
7973
7974 // Null the GrowableObjectArray, we are removing it's backing array.
7975 growable_array.SetLength(0);
7976 growable_array.SetData(new_array);
7977
7978 // If there is any left over space fill it with either an Array object or
7979 // just a plain object (depending on the amount of left over space) so
7980 // that it can be traversed over successfully during garbage collection.
7981 if (capacity_size != used_size) {
7982 NoGCScope no_gc;
7983 ASSERT(capacity_len > used_len);
7984 intptr_t leftover_size = capacity_size - used_size;
7985
7986 uword addr = RawObject::ToAddr(array.raw()) + used_size;
7987 if (leftover_size >= Array::InstanceSize(0)) {
7988 // As we have enough space to use an array object, update the leftover
7989 // space as an Array object.
7990 new_array.raw_ = reinterpret_cast<RawArray*>(RawObject::FromAddr(addr));
7991 new_array.raw_ptr()->class_ = isolate->object_store()->array_class();
7992 tags = RawObject::SizeTag::update(leftover_size, tags);
7993 new_array.raw_ptr()->tags_ = tags;
7994 intptr_t leftover_len =
7995 ((leftover_size - Array::InstanceSize(0)) / kWordSize);
7996 new_array.SetLength(leftover_len);
7997 } else {
7998 // Update the leftover space as a basic object.
7999 ASSERT(leftover_size == Object::InstanceSize());
8000 Object& new_object = Object::Handle(isolate, RawObject::FromAddr(addr));
8001 new_object.raw()->ptr()->class_ = isolate->object_store()->object_class();
8002 tags = RawObject::SizeTag::update(leftover_size, tags);
8003 new_object.raw()->ptr()->tags_ = tags;
8004 }
8005 }
8006 return array.raw();
8007 }
8008
8009
7955 RawImmutableArray* ImmutableArray::New(intptr_t len, 8010 RawImmutableArray* ImmutableArray::New(intptr_t len,
7956 Heap::Space space) { 8011 Heap::Space space) {
7957 ObjectStore* object_store = Isolate::Current()->object_store(); 8012 ObjectStore* object_store = Isolate::Current()->object_store();
7958 Class& cls = Class::Handle(object_store->immutable_array_class()); 8013 Class& cls = Class::Handle(object_store->immutable_array_class());
7959 return reinterpret_cast<RawImmutableArray*>(Array::New(cls, len, space)); 8014 return reinterpret_cast<RawImmutableArray*>(Array::New(cls, len, space));
7960 } 8015 }
7961 8016
7962 8017
7963 const char* ImmutableArray::ToCString() const { 8018 const char* ImmutableArray::ToCString() const {
7964 return "ImmutableArray"; 8019 return "ImmutableArray";
7965 } 8020 }
7966 8021
7967 8022
8023 void GrowableObjectArray::Add(const Object& value, Heap::Space space) const {
8024 ASSERT(!IsNull());
8025 Array& contents = Array::Handle(data());
8026 if (Length() == Capacity()) {
8027 intptr_t new_capacity = Capacity() * 2;
8028 if (new_capacity <= Capacity()) {
8029 // Use the preallocated out of memory exception to avoid calling
8030 // into dart code or allocating any code.
8031 const Instance& exception =
8032 Instance::Handle(Isolate::Current()->object_store()->out_of_memory());
8033 Exceptions::Throw(exception);
8034 UNREACHABLE();
8035 }
8036 StorePointer(&(raw_ptr()->data_),
8037 Array::Grow(contents, new_capacity, space));
8038 contents = data();
8039 }
8040 ASSERT(Length() < Capacity());
8041 intptr_t index = Length();
8042 SetLength(index + 1);
8043 contents.SetAt(index, value);
8044 }
8045
8046
8047 RawObject* GrowableObjectArray::RemoveLast() const {
8048 ASSERT(!IsNull());
8049 ASSERT(Length() > 0);
8050 intptr_t index = Length() - 1;
8051 const Array& contents = Array::Handle(data());
8052 const Object& obj = Object::Handle(contents.At(index));
8053 contents.SetAt(index, Object::Handle());
8054 SetLength(index);
8055 return obj.raw();
8056 }
8057
8058
8059 bool GrowableObjectArray::Equals(const Instance& other) const {
8060 // If both handles point to the same raw instance they are equal.
8061 if (this->raw() == other.raw()) {
8062 return true;
8063 }
8064
8065 // Other instance must be non null and a GrowableObjectArray.
8066 if (!other.IsGrowableObjectArray() || other.IsNull()) {
8067 return false;
8068 }
8069
8070 GrowableObjectArray& other_arr = GrowableObjectArray::Handle();
8071 other_arr ^= other.raw();
8072
8073 // The capacity and length of both objects must be equal.
8074 if (Capacity() != other_arr.Capacity() || Length() != other_arr.Length()) {
8075 return false;
8076 }
8077
8078 // Both must have the same type arguments.
8079 if (!AbstractTypeArguments::AreEqual(
8080 AbstractTypeArguments::Handle(GetTypeArguments()),
8081 AbstractTypeArguments::Handle(other.GetTypeArguments()))) {
8082 return false;
8083 }
8084
8085 // The data part in both arrays must be identical.
8086 const Array& contents = Array::Handle(data());
8087 const Array& other_contents = Array::Handle(other_arr.data());
8088 for (intptr_t i = 0; i < Length(); i++) {
8089 if (contents.At(i) != other_contents.At(i)) {
8090 return false;
8091 }
8092 }
8093 return true;
8094 }
8095
8096
8097 RawGrowableObjectArray* GrowableObjectArray::New(intptr_t capacity,
8098 Heap::Space space) {
8099 ObjectStore* object_store = Isolate::Current()->object_store();
8100 Class& cls = Class::Handle(object_store->growable_object_array_class());
8101 const Array& data = Array::Handle(Array::New(capacity, space));
8102 GrowableObjectArray& result = GrowableObjectArray::Handle();
8103 {
8104 RawObject* raw = Object::Allocate(cls,
8105 GrowableObjectArray::InstanceSize(),
8106 space);
8107 NoGCScope no_gc;
8108 result ^= raw;
8109 result.SetLength(0);
8110 result.SetData(data);
8111 }
8112 return result.raw();
8113 }
8114
8115
8116 const char* GrowableObjectArray::ToCString() const {
8117 return "GrowableObjectArray";
8118 }
8119
8120
7968 intptr_t ByteArray::Length() const { 8121 intptr_t ByteArray::Length() const {
7969 // ByteArray is an abstract class. 8122 // ByteArray is an abstract class.
7970 UNREACHABLE(); 8123 UNREACHABLE();
7971 return 0; 8124 return 0;
7972 } 8125 }
7973 8126
7974 8127
7975 void ByteArray::Copy(uint8_t* dst, 8128 void ByteArray::Copy(uint8_t* dst,
7976 const ByteArray& src, 8129 const ByteArray& src,
7977 intptr_t src_offset, 8130 intptr_t src_offset,
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
8524 result.set_num_args_tested(num_args_tested); 8677 result.set_num_args_tested(num_args_tested);
8525 // Number of array elements in one test entry (num_args_tested + 1) 8678 // Number of array elements in one test entry (num_args_tested + 1)
8526 intptr_t len = result.TestEntryLength(); 8679 intptr_t len = result.TestEntryLength();
8527 // IC data array must be null terminated (sentinel entry). 8680 // IC data array must be null terminated (sentinel entry).
8528 Array& ic_data = Array::Handle(Array::New(len, Heap::kOld)); 8681 Array& ic_data = Array::Handle(Array::New(len, Heap::kOld));
8529 result.set_ic_data(ic_data); 8682 result.set_ic_data(ic_data);
8530 return result.raw(); 8683 return result.raw();
8531 } 8684 }
8532 8685
8533 } // namespace dart 8686 } // namespace dart
OLDNEW
« no previous file with comments | « vm/object.h ('k') | vm/object_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698