Chromium Code Reviews| 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 7293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7304 NoGCScope no_gc; | 7304 NoGCScope no_gc; |
| 7305 result ^= raw; | 7305 result ^= raw; |
| 7306 result.SetLength(num_descriptors); | 7306 result.SetLength(num_descriptors); |
| 7307 } | 7307 } |
| 7308 return result.raw(); | 7308 return result.raw(); |
| 7309 } | 7309 } |
| 7310 | 7310 |
| 7311 | 7311 |
| 7312 const char* PcDescriptors::KindAsStr(intptr_t index) const { | 7312 const char* PcDescriptors::KindAsStr(intptr_t index) const { |
| 7313 switch (DescriptorKind(index)) { | 7313 switch (DescriptorKind(index)) { |
| 7314 case PcDescriptors::kDeopt: return "deopt "; | 7314 case PcDescriptors::kDeopt: return "deopt "; |
| 7315 case PcDescriptors::kEntryPatch: return "entry-patch "; | 7315 case PcDescriptors::kEntryPatch: return "entry-patch "; |
| 7316 case PcDescriptors::kPatchCode: return "patch "; | 7316 case PcDescriptors::kPatchCode: return "patch "; |
| 7317 case PcDescriptors::kLazyDeoptJump: return "lazy-deopt "; | 7317 case PcDescriptors::kLazyDeoptJump: return "lazy-deopt "; |
| 7318 case PcDescriptors::kIcCall: return "ic-call "; | 7318 case PcDescriptors::kIcCall: return "ic-call "; |
| 7319 case PcDescriptors::kFuncCall: return "fn-call "; | 7319 case PcDescriptors::kOptStaticCall: return "opt-call "; |
| 7320 case PcDescriptors::kClosureCall: return "closure-call "; | 7320 case PcDescriptors::kUnoptStaticCall: return "unopt-call "; |
| 7321 case PcDescriptors::kReturn: return "return "; | 7321 case PcDescriptors::kClosureCall: return "closure-call "; |
| 7322 case PcDescriptors::kRuntimeCall: return "runtime-call "; | 7322 case PcDescriptors::kReturn: return "return "; |
| 7323 case PcDescriptors::kOsrEntry: return "osr-entry "; | 7323 case PcDescriptors::kRuntimeCall: return "runtime-call "; |
| 7324 case PcDescriptors::kOther: return "other "; | 7324 case PcDescriptors::kOsrEntry: return "osr-entry "; |
| 7325 case PcDescriptors::kOther: return "other "; | |
| 7325 } | 7326 } |
| 7326 UNREACHABLE(); | 7327 UNREACHABLE(); |
| 7327 return ""; | 7328 return ""; |
| 7328 } | 7329 } |
| 7329 | 7330 |
| 7330 | 7331 |
| 7331 void PcDescriptors::PrintHeaderString() { | 7332 void PcDescriptors::PrintHeaderString() { |
| 7332 // 4 bits per hex digit + 2 for "0x". | 7333 // 4 bits per hex digit + 2 for "0x". |
| 7333 const int addr_width = (kBitsPerWord / 4) + 2; | 7334 const int addr_width = (kBitsPerWord / 4) + 2; |
| 7334 // "*" in a printf format specifier tells it to read the field width from | 7335 // "*" in a printf format specifier tells it to read the field width from |
| (...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8235 intptr_t Code::ExtractIcDataArraysAtCalls( | 8236 intptr_t Code::ExtractIcDataArraysAtCalls( |
| 8236 GrowableArray<intptr_t>* node_ids, | 8237 GrowableArray<intptr_t>* node_ids, |
| 8237 const GrowableObjectArray& ic_data_objs) const { | 8238 const GrowableObjectArray& ic_data_objs) const { |
| 8238 ASSERT(node_ids != NULL); | 8239 ASSERT(node_ids != NULL); |
| 8239 ASSERT(!ic_data_objs.IsNull()); | 8240 ASSERT(!ic_data_objs.IsNull()); |
| 8240 const PcDescriptors& descriptors = | 8241 const PcDescriptors& descriptors = |
| 8241 PcDescriptors::Handle(this->pc_descriptors()); | 8242 PcDescriptors::Handle(this->pc_descriptors()); |
| 8242 ICData& ic_data_obj = ICData::Handle(); | 8243 ICData& ic_data_obj = ICData::Handle(); |
| 8243 intptr_t max_id = -1; | 8244 intptr_t max_id = -1; |
| 8244 for (intptr_t i = 0; i < descriptors.Length(); i++) { | 8245 for (intptr_t i = 0; i < descriptors.Length(); i++) { |
| 8245 if (descriptors.DescriptorKind(i) == PcDescriptors::kIcCall) { | 8246 PcDescriptors::Kind kind = descriptors.DescriptorKind(i); |
| 8247 if ((kind == PcDescriptors::kIcCall) || | |
| 8248 (kind == PcDescriptors::kUnoptStaticCall)) { | |
| 8246 intptr_t deopt_id = descriptors.DeoptId(i); | 8249 intptr_t deopt_id = descriptors.DeoptId(i); |
| 8247 if (deopt_id > max_id) { | 8250 if (deopt_id > max_id) { |
| 8248 max_id = deopt_id; | 8251 max_id = deopt_id; |
| 8249 } | 8252 } |
| 8250 node_ids->Add(deopt_id); | 8253 node_ids->Add(deopt_id); |
| 8251 CodePatcher::GetInstanceCallAt(descriptors.PC(i), *this, &ic_data_obj); | 8254 uword ret_addr = descriptors.PC(i); |
| 8255 if (kind == PcDescriptors::kIcCall) { | |
| 8256 CodePatcher::GetInstanceCallAt(ret_addr, *this, &ic_data_obj); | |
| 8257 } else { | |
| 8258 ASSERT(kind == PcDescriptors::kUnoptStaticCall); | |
|
siva
2013/06/25 21:21:05
This assert seems superfluous considering there is
srdjan
2013/06/25 21:26:08
Removed
| |
| 8259 CodePatcher::GetUnoptimizedStaticCallAt(ret_addr, *this, &ic_data_obj); | |
| 8260 } | |
| 8252 ic_data_objs.Add(ic_data_obj); | 8261 ic_data_objs.Add(ic_data_obj); |
| 8253 } | 8262 } |
| 8254 } | 8263 } |
| 8255 return max_id; | 8264 return max_id; |
| 8256 } | 8265 } |
| 8257 | 8266 |
| 8258 | 8267 |
| 8259 RawArray* Code::ExtractTypeFeedbackArray() const { | 8268 RawArray* Code::ExtractTypeFeedbackArray() const { |
| 8260 ASSERT(!IsNull() && !is_optimized()); | 8269 ASSERT(!IsNull() && !is_optimized()); |
| 8261 GrowableArray<intptr_t> deopt_ids; | 8270 GrowableArray<intptr_t> deopt_ids; |
| 8262 const GrowableObjectArray& ic_data_objs = | 8271 const GrowableObjectArray& ic_data_objs = |
| 8263 GrowableObjectArray::Handle(GrowableObjectArray::New()); | 8272 GrowableObjectArray::Handle(GrowableObjectArray::New()); |
| 8264 const intptr_t max_id = | 8273 const intptr_t max_id = |
| 8265 ExtractIcDataArraysAtCalls(&deopt_ids, ic_data_objs); | 8274 ExtractIcDataArraysAtCalls(&deopt_ids, ic_data_objs); |
| 8266 const Array& result = Array::Handle(Array::New(max_id + 1)); | 8275 const Array& result = Array::Handle(Array::New(max_id + 1)); |
| 8267 for (intptr_t i = 0; i < deopt_ids.length(); i++) { | 8276 for (intptr_t i = 0; i < deopt_ids.length(); i++) { |
| 8268 intptr_t result_index = deopt_ids[i]; | 8277 intptr_t result_index = deopt_ids[i]; |
| 8269 ASSERT(result.At(result_index) == Object::null()); | 8278 ASSERT(result.At(result_index) == Object::null()); |
| 8270 result.SetAt(result_index, Object::Handle(ic_data_objs.At(i))); | 8279 result.SetAt(result_index, Object::Handle(ic_data_objs.At(i))); |
| 8271 } | 8280 } |
| 8272 return result.raw(); | 8281 return result.raw(); |
| 8273 } | 8282 } |
| 8274 | 8283 |
| 8275 | 8284 |
| 8276 void Code::ExtractUncalledStaticCallDeoptIds( | |
| 8277 GrowableArray<intptr_t>* deopt_ids) const { | |
| 8278 ASSERT(!IsNull() && !is_optimized()); | |
| 8279 ASSERT(deopt_ids != NULL); | |
| 8280 deopt_ids->Clear(); | |
| 8281 const PcDescriptors& descriptors = | |
| 8282 PcDescriptors::Handle(this->pc_descriptors()); | |
| 8283 for (intptr_t i = 0; i < descriptors.Length(); i++) { | |
| 8284 if (descriptors.DescriptorKind(i) == PcDescriptors::kFuncCall) { | |
| 8285 // Static call. | |
| 8286 const uword target_addr = | |
| 8287 CodePatcher::GetStaticCallTargetAt(descriptors.PC(i), *this); | |
| 8288 if (target_addr == StubCode::CallStaticFunctionEntryPoint()) { | |
| 8289 deopt_ids->Add(descriptors.DeoptId(i)); | |
| 8290 } | |
| 8291 } | |
| 8292 } | |
| 8293 } | |
| 8294 | |
| 8295 | |
| 8296 RawStackmap* Code::GetStackmap(uword pc, Array* maps, Stackmap* map) const { | 8285 RawStackmap* Code::GetStackmap(uword pc, Array* maps, Stackmap* map) const { |
| 8297 // This code is used during iterating frames during a GC and hence it | 8286 // This code is used during iterating frames during a GC and hence it |
| 8298 // should not in turn start a GC. | 8287 // should not in turn start a GC. |
| 8299 NoGCScope no_gc; | 8288 NoGCScope no_gc; |
| 8300 if (stackmaps() == Array::null()) { | 8289 if (stackmaps() == Array::null()) { |
| 8301 // No stack maps are present in the code object which means this | 8290 // No stack maps are present in the code object which means this |
| 8302 // frame relies on tagged pointers. | 8291 // frame relies on tagged pointers. |
| 8303 return Stackmap::null(); | 8292 return Stackmap::null(); |
| 8304 } | 8293 } |
| 8305 // A stack map is present in the code object, use the stack map to visit | 8294 // A stack map is present in the code object, use the stack map to visit |
| (...skipping 5370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13676 space); | 13665 space); |
| 13677 return reinterpret_cast<RawWeakProperty*>(raw); | 13666 return reinterpret_cast<RawWeakProperty*>(raw); |
| 13678 } | 13667 } |
| 13679 | 13668 |
| 13680 | 13669 |
| 13681 const char* WeakProperty::ToCString() const { | 13670 const char* WeakProperty::ToCString() const { |
| 13682 return "_WeakProperty"; | 13671 return "_WeakProperty"; |
| 13683 } | 13672 } |
| 13684 | 13673 |
| 13685 } // namespace dart | 13674 } // namespace dart |
| OLD | NEW |