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 6450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6461 void Function::SaveICDataMap( | 6461 void Function::SaveICDataMap( |
6462 const ZoneGrowableArray<const ICData*>& deopt_id_to_ic_data) const { | 6462 const ZoneGrowableArray<const ICData*>& deopt_id_to_ic_data) const { |
6463 // Compute number of ICData objectsto save. | 6463 // Compute number of ICData objectsto save. |
6464 intptr_t count = 0; | 6464 intptr_t count = 0; |
6465 for (intptr_t i = 0; i < deopt_id_to_ic_data.length(); i++) { | 6465 for (intptr_t i = 0; i < deopt_id_to_ic_data.length(); i++) { |
6466 if (deopt_id_to_ic_data[i] != NULL) { | 6466 if (deopt_id_to_ic_data[i] != NULL) { |
6467 count++; | 6467 count++; |
6468 } | 6468 } |
6469 } | 6469 } |
6470 | 6470 |
6471 const Array& a = Array::Handle(Array::New(count, Heap::kOld)); | 6471 const Array& a = Array::Handle(Array::NewOrEmpty(count, Heap::kOld)); |
6472 count = 0; | 6472 count = 0; |
6473 for (intptr_t i = 0; i < deopt_id_to_ic_data.length(); i++) { | 6473 for (intptr_t i = 0; i < deopt_id_to_ic_data.length(); i++) { |
6474 if (deopt_id_to_ic_data[i] != NULL) { | 6474 if (deopt_id_to_ic_data[i] != NULL) { |
6475 a.SetAt(count++, *deopt_id_to_ic_data[i]); | 6475 a.SetAt(count++, *deopt_id_to_ic_data[i]); |
6476 } | 6476 } |
6477 } | 6477 } |
siva
2014/07/09 20:08:02
Similarly here we could go with
if (count == 0) {
| |
6478 set_ic_data_array(a); | 6478 set_ic_data_array(a); |
6479 } | 6479 } |
6480 | 6480 |
6481 | 6481 |
6482 void Function::RestoreICDataMap( | 6482 void Function::RestoreICDataMap( |
6483 ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data) const { | 6483 ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data) const { |
6484 Isolate* isolate = Isolate::Current(); | 6484 Isolate* isolate = Isolate::Current(); |
6485 const Array& saved_icd = Array::Handle(isolate, ic_data_array()); | 6485 const Array& saved_icd = Array::Handle(isolate, ic_data_array()); |
6486 if (saved_icd.Length() == 0) { | 6486 if (saved_icd.Length() == 0) { |
6487 deopt_id_to_ic_data->Clear(); | 6487 deopt_id_to_ic_data->Clear(); |
(...skipping 4098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10586 LocalVarDescriptors& result = LocalVarDescriptors::Handle(); | 10586 LocalVarDescriptors& result = LocalVarDescriptors::Handle(); |
10587 { | 10587 { |
10588 uword size = LocalVarDescriptors::InstanceSize(num_variables); | 10588 uword size = LocalVarDescriptors::InstanceSize(num_variables); |
10589 RawObject* raw = Object::Allocate(LocalVarDescriptors::kClassId, | 10589 RawObject* raw = Object::Allocate(LocalVarDescriptors::kClassId, |
10590 size, | 10590 size, |
10591 Heap::kOld); | 10591 Heap::kOld); |
10592 NoGCScope no_gc; | 10592 NoGCScope no_gc; |
10593 result ^= raw; | 10593 result ^= raw; |
10594 result.raw_ptr()->length_ = num_variables; | 10594 result.raw_ptr()->length_ = num_variables; |
10595 } | 10595 } |
10596 const Array& names = Array::Handle(Array::New(num_variables, Heap::kOld)); | 10596 const Array& names = |
10597 Array::Handle(Array::NewOrEmpty(num_variables, Heap::kOld)); | |
10597 result.raw_ptr()->names_ = names.raw(); | 10598 result.raw_ptr()->names_ = names.raw(); |
siva
2014/07/09 20:08:02
ditto here too, avoids the handle creation.
| |
10598 return result.raw(); | 10599 return result.raw(); |
10599 } | 10600 } |
10600 | 10601 |
10601 | 10602 |
10602 intptr_t LocalVarDescriptors::Length() const { | 10603 intptr_t LocalVarDescriptors::Length() const { |
10603 return raw_ptr()->length_; | 10604 return raw_ptr()->length_; |
10604 } | 10605 } |
10605 | 10606 |
10606 | 10607 |
10607 intptr_t ExceptionHandlers::Length() const { | 10608 intptr_t ExceptionHandlers::Length() const { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10687 ExceptionHandlers& result = ExceptionHandlers::Handle(); | 10688 ExceptionHandlers& result = ExceptionHandlers::Handle(); |
10688 { | 10689 { |
10689 uword size = ExceptionHandlers::InstanceSize(num_handlers); | 10690 uword size = ExceptionHandlers::InstanceSize(num_handlers); |
10690 RawObject* raw = Object::Allocate(ExceptionHandlers::kClassId, | 10691 RawObject* raw = Object::Allocate(ExceptionHandlers::kClassId, |
10691 size, | 10692 size, |
10692 Heap::kOld); | 10693 Heap::kOld); |
10693 NoGCScope no_gc; | 10694 NoGCScope no_gc; |
10694 result ^= raw; | 10695 result ^= raw; |
10695 result.raw_ptr()->length_ = num_handlers; | 10696 result.raw_ptr()->length_ = num_handlers; |
10696 } | 10697 } |
10697 const Array& handled_types_data = Array::Handle(Array::New(num_handlers)); | 10698 const Array& handled_types_data = |
10699 Array::Handle(Array::NewOrEmpty(num_handlers)); | |
siva
2014/07/09 20:08:02
Ditto.
| |
10698 result.set_handled_types_data(handled_types_data); | 10700 result.set_handled_types_data(handled_types_data); |
10699 return result.raw(); | 10701 return result.raw(); |
10700 } | 10702 } |
10701 | 10703 |
10702 | 10704 |
10703 const char* ExceptionHandlers::ToCString() const { | 10705 const char* ExceptionHandlers::ToCString() const { |
10704 if (Length() == 0) { | 10706 if (Length() == 0) { |
10705 return "No exception handlers\n"; | 10707 return "No exception handlers\n"; |
10706 } | 10708 } |
10707 Array& handled_types = Array::Handle(); | 10709 Array& handled_types = Array::Handle(); |
(...skipping 8346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
19054 return tag_label.ToCString(); | 19056 return tag_label.ToCString(); |
19055 } | 19057 } |
19056 | 19058 |
19057 | 19059 |
19058 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 19060 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
19059 Instance::PrintJSONImpl(stream, ref); | 19061 Instance::PrintJSONImpl(stream, ref); |
19060 } | 19062 } |
19061 | 19063 |
19062 | 19064 |
19063 } // namespace dart | 19065 } // namespace dart |
OLD | NEW |