Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(962)

Unified Diff: src/objects.cc

Issue 2525573002: [runtime] Always normalize prototype maps that aren't marked as 'should be fast' yet (Closed)
Patch Set: minor cleanup Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/fast-prototype.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index f0b9b04cdb0673abbc9ef48b93a0813ffd28ea63..9bc106d54474b99a4e770af0369ae7595d315530 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -12539,19 +12539,10 @@ void Map::CompleteInobjectSlackTracking() {
static bool PrototypeBenefitsFromNormalization(Handle<JSObject> object) {
DisallowHeapAllocation no_gc;
if (!object->HasFastProperties()) return false;
- Map* map = object->map();
- if (map->is_prototype_map()) return false;
- DescriptorArray* descriptors = map->instance_descriptors();
- for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) {
- PropertyDetails details = descriptors->GetDetails(i);
- if (details.location() == kDescriptor) continue;
- if (details.representation().IsHeapObject() ||
- details.representation().IsTagged()) {
- FieldIndex index = FieldIndex::ForDescriptor(map, i);
- if (object->RawFastPropertyAt(index)->IsJSFunction()) return true;
- }
- }
- return false;
+ if (object->IsJSGlobalProxy()) return false;
+ if (object->GetIsolate()->bootstrapper()->IsActive()) return false;
+ return !object->map()->is_prototype_map() ||
+ !object->map()->should_be_fast_prototype_map();
}
// static
@@ -12566,8 +12557,10 @@ void JSObject::MakePrototypesFast(Handle<Object> receiver,
if (!current->IsJSObject()) return;
Handle<JSObject> current_obj = Handle<JSObject>::cast(current);
Map* current_map = current_obj->map();
- if (current_map->is_prototype_map() &&
- !current_map->should_be_fast_prototype_map()) {
+ if (current_map->is_prototype_map()) {
+ // If the map is already marked as should be fast, we're done. Its
+ // prototypes will have been marked already as well.
+ if (current_map->should_be_fast_prototype_map()) return;
Handle<Map> map(current_map);
Map::SetShouldBeFastPrototypeMap(map, true, isolate);
JSObject::OptimizeAsPrototype(current_obj, FAST_PROTOTYPE);
« no previous file with comments | « no previous file | test/mjsunit/fast-prototype.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698