Revision: 22510
Author: [email protected]
Date: Mon Jul 21 15:59:05 2014 UTC
Log: Rename CurrentMapForDeprecated to TryUpdate, and introduce
Map::Update which potentially deprecates
BUG=
[email protected]
Review URL: https://codereview.chromium.org/401243003
http://code.google.com/p/v8/source/detail?r=22510
Modified:
/branches/bleeding_edge/src/ast.h
/branches/bleeding_edge/src/objects.cc
/branches/bleeding_edge/src/objects.h
/branches/bleeding_edge/src/type-info.cc
=======================================
--- /branches/bleeding_edge/src/ast.h Mon Jul 21 11:19:56 2014 UTC
+++ /branches/bleeding_edge/src/ast.h Mon Jul 21 15:59:05 2014 UTC
@@ -265,7 +265,7 @@
int length() const { return list_.length(); }
void AddMapIfMissing(Handle<Map> map, Zone* zone) {
- if (!Map::CurrentMapForDeprecated(map).ToHandle(&map)) return;
+ if (!Map::TryUpdate(map).ToHandle(&map)) return;
for (int i = 0; i < length(); ++i) {
if (at(i).is_identical_to(map)) return;
}
=======================================
--- /branches/bleeding_edge/src/objects.cc Mon Jul 21 13:10:14 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc Mon Jul 21 15:59:05 2014 UTC
@@ -2861,7 +2861,7 @@
// static
-MaybeHandle<Map> Map::CurrentMapForDeprecated(Handle<Map> map) {
+MaybeHandle<Map> Map::TryUpdate(Handle<Map> map) {
Handle<Map> proto_map(map);
while (proto_map->prototype()->IsJSObject()) {
Handle<JSObject> holder(JSObject::cast(proto_map->prototype()));
@@ -2870,12 +2870,20 @@
proto_map = Handle<Map>(holder->map());
}
}
- return CurrentMapForDeprecatedInternal(map);
+ return TryUpdateInternal(map);
+}
+
+
+// static
+Handle<Map> Map::Update(Handle<Map> map) {
+ return GeneralizeRepresentation(map, 0, Representation::None(),
+ HeapType::None(map->GetIsolate()),
+ ALLOW_AS_CONSTANT);
}
// static
-MaybeHandle<Map> Map::CurrentMapForDeprecatedInternal(Handle<Map> old_map)
{
+MaybeHandle<Map> Map::TryUpdateInternal(Handle<Map> old_map) {
DisallowHeapAllocation no_allocation;
DisallowDeoptimization no_deoptimization(old_map->GetIsolate());
@@ -3940,17 +3948,12 @@
void JSObject::MigrateInstance(Handle<JSObject> object) {
- // Converting any field to the most specific type will cause the
- // GeneralizeFieldRepresentation algorithm to create the most general
existing
- // transition that matches the object. This achieves what is needed.
Handle<Map> original_map(object->map());
- GeneralizeFieldRepresentation(
- object, 0, Representation::None(),
- HeapType::None(object->GetIsolate()),
- ALLOW_AS_CONSTANT);
- object->map()->set_migration_target(true);
+ Handle<Map> map = Map::Update(original_map);
+ map->set_migration_target(true);
+ MigrateToMap(object, map);
if (FLAG_trace_migration) {
- object->PrintInstanceMigration(stdout, *original_map, object->map());
+ object->PrintInstanceMigration(stdout, *original_map, *map);
}
}
@@ -3961,7 +3964,7 @@
DisallowDeoptimization no_deoptimization(isolate);
Handle<Map> original_map(object->map(), isolate);
Handle<Map> new_map;
- if
(!Map::CurrentMapForDeprecatedInternal(original_map).ToHandle(&new_map)) {
+ if (!Map::TryUpdate(original_map).ToHandle(&new_map)) {
return false;
}
JSObject::MigrateToMap(object, new_map);
@@ -7326,11 +7329,7 @@
if (map->is_dictionary_map()) return map;
// Migrate to the newest map before storing the property.
- if (map->is_deprecated()) {
- map = GeneralizeRepresentation(map, 0, Representation::None(),
- HeapType::None(map->GetIsolate()),
- ALLOW_AS_CONSTANT);
- }
+ if (map->is_deprecated()) map = Update(map);
Handle<DescriptorArray> descriptors(map->instance_descriptors());
@@ -7353,11 +7352,7 @@
if (map->is_dictionary_map()) return map;
// Migrate to the newest map before transitioning to the new property.
- if (map->is_deprecated()) {
- map = GeneralizeRepresentation(map, 0, Representation::None(),
- HeapType::None(map->GetIsolate()),
- ALLOW_AS_CONSTANT);
- }
+ if (map->is_deprecated()) map = Update(map);
int index = map->SearchTransition(*name);
if (index != TransitionArray::kNotFound) {
=======================================
--- /branches/bleeding_edge/src/objects.h Mon Jul 21 13:10:14 2014 UTC
+++ /branches/bleeding_edge/src/objects.h Mon Jul 21 15:59:05 2014 UTC
@@ -6451,12 +6451,16 @@
// is found by re-transitioning from the root of the transition tree
using the
// descriptor array of the map. Returns NULL if no updated map is found.
// This method also applies any pending migrations along the prototype
chain.
- static MaybeHandle<Map> CurrentMapForDeprecated(Handle<Map> map)
- V8_WARN_UNUSED_RESULT;
+ static MaybeHandle<Map> TryUpdate(Handle<Map> map) V8_WARN_UNUSED_RESULT;
// Same as above, but does not touch the prototype chain.
- static MaybeHandle<Map> CurrentMapForDeprecatedInternal(Handle<Map> map)
+ static MaybeHandle<Map> TryUpdateInternal(Handle<Map> map)
V8_WARN_UNUSED_RESULT;
+ // Returns a non-deprecated version of the input. This method may
deprecate
+ // existing maps along the way if encodings conflict. Not for use while
+ // gathering type feedback. Use TryUpdate in those cases instead.
+ static Handle<Map> Update(Handle<Map> map);
+
static Handle<Map> CopyDropDescriptors(Handle<Map> map);
static Handle<Map> CopyInsertDescriptor(Handle<Map> map,
Descriptor* descriptor,
=======================================
--- /branches/bleeding_edge/src/type-info.cc Mon Jul 21 13:10:14 2014 UTC
+++ /branches/bleeding_edge/src/type-info.cc Mon Jul 21 15:59:05 2014 UTC
@@ -200,7 +200,7 @@
Handle<Map> map;
Map* raw_map = code->FindFirstMap();
if (raw_map != NULL) {
- if (Map::CurrentMapForDeprecated(handle(raw_map)).ToHandle(&map) &&
+ if (Map::TryUpdate(handle(raw_map)).ToHandle(&map) &&
CanRetainOtherContext(*map, *native_context_)) {
map = Handle<Map>::null();
}
--
--
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.