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

Side by Side Diff: src/objects.cc

Issue 706243002: Avoid some unnecessary fast-properties map creations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: update tests 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 | « no previous file | 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 9398 matching lines...) Expand 10 before | Expand all | Expand 10 after
9409 9409
9410 9410
9411 void JSObject::OptimizeAsPrototype(Handle<JSObject> object, 9411 void JSObject::OptimizeAsPrototype(Handle<JSObject> object,
9412 PrototypeOptimizationMode mode) { 9412 PrototypeOptimizationMode mode) {
9413 if (object->IsGlobalObject()) return; 9413 if (object->IsGlobalObject()) return;
9414 if (object->IsJSGlobalProxy()) return; 9414 if (object->IsJSGlobalProxy()) return;
9415 if (mode == FAST_PROTOTYPE && !object->map()->is_prototype_map()) { 9415 if (mode == FAST_PROTOTYPE && !object->map()->is_prototype_map()) {
9416 // First normalize to ensure all JSFunctions are CONSTANT. 9416 // First normalize to ensure all JSFunctions are CONSTANT.
9417 JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, 0); 9417 JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, 0);
9418 } 9418 }
9419 bool has_just_copied_map = false;
9419 if (!object->HasFastProperties()) { 9420 if (!object->HasFastProperties()) {
9420 JSObject::MigrateSlowToFast(object, 0); 9421 JSObject::MigrateSlowToFast(object, 0);
9422 has_just_copied_map = true;
9421 } 9423 }
9422 if (mode == FAST_PROTOTYPE && object->HasFastProperties() && 9424 if (mode == FAST_PROTOTYPE && object->HasFastProperties() &&
9423 !object->map()->is_prototype_map()) { 9425 !object->map()->is_prototype_map()) {
9424 Handle<Map> new_map = Map::Copy(handle(object->map())); 9426 if (!has_just_copied_map) {
9425 JSObject::MigrateToMap(object, new_map); 9427 Handle<Map> new_map = Map::Copy(handle(object->map()));
9428 JSObject::MigrateToMap(object, new_map);
9429 }
9426 object->map()->set_is_prototype_map(true); 9430 object->map()->set_is_prototype_map(true);
9427 } 9431 }
9428 } 9432 }
9429 9433
9430 9434
9431 void JSObject::ReoptimizeIfPrototype(Handle<JSObject> object) { 9435 void JSObject::ReoptimizeIfPrototype(Handle<JSObject> object) {
9432 if (!object->map()->is_prototype_map()) return; 9436 if (!object->map()->is_prototype_map()) return;
9433 OptimizeAsPrototype(object, FAST_PROTOTYPE); 9437 OptimizeAsPrototype(object, FAST_PROTOTYPE);
9434 } 9438 }
9435 9439
(...skipping 7131 matching lines...) Expand 10 before | Expand all | Expand 10 after
16567 Handle<DependentCode> codes = 16571 Handle<DependentCode> codes =
16568 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), 16572 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()),
16569 DependentCode::kPropertyCellChangedGroup, 16573 DependentCode::kPropertyCellChangedGroup,
16570 info->object_wrapper()); 16574 info->object_wrapper());
16571 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); 16575 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes);
16572 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 16576 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
16573 cell, info->zone()); 16577 cell, info->zone());
16574 } 16578 }
16575 16579
16576 } } // namespace v8::internal 16580 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/runtime/runtime-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698