v8/test/cctest/test-transitions.h
Jakob Kummerow e567dd3ab4 Refactor TransitionArray access
in preparation for caching StoreIC-Transition handlers in there.
This CL should not change behavior or performance.

The TransitionArray class no longer serves a dual purpose; it is now
simply the data structure serving that role. Further, it now supports
storing transitioning handlers in its "target" slot, which in turn have
a WeakCell pointing to the transition target (but this functionality
is not being used yet).

The interface for accessing a map's transitions, previously implemented
as a set of static functions, is now handled by the TransitionsAccessor
class. It distinguishes the following internal states:
- kPrototypeInfo: map is a prototype map, will never cache any transitions.
- kUninitialized: map can cache transitions, but doesn't have any.
- kWeakCell: map caches a single transition, stored inline. Formerly known
             as "IsSimpleTransition".
- kFullTransitionArray: map uses a TransitionArray to store transitions.
- kTuple3Handler, kFixedArrayHandler: to be used in the future for caching
                                      transitioning handlers.

Change-Id: If2aa68390981f96f317b958445a6e0b935c2a14e
Reviewed-on: https://chromium-review.googlesource.com/550118
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46981}
2017-07-28 19:41:21 +00:00

32 lines
876 B
C++

// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_TEST_CCTEST_TEST_TRANSITIONS_H_
#define V8_TEST_CCTEST_TEST_TRANSITIONS_H_
#include "src/transitions.h"
namespace v8 {
namespace internal {
class TestTransitionsAccessor : public TransitionsAccessor {
public:
TestTransitionsAccessor(Map* map, DisallowHeapAllocation* no_gc)
: TransitionsAccessor(map, no_gc) {}
explicit TestTransitionsAccessor(Handle<Map> map)
: TransitionsAccessor(map) {}
// Expose internals for tests.
bool IsWeakCellEncoding() { return encoding() == kWeakCell; }
bool IsFullTransitionArrayEncoding() {
return encoding() == kFullTransitionArray;
}
};
} // namespace internal
} // namespace v8
#endif // V8_TEST_CCTEST_TEST_TRANSITIONS_H_