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

Side by Side Diff: src/objects.cc

Issue 1973473002: [runtime] Record runtime call stats for Map::TransitionTo*Property, JSObject::OptimizeAsPrototype t… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@handler-counters2
Patch Set: Addressing comments and rebasing Created 4 years, 7 months 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
« src/lookup.cc ('K') | « src/lookup.cc ('k') | src/v8.gyp » ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 "src/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <sstream> 9 #include <sstream>
10 10
11 #include "src/objects-inl.h" 11 #include "src/objects-inl.h"
12 12
13 #include "src/accessors.h" 13 #include "src/accessors.h"
14 #include "src/allocation-site-scopes.h" 14 #include "src/allocation-site-scopes.h"
15 #include "src/api-arguments.h" 15 #include "src/api-arguments.h"
16 #include "src/api-natives.h" 16 #include "src/api-natives.h"
17 #include "src/api.h" 17 #include "src/api.h"
18 #include "src/base/bits.h" 18 #include "src/base/bits.h"
19 #include "src/base/utils/random-number-generator.h" 19 #include "src/base/utils/random-number-generator.h"
20 #include "src/bootstrapper.h" 20 #include "src/bootstrapper.h"
21 #include "src/code-stubs.h" 21 #include "src/code-stubs.h"
22 #include "src/codegen.h" 22 #include "src/codegen.h"
23 #include "src/compilation-dependencies.h" 23 #include "src/compilation-dependencies.h"
24 #include "src/compiler.h" 24 #include "src/compiler.h"
25 #include "src/counters-inl.h"
26 #include "src/counters.h"
25 #include "src/date.h" 27 #include "src/date.h"
26 #include "src/debug/debug.h" 28 #include "src/debug/debug.h"
27 #include "src/deoptimizer.h" 29 #include "src/deoptimizer.h"
28 #include "src/elements.h" 30 #include "src/elements.h"
29 #include "src/execution.h" 31 #include "src/execution.h"
30 #include "src/field-index-inl.h" 32 #include "src/field-index-inl.h"
31 #include "src/field-index.h" 33 #include "src/field-index.h"
32 #include "src/field-type.h" 34 #include "src/field-type.h"
33 #include "src/frames-inl.h" 35 #include "src/frames-inl.h"
34 #include "src/full-codegen/full-codegen.h" 36 #include "src/full-codegen/full-codegen.h"
(...skipping 8976 matching lines...) Expand 10 before | Expand all | Expand 10 after
9011 DCHECK(!map->is_dictionary_map()); 9013 DCHECK(!map->is_dictionary_map());
9012 // Update to the newest map before storing the property. 9014 // Update to the newest map before storing the property.
9013 return UpdateDescriptorForValue(Update(map), descriptor, value); 9015 return UpdateDescriptorForValue(Update(map), descriptor, value);
9014 } 9016 }
9015 9017
9016 9018
9017 Handle<Map> Map::TransitionToDataProperty(Handle<Map> map, Handle<Name> name, 9019 Handle<Map> Map::TransitionToDataProperty(Handle<Map> map, Handle<Name> name,
9018 Handle<Object> value, 9020 Handle<Object> value,
9019 PropertyAttributes attributes, 9021 PropertyAttributes attributes,
9020 StoreFromKeyed store_mode) { 9022 StoreFromKeyed store_mode) {
9023 RuntimeCallTimerScope stats_scope(
9024 *map, map->is_prototype_map()
9025 ? &RuntimeCallStats::PrototypeMap_TransitionToDataProperty
9026 : &RuntimeCallStats::Map_TransitionToDataProperty);
9027
9021 DCHECK(name->IsUniqueName()); 9028 DCHECK(name->IsUniqueName());
9022 DCHECK(!map->is_dictionary_map()); 9029 DCHECK(!map->is_dictionary_map());
9023 9030
9024 // Migrate to the newest map before storing the property. 9031 // Migrate to the newest map before storing the property.
9025 map = Update(map); 9032 map = Update(map);
9026 9033
9027 Map* maybe_transition = 9034 Map* maybe_transition =
9028 TransitionArray::SearchTransition(*map, kData, *name, attributes); 9035 TransitionArray::SearchTransition(*map, kData, *name, attributes);
9029 if (maybe_transition != NULL) { 9036 if (maybe_transition != NULL) {
9030 Handle<Map> transition(maybe_transition); 9037 Handle<Map> transition(maybe_transition);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
9091 map, descriptor, kind, attributes, Representation::None(), 9098 map, descriptor, kind, attributes, Representation::None(),
9092 FieldType::None(isolate), FORCE_FIELD); 9099 FieldType::None(isolate), FORCE_FIELD);
9093 return new_map; 9100 return new_map;
9094 } 9101 }
9095 9102
9096 Handle<Map> Map::TransitionToAccessorProperty(Isolate* isolate, Handle<Map> map, 9103 Handle<Map> Map::TransitionToAccessorProperty(Isolate* isolate, Handle<Map> map,
9097 Handle<Name> name, int descriptor, 9104 Handle<Name> name, int descriptor,
9098 Handle<Object> getter, 9105 Handle<Object> getter,
9099 Handle<Object> setter, 9106 Handle<Object> setter,
9100 PropertyAttributes attributes) { 9107 PropertyAttributes attributes) {
9108 RuntimeCallTimerScope stats_scope(
9109 isolate,
9110 map->is_prototype_map()
9111 ? &RuntimeCallStats::PrototypeMap_TransitionToAccessorProperty
9112 : &RuntimeCallStats::Map_TransitionToAccessorProperty);
9113
9101 // At least one of the accessors needs to be a new value. 9114 // At least one of the accessors needs to be a new value.
9102 DCHECK(!getter->IsNull() || !setter->IsNull()); 9115 DCHECK(!getter->IsNull() || !setter->IsNull());
9103 DCHECK(name->IsUniqueName()); 9116 DCHECK(name->IsUniqueName());
9104 9117
9105 // Dictionary maps can always have additional data properties. 9118 // Dictionary maps can always have additional data properties.
9106 if (map->is_dictionary_map()) return map; 9119 if (map->is_dictionary_map()) return map;
9107 9120
9108 // Migrate to the newest map before transitioning to the new property. 9121 // Migrate to the newest map before transitioning to the new property.
9109 map = Update(map); 9122 map = Update(map);
9110 9123
(...skipping 2549 matching lines...) Expand 10 before | Expand all | Expand 10 after
11660 Handle<Cell> cell = isolate->factory()->NewCell( 11673 Handle<Cell> cell = isolate->factory()->NewCell(
11661 handle(Smi::FromInt(Map::kPrototypeChainValid), isolate)); 11674 handle(Smi::FromInt(Map::kPrototypeChainValid), isolate));
11662 proto_info->set_validity_cell(*cell); 11675 proto_info->set_validity_cell(*cell);
11663 return cell; 11676 return cell;
11664 } 11677 }
11665 11678
11666 11679
11667 // static 11680 // static
11668 void Map::SetPrototype(Handle<Map> map, Handle<Object> prototype, 11681 void Map::SetPrototype(Handle<Map> map, Handle<Object> prototype,
11669 PrototypeOptimizationMode proto_mode) { 11682 PrototypeOptimizationMode proto_mode) {
11683 RuntimeCallTimerScope stats_scope(*map, &RuntimeCallStats::Map_SetPrototype);
11684
11670 bool is_hidden = false; 11685 bool is_hidden = false;
11671 if (prototype->IsJSObject()) { 11686 if (prototype->IsJSObject()) {
11672 Handle<JSObject> prototype_jsobj = Handle<JSObject>::cast(prototype); 11687 Handle<JSObject> prototype_jsobj = Handle<JSObject>::cast(prototype);
11673 JSObject::OptimizeAsPrototype(prototype_jsobj, proto_mode); 11688 JSObject::OptimizeAsPrototype(prototype_jsobj, proto_mode);
11674 11689
11675 Object* maybe_constructor = prototype_jsobj->map()->GetConstructor(); 11690 Object* maybe_constructor = prototype_jsobj->map()->GetConstructor();
11676 if (maybe_constructor->IsJSFunction()) { 11691 if (maybe_constructor->IsJSFunction()) {
11677 JSFunction* constructor = JSFunction::cast(maybe_constructor); 11692 JSFunction* constructor = JSFunction::cast(maybe_constructor);
11678 Object* data = constructor->shared()->function_data(); 11693 Object* data = constructor->shared()->function_data();
11679 is_hidden = (data->IsFunctionTemplateInfo() && 11694 is_hidden = (data->IsFunctionTemplateInfo() &&
(...skipping 6578 matching lines...) Expand 10 before | Expand all | Expand 10 after
18258 if (cell->value() != *new_value) { 18273 if (cell->value() != *new_value) {
18259 cell->set_value(*new_value); 18274 cell->set_value(*new_value);
18260 Isolate* isolate = cell->GetIsolate(); 18275 Isolate* isolate = cell->GetIsolate();
18261 cell->dependent_code()->DeoptimizeDependentCodeGroup( 18276 cell->dependent_code()->DeoptimizeDependentCodeGroup(
18262 isolate, DependentCode::kPropertyCellChangedGroup); 18277 isolate, DependentCode::kPropertyCellChangedGroup);
18263 } 18278 }
18264 } 18279 }
18265 18280
18266 } // namespace internal 18281 } // namespace internal
18267 } // namespace v8 18282 } // namespace v8
OLDNEW
« src/lookup.cc ('K') | « src/lookup.cc ('k') | src/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698