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 <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "src/ic/ic.h" | 30 #include "src/ic/ic.h" |
31 #include "src/interpreter/bytecodes.h" | 31 #include "src/interpreter/bytecodes.h" |
32 #include "src/isolate-inl.h" | 32 #include "src/isolate-inl.h" |
33 #include "src/key-accumulator.h" | 33 #include "src/key-accumulator.h" |
34 #include "src/list.h" | 34 #include "src/list.h" |
35 #include "src/log.h" | 35 #include "src/log.h" |
36 #include "src/lookup.h" | 36 #include "src/lookup.h" |
37 #include "src/macro-assembler.h" | 37 #include "src/macro-assembler.h" |
38 #include "src/messages.h" | 38 #include "src/messages.h" |
39 #include "src/objects-inl.h" | 39 #include "src/objects-inl.h" |
| 40 #include "src/objects-body-descriptors-inl.h" |
40 #include "src/profiler/cpu-profiler.h" | 41 #include "src/profiler/cpu-profiler.h" |
41 #include "src/property-descriptor.h" | 42 #include "src/property-descriptor.h" |
42 #include "src/prototype.h" | 43 #include "src/prototype.h" |
43 #include "src/safepoint-table.h" | 44 #include "src/safepoint-table.h" |
44 #include "src/string-builder.h" | 45 #include "src/string-builder.h" |
45 #include "src/string-search.h" | 46 #include "src/string-search.h" |
46 #include "src/string-stream.h" | 47 #include "src/string-stream.h" |
47 #include "src/utils.h" | 48 #include "src/utils.h" |
48 | 49 |
49 #ifdef ENABLE_DISASSEMBLER | 50 #ifdef ENABLE_DISASSEMBLER |
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1992 os << accumulator.ToCString().get(); | 1993 os << accumulator.ToCString().get(); |
1993 break; | 1994 break; |
1994 } | 1995 } |
1995 default: | 1996 default: |
1996 os << "<Other heap object (" << map()->instance_type() << ")>"; | 1997 os << "<Other heap object (" << map()->instance_type() << ")>"; |
1997 break; | 1998 break; |
1998 } | 1999 } |
1999 } | 2000 } |
2000 | 2001 |
2001 | 2002 |
2002 void HeapObject::Iterate(ObjectVisitor* v) { | 2003 void HeapObject::Iterate(ObjectVisitor* v) { IterateFast<ObjectVisitor>(v); } |
2003 // Handle header | 2004 |
2004 IteratePointer(v, kMapOffset); | 2005 |
2005 // Handle object body | 2006 void HeapObject::IterateBody(ObjectVisitor* v) { |
2006 Map* m = map(); | 2007 Map* m = map(); |
2007 IterateBody(m->instance_type(), SizeFromMap(m), v); | 2008 IterateBodyFast<ObjectVisitor>(m->instance_type(), SizeFromMap(m), v); |
2008 } | 2009 } |
2009 | 2010 |
2010 | 2011 |
| 2012 void HeapObject::IterateBody(InstanceType type, int object_size, |
| 2013 ObjectVisitor* v) { |
| 2014 IterateBodyFast<ObjectVisitor>(type, object_size, v); |
| 2015 } |
| 2016 |
| 2017 |
| 2018 struct CallIsValidSlot { |
| 2019 template <typename BodyDescriptor> |
| 2020 static bool apply(HeapObject* obj, int offset, int) { |
| 2021 return BodyDescriptor::IsValidSlot(obj, offset); |
| 2022 } |
| 2023 }; |
| 2024 |
| 2025 |
| 2026 bool HeapObject::IsValidSlot(int offset) { |
| 2027 DCHECK_NE(0, offset); |
| 2028 return BodyDescriptorApply<CallIsValidSlot, bool>(map()->instance_type(), |
| 2029 this, offset, 0); |
| 2030 } |
| 2031 |
| 2032 |
2011 bool HeapNumber::HeapNumberBooleanValue() { | 2033 bool HeapNumber::HeapNumberBooleanValue() { |
2012 return DoubleToBoolean(value()); | 2034 return DoubleToBoolean(value()); |
2013 } | 2035 } |
2014 | 2036 |
2015 | 2037 |
2016 void HeapNumber::HeapNumberPrint(std::ostream& os) { // NOLINT | 2038 void HeapNumber::HeapNumberPrint(std::ostream& os) { // NOLINT |
2017 os << value(); | 2039 os << value(); |
2018 } | 2040 } |
2019 | 2041 |
2020 | 2042 |
(...skipping 13262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15283 static uint32_t StringHash(Object* obj) { | 15305 static uint32_t StringHash(Object* obj) { |
15284 return String::cast(obj)->Hash(); | 15306 return String::cast(obj)->Hash(); |
15285 } | 15307 } |
15286 | 15308 |
15287 Handle<String> string_; | 15309 Handle<String> string_; |
15288 }; | 15310 }; |
15289 | 15311 |
15290 | 15312 |
15291 template<typename Derived, typename Shape, typename Key> | 15313 template<typename Derived, typename Shape, typename Key> |
15292 void HashTable<Derived, Shape, Key>::IteratePrefix(ObjectVisitor* v) { | 15314 void HashTable<Derived, Shape, Key>::IteratePrefix(ObjectVisitor* v) { |
15293 IteratePointers(v, 0, kElementsStartOffset); | 15315 BodyDescriptorBase::IteratePointers(this, 0, kElementsStartOffset, v); |
15294 } | 15316 } |
15295 | 15317 |
15296 | 15318 |
15297 template<typename Derived, typename Shape, typename Key> | 15319 template<typename Derived, typename Shape, typename Key> |
15298 void HashTable<Derived, Shape, Key>::IterateElements(ObjectVisitor* v) { | 15320 void HashTable<Derived, Shape, Key>::IterateElements(ObjectVisitor* v) { |
15299 IteratePointers(v, | 15321 BodyDescriptorBase::IteratePointers(this, kElementsStartOffset, |
15300 kElementsStartOffset, | 15322 kHeaderSize + length() * kPointerSize, v); |
15301 kHeaderSize + length() * kPointerSize); | |
15302 } | 15323 } |
15303 | 15324 |
15304 | 15325 |
15305 template<typename Derived, typename Shape, typename Key> | 15326 template<typename Derived, typename Shape, typename Key> |
15306 Handle<Derived> HashTable<Derived, Shape, Key>::New( | 15327 Handle<Derived> HashTable<Derived, Shape, Key>::New( |
15307 Isolate* isolate, | 15328 Isolate* isolate, |
15308 int at_least_space_for, | 15329 int at_least_space_for, |
15309 MinimumCapacity capacity_option, | 15330 MinimumCapacity capacity_option, |
15310 PretenureFlag pretenure) { | 15331 PretenureFlag pretenure) { |
15311 DCHECK(0 <= at_least_space_for); | 15332 DCHECK(0 <= at_least_space_for); |
(...skipping 2589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17901 if (cell->value() != *new_value) { | 17922 if (cell->value() != *new_value) { |
17902 cell->set_value(*new_value); | 17923 cell->set_value(*new_value); |
17903 Isolate* isolate = cell->GetIsolate(); | 17924 Isolate* isolate = cell->GetIsolate(); |
17904 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 17925 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
17905 isolate, DependentCode::kPropertyCellChangedGroup); | 17926 isolate, DependentCode::kPropertyCellChangedGroup); |
17906 } | 17927 } |
17907 } | 17928 } |
17908 | 17929 |
17909 } // namespace internal | 17930 } // namespace internal |
17910 } // namespace v8 | 17931 } // namespace v8 |
OLD | NEW |