Revision: 20793
Author: [email protected]
Date: Wed Apr 16 11:25:29 2014 UTC
Log: Move CopyReplaceDescriptors to private
BUG=
[email protected]
Review URL: https://codereview.chromium.org/239203002
http://code.google.com/p/v8/source/detail?r=20793
Modified:
/branches/bleeding_edge/src/objects.cc
/branches/bleeding_edge/src/objects.h
=======================================
--- /branches/bleeding_edge/src/objects.cc Wed Apr 16 11:11:21 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc Wed Apr 16 11:25:29 2014 UTC
@@ -5756,16 +5756,7 @@
JSObject::MigrateToMap(object, transition_map);
} else if (object->HasFastProperties() &&
old_map->CanHaveMoreTransitions()) {
// Create a new descriptor array with fully-frozen properties
- int num_descriptors = old_map->NumberOfOwnDescriptors();
- Handle<DescriptorArray> new_descriptors =
- DescriptorArray::CopyUpToAddAttributes(
- handle(old_map->instance_descriptors()), num_descriptors,
FROZEN);
- Handle<Map> new_map = Map::CopyReplaceDescriptors(
- old_map, new_descriptors, INSERT_TRANSITION,
- isolate->factory()->frozen_symbol());
- new_map->freeze();
- new_map->set_is_extensible(false);
- new_map->set_elements_kind(DICTIONARY_ELEMENTS);
+ Handle<Map> new_map = Map::CopyForFreeze(old_map);
JSObject::MigrateToMap(object, new_map);
} else {
// Slow path: need to normalize properties for safety
@@ -6967,16 +6958,7 @@
Handle<Map> Map::CopyReplaceDescriptors(Handle<Map> map,
Handle<DescriptorArray>
descriptors,
TransitionFlag flag,
- SimpleTransitionFlag simple_flag) {
- return CopyReplaceDescriptors(
- map, descriptors, flag, Handle<Name>::null(), simple_flag);
-}
-
-
-Handle<Map> Map::CopyReplaceDescriptors(Handle<Map> map,
- Handle<DescriptorArray>
descriptors,
- TransitionFlag flag,
- Handle<Name> name,
+ MaybeHandle<Name> maybe_name,
SimpleTransitionFlag simple_flag) {
ASSERT(descriptors->IsSortedNoDuplicates());
@@ -6984,6 +6966,8 @@
result->InitializeDescriptors(*descriptors);
if (flag == INSERT_TRANSITION && map->CanHaveMoreTransitions()) {
+ Handle<Name> name;
+ CHECK(maybe_name.ToHandle(&name));
Handle<TransitionArray> transitions = TransitionArray::CopyInsert(
map, name, result, simple_flag);
map->set_transitions(*transitions);
@@ -7120,7 +7104,8 @@
int number_of_own_descriptors = map->NumberOfOwnDescriptors();
Handle<DescriptorArray> new_descriptors =
DescriptorArray::CopyUpTo(descriptors, number_of_own_descriptors);
- return CopyReplaceDescriptors(map, new_descriptors, OMIT_TRANSITION);
+ return CopyReplaceDescriptors(
+ map, new_descriptors, OMIT_TRANSITION, MaybeHandle<Name>());
}
@@ -7151,6 +7136,20 @@
copy->set_visitor_id(StaticVisitorBase::GetVisitorId(*copy));
return copy;
}
+
+
+Handle<Map> Map::CopyForFreeze(Handle<Map> map) {
+ int num_descriptors = map->NumberOfOwnDescriptors();
+ Isolate* isolate = map->GetIsolate();
+ Handle<DescriptorArray> new_desc =
DescriptorArray::CopyUpToAddAttributes(
+ handle(map->instance_descriptors(), isolate), num_descriptors,
FROZEN);
+ Handle<Map> new_map = Map::CopyReplaceDescriptors(
+ map, new_desc, INSERT_TRANSITION,
isolate->factory()->frozen_symbol());
+ new_map->freeze();
+ new_map->set_is_extensible(false);
+ new_map->set_elements_kind(DICTIONARY_ELEMENTS);
+ return new_map;
+}
Handle<Map> Map::CopyAddDescriptor(Handle<Map> map,
=======================================
--- /branches/bleeding_edge/src/objects.h Wed Apr 16 11:11:21 2014 UTC
+++ /branches/bleeding_edge/src/objects.h Wed Apr 16 11:25:29 2014 UTC
@@ -6398,17 +6398,6 @@
static Handle<Map> CurrentMapForDeprecatedInternal(Handle<Map> map);
static Handle<Map> CopyDropDescriptors(Handle<Map> map);
- static Handle<Map> CopyReplaceDescriptors(
- Handle<Map> map,
- Handle<DescriptorArray> descriptors,
- TransitionFlag flag,
- Handle<Name> name,
- SimpleTransitionFlag simple_flag = FULL_TRANSITION);
- static Handle<Map> CopyReplaceDescriptors(
- Handle<Map> map,
- Handle<DescriptorArray> descriptors,
- TransitionFlag flag,
- SimpleTransitionFlag simple_flag = FULL_TRANSITION);
static Handle<Map> CopyInsertDescriptor(Handle<Map> map,
Descriptor* descriptor,
TransitionFlag flag);
@@ -6441,6 +6430,8 @@
static Handle<Map> CopyForObserved(Handle<Map> map);
+ static Handle<Map> CopyForFreeze(Handle<Map> map);
+
static Handle<Map> CopyNormalized(Handle<Map> map,
PropertyNormalizationMode mode,
NormalizedMapSharingMode sharing);
@@ -6686,6 +6677,12 @@
static Handle<Map> CopyAddDescriptor(Handle<Map> map,
Descriptor* descriptor,
TransitionFlag flag);
+ static Handle<Map> CopyReplaceDescriptors(
+ Handle<Map> map,
+ Handle<DescriptorArray> descriptors,
+ TransitionFlag flag,
+ MaybeHandle<Name> maybe_name,
+ SimpleTransitionFlag simple_flag = FULL_TRANSITION);
// Zaps the contents of backing data structures. Note that the
// heap verifier (i.e. VerifyMarkingVisitor) relies on zapping of objects
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.