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

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

Issue 10386107: Implement spawnUri from dart:isolate. This function allows us to (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 4571 matching lines...) Expand 10 before | Expand all | Expand 10 after
4582 4582
4583 void ClassDictionaryIterator::MoveToNextClass() { 4583 void ClassDictionaryIterator::MoveToNextClass() {
4584 Object& obj = Object::Handle(array_.At(next_ix_)); 4584 Object& obj = Object::Handle(array_.At(next_ix_));
4585 while (!obj.IsClass() && HasNext()) { 4585 while (!obj.IsClass() && HasNext()) {
4586 next_ix_++; 4586 next_ix_++;
4587 obj = array_.At(next_ix_); 4587 obj = array_.At(next_ix_);
4588 } 4588 }
4589 } 4589 }
4590 4590
4591 4591
4592 void Library::set_import_map(const Array& map) const {
4593 StorePointer(&raw_ptr()->import_map_, map.raw());
4594 }
4595
4596
4597 void Library::SetName(const String& name) const { 4592 void Library::SetName(const String& name) const {
4598 // Only set name once. 4593 // Only set name once.
4599 ASSERT(!Loaded()); 4594 ASSERT(!Loaded());
4600 ASSERT(name.IsSymbol()); 4595 ASSERT(name.IsSymbol());
4601 StorePointer(&raw_ptr()->name_, name.raw()); 4596 StorePointer(&raw_ptr()->name_, name.raw());
4602 } 4597 }
4603 4598
4604 4599
4605 void Library::SetLoadInProgress() const { 4600 void Library::SetLoadInProgress() const {
4606 // Should not be already loaded. 4601 // Should not be already loaded.
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
5188 lib ^= imports.At(i); 5183 lib ^= imports.At(i);
5189 import_url = lib.url(); 5184 import_url = lib.url();
5190 if (url.Equals(import_url)) { 5185 if (url.Equals(import_url)) {
5191 return lib.raw(); 5186 return lib.raw();
5192 } 5187 }
5193 } 5188 }
5194 return Library::null(); 5189 return Library::null();
5195 } 5190 }
5196 5191
5197 5192
5198 RawString* Library::LookupImportMap(const String& ident) const {
5199 Array& import_map = Array::Handle(this->import_map());
5200 intptr_t length = import_map.Length();
5201 intptr_t index = 0;
5202 String& name = String::Handle();
5203 while (index < (length - 1)) {
5204 name ^= import_map.At(index);
5205 if (name.Equals(ident)) {
5206 name ^= import_map.At(index + 1);
5207 return name.raw();
5208 }
5209 index += 2;
5210 }
5211 return String::null();
5212 }
5213
5214
5215 void Library::AddImport(const Library& library) const { 5193 void Library::AddImport(const Library& library) const {
5216 Array& imports = Array::Handle(this->imports()); 5194 Array& imports = Array::Handle(this->imports());
5217 intptr_t capacity = imports.Length(); 5195 intptr_t capacity = imports.Length();
5218 if (num_imports() == capacity) { 5196 if (num_imports() == capacity) {
5219 capacity = capacity + kImportsCapacityIncrement; 5197 capacity = capacity + kImportsCapacityIncrement;
5220 imports = Array::Grow(imports, capacity); 5198 imports = Array::Grow(imports, capacity);
5221 StorePointer(&raw_ptr()->imports_, imports.raw()); 5199 StorePointer(&raw_ptr()->imports_, imports.raw());
5222 } 5200 }
5223 intptr_t index = num_imports(); 5201 intptr_t index = num_imports();
5224 imports.SetAt(index, library); 5202 imports.SetAt(index, library);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
5280 5258
5281 RawLibrary* Library::NewLibraryHelper(const String& url, 5259 RawLibrary* Library::NewLibraryHelper(const String& url,
5282 bool import_core_lib) { 5260 bool import_core_lib) {
5283 const Library& result = Library::Handle(Library::New()); 5261 const Library& result = Library::Handle(Library::New());
5284 result.raw_ptr()->name_ = url.raw(); 5262 result.raw_ptr()->name_ = url.raw();
5285 result.raw_ptr()->url_ = url.raw(); 5263 result.raw_ptr()->url_ = url.raw();
5286 result.raw_ptr()->private_key_ = Scanner::AllocatePrivateKey(result); 5264 result.raw_ptr()->private_key_ = Scanner::AllocatePrivateKey(result);
5287 result.raw_ptr()->dictionary_ = Array::Empty(); 5265 result.raw_ptr()->dictionary_ = Array::Empty();
5288 result.raw_ptr()->anonymous_classes_ = Array::Empty(); 5266 result.raw_ptr()->anonymous_classes_ = Array::Empty();
5289 result.raw_ptr()->num_anonymous_ = 0; 5267 result.raw_ptr()->num_anonymous_ = 0;
5290 result.raw_ptr()->import_map_ = Array::Empty();
5291 result.raw_ptr()->imports_ = Array::Empty(); 5268 result.raw_ptr()->imports_ = Array::Empty();
5292 result.raw_ptr()->next_registered_ = Library::null(); 5269 result.raw_ptr()->next_registered_ = Library::null();
5293 result.raw_ptr()->loaded_scripts_ = Array::null(); 5270 result.raw_ptr()->loaded_scripts_ = Array::null();
5294 result.set_native_entry_resolver(NULL); 5271 result.set_native_entry_resolver(NULL);
5295 result.raw_ptr()->corelib_imported_ = true; 5272 result.raw_ptr()->corelib_imported_ = true;
5296 result.raw_ptr()->load_state_ = RawLibrary::kAllocated; 5273 result.raw_ptr()->load_state_ = RawLibrary::kAllocated;
5297 result.InitClassDictionary(); 5274 result.InitClassDictionary();
5298 result.InitImportList(); 5275 result.InitImportList();
5299 result.InitImportedIntoList(); 5276 result.InitImportedIntoList();
5300 if (import_core_lib) { 5277 if (import_core_lib) {
(...skipping 4642 matching lines...) Expand 10 before | Expand all | Expand 10 after
9943 const String& str = String::Handle(pattern()); 9920 const String& str = String::Handle(pattern());
9944 const char* format = "JSRegExp: pattern=%s flags=%s"; 9921 const char* format = "JSRegExp: pattern=%s flags=%s";
9945 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 9922 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
9946 char* chars = reinterpret_cast<char*>( 9923 char* chars = reinterpret_cast<char*>(
9947 Isolate::Current()->current_zone()->Allocate(len + 1)); 9924 Isolate::Current()->current_zone()->Allocate(len + 1));
9948 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 9925 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
9949 return chars; 9926 return chars;
9950 } 9927 }
9951 9928
9952 } // namespace dart 9929 } // 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