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 #ifndef VM_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
| 6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
| (...skipping 3394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3405 | 3405 |
| 3406 // Return true if the target function of this IC data may check for (and | 3406 // Return true if the target function of this IC data may check for (and |
| 3407 // possibly issue) a Javascript compatibility warning. | 3407 // possibly issue) a Javascript compatibility warning. |
| 3408 bool MayCheckForJSWarning() const; | 3408 bool MayCheckForJSWarning() const; |
| 3409 | 3409 |
| 3410 bool IsClosureCall() const; | 3410 bool IsClosureCall() const; |
| 3411 void SetIsClosureCall() const; | 3411 void SetIsClosureCall() const; |
| 3412 | 3412 |
| 3413 intptr_t NumberOfChecks() const; | 3413 intptr_t NumberOfChecks() const; |
| 3414 | 3414 |
| 3415 // Discounts any checks with usage of zero. | |
| 3416 intptr_t NumberOfUsedChecks() const; | |
| 3417 | |
| 3415 static intptr_t InstanceSize() { | 3418 static intptr_t InstanceSize() { |
| 3416 return RoundedAllocationSize(sizeof(RawICData)); | 3419 return RoundedAllocationSize(sizeof(RawICData)); |
| 3417 } | 3420 } |
| 3418 | 3421 |
| 3419 static intptr_t target_name_offset() { | 3422 static intptr_t target_name_offset() { |
| 3420 return OFFSET_OF(RawICData, target_name_); | 3423 return OFFSET_OF(RawICData, target_name_); |
| 3421 } | 3424 } |
| 3422 | 3425 |
| 3423 static intptr_t state_bits_offset() { | 3426 static intptr_t state_bits_offset() { |
| 3424 return OFFSET_OF(RawICData, state_bits_); | 3427 return OFFSET_OF(RawICData, state_bits_); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 3454 void AddCheck(const GrowableArray<intptr_t>& class_ids, | 3457 void AddCheck(const GrowableArray<intptr_t>& class_ids, |
| 3455 const Function& target) const; | 3458 const Function& target) const; |
| 3456 // Adds sorted so that Smi is the first class-id. Use only for | 3459 // Adds sorted so that Smi is the first class-id. Use only for |
| 3457 // num_args_tested == 1. | 3460 // num_args_tested == 1. |
| 3458 void AddReceiverCheck(intptr_t receiver_class_id, | 3461 void AddReceiverCheck(intptr_t receiver_class_id, |
| 3459 const Function& target, | 3462 const Function& target, |
| 3460 intptr_t count = 1) const; | 3463 intptr_t count = 1) const; |
| 3461 | 3464 |
| 3462 // Retrieving checks. | 3465 // Retrieving checks. |
| 3463 | 3466 |
| 3467 // TODO(srdjan): GetCheckAt without target. | |
| 3464 void GetCheckAt(intptr_t index, | 3468 void GetCheckAt(intptr_t index, |
| 3465 GrowableArray<intptr_t>* class_ids, | 3469 GrowableArray<intptr_t>* class_ids, |
| 3466 Function* target) const; | 3470 Function* target) const; |
| 3467 // Only for 'num_args_checked == 1'. | 3471 // Only for 'num_args_checked == 1'. |
| 3468 void GetOneClassCheckAt(intptr_t index, | 3472 void GetOneClassCheckAt(intptr_t index, |
| 3469 intptr_t* class_id, | 3473 intptr_t* class_id, |
| 3470 Function* target) const; | 3474 Function* target) const; |
| 3471 // Only for 'num_args_checked == 1'. | 3475 // Only for 'num_args_checked == 1'. |
| 3472 intptr_t GetCidAt(intptr_t index) const; | 3476 intptr_t GetCidAt(intptr_t index) const; |
| 3473 | 3477 |
| 3474 intptr_t GetReceiverClassIdAt(intptr_t index) const; | 3478 intptr_t GetReceiverClassIdAt(intptr_t index) const; |
| 3475 intptr_t GetClassIdAt(intptr_t index, intptr_t arg_nr) const; | 3479 intptr_t GetClassIdAt(intptr_t index, intptr_t arg_nr) const; |
| 3476 | 3480 |
| 3477 RawFunction* GetTargetAt(intptr_t index) const; | 3481 RawFunction* GetTargetAt(intptr_t index) const; |
| 3478 RawFunction* GetTargetForReceiverClassId(intptr_t class_id) const; | 3482 RawFunction* GetTargetForReceiverClassId(intptr_t class_id) const; |
| 3479 | 3483 |
| 3480 void IncrementCountAt(intptr_t index, intptr_t value) const; | 3484 void IncrementCountAt(intptr_t index, intptr_t value) const; |
| 3481 void SetCountAt(intptr_t index, intptr_t value) const; | 3485 void SetCountAt(intptr_t index, intptr_t value) const; |
| 3482 intptr_t GetCountAt(intptr_t index) const; | 3486 intptr_t GetCountAt(intptr_t index) const; |
| 3483 intptr_t AggregateCount() const; | 3487 intptr_t AggregateCount() const; |
| 3484 | 3488 |
| 3485 // Returns this->raw() if num_args_tested == 1 and arg_nr == 1, otherwise | 3489 // Returns this->raw() if num_args_tested == 1 and arg_nr == 1, otherwise |
| 3486 // returns a new ICData object containing only unique arg_nr checks. | 3490 // returns a new ICData object containing only unique arg_nr checks. |
| 3491 // Returns only used entries., | |
|
zra
2014/08/20 20:17:11
remove comma.
srdjan
2014/08/21 17:30:22
Done.
| |
| 3487 RawICData* AsUnaryClassChecksForArgNr(intptr_t arg_nr) const; | 3492 RawICData* AsUnaryClassChecksForArgNr(intptr_t arg_nr) const; |
| 3488 RawICData* AsUnaryClassChecks() const { | 3493 RawICData* AsUnaryClassChecks() const { |
| 3489 return AsUnaryClassChecksForArgNr(0); | 3494 return AsUnaryClassChecksForArgNr(0); |
| 3490 } | 3495 } |
| 3491 | 3496 |
| 3497 // Consider only used entries. | |
| 3492 bool AllTargetsHaveSameOwner(intptr_t owner_cid) const; | 3498 bool AllTargetsHaveSameOwner(intptr_t owner_cid) const; |
| 3493 bool AllReceiversAreNumbers() const; | 3499 bool AllReceiversAreNumbers() const; |
| 3494 bool HasOneTarget() const; | 3500 bool HasOneTarget() const; |
| 3495 bool HasReceiverClassId(intptr_t class_id) const; | 3501 bool HasReceiverClassId(intptr_t class_id) const; |
| 3496 | 3502 |
| 3497 static RawICData* New(const Function& owner, | 3503 static RawICData* New(const Function& owner, |
| 3498 const String& target_name, | 3504 const String& target_name, |
| 3499 const Array& arguments_descriptor, | 3505 const Array& arguments_descriptor, |
| 3500 intptr_t deopt_id, | 3506 intptr_t deopt_id, |
| 3501 intptr_t num_args_tested); | 3507 intptr_t num_args_tested); |
| 3502 | 3508 |
| 3503 static intptr_t TestEntryLengthFor(intptr_t num_args); | 3509 static intptr_t TestEntryLengthFor(intptr_t num_args); |
| 3504 | 3510 |
| 3505 static intptr_t TargetIndexFor(intptr_t num_args) { | 3511 static intptr_t TargetIndexFor(intptr_t num_args) { |
| 3506 return num_args; | 3512 return num_args; |
| 3507 } | 3513 } |
| 3508 | 3514 |
| 3509 static intptr_t CountIndexFor(intptr_t num_args) { | 3515 static intptr_t CountIndexFor(intptr_t num_args) { |
| 3510 return (num_args + 1); | 3516 return (num_args + 1); |
| 3511 } | 3517 } |
| 3512 | 3518 |
| 3519 bool IsUsedAt(intptr_t i) const; | |
| 3520 | |
| 3521 void GetUsedCidsForTwoArgs(GrowableArray<intptr_t>* first, | |
| 3522 GrowableArray<intptr_t>* second) const; | |
| 3523 | |
| 3513 private: | 3524 private: |
| 3514 RawArray* ic_data() const { | 3525 RawArray* ic_data() const { |
| 3515 return raw_ptr()->ic_data_; | 3526 return raw_ptr()->ic_data_; |
| 3516 } | 3527 } |
| 3517 | 3528 |
| 3518 void set_owner(const Function& value) const; | 3529 void set_owner(const Function& value) const; |
| 3519 void set_target_name(const String& value) const; | 3530 void set_target_name(const String& value) const; |
| 3520 void set_arguments_descriptor(const Array& value) const; | 3531 void set_arguments_descriptor(const Array& value) const; |
| 3521 void set_deopt_id(intptr_t value) const; | 3532 void set_deopt_id(intptr_t value) const; |
| 3522 void SetNumArgsTested(intptr_t value) const; | 3533 void SetNumArgsTested(intptr_t value) const; |
| (...skipping 3786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7309 | 7320 |
| 7310 | 7321 |
| 7311 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7322 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 7312 intptr_t index) { | 7323 intptr_t index) { |
| 7313 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7324 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 7314 } | 7325 } |
| 7315 | 7326 |
| 7316 } // namespace dart | 7327 } // namespace dart |
| 7317 | 7328 |
| 7318 #endif // VM_OBJECT_H_ | 7329 #endif // VM_OBJECT_H_ |
| OLD | NEW |