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