OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/property.h" | 5 #include "src/property.h" |
6 | 6 |
7 #include "src/field-type.h" | 7 #include "src/field-type.h" |
8 #include "src/handles-inl.h" | 8 #include "src/handles-inl.h" |
9 #include "src/objects-inl.h" | 9 #include "src/objects-inl.h" |
10 #include "src/ostreams.h" | 10 #include "src/ostreams.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 PropertyAttributes attributes, | 33 PropertyAttributes attributes, |
34 PropertyConstness constness, | 34 PropertyConstness constness, |
35 Representation representation, | 35 Representation representation, |
36 Handle<Object> wrapped_field_type) { | 36 Handle<Object> wrapped_field_type) { |
37 DCHECK(wrapped_field_type->IsSmi() || wrapped_field_type->IsWeakCell()); | 37 DCHECK(wrapped_field_type->IsSmi() || wrapped_field_type->IsWeakCell()); |
38 PropertyDetails details(kData, attributes, kField, constness, representation, | 38 PropertyDetails details(kData, attributes, kField, constness, representation, |
39 field_index); | 39 field_index); |
40 return Descriptor(key, wrapped_field_type, details); | 40 return Descriptor(key, wrapped_field_type, details); |
41 } | 41 } |
42 | 42 |
| 43 Descriptor Descriptor::DataConstant(Handle<Name> key, int field_index, |
| 44 Handle<Object> value, |
| 45 PropertyAttributes attributes) { |
| 46 if (FLAG_track_constant_fields) { |
| 47 Handle<Object> any_type(FieldType::Any(), key->GetIsolate()); |
| 48 return DataField(key, field_index, attributes, kConst, |
| 49 Representation::Tagged(), any_type); |
| 50 |
| 51 } else { |
| 52 return Descriptor(key, value, kData, attributes, kDescriptor, kConst, |
| 53 value->OptimalRepresentation(), field_index); |
| 54 } |
| 55 } |
| 56 |
43 // Outputs PropertyDetails as a dictionary details. | 57 // Outputs PropertyDetails as a dictionary details. |
44 void PropertyDetails::PrintAsSlowTo(std::ostream& os) { | 58 void PropertyDetails::PrintAsSlowTo(std::ostream& os) { |
45 os << "("; | 59 os << "("; |
46 if (constness() == kConst) os << "const "; | 60 if (constness() == kConst) os << "const "; |
47 os << (kind() == kData ? "data" : "accessor"); | 61 os << (kind() == kData ? "data" : "accessor"); |
48 os << ", dictionary_index: " << dictionary_index(); | 62 os << ", dictionary_index: " << dictionary_index(); |
49 os << ", attrs: " << attributes() << ")"; | 63 os << ", attrs: " << attributes() << ")"; |
50 } | 64 } |
51 | 65 |
52 // Outputs PropertyDetails as a descriptor array details. | 66 // Outputs PropertyDetails as a descriptor array details. |
(...skipping 28 matching lines...) Expand all Loading... |
81 PrintAsSlowTo(os); | 95 PrintAsSlowTo(os); |
82 } else { | 96 } else { |
83 PrintAsFastTo(os, PrintMode::kPrintFull); | 97 PrintAsFastTo(os, PrintMode::kPrintFull); |
84 } | 98 } |
85 os << "\n" << std::flush; | 99 os << "\n" << std::flush; |
86 } | 100 } |
87 #endif | 101 #endif |
88 | 102 |
89 } // namespace internal | 103 } // namespace internal |
90 } // namespace v8 | 104 } // namespace v8 |
OLD | NEW |