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 16000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16011 if (key->FilterKey(filter)) continue; | 16011 if (key->FilterKey(filter)) continue; |
16012 keys->AddKey(key, DO_NOT_CONVERT); | 16012 keys->AddKey(key, DO_NOT_CONVERT); |
16013 } | 16013 } |
16014 } else if (IsJSGlobalObject()) { | 16014 } else if (IsJSGlobalObject()) { |
16015 GlobalDictionary::CollectKeysTo(handle(global_dictionary()), keys, filter); | 16015 GlobalDictionary::CollectKeysTo(handle(global_dictionary()), keys, filter); |
16016 } else { | 16016 } else { |
16017 NameDictionary::CollectKeysTo(handle(property_dictionary()), keys, filter); | 16017 NameDictionary::CollectKeysTo(handle(property_dictionary()), keys, filter); |
16018 } | 16018 } |
16019 } | 16019 } |
16020 | 16020 |
| 16021 bool JSObject::WasConstructedFromApiFunction() { |
| 16022 auto instance_type = map()->instance_type(); |
| 16023 bool is_api_object = instance_type == JS_API_OBJECT_TYPE || |
| 16024 instance_type == JS_SPECIAL_API_OBJECT_TYPE; |
| 16025 #ifdef ENABLE_SLOW_DCHECKS |
| 16026 if (FLAG_enable_slow_asserts) { |
| 16027 Object* maybe_constructor = map()->GetConstructor(); |
| 16028 if (!maybe_constructor->IsJSFunction()) return false; |
| 16029 JSFunction* constructor = JSFunction::cast(maybe_constructor); |
| 16030 if (constructor->shared()->IsApiFunction()) { |
| 16031 DCHECK(is_api_object); |
| 16032 } else { |
| 16033 DCHECK(!is_api_object); |
| 16034 } |
| 16035 } |
| 16036 #endif |
| 16037 return is_api_object; |
| 16038 } |
16021 | 16039 |
16022 int JSObject::NumberOfOwnElements(PropertyFilter filter) { | 16040 int JSObject::NumberOfOwnElements(PropertyFilter filter) { |
16023 // Fast case for objects with no elements. | 16041 // Fast case for objects with no elements. |
16024 if (!IsJSValue() && HasFastElements()) { | 16042 if (!IsJSValue() && HasFastElements()) { |
16025 uint32_t length = | 16043 uint32_t length = |
16026 IsJSArray() | 16044 IsJSArray() |
16027 ? static_cast<uint32_t>( | 16045 ? static_cast<uint32_t>( |
16028 Smi::cast(JSArray::cast(this)->length())->value()) | 16046 Smi::cast(JSArray::cast(this)->length())->value()) |
16029 : static_cast<uint32_t>(FixedArrayBase::cast(elements())->length()); | 16047 : static_cast<uint32_t>(FixedArrayBase::cast(elements())->length()); |
16030 if (length == 0) return 0; | 16048 if (length == 0) return 0; |
(...skipping 3285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19316 if (cell->value() != *new_value) { | 19334 if (cell->value() != *new_value) { |
19317 cell->set_value(*new_value); | 19335 cell->set_value(*new_value); |
19318 Isolate* isolate = cell->GetIsolate(); | 19336 Isolate* isolate = cell->GetIsolate(); |
19319 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19337 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
19320 isolate, DependentCode::kPropertyCellChangedGroup); | 19338 isolate, DependentCode::kPropertyCellChangedGroup); |
19321 } | 19339 } |
19322 } | 19340 } |
19323 | 19341 |
19324 } // namespace internal | 19342 } // namespace internal |
19325 } // namespace v8 | 19343 } // namespace v8 |
OLD | NEW |