OLD | NEW |
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 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 ASSERT(public_class_name.Length() > 0); | 981 ASSERT(public_class_name.Length() > 0); |
982 ASSERT(public_class_name.CharAt(0) == '_'); | 982 ASSERT(public_class_name.CharAt(0) == '_'); |
983 String& str = String::Handle(); | 983 String& str = String::Handle(); |
984 str = lib.PrivateName(public_class_name); | 984 str = lib.PrivateName(public_class_name); |
985 cls.set_name(str); | 985 cls.set_name(str); |
986 lib.AddClass(cls); | 986 lib.AddClass(cls); |
987 } | 987 } |
988 | 988 |
989 | 989 |
990 RawError* Object::Init(Isolate* isolate) { | 990 RawError* Object::Init(Isolate* isolate) { |
991 TIMERSCOPE(isolate, time_bootstrap); | 991 Thread* thread = Thread::Current(); |
| 992 ASSERT(isolate == thread->isolate()); |
| 993 TIMERSCOPE(thread, time_bootstrap); |
992 TimelineDurationScope tds(isolate, | 994 TimelineDurationScope tds(isolate, |
993 isolate->GetIsolateStream(), | 995 isolate->GetIsolateStream(), |
994 "Object::Init"); | 996 "Object::Init"); |
995 | 997 |
996 #if defined(DART_NO_SNAPSHOT) | 998 #if defined(DART_NO_SNAPSHOT) |
997 // Object::Init version when we are running in a version of dart that does | 999 // Object::Init version when we are running in a version of dart that does |
998 // not have a full snapshot linked in. | 1000 // not have a full snapshot linked in. |
999 ObjectStore* object_store = isolate->object_store(); | 1001 ObjectStore* object_store = isolate->object_store(); |
1000 | 1002 |
1001 Class& cls = Class::Handle(isolate); | 1003 Class& cls = Class::Handle(isolate); |
(...skipping 7533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8535 Thread* thread = Thread::Current(); | 8537 Thread* thread = Thread::Current(); |
8536 Zone* zone = thread->zone(); | 8538 Zone* zone = thread->zone(); |
8537 Isolate* isolate = thread->isolate(); | 8539 Isolate* isolate = thread->isolate(); |
8538 const TokenStream& tkns = TokenStream::Handle(zone, tokens()); | 8540 const TokenStream& tkns = TokenStream::Handle(zone, tokens()); |
8539 if (!tkns.IsNull()) { | 8541 if (!tkns.IsNull()) { |
8540 // Already tokenized. | 8542 // Already tokenized. |
8541 return; | 8543 return; |
8542 } | 8544 } |
8543 // Get the source, scan and allocate the token stream. | 8545 // Get the source, scan and allocate the token stream. |
8544 VMTagScope tagScope(thread, VMTag::kCompileScannerTagId); | 8546 VMTagScope tagScope(thread, VMTag::kCompileScannerTagId); |
8545 CSTAT_TIMER_SCOPE(isolate, scanner_timer); | 8547 CSTAT_TIMER_SCOPE(thread, scanner_timer); |
8546 const String& src = String::Handle(zone, Source()); | 8548 const String& src = String::Handle(zone, Source()); |
8547 Scanner scanner(src, private_key); | 8549 Scanner scanner(src, private_key); |
8548 set_tokens(TokenStream::Handle(zone, | 8550 set_tokens(TokenStream::Handle(zone, |
8549 TokenStream::New(scanner.GetStream(), | 8551 TokenStream::New(scanner.GetStream(), |
8550 private_key))); | 8552 private_key))); |
8551 INC_STAT(isolate, src_length, src.Length()); | 8553 INC_STAT(isolate, src_length, src.Length()); |
8552 } | 8554 } |
8553 | 8555 |
8554 | 8556 |
8555 void Script::SetLocationOffset(intptr_t line_offset, | 8557 void Script::SetLocationOffset(intptr_t line_offset, |
(...skipping 2469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11025 NoSafepointScope no_safepoint; | 11027 NoSafepointScope no_safepoint; |
11026 uint8_t* data = UnsafeMutableNonPointer(&raw_ptr()->data()[0]); | 11028 uint8_t* data = UnsafeMutableNonPointer(&raw_ptr()->data()[0]); |
11027 for (intptr_t i = 0; i < delta_encoded_data->length(); ++i) { | 11029 for (intptr_t i = 0; i < delta_encoded_data->length(); ++i) { |
11028 data[i] = (*delta_encoded_data)[i]; | 11030 data[i] = (*delta_encoded_data)[i]; |
11029 } | 11031 } |
11030 } | 11032 } |
11031 | 11033 |
11032 | 11034 |
11033 RawPcDescriptors* PcDescriptors::New(GrowableArray<uint8_t>* data) { | 11035 RawPcDescriptors* PcDescriptors::New(GrowableArray<uint8_t>* data) { |
11034 ASSERT(Object::pc_descriptors_class() != Class::null()); | 11036 ASSERT(Object::pc_descriptors_class() != Class::null()); |
11035 Isolate* isolate = Isolate::Current(); | 11037 Thread* thread = Thread::Current(); |
11036 PcDescriptors& result = PcDescriptors::Handle(isolate); | 11038 Isolate* isolate = thread->isolate(); |
| 11039 PcDescriptors& result = PcDescriptors::Handle(thread->zone()); |
11037 { | 11040 { |
11038 uword size = PcDescriptors::InstanceSize(data->length()); | 11041 uword size = PcDescriptors::InstanceSize(data->length()); |
11039 RawObject* raw = Object::Allocate(PcDescriptors::kClassId, | 11042 RawObject* raw = Object::Allocate(PcDescriptors::kClassId, |
11040 size, | 11043 size, |
11041 Heap::kOld); | 11044 Heap::kOld); |
11042 INC_STAT(isolate, total_code_size, size); | 11045 INC_STAT(isolate, total_code_size, size); |
11043 INC_STAT(isolate, pc_desc_size, size); | 11046 INC_STAT(isolate, pc_desc_size, size); |
11044 NoSafepointScope no_safepoint; | 11047 NoSafepointScope no_safepoint; |
11045 result ^= raw; | 11048 result ^= raw; |
11046 result.SetLength(data->length()); | 11049 result.SetLength(data->length()); |
11047 result.CopyData(data); | 11050 result.CopyData(data); |
11048 } | 11051 } |
11049 return result.raw(); | 11052 return result.raw(); |
11050 } | 11053 } |
11051 | 11054 |
11052 | 11055 |
11053 RawPcDescriptors* PcDescriptors::New(intptr_t length) { | 11056 RawPcDescriptors* PcDescriptors::New(intptr_t length) { |
11054 ASSERT(Object::pc_descriptors_class() != Class::null()); | 11057 ASSERT(Object::pc_descriptors_class() != Class::null()); |
11055 Isolate* isolate = Isolate::Current(); | 11058 Thread* thread = Thread::Current(); |
11056 PcDescriptors& result = PcDescriptors::Handle(isolate); | 11059 Isolate* isolate = thread->isolate(); |
| 11060 PcDescriptors& result = PcDescriptors::Handle(thread->zone()); |
11057 { | 11061 { |
11058 uword size = PcDescriptors::InstanceSize(length); | 11062 uword size = PcDescriptors::InstanceSize(length); |
11059 RawObject* raw = Object::Allocate(PcDescriptors::kClassId, | 11063 RawObject* raw = Object::Allocate(PcDescriptors::kClassId, |
11060 size, | 11064 size, |
11061 Heap::kOld); | 11065 Heap::kOld); |
11062 INC_STAT(isolate, total_code_size, size); | 11066 INC_STAT(isolate, total_code_size, size); |
11063 INC_STAT(isolate, pc_desc_size, size); | 11067 INC_STAT(isolate, pc_desc_size, size); |
11064 NoSafepointScope no_safepoint; | 11068 NoSafepointScope no_safepoint; |
11065 result ^= raw; | 11069 result ^= raw; |
11066 result.SetLength(length); | 11070 result.SetLength(length); |
(...skipping 10323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21390 return tag_label.ToCString(); | 21394 return tag_label.ToCString(); |
21391 } | 21395 } |
21392 | 21396 |
21393 | 21397 |
21394 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21398 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
21395 Instance::PrintJSONImpl(stream, ref); | 21399 Instance::PrintJSONImpl(stream, ref); |
21396 } | 21400 } |
21397 | 21401 |
21398 | 21402 |
21399 } // namespace dart | 21403 } // namespace dart |
OLD | NEW |