Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 // Class for handling inline cache stubs | |
| 5 | |
| 6 // At instance call the ECX register contains the IC-data array. | |
|
regis
2011/10/21 03:03:52
This header is not ia32 specific, so I would write
srdjan
2011/10/22 07:48:53
Done.
| |
| 7 // That array contains information relevant for the call site: function name and | |
| 8 // inline cache data. Class ICData is a wrapper around that array. | |
| 9 // The array format is: | |
| 10 // 0: function-name | |
| 11 // 1: N, number of arguments checked. | |
| 12 // 2 .. (length - 1): group of checks, each check containing: | |
| 13 // - N classes. | |
| 14 // - 1 target function. | |
| 15 // Whenever first N arguments of an instance call have the same class as the | |
| 16 // check, jump to the target function. | |
| 17 // Array is terminated with a nulled check (all classes and target are NULL). | |
|
regis
2011/10/21 03:03:52
Array is null terminated (all ...
srdjan
2011/10/22 07:48:53
Done.
| |
| 18 // The array does not contain Null-Classes. Null objects cannot be added. | |
| 19 | |
| 20 #ifndef VM_IC_DATA_H_ | |
| 21 #define VM_IC_DATA_H_ | |
| 22 | |
| 23 #include "vm/allocation.h" | |
| 24 #include "vm/growable_array.h" | |
| 25 | |
| 26 namespace dart { | |
| 27 | |
| 28 class Array; | |
| 29 class Class; | |
| 30 class Function; | |
| 31 class String; | |
| 32 class RawArray; | |
| 33 class RawString; | |
| 34 | |
| 35 class ICData : public ValueObject { | |
| 36 public: | |
| 37 // Wrap IC data around 'array'. | |
| 38 explicit ICData(const Array& array); | |
| 39 | |
| 40 // Create a new array with zero checks. | |
| 41 ICData(const String& function_name, intptr_t num_args_checked); | |
| 42 | |
| 43 RawArray* data() const; | |
| 44 | |
| 45 RawString* FunctionName() const; | |
| 46 | |
| 47 intptr_t NumberOfArgumentsChecked() const; | |
| 48 intptr_t NumberOfChecks() const; | |
| 49 | |
| 50 // Also updates the instance call at 'return_address_'. | |
| 51 void AddCheck(const GrowableArray<const Class*>& classes, | |
| 52 const Function& target); | |
| 53 | |
| 54 void SetCheckAt(intptr_t index, | |
| 55 const GrowableArray<const Class*>& classes, | |
| 56 const Function& target); | |
| 57 | |
| 58 void GetCheckAt(intptr_t index, | |
| 59 GrowableArray<const Class*>* classes, | |
| 60 Function* target) const; | |
| 61 | |
| 62 static const int kNameIndex = 0; | |
| 63 | |
| 64 private: | |
| 65 intptr_t ArrayElementsPerCheck() const; | |
| 66 | |
| 67 const Array* data_; | |
| 68 | |
| 69 static const int kNumArgsCheckedIndex = 1; | |
| 70 static const int kChecksStartIndex = 2; | |
| 71 | |
| 72 DISALLOW_COPY_AND_ASSIGN(ICData); | |
| 73 }; | |
| 74 | |
| 75 } // namespace dart | |
| 76 | |
| 77 #endif // VM_IC_DATA_H_ | |
| OLD | NEW |