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

Side by Side Diff: vm/object.cc

Issue 8520030: Set the loaded_ flag in RawLibrary when it is completely loaded. This (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 9 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/assert.h" 8 #include "vm/assert.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 3653 matching lines...) Expand 10 before | Expand all | Expand 10 after
3664 Object& obj = Object::Handle(array_.At(next_ix_)); 3664 Object& obj = Object::Handle(array_.At(next_ix_));
3665 while (!obj.IsClass() && HasNext()) { 3665 while (!obj.IsClass() && HasNext()) {
3666 next_ix_++; 3666 next_ix_++;
3667 obj = array_.At(next_ix_); 3667 obj = array_.At(next_ix_);
3668 } 3668 }
3669 } 3669 }
3670 3670
3671 3671
3672 void Library::SetName(const String& name) const { 3672 void Library::SetName(const String& name) const {
3673 // Only set name once. 3673 // Only set name once.
3674 ASSERT(raw_ptr()->name_ == raw_ptr()->url_); 3674 ASSERT(!loaded());
3675 ASSERT(name.IsSymbol()); 3675 ASSERT(name.IsSymbol());
3676 StorePointer(&raw_ptr()->name_, name.raw()); 3676 StorePointer(&raw_ptr()->name_, name.raw());
3677 } 3677 }
3678 3678
3679 3679
3680 void Library::SetLoaded() const {
3681 // Should not be already loaded.
3682 ASSERT(!loaded());
3683 raw_ptr()->loaded_ = true;
3684 }
3685
3686
3680 void Library::GrowDictionary(const Array& dict, intptr_t dict_size) const { 3687 void Library::GrowDictionary(const Array& dict, intptr_t dict_size) const {
3681 // TODO(iposva): Avoid exponential growth. 3688 // TODO(iposva): Avoid exponential growth.
3682 intptr_t new_dict_size = dict_size * 2; 3689 intptr_t new_dict_size = dict_size * 2;
3683 const Array& new_dict = 3690 const Array& new_dict =
3684 Array::Handle(Array::New(new_dict_size + 1, Heap::kOld)); 3691 Array::Handle(Array::New(new_dict_size + 1, Heap::kOld));
3685 // Rehash all elements from the original dictionary 3692 // Rehash all elements from the original dictionary
3686 // to the newly allocated array. 3693 // to the newly allocated array.
3687 Object& entry = Class::Handle(); 3694 Object& entry = Class::Handle();
3688 String& entry_name = String::Handle(); 3695 String& entry_name = String::Handle();
3689 Object& new_entry = Object::Handle(); 3696 Object& new_entry = Object::Handle();
(...skipping 3305 matching lines...) Expand 10 before | Expand all | Expand 10 after
6995 const String& str = String::Handle(pattern()); 7002 const String& str = String::Handle(pattern());
6996 const char* format = "JSRegExp: pattern=%s flags=%s"; 7003 const char* format = "JSRegExp: pattern=%s flags=%s";
6997 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 7004 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
6998 char* chars = reinterpret_cast<char*>( 7005 char* chars = reinterpret_cast<char*>(
6999 Isolate::Current()->current_zone()->Allocate(len + 1)); 7006 Isolate::Current()->current_zone()->Allocate(len + 1));
7000 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 7007 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
7001 return chars; 7008 return chars;
7002 } 7009 }
7003 7010
7004 } // namespace dart 7011 } // namespace dart
OLDNEW
« vm/dart_api_impl.cc ('K') | « vm/object.h ('k') | vm/raw_object_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698