Commit d2f229bf authored by ishell@chromium.org's avatar ishell@chromium.org

Several methods moved from JSObject to Map.

R=verwaest@chromium.org

Review URL: https://codereview.chromium.org/349203002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21940 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b3f84877
......@@ -358,19 +358,19 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() {
bool follow_expected = false;
Handle<Map> target;
if (seq_ascii) {
key = JSObject::ExpectedTransitionKey(map);
key = Map::ExpectedTransitionKey(map);
follow_expected = !key.is_null() && ParseJsonString(key);
}
// If the expected transition hits, follow it.
if (follow_expected) {
target = JSObject::ExpectedTransitionTarget(map);
target = Map::ExpectedTransitionTarget(map);
} else {
// If the expected transition failed, parse an internalized string and
// try to find a matching transition.
key = ParseJsonInternalizedString();
if (key.is_null()) return ReportUnexpectedCharacter();
target = JSObject::FindTransitionToField(map, key);
target = Map::FindTransitionToField(map, key);
// If a transition was found, follow it and continue.
transitioning = !target.is_null();
}
......
......@@ -1810,7 +1810,7 @@ void JSObject::initialize_elements() {
}
Handle<String> JSObject::ExpectedTransitionKey(Handle<Map> map) {
Handle<String> Map::ExpectedTransitionKey(Handle<Map> map) {
DisallowHeapAllocation no_gc;
if (!map->HasTransitionArray()) return Handle<String>::null();
TransitionArray* transitions = map->transitions();
......@@ -1825,14 +1825,14 @@ Handle<String> JSObject::ExpectedTransitionKey(Handle<Map> map) {
}
Handle<Map> JSObject::ExpectedTransitionTarget(Handle<Map> map) {
Handle<Map> Map::ExpectedTransitionTarget(Handle<Map> map) {
ASSERT(!ExpectedTransitionKey(map).is_null());
return Handle<Map>(map->transitions()->GetTarget(
TransitionArray::kSimpleTransitionIndex));
}
Handle<Map> JSObject::FindTransitionToField(Handle<Map> map, Handle<Name> key) {
Handle<Map> Map::FindTransitionToField(Handle<Map> map, Handle<Name> key) {
DisallowHeapAllocation no_allocation;
if (!map->HasTransitionArray()) return Handle<Map>::null();
TransitionArray* transitions = map->transitions();
......
......@@ -2152,14 +2152,6 @@ class JSObject: public JSReceiver {
StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED,
ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING);
static inline Handle<String> ExpectedTransitionKey(Handle<Map> map);
static inline Handle<Map> ExpectedTransitionTarget(Handle<Map> map);
// Try to follow an existing transition to a field with attributes NONE. The
// return value indicates whether the transition was successful.
static inline Handle<Map> FindTransitionToField(Handle<Map> map,
Handle<Name> key);
// Extend the receiver with a single fast property appeared first in the
// passed map. This also extends the property backing store if necessary.
static void AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map);
......@@ -6234,14 +6226,21 @@ class Map: public HeapObject {
inline bool HasTransitionArray() const;
inline bool HasElementsTransition();
inline Map* elements_transition_map();
static Handle<TransitionArray> SetElementsTransitionMap(
Handle<Map> map, Handle<Map> transitioned_map);
inline Map* GetTransition(int transition_index);
inline int SearchTransition(Name* name);
inline FixedArrayBase* GetInitialElements();
DECL_ACCESSORS(transitions, TransitionArray)
static inline Handle<String> ExpectedTransitionKey(Handle<Map> map);
static inline Handle<Map> ExpectedTransitionTarget(Handle<Map> map);
// Try to follow an existing transition to a field with attributes NONE. The
// return value indicates whether the transition was successful.
static inline Handle<Map> FindTransitionToField(Handle<Map> map,
Handle<Name> key);
Map* FindRootMap();
Map* FindFieldOwner(int descriptor);
......@@ -6249,15 +6248,17 @@ class Map: public HeapObject {
int NumberOfFields();
// TODO(ishell): candidate with JSObject::MigrateToMap().
bool InstancesNeedRewriting(Map* target,
int target_number_of_fields,
int target_inobject,
int target_unused);
// TODO(ishell): moveit!
static Handle<Map> GeneralizeAllFieldRepresentations(Handle<Map> map);
static Handle<HeapType> GeneralizeFieldType(Handle<HeapType> type1,
Handle<HeapType> type2,
Isolate* isolate)
V8_WARN_UNUSED_RESULT;
MUST_USE_RESULT static Handle<HeapType> GeneralizeFieldType(
Handle<HeapType> type1,
Handle<HeapType> type2,
Isolate* isolate);
static void GeneralizeFieldType(Handle<Map> map,
int modify_index,
Handle<HeapType> new_field_type);
......@@ -6542,7 +6543,6 @@ class Map: public HeapObject {
// elements_kind that's found in |candidates|, or null handle if no match is
// found at all.
Handle<Map> FindTransitionedMap(MapHandleList* candidates);
Map* FindTransitionedMap(MapList* candidates);
bool CanTransition() {
// Only JSObject and subtypes have map transitions and back pointers.
......@@ -6704,6 +6704,9 @@ class Map: public HeapObject {
bool EquivalentToForNormalization(Map* other, PropertyNormalizationMode mode);
private:
static Handle<TransitionArray> SetElementsTransitionMap(
Handle<Map> map, Handle<Map> transitioned_map);
bool EquivalentToForTransition(Map* other);
static Handle<Map> RawCopy(Handle<Map> map, int instance_size);
static Handle<Map> ShareDescriptor(Handle<Map> map,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment