Chromium Code Reviews| Index: runtime/vm/become.h |
| diff --git a/runtime/vm/become.h b/runtime/vm/become.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b0f717e4275ef7b138dbfcd50c67d599f89d2c92 |
| --- /dev/null |
| +++ b/runtime/vm/become.h |
| @@ -0,0 +1,34 @@ |
| +// Copyright (c) 2016, 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. |
| + |
| +#ifndef VM_BECOME_H_ |
| +#define VM_BECOME_H_ |
| + |
| +#include "vm/allocation.h" |
| + |
| +namespace dart { |
| + |
| +class Array; |
| + |
| +class Become : public AllStatic { |
| + public: |
| + // Smalltalk's one-way bulk become (Array>>#elementsForwardIdentityTo:). |
| + // Redirects all pointers to elements of 'before' to the corresponding element |
| + // in 'after'. Every element in 'before' is guaranteed to be dead after this |
|
Ivan Posva
2016/05/16 20:58:59
"is guaranteed to be dead" -> "is guaranteed to be
Cutch
2016/05/17 18:03:51
Done.
|
| + // operation, though we won't finalize them until the next GC discovers this. |
| + // Useful for atomically applying behavior and schema changes. |
| + static void ElementsForwardIdentity(const Array& before, const Array& after); |
| + |
| + // For completeness, Smalltalk also has a two-way bulk become |
| + // (Array>>#elementsExchangeIdentityWith:). This is typically used in |
| + // application-level virtual memory or persistence schemes, where a set of |
| + // objects are swapped with so-called husks and the original objects are |
| + // serialized. |
| + // static void ElementsExchangeIdentity(const Array& before, |
|
Ivan Posva
2016/05/16 20:58:59
Drop this as it is not needed for reload.
Cutch
2016/05/17 18:03:51
Done.
|
| + // const Array& after); |
| +}; |
| + |
| +} // namespace dart |
| + |
| +#endif // VM_BECOME_H_ |