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

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

Issue 351373002: Coverage API revamp (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: handle scripts via url instead of object Created 6 years, 5 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
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 "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 8289 matching lines...) Expand 10 before | Expand all | Expand 10 after
8300 break; 8300 break;
8301 } 8301 }
8302 const Smi& smi = Smi::Cast(value); 8302 const Smi& smi = Smi::Cast(value);
8303 lineInfo.AddValue(smi.Value()); 8303 lineInfo.AddValue(smi.Value());
8304 } 8304 }
8305 } 8305 }
8306 } 8306 }
8307 } 8307 }
8308 8308
8309 8309
8310 RawLibrary* Script::FindLibrary() const {
8311 Isolate* isolate = Isolate::Current();
8312 const GrowableObjectArray& libs = GrowableObjectArray::Handle(
8313 isolate, isolate->object_store()->libraries());
8314 Library& lib = Library::Handle();
8315 Script& script = Script::Handle();
8316 for (intptr_t i = 0; i < libs.Length(); i++) {
8317 lib ^= libs.At(i);
8318 ASSERT(!lib.IsNull());
8319 const Array& loaded_scripts = Array::Handle(lib.LoadedScripts());
8320 ASSERT(!loaded_scripts.IsNull());
8321 for (intptr_t j = 0; j < loaded_scripts.Length(); j++) {
8322 script ^= loaded_scripts.At(j);
8323 ASSERT(!script.IsNull());
8324 if (script.raw() == raw()) {
8325 return lib.raw();
8326 }
8327 }
8328 }
8329 return Library::null();
8330 }
8331
8332
8333 RawScript* Script::FindByUrl(const String& url) {
8334 Isolate* isolate = Isolate::Current();
8335 const GrowableObjectArray& libs = GrowableObjectArray::Handle(
8336 isolate, isolate->object_store()->libraries());
8337 Library& lib = Library::Handle();
8338 Script& script = Script::Handle();
8339 String& script_url = String::Handle();
8340 for (intptr_t i = 0; i < libs.Length(); i++) {
8341 lib ^= libs.At(i);
8342 ASSERT(!lib.IsNull());
8343 const Array& loaded_scripts = Array::Handle(lib.LoadedScripts());
8344 ASSERT(!loaded_scripts.IsNull());
8345 for (intptr_t j = 0; j < loaded_scripts.Length(); j++) {
8346 script ^= loaded_scripts.At(j);
8347 ASSERT(!script.IsNull());
8348 script_url ^= script.url();
8349 if (script_url.Equals(url)) {
8350 return script.raw();
8351 }
8352 }
8353 }
8354 return Script::null();
8355 }
8356
8357
8358 DictionaryIterator::DictionaryIterator(const Library& library) 8310 DictionaryIterator::DictionaryIterator(const Library& library)
8359 : array_(Array::Handle(library.dictionary())), 8311 : array_(Array::Handle(library.dictionary())),
8360 // Last element in array is a Smi indicating the number of entries used. 8312 // Last element in array is a Smi indicating the number of entries used.
8361 size_(Array::Handle(library.dictionary()).Length() - 1), 8313 size_(Array::Handle(library.dictionary()).Length() - 1),
8362 next_ix_(0) { 8314 next_ix_(0) {
8363 MoveToNextObject(); 8315 MoveToNextObject();
8364 } 8316 }
8365 8317
8366 8318
8367 RawObject* DictionaryIterator::GetNext() { 8319 RawObject* DictionaryIterator::GetNext() {
(...skipping 10722 matching lines...) Expand 10 before | Expand all | Expand 10 after
19090 return tag_label.ToCString(); 19042 return tag_label.ToCString();
19091 } 19043 }
19092 19044
19093 19045
19094 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 19046 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
19095 Instance::PrintJSONImpl(stream, ref); 19047 Instance::PrintJSONImpl(stream, ref);
19096 } 19048 }
19097 19049
19098 19050
19099 } // namespace dart 19051 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698