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 9435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9446 | 9446 |
9447 | 9447 |
9448 Handle<Map> Map::TransitionToDataProperty(Handle<Map> map, Handle<Name> name, | 9448 Handle<Map> Map::TransitionToDataProperty(Handle<Map> map, Handle<Name> name, |
9449 Handle<Object> value, | 9449 Handle<Object> value, |
9450 PropertyAttributes attributes, | 9450 PropertyAttributes attributes, |
9451 StoreFromKeyed store_mode) { | 9451 StoreFromKeyed store_mode) { |
9452 RuntimeCallTimerScope stats_scope( | 9452 RuntimeCallTimerScope stats_scope( |
9453 *map, map->is_prototype_map() | 9453 *map, map->is_prototype_map() |
9454 ? &RuntimeCallStats::PrototypeMap_TransitionToDataProperty | 9454 ? &RuntimeCallStats::PrototypeMap_TransitionToDataProperty |
9455 : &RuntimeCallStats::Map_TransitionToDataProperty); | 9455 : &RuntimeCallStats::Map_TransitionToDataProperty); |
| 9456 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 9457 map->GetIsolate(), |
| 9458 (map->is_prototype_map() |
| 9459 ? &tracing::TraceEventStatsTable:: |
| 9460 PrototypeMap_TransitionToDataProperty |
| 9461 : &tracing::TraceEventStatsTable::Map_TransitionToDataProperty)) |
9456 | 9462 |
9457 DCHECK(name->IsUniqueName()); | 9463 DCHECK(name->IsUniqueName()); |
9458 DCHECK(!map->is_dictionary_map()); | 9464 DCHECK(!map->is_dictionary_map()); |
9459 | 9465 |
9460 // Migrate to the newest map before storing the property. | 9466 // Migrate to the newest map before storing the property. |
9461 map = Update(map); | 9467 map = Update(map); |
9462 | 9468 |
9463 Map* maybe_transition = | 9469 Map* maybe_transition = |
9464 TransitionArray::SearchTransition(*map, kData, *name, attributes); | 9470 TransitionArray::SearchTransition(*map, kData, *name, attributes); |
9465 if (maybe_transition != NULL) { | 9471 if (maybe_transition != NULL) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9532 Handle<Map> Map::TransitionToAccessorProperty(Isolate* isolate, Handle<Map> map, | 9538 Handle<Map> Map::TransitionToAccessorProperty(Isolate* isolate, Handle<Map> map, |
9533 Handle<Name> name, int descriptor, | 9539 Handle<Name> name, int descriptor, |
9534 Handle<Object> getter, | 9540 Handle<Object> getter, |
9535 Handle<Object> setter, | 9541 Handle<Object> setter, |
9536 PropertyAttributes attributes) { | 9542 PropertyAttributes attributes) { |
9537 RuntimeCallTimerScope stats_scope( | 9543 RuntimeCallTimerScope stats_scope( |
9538 isolate, | 9544 isolate, |
9539 map->is_prototype_map() | 9545 map->is_prototype_map() |
9540 ? &RuntimeCallStats::PrototypeMap_TransitionToAccessorProperty | 9546 ? &RuntimeCallStats::PrototypeMap_TransitionToAccessorProperty |
9541 : &RuntimeCallStats::Map_TransitionToAccessorProperty); | 9547 : &RuntimeCallStats::Map_TransitionToAccessorProperty); |
| 9548 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 9549 isolate, |
| 9550 (map->is_prototype_map() |
| 9551 ? &tracing::TraceEventStatsTable:: |
| 9552 PrototypeMap_TransitionToAccessorProperty |
| 9553 : &tracing::TraceEventStatsTable::Map_TransitionToAccessorProperty)); |
9542 | 9554 |
9543 // At least one of the accessors needs to be a new value. | 9555 // At least one of the accessors needs to be a new value. |
9544 DCHECK(!getter->IsNull(isolate) || !setter->IsNull(isolate)); | 9556 DCHECK(!getter->IsNull(isolate) || !setter->IsNull(isolate)); |
9545 DCHECK(name->IsUniqueName()); | 9557 DCHECK(name->IsUniqueName()); |
9546 | 9558 |
9547 // Dictionary maps can always have additional data properties. | 9559 // Dictionary maps can always have additional data properties. |
9548 if (map->is_dictionary_map()) return map; | 9560 if (map->is_dictionary_map()) return map; |
9549 | 9561 |
9550 // Migrate to the newest map before transitioning to the new property. | 9562 // Migrate to the newest map before transitioning to the new property. |
9551 map = Update(map); | 9563 map = Update(map); |
(...skipping 2930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12482 handle(Smi::FromInt(Map::kPrototypeChainValid), isolate)); | 12494 handle(Smi::FromInt(Map::kPrototypeChainValid), isolate)); |
12483 proto_info->set_validity_cell(*cell); | 12495 proto_info->set_validity_cell(*cell); |
12484 return cell; | 12496 return cell; |
12485 } | 12497 } |
12486 | 12498 |
12487 | 12499 |
12488 // static | 12500 // static |
12489 void Map::SetPrototype(Handle<Map> map, Handle<Object> prototype, | 12501 void Map::SetPrototype(Handle<Map> map, Handle<Object> prototype, |
12490 PrototypeOptimizationMode proto_mode) { | 12502 PrototypeOptimizationMode proto_mode) { |
12491 RuntimeCallTimerScope stats_scope(*map, &RuntimeCallStats::Map_SetPrototype); | 12503 RuntimeCallTimerScope stats_scope(*map, &RuntimeCallStats::Map_SetPrototype); |
| 12504 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 12505 map->GetIsolate(), &tracing::TraceEventStatsTable::Map_SetPrototype); |
12492 | 12506 |
12493 bool is_hidden = false; | 12507 bool is_hidden = false; |
12494 if (prototype->IsJSObject()) { | 12508 if (prototype->IsJSObject()) { |
12495 Handle<JSObject> prototype_jsobj = Handle<JSObject>::cast(prototype); | 12509 Handle<JSObject> prototype_jsobj = Handle<JSObject>::cast(prototype); |
12496 JSObject::OptimizeAsPrototype(prototype_jsobj, proto_mode); | 12510 JSObject::OptimizeAsPrototype(prototype_jsobj, proto_mode); |
12497 | 12511 |
12498 Object* maybe_constructor = prototype_jsobj->map()->GetConstructor(); | 12512 Object* maybe_constructor = prototype_jsobj->map()->GetConstructor(); |
12499 if (maybe_constructor->IsJSFunction()) { | 12513 if (maybe_constructor->IsJSFunction()) { |
12500 JSFunction* constructor = JSFunction::cast(maybe_constructor); | 12514 JSFunction* constructor = JSFunction::cast(maybe_constructor); |
12501 Object* data = constructor->shared()->function_data(); | 12515 Object* data = constructor->shared()->function_data(); |
(...skipping 6915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19417 for (PrototypeIterator iter(isolate, this, kStartAtReceiver, | 19431 for (PrototypeIterator iter(isolate, this, kStartAtReceiver, |
19418 PrototypeIterator::END_AT_NULL); | 19432 PrototypeIterator::END_AT_NULL); |
19419 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) { | 19433 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) { |
19420 if (iter.GetCurrent<Object>()->IsJSProxy()) return true; | 19434 if (iter.GetCurrent<Object>()->IsJSProxy()) return true; |
19421 } | 19435 } |
19422 return false; | 19436 return false; |
19423 } | 19437 } |
19424 | 19438 |
19425 } // namespace internal | 19439 } // namespace internal |
19426 } // namespace v8 | 19440 } // namespace v8 |
OLD | NEW |