OLD | NEW |
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 |
(...skipping 9143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9154 | 9154 |
9155 | 9155 |
9156 Handle<Map> Map::TransitionToDataProperty(Handle<Map> map, Handle<Name> name, | 9156 Handle<Map> Map::TransitionToDataProperty(Handle<Map> map, Handle<Name> name, |
9157 Handle<Object> value, | 9157 Handle<Object> value, |
9158 PropertyAttributes attributes, | 9158 PropertyAttributes attributes, |
9159 StoreFromKeyed store_mode) { | 9159 StoreFromKeyed store_mode) { |
9160 RuntimeCallTimerScope stats_scope( | 9160 RuntimeCallTimerScope stats_scope( |
9161 *map, map->is_prototype_map() | 9161 *map, map->is_prototype_map() |
9162 ? &RuntimeCallStats::PrototypeMap_TransitionToDataProperty | 9162 ? &RuntimeCallStats::PrototypeMap_TransitionToDataProperty |
9163 : &RuntimeCallStats::Map_TransitionToDataProperty); | 9163 : &RuntimeCallStats::Map_TransitionToDataProperty); |
| 9164 TRACE_RUNTIME_CALL(map->is_prototype_map() |
| 9165 ? "PrototypeMap_TransitionToDataProperty" |
| 9166 : "Map_TransitionToDataProperty"); |
9164 | 9167 |
9165 DCHECK(name->IsUniqueName()); | 9168 DCHECK(name->IsUniqueName()); |
9166 DCHECK(!map->is_dictionary_map()); | 9169 DCHECK(!map->is_dictionary_map()); |
9167 | 9170 |
9168 // Migrate to the newest map before storing the property. | 9171 // Migrate to the newest map before storing the property. |
9169 map = Update(map); | 9172 map = Update(map); |
9170 | 9173 |
9171 Map* maybe_transition = | 9174 Map* maybe_transition = |
9172 TransitionArray::SearchTransition(*map, kData, *name, attributes); | 9175 TransitionArray::SearchTransition(*map, kData, *name, attributes); |
9173 if (maybe_transition != NULL) { | 9176 if (maybe_transition != NULL) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9240 Handle<Map> Map::TransitionToAccessorProperty(Isolate* isolate, Handle<Map> map, | 9243 Handle<Map> Map::TransitionToAccessorProperty(Isolate* isolate, Handle<Map> map, |
9241 Handle<Name> name, int descriptor, | 9244 Handle<Name> name, int descriptor, |
9242 Handle<Object> getter, | 9245 Handle<Object> getter, |
9243 Handle<Object> setter, | 9246 Handle<Object> setter, |
9244 PropertyAttributes attributes) { | 9247 PropertyAttributes attributes) { |
9245 RuntimeCallTimerScope stats_scope( | 9248 RuntimeCallTimerScope stats_scope( |
9246 isolate, | 9249 isolate, |
9247 map->is_prototype_map() | 9250 map->is_prototype_map() |
9248 ? &RuntimeCallStats::PrototypeMap_TransitionToAccessorProperty | 9251 ? &RuntimeCallStats::PrototypeMap_TransitionToAccessorProperty |
9249 : &RuntimeCallStats::Map_TransitionToAccessorProperty); | 9252 : &RuntimeCallStats::Map_TransitionToAccessorProperty); |
| 9253 TRACE_RUNTIME_CALL(map->is_prototype_map() |
| 9254 ? "PrototypeMap_TransitionToAccessorProperty" |
| 9255 : "Map_TransitionToAccessorProperty"); |
9250 | 9256 |
9251 // At least one of the accessors needs to be a new value. | 9257 // At least one of the accessors needs to be a new value. |
9252 DCHECK(!getter->IsNull() || !setter->IsNull()); | 9258 DCHECK(!getter->IsNull() || !setter->IsNull()); |
9253 DCHECK(name->IsUniqueName()); | 9259 DCHECK(name->IsUniqueName()); |
9254 | 9260 |
9255 // Dictionary maps can always have additional data properties. | 9261 // Dictionary maps can always have additional data properties. |
9256 if (map->is_dictionary_map()) return map; | 9262 if (map->is_dictionary_map()) return map; |
9257 | 9263 |
9258 // Migrate to the newest map before transitioning to the new property. | 9264 // Migrate to the newest map before transitioning to the new property. |
9259 map = Update(map); | 9265 map = Update(map); |
(...skipping 2843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12103 handle(Smi::FromInt(Map::kPrototypeChainValid), isolate)); | 12109 handle(Smi::FromInt(Map::kPrototypeChainValid), isolate)); |
12104 proto_info->set_validity_cell(*cell); | 12110 proto_info->set_validity_cell(*cell); |
12105 return cell; | 12111 return cell; |
12106 } | 12112 } |
12107 | 12113 |
12108 | 12114 |
12109 // static | 12115 // static |
12110 void Map::SetPrototype(Handle<Map> map, Handle<Object> prototype, | 12116 void Map::SetPrototype(Handle<Map> map, Handle<Object> prototype, |
12111 PrototypeOptimizationMode proto_mode) { | 12117 PrototypeOptimizationMode proto_mode) { |
12112 RuntimeCallTimerScope stats_scope(*map, &RuntimeCallStats::Map_SetPrototype); | 12118 RuntimeCallTimerScope stats_scope(*map, &RuntimeCallStats::Map_SetPrototype); |
| 12119 TRACE_RUNTIME_CALL("Map_SetPrototype"); |
12113 | 12120 |
12114 bool is_hidden = false; | 12121 bool is_hidden = false; |
12115 if (prototype->IsJSObject()) { | 12122 if (prototype->IsJSObject()) { |
12116 Handle<JSObject> prototype_jsobj = Handle<JSObject>::cast(prototype); | 12123 Handle<JSObject> prototype_jsobj = Handle<JSObject>::cast(prototype); |
12117 JSObject::OptimizeAsPrototype(prototype_jsobj, proto_mode); | 12124 JSObject::OptimizeAsPrototype(prototype_jsobj, proto_mode); |
12118 | 12125 |
12119 Object* maybe_constructor = prototype_jsobj->map()->GetConstructor(); | 12126 Object* maybe_constructor = prototype_jsobj->map()->GetConstructor(); |
12120 if (maybe_constructor->IsJSFunction()) { | 12127 if (maybe_constructor->IsJSFunction()) { |
12121 JSFunction* constructor = JSFunction::cast(maybe_constructor); | 12128 JSFunction* constructor = JSFunction::cast(maybe_constructor); |
12122 Object* data = constructor->shared()->function_data(); | 12129 Object* data = constructor->shared()->function_data(); |
(...skipping 6733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18856 if (cell->value() != *new_value) { | 18863 if (cell->value() != *new_value) { |
18857 cell->set_value(*new_value); | 18864 cell->set_value(*new_value); |
18858 Isolate* isolate = cell->GetIsolate(); | 18865 Isolate* isolate = cell->GetIsolate(); |
18859 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 18866 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
18860 isolate, DependentCode::kPropertyCellChangedGroup); | 18867 isolate, DependentCode::kPropertyCellChangedGroup); |
18861 } | 18868 } |
18862 } | 18869 } |
18863 | 18870 |
18864 } // namespace internal | 18871 } // namespace internal |
18865 } // namespace v8 | 18872 } // namespace v8 |
OLD | NEW |