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

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

Issue 10407042: spawnUri. Take two. This time I'll wait for Anton before committing :-). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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 | « runtime/vm/object.h ('k') | runtime/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 4611 matching lines...) Expand 10 before | Expand all | Expand 10 after
4622 4622
4623 void ClassDictionaryIterator::MoveToNextClass() { 4623 void ClassDictionaryIterator::MoveToNextClass() {
4624 Object& obj = Object::Handle(array_.At(next_ix_)); 4624 Object& obj = Object::Handle(array_.At(next_ix_));
4625 while (!obj.IsClass() && HasNext()) { 4625 while (!obj.IsClass() && HasNext()) {
4626 next_ix_++; 4626 next_ix_++;
4627 obj = array_.At(next_ix_); 4627 obj = array_.At(next_ix_);
4628 } 4628 }
4629 } 4629 }
4630 4630
4631 4631
4632 void Library::set_import_map(const Array& map) const {
4633 StorePointer(&raw_ptr()->import_map_, map.raw());
4634 }
4635
4636
4637 void Library::SetName(const String& name) const { 4632 void Library::SetName(const String& name) const {
4638 // Only set name once. 4633 // Only set name once.
4639 ASSERT(!Loaded()); 4634 ASSERT(!Loaded());
4640 ASSERT(name.IsSymbol()); 4635 ASSERT(name.IsSymbol());
4641 StorePointer(&raw_ptr()->name_, name.raw()); 4636 StorePointer(&raw_ptr()->name_, name.raw());
4642 } 4637 }
4643 4638
4644 4639
4645 void Library::SetLoadInProgress() const { 4640 void Library::SetLoadInProgress() const {
4646 // Should not be already loaded. 4641 // Should not be already loaded.
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
5228 lib ^= imports.At(i); 5223 lib ^= imports.At(i);
5229 import_url = lib.url(); 5224 import_url = lib.url();
5230 if (url.Equals(import_url)) { 5225 if (url.Equals(import_url)) {
5231 return lib.raw(); 5226 return lib.raw();
5232 } 5227 }
5233 } 5228 }
5234 return Library::null(); 5229 return Library::null();
5235 } 5230 }
5236 5231
5237 5232
5238 RawString* Library::LookupImportMap(const String& ident) const {
5239 Array& import_map = Array::Handle(this->import_map());
5240 intptr_t length = import_map.Length();
5241 intptr_t index = 0;
5242 String& name = String::Handle();
5243 while (index < (length - 1)) {
5244 name ^= import_map.At(index);
5245 if (name.Equals(ident)) {
5246 name ^= import_map.At(index + 1);
5247 return name.raw();
5248 }
5249 index += 2;
5250 }
5251 return String::null();
5252 }
5253
5254
5255 void Library::AddImport(const Library& library) const { 5233 void Library::AddImport(const Library& library) const {
5256 Array& imports = Array::Handle(this->imports()); 5234 Array& imports = Array::Handle(this->imports());
5257 intptr_t capacity = imports.Length(); 5235 intptr_t capacity = imports.Length();
5258 if (num_imports() == capacity) { 5236 if (num_imports() == capacity) {
5259 capacity = capacity + kImportsCapacityIncrement; 5237 capacity = capacity + kImportsCapacityIncrement;
5260 imports = Array::Grow(imports, capacity); 5238 imports = Array::Grow(imports, capacity);
5261 StorePointer(&raw_ptr()->imports_, imports.raw()); 5239 StorePointer(&raw_ptr()->imports_, imports.raw());
5262 } 5240 }
5263 intptr_t index = num_imports(); 5241 intptr_t index = num_imports();
5264 imports.SetAt(index, library); 5242 imports.SetAt(index, library);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
5320 5298
5321 RawLibrary* Library::NewLibraryHelper(const String& url, 5299 RawLibrary* Library::NewLibraryHelper(const String& url,
5322 bool import_core_lib) { 5300 bool import_core_lib) {
5323 const Library& result = Library::Handle(Library::New()); 5301 const Library& result = Library::Handle(Library::New());
5324 result.raw_ptr()->name_ = url.raw(); 5302 result.raw_ptr()->name_ = url.raw();
5325 result.raw_ptr()->url_ = url.raw(); 5303 result.raw_ptr()->url_ = url.raw();
5326 result.raw_ptr()->private_key_ = Scanner::AllocatePrivateKey(result); 5304 result.raw_ptr()->private_key_ = Scanner::AllocatePrivateKey(result);
5327 result.raw_ptr()->dictionary_ = Array::Empty(); 5305 result.raw_ptr()->dictionary_ = Array::Empty();
5328 result.raw_ptr()->anonymous_classes_ = Array::Empty(); 5306 result.raw_ptr()->anonymous_classes_ = Array::Empty();
5329 result.raw_ptr()->num_anonymous_ = 0; 5307 result.raw_ptr()->num_anonymous_ = 0;
5330 result.raw_ptr()->import_map_ = Array::Empty();
5331 result.raw_ptr()->imports_ = Array::Empty(); 5308 result.raw_ptr()->imports_ = Array::Empty();
5332 result.raw_ptr()->next_registered_ = Library::null(); 5309 result.raw_ptr()->next_registered_ = Library::null();
5333 result.raw_ptr()->loaded_scripts_ = Array::null(); 5310 result.raw_ptr()->loaded_scripts_ = Array::null();
5334 result.set_native_entry_resolver(NULL); 5311 result.set_native_entry_resolver(NULL);
5335 result.raw_ptr()->corelib_imported_ = true; 5312 result.raw_ptr()->corelib_imported_ = true;
5336 result.raw_ptr()->load_state_ = RawLibrary::kAllocated; 5313 result.raw_ptr()->load_state_ = RawLibrary::kAllocated;
5337 result.InitClassDictionary(); 5314 result.InitClassDictionary();
5338 result.InitImportList(); 5315 result.InitImportList();
5339 result.InitImportedIntoList(); 5316 result.InitImportedIntoList();
5340 if (import_core_lib) { 5317 if (import_core_lib) {
(...skipping 4701 matching lines...) Expand 10 before | Expand all | Expand 10 after
10042 const String& str = String::Handle(pattern()); 10019 const String& str = String::Handle(pattern());
10043 const char* format = "JSRegExp: pattern=%s flags=%s"; 10020 const char* format = "JSRegExp: pattern=%s flags=%s";
10044 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 10021 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
10045 char* chars = reinterpret_cast<char*>( 10022 char* chars = reinterpret_cast<char*>(
10046 Isolate::Current()->current_zone()->Allocate(len + 1)); 10023 Isolate::Current()->current_zone()->Allocate(len + 1));
10047 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 10024 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
10048 return chars; 10025 return chars;
10049 } 10026 }
10050 10027
10051 } // namespace dart 10028 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698