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

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

Issue 10332257: Revert my last change. (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
4592 void Library::SetName(const String& name) const { 4597 void Library::SetName(const String& name) const {
4593 // Only set name once. 4598 // Only set name once.
4594 ASSERT(!Loaded()); 4599 ASSERT(!Loaded());
4595 ASSERT(name.IsSymbol()); 4600 ASSERT(name.IsSymbol());
4596 StorePointer(&raw_ptr()->name_, name.raw()); 4601 StorePointer(&raw_ptr()->name_, name.raw());
4597 } 4602 }
4598 4603
4599 4604
4600 void Library::SetLoadInProgress() const { 4605 void Library::SetLoadInProgress() const {
4601 // Should not be already loaded. 4606 // Should not be already loaded.
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
5183 lib ^= imports.At(i); 5188 lib ^= imports.At(i);
5184 import_url = lib.url(); 5189 import_url = lib.url();
5185 if (url.Equals(import_url)) { 5190 if (url.Equals(import_url)) {
5186 return lib.raw(); 5191 return lib.raw();
5187 } 5192 }
5188 } 5193 }
5189 return Library::null(); 5194 return Library::null();
5190 } 5195 }
5191 5196
5192 5197
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
5193 void Library::AddImport(const Library& library) const { 5215 void Library::AddImport(const Library& library) const {
5194 Array& imports = Array::Handle(this->imports()); 5216 Array& imports = Array::Handle(this->imports());
5195 intptr_t capacity = imports.Length(); 5217 intptr_t capacity = imports.Length();
5196 if (num_imports() == capacity) { 5218 if (num_imports() == capacity) {
5197 capacity = capacity + kImportsCapacityIncrement; 5219 capacity = capacity + kImportsCapacityIncrement;
5198 imports = Array::Grow(imports, capacity); 5220 imports = Array::Grow(imports, capacity);
5199 StorePointer(&raw_ptr()->imports_, imports.raw()); 5221 StorePointer(&raw_ptr()->imports_, imports.raw());
5200 } 5222 }
5201 intptr_t index = num_imports(); 5223 intptr_t index = num_imports();
5202 imports.SetAt(index, library); 5224 imports.SetAt(index, library);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
5258 5280
5259 RawLibrary* Library::NewLibraryHelper(const String& url, 5281 RawLibrary* Library::NewLibraryHelper(const String& url,
5260 bool import_core_lib) { 5282 bool import_core_lib) {
5261 const Library& result = Library::Handle(Library::New()); 5283 const Library& result = Library::Handle(Library::New());
5262 result.raw_ptr()->name_ = url.raw(); 5284 result.raw_ptr()->name_ = url.raw();
5263 result.raw_ptr()->url_ = url.raw(); 5285 result.raw_ptr()->url_ = url.raw();
5264 result.raw_ptr()->private_key_ = Scanner::AllocatePrivateKey(result); 5286 result.raw_ptr()->private_key_ = Scanner::AllocatePrivateKey(result);
5265 result.raw_ptr()->dictionary_ = Array::Empty(); 5287 result.raw_ptr()->dictionary_ = Array::Empty();
5266 result.raw_ptr()->anonymous_classes_ = Array::Empty(); 5288 result.raw_ptr()->anonymous_classes_ = Array::Empty();
5267 result.raw_ptr()->num_anonymous_ = 0; 5289 result.raw_ptr()->num_anonymous_ = 0;
5290 result.raw_ptr()->import_map_ = Array::Empty();
5268 result.raw_ptr()->imports_ = Array::Empty(); 5291 result.raw_ptr()->imports_ = Array::Empty();
5269 result.raw_ptr()->next_registered_ = Library::null(); 5292 result.raw_ptr()->next_registered_ = Library::null();
5270 result.raw_ptr()->loaded_scripts_ = Array::null(); 5293 result.raw_ptr()->loaded_scripts_ = Array::null();
5271 result.set_native_entry_resolver(NULL); 5294 result.set_native_entry_resolver(NULL);
5272 result.raw_ptr()->corelib_imported_ = true; 5295 result.raw_ptr()->corelib_imported_ = true;
5273 result.raw_ptr()->load_state_ = RawLibrary::kAllocated; 5296 result.raw_ptr()->load_state_ = RawLibrary::kAllocated;
5274 result.InitClassDictionary(); 5297 result.InitClassDictionary();
5275 result.InitImportList(); 5298 result.InitImportList();
5276 result.InitImportedIntoList(); 5299 result.InitImportedIntoList();
5277 if (import_core_lib) { 5300 if (import_core_lib) {
(...skipping 4698 matching lines...) Expand 10 before | Expand all | Expand 10 after
9976 const String& str = String::Handle(pattern()); 9999 const String& str = String::Handle(pattern());
9977 const char* format = "JSRegExp: pattern=%s flags=%s"; 10000 const char* format = "JSRegExp: pattern=%s flags=%s";
9978 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 10001 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
9979 char* chars = reinterpret_cast<char*>( 10002 char* chars = reinterpret_cast<char*>(
9980 Isolate::Current()->current_zone()->Allocate(len + 1)); 10003 Isolate::Current()->current_zone()->Allocate(len + 1));
9981 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 10004 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
9982 return chars; 10005 return chars;
9983 } 10006 }
9984 10007
9985 } // namespace dart 10008 } // 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