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

Side by Side Diff: src/objects.cc

Issue 714883003: Reland "Avoid some unnecessary fast-properties map creations." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/messages.js ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <sstream> 5 #include <sstream>
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/allocation-site-scopes.h" 10 #include "src/allocation-site-scopes.h"
(...skipping 9487 matching lines...) Expand 10 before | Expand all | Expand 10 after
9498 9498
9499 void JSObject::OptimizeAsPrototype(Handle<JSObject> object, 9499 void JSObject::OptimizeAsPrototype(Handle<JSObject> object,
9500 PrototypeOptimizationMode mode) { 9500 PrototypeOptimizationMode mode) {
9501 if (object->IsGlobalObject()) return; 9501 if (object->IsGlobalObject()) return;
9502 if (object->IsJSGlobalProxy()) return; 9502 if (object->IsJSGlobalProxy()) return;
9503 if (mode == FAST_PROTOTYPE && !object->map()->is_prototype_map()) { 9503 if (mode == FAST_PROTOTYPE && !object->map()->is_prototype_map()) {
9504 // First normalize to ensure all JSFunctions are CONSTANT. 9504 // First normalize to ensure all JSFunctions are CONSTANT.
9505 JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, 0, 9505 JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, 0,
9506 "NormalizeAsPrototype"); 9506 "NormalizeAsPrototype");
9507 } 9507 }
9508 bool has_just_copied_map = false;
9508 if (!object->HasFastProperties()) { 9509 if (!object->HasFastProperties()) {
9509 JSObject::MigrateSlowToFast(object, 0, "OptimizeAsPrototype"); 9510 JSObject::MigrateSlowToFast(object, 0, "OptimizeAsPrototype");
9511 has_just_copied_map = true;
9510 } 9512 }
9511 if (mode == FAST_PROTOTYPE && object->HasFastProperties() && 9513 if (mode == FAST_PROTOTYPE && object->HasFastProperties() &&
9512 !object->map()->is_prototype_map()) { 9514 !object->map()->is_prototype_map()) {
9513 Handle<Map> new_map = Map::Copy(handle(object->map()), "CopyAsPrototype"); 9515 if (!has_just_copied_map) {
9514 JSObject::MigrateToMap(object, new_map); 9516 Handle<Map> new_map = Map::Copy(handle(object->map()), "CopyAsPrototype");
9517 JSObject::MigrateToMap(object, new_map);
9518 }
9515 object->map()->set_is_prototype_map(true); 9519 object->map()->set_is_prototype_map(true);
9516 } 9520 }
9517 } 9521 }
9518 9522
9519 9523
9520 void JSObject::ReoptimizeIfPrototype(Handle<JSObject> object) { 9524 void JSObject::ReoptimizeIfPrototype(Handle<JSObject> object) {
9521 if (!object->map()->is_prototype_map()) return; 9525 if (!object->map()->is_prototype_map()) return;
9522 OptimizeAsPrototype(object, FAST_PROTOTYPE); 9526 OptimizeAsPrototype(object, FAST_PROTOTYPE);
9523 } 9527 }
9524 9528
(...skipping 7139 matching lines...) Expand 10 before | Expand all | Expand 10 after
16664 Handle<DependentCode> codes = 16668 Handle<DependentCode> codes =
16665 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), 16669 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()),
16666 DependentCode::kPropertyCellChangedGroup, 16670 DependentCode::kPropertyCellChangedGroup,
16667 info->object_wrapper()); 16671 info->object_wrapper());
16668 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); 16672 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes);
16669 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 16673 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
16670 cell, info->zone()); 16674 cell, info->zone());
16671 } 16675 }
16672 16676
16673 } } // namespace v8::internal 16677 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/messages.js ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698