OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 <iomanip> | 7 #include <iomanip> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 7085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7096 full_layout_descriptor); | 7096 full_layout_descriptor); |
7097 result->set_layout_descriptor(*layout_descriptor); | 7097 result->set_layout_descriptor(*layout_descriptor); |
7098 #ifdef VERIFY_HEAP | 7098 #ifdef VERIFY_HEAP |
7099 // TODO(ishell): remove these checks from VERIFY_HEAP mode. | 7099 // TODO(ishell): remove these checks from VERIFY_HEAP mode. |
7100 if (FLAG_verify_heap) { | 7100 if (FLAG_verify_heap) { |
7101 CHECK(result->layout_descriptor()->IsConsistentWithMap(*result)); | 7101 CHECK(result->layout_descriptor()->IsConsistentWithMap(*result)); |
7102 } | 7102 } |
7103 #else | 7103 #else |
7104 SLOW_DCHECK(result->layout_descriptor()->IsConsistentWithMap(*result)); | 7104 SLOW_DCHECK(result->layout_descriptor()->IsConsistentWithMap(*result)); |
7105 #endif | 7105 #endif |
7106 result->set_visitor_id(StaticVisitorBase::GetVisitorId(*result)); | 7106 result->set_visitor_id(Heap::GetStaticVisitorIdForMap(*result)); |
7107 } | 7107 } |
7108 | 7108 |
7109 Handle<Name> name = handle(descriptors->GetKey(new_descriptor)); | 7109 Handle<Name> name = handle(descriptors->GetKey(new_descriptor)); |
7110 ConnectTransition(map, result, name, SIMPLE_PROPERTY_TRANSITION); | 7110 ConnectTransition(map, result, name, SIMPLE_PROPERTY_TRANSITION); |
7111 | 7111 |
7112 return result; | 7112 return result; |
7113 } | 7113 } |
7114 | 7114 |
7115 | 7115 |
7116 Handle<Map> Map::CopyAsElementsKind(Handle<Map> map, ElementsKind kind, | 7116 Handle<Map> Map::CopyAsElementsKind(Handle<Map> map, ElementsKind kind, |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7233 inobject_properties = max_extra_properties; | 7233 inobject_properties = max_extra_properties; |
7234 } | 7234 } |
7235 | 7235 |
7236 int new_instance_size = | 7236 int new_instance_size = |
7237 JSObject::kHeaderSize + kPointerSize * inobject_properties; | 7237 JSObject::kHeaderSize + kPointerSize * inobject_properties; |
7238 | 7238 |
7239 // Adjust the map with the extra inobject properties. | 7239 // Adjust the map with the extra inobject properties. |
7240 copy->SetInObjectProperties(inobject_properties); | 7240 copy->SetInObjectProperties(inobject_properties); |
7241 copy->set_unused_property_fields(inobject_properties); | 7241 copy->set_unused_property_fields(inobject_properties); |
7242 copy->set_instance_size(new_instance_size); | 7242 copy->set_instance_size(new_instance_size); |
7243 copy->set_visitor_id(StaticVisitorBase::GetVisitorId(*copy)); | 7243 copy->set_visitor_id(Heap::GetStaticVisitorIdForMap(*copy)); |
7244 return copy; | 7244 return copy; |
7245 } | 7245 } |
7246 | 7246 |
7247 | 7247 |
7248 Handle<Map> Map::CopyForPreventExtensions(Handle<Map> map, | 7248 Handle<Map> Map::CopyForPreventExtensions(Handle<Map> map, |
7249 PropertyAttributes attrs_to_add, | 7249 PropertyAttributes attrs_to_add, |
7250 Handle<Symbol> transition_marker, | 7250 Handle<Symbol> transition_marker, |
7251 const char* reason) { | 7251 const char* reason) { |
7252 int num_descriptors = map->NumberOfOwnDescriptors(); | 7252 int num_descriptors = map->NumberOfOwnDescriptors(); |
7253 Isolate* isolate = map->GetIsolate(); | 7253 Isolate* isolate = map->GetIsolate(); |
(...skipping 2748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10002 } | 10002 } |
10003 | 10003 |
10004 | 10004 |
10005 static void ShrinkInstanceSize(Map* map, void* data) { | 10005 static void ShrinkInstanceSize(Map* map, void* data) { |
10006 int slack = *reinterpret_cast<int*>(data); | 10006 int slack = *reinterpret_cast<int*>(data); |
10007 map->SetInObjectProperties(map->GetInObjectProperties() - slack); | 10007 map->SetInObjectProperties(map->GetInObjectProperties() - slack); |
10008 map->set_unused_property_fields(map->unused_property_fields() - slack); | 10008 map->set_unused_property_fields(map->unused_property_fields() - slack); |
10009 map->set_instance_size(map->instance_size() - slack * kPointerSize); | 10009 map->set_instance_size(map->instance_size() - slack * kPointerSize); |
10010 | 10010 |
10011 // Visitor id might depend on the instance size, recalculate it. | 10011 // Visitor id might depend on the instance size, recalculate it. |
10012 map->set_visitor_id(StaticVisitorBase::GetVisitorId(map)); | 10012 map->set_visitor_id(Heap::GetStaticVisitorIdForMap(map)); |
10013 } | 10013 } |
10014 | 10014 |
10015 | 10015 |
10016 void JSFunction::CompleteInobjectSlackTracking() { | 10016 void JSFunction::CompleteInobjectSlackTracking() { |
10017 DCHECK(has_initial_map()); | 10017 DCHECK(has_initial_map()); |
10018 Map* map = initial_map(); | 10018 Map* map = initial_map(); |
10019 | 10019 |
10020 DCHECK(map->counter() >= Map::kSlackTrackingCounterEnd - 1); | 10020 DCHECK(map->counter() >= Map::kSlackTrackingCounterEnd - 1); |
10021 map->set_counter(Map::kRetainingCounterStart); | 10021 map->set_counter(Map::kRetainingCounterStart); |
10022 | 10022 |
(...skipping 6329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16352 if (cell->value() != *new_value) { | 16352 if (cell->value() != *new_value) { |
16353 cell->set_value(*new_value); | 16353 cell->set_value(*new_value); |
16354 Isolate* isolate = cell->GetIsolate(); | 16354 Isolate* isolate = cell->GetIsolate(); |
16355 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 16355 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
16356 isolate, DependentCode::kPropertyCellChangedGroup); | 16356 isolate, DependentCode::kPropertyCellChangedGroup); |
16357 } | 16357 } |
16358 } | 16358 } |
16359 | 16359 |
16360 } // namespace internal | 16360 } // namespace internal |
16361 } // namespace v8 | 16361 } // namespace v8 |
OLD | NEW |