Chromium Code Reviews| Index: runtime/vm/ic_data.h |
| =================================================================== |
| --- runtime/vm/ic_data.h (revision 0) |
| +++ runtime/vm/ic_data.h (revision 0) |
| @@ -0,0 +1,77 @@ |
| +// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| +// Class for handling inline cache stubs |
| + |
| +// 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.
|
| +// That array contains information relevant for the call site: function name and |
| +// inline cache data. Class ICData is a wrapper around that array. |
| +// The array format is: |
| +// 0: function-name |
| +// 1: N, number of arguments checked. |
| +// 2 .. (length - 1): group of checks, each check containing: |
| +// - N classes. |
| +// - 1 target function. |
| +// Whenever first N arguments of an instance call have the same class as the |
| +// check, jump to the target function. |
| +// 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.
|
| +// The array does not contain Null-Classes. Null objects cannot be added. |
| + |
| +#ifndef VM_IC_DATA_H_ |
| +#define VM_IC_DATA_H_ |
| + |
| +#include "vm/allocation.h" |
| +#include "vm/growable_array.h" |
| + |
| +namespace dart { |
| + |
| +class Array; |
| +class Class; |
| +class Function; |
| +class String; |
| +class RawArray; |
| +class RawString; |
| + |
| +class ICData : public ValueObject { |
| + public: |
| + // Wrap IC data around 'array'. |
| + explicit ICData(const Array& array); |
| + |
| + // Create a new array with zero checks. |
| + ICData(const String& function_name, intptr_t num_args_checked); |
| + |
| + RawArray* data() const; |
| + |
| + RawString* FunctionName() const; |
| + |
| + intptr_t NumberOfArgumentsChecked() const; |
| + intptr_t NumberOfChecks() const; |
| + |
| + // Also updates the instance call at 'return_address_'. |
| + void AddCheck(const GrowableArray<const Class*>& classes, |
| + const Function& target); |
| + |
| + void SetCheckAt(intptr_t index, |
| + const GrowableArray<const Class*>& classes, |
| + const Function& target); |
| + |
| + void GetCheckAt(intptr_t index, |
| + GrowableArray<const Class*>* classes, |
| + Function* target) const; |
| + |
| + static const int kNameIndex = 0; |
| + |
| + private: |
| + intptr_t ArrayElementsPerCheck() const; |
| + |
| + const Array* data_; |
| + |
| + static const int kNumArgsCheckedIndex = 1; |
| + static const int kChecksStartIndex = 2; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ICData); |
| +}; |
| + |
| +} // namespace dart |
| + |
| +#endif // VM_IC_DATA_H_ |