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 <memory> | 9 #include <memory> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 9161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9172 | 9172 |
9173 | 9173 |
9174 Handle<Map> Map::TransitionToDataProperty(Handle<Map> map, Handle<Name> name, | 9174 Handle<Map> Map::TransitionToDataProperty(Handle<Map> map, Handle<Name> name, |
9175 Handle<Object> value, | 9175 Handle<Object> value, |
9176 PropertyAttributes attributes, | 9176 PropertyAttributes attributes, |
9177 StoreFromKeyed store_mode) { | 9177 StoreFromKeyed store_mode) { |
9178 RuntimeCallTimerScope stats_scope( | 9178 RuntimeCallTimerScope stats_scope( |
9179 *map, map->is_prototype_map() | 9179 *map, map->is_prototype_map() |
9180 ? &RuntimeCallStats::PrototypeMap_TransitionToDataProperty | 9180 ? &RuntimeCallStats::PrototypeMap_TransitionToDataProperty |
9181 : &RuntimeCallStats::Map_TransitionToDataProperty); | 9181 : &RuntimeCallStats::Map_TransitionToDataProperty); |
| 9182 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 9183 map->GetIsolate(), |
| 9184 (map->is_prototype_map() |
| 9185 ? &tracing::TraceEventStatsTable:: |
| 9186 PrototypeMap_TransitionToDataProperty |
| 9187 : &tracing::TraceEventStatsTable::Map_TransitionToDataProperty)) |
9182 | 9188 |
9183 DCHECK(name->IsUniqueName()); | 9189 DCHECK(name->IsUniqueName()); |
9184 DCHECK(!map->is_dictionary_map()); | 9190 DCHECK(!map->is_dictionary_map()); |
9185 | 9191 |
9186 // Migrate to the newest map before storing the property. | 9192 // Migrate to the newest map before storing the property. |
9187 map = Update(map); | 9193 map = Update(map); |
9188 | 9194 |
9189 Map* maybe_transition = | 9195 Map* maybe_transition = |
9190 TransitionArray::SearchTransition(*map, kData, *name, attributes); | 9196 TransitionArray::SearchTransition(*map, kData, *name, attributes); |
9191 if (maybe_transition != NULL) { | 9197 if (maybe_transition != NULL) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9258 Handle<Map> Map::TransitionToAccessorProperty(Isolate* isolate, Handle<Map> map, | 9264 Handle<Map> Map::TransitionToAccessorProperty(Isolate* isolate, Handle<Map> map, |
9259 Handle<Name> name, int descriptor, | 9265 Handle<Name> name, int descriptor, |
9260 Handle<Object> getter, | 9266 Handle<Object> getter, |
9261 Handle<Object> setter, | 9267 Handle<Object> setter, |
9262 PropertyAttributes attributes) { | 9268 PropertyAttributes attributes) { |
9263 RuntimeCallTimerScope stats_scope( | 9269 RuntimeCallTimerScope stats_scope( |
9264 isolate, | 9270 isolate, |
9265 map->is_prototype_map() | 9271 map->is_prototype_map() |
9266 ? &RuntimeCallStats::PrototypeMap_TransitionToAccessorProperty | 9272 ? &RuntimeCallStats::PrototypeMap_TransitionToAccessorProperty |
9267 : &RuntimeCallStats::Map_TransitionToAccessorProperty); | 9273 : &RuntimeCallStats::Map_TransitionToAccessorProperty); |
| 9274 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 9275 isolate, |
| 9276 (map->is_prototype_map() |
| 9277 ? &tracing::TraceEventStatsTable:: |
| 9278 PrototypeMap_TransitionToAccessorProperty |
| 9279 : &tracing::TraceEventStatsTable::Map_TransitionToAccessorProperty)); |
9268 | 9280 |
9269 // At least one of the accessors needs to be a new value. | 9281 // At least one of the accessors needs to be a new value. |
9270 DCHECK(!getter->IsNull(isolate) || !setter->IsNull(isolate)); | 9282 DCHECK(!getter->IsNull(isolate) || !setter->IsNull(isolate)); |
9271 DCHECK(name->IsUniqueName()); | 9283 DCHECK(name->IsUniqueName()); |
9272 | 9284 |
9273 // Dictionary maps can always have additional data properties. | 9285 // Dictionary maps can always have additional data properties. |
9274 if (map->is_dictionary_map()) return map; | 9286 if (map->is_dictionary_map()) return map; |
9275 | 9287 |
9276 // Migrate to the newest map before transitioning to the new property. | 9288 // Migrate to the newest map before transitioning to the new property. |
9277 map = Update(map); | 9289 map = Update(map); |
(...skipping 2861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12139 handle(Smi::FromInt(Map::kPrototypeChainValid), isolate)); | 12151 handle(Smi::FromInt(Map::kPrototypeChainValid), isolate)); |
12140 proto_info->set_validity_cell(*cell); | 12152 proto_info->set_validity_cell(*cell); |
12141 return cell; | 12153 return cell; |
12142 } | 12154 } |
12143 | 12155 |
12144 | 12156 |
12145 // static | 12157 // static |
12146 void Map::SetPrototype(Handle<Map> map, Handle<Object> prototype, | 12158 void Map::SetPrototype(Handle<Map> map, Handle<Object> prototype, |
12147 PrototypeOptimizationMode proto_mode) { | 12159 PrototypeOptimizationMode proto_mode) { |
12148 RuntimeCallTimerScope stats_scope(*map, &RuntimeCallStats::Map_SetPrototype); | 12160 RuntimeCallTimerScope stats_scope(*map, &RuntimeCallStats::Map_SetPrototype); |
| 12161 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 12162 map->GetIsolate(), &tracing::TraceEventStatsTable::Map_SetPrototype); |
12149 | 12163 |
12150 bool is_hidden = false; | 12164 bool is_hidden = false; |
12151 if (prototype->IsJSObject()) { | 12165 if (prototype->IsJSObject()) { |
12152 Handle<JSObject> prototype_jsobj = Handle<JSObject>::cast(prototype); | 12166 Handle<JSObject> prototype_jsobj = Handle<JSObject>::cast(prototype); |
12153 JSObject::OptimizeAsPrototype(prototype_jsobj, proto_mode); | 12167 JSObject::OptimizeAsPrototype(prototype_jsobj, proto_mode); |
12154 | 12168 |
12155 Object* maybe_constructor = prototype_jsobj->map()->GetConstructor(); | 12169 Object* maybe_constructor = prototype_jsobj->map()->GetConstructor(); |
12156 if (maybe_constructor->IsJSFunction()) { | 12170 if (maybe_constructor->IsJSFunction()) { |
12157 JSFunction* constructor = JSFunction::cast(maybe_constructor); | 12171 JSFunction* constructor = JSFunction::cast(maybe_constructor); |
12158 Object* data = constructor->shared()->function_data(); | 12172 Object* data = constructor->shared()->function_data(); |
(...skipping 6832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18991 for (PrototypeIterator iter(isolate, this, kStartAtReceiver, | 19005 for (PrototypeIterator iter(isolate, this, kStartAtReceiver, |
18992 PrototypeIterator::END_AT_NULL); | 19006 PrototypeIterator::END_AT_NULL); |
18993 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) { | 19007 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) { |
18994 if (iter.GetCurrent<Object>()->IsJSProxy()) return true; | 19008 if (iter.GetCurrent<Object>()->IsJSProxy()) return true; |
18995 } | 19009 } |
18996 return false; | 19010 return false; |
18997 } | 19011 } |
18998 | 19012 |
18999 } // namespace internal | 19013 } // namespace internal |
19000 } // namespace v8 | 19014 } // namespace v8 |
OLD | NEW |