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 #ifndef V8_PROPERTY_H_ | 5 #ifndef V8_PROPERTY_H_ |
6 #define V8_PROPERTY_H_ | 6 #define V8_PROPERTY_H_ |
7 | 7 |
8 #include "src/factory.h" | 8 #include "src/factory.h" |
9 #include "src/field-index.h" | 9 #include "src/field-index.h" |
10 #include "src/field-index-inl.h" | 10 #include "src/field-index-inl.h" |
11 #include "src/isolate.h" | 11 #include "src/isolate.h" |
12 #include "src/types.h" | 12 #include "src/types.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 | 16 |
17 class OStream; | 17 class OStream; |
18 | 18 |
19 // Abstraction for elements in instance-descriptor arrays. | 19 // Abstraction for elements in instance-descriptor arrays. |
20 // | 20 // |
21 // Each descriptor has a key, property attributes, property type, | 21 // Each descriptor has a key, property attributes, property type, |
22 // property index (in the actual instance-descriptor array) and | 22 // property index (in the actual instance-descriptor array) and |
23 // optionally a piece of data. | 23 // optionally a piece of data. |
24 class Descriptor BASE_EMBEDDED { | 24 class Descriptor BASE_EMBEDDED { |
25 public: | 25 public: |
26 Descriptor() : details_(Smi::FromInt(0)) {} | |
Toon Verwaest
2014/08/20 07:43:11
Is this change necessary?
| |
27 | |
26 void KeyToUniqueName() { | 28 void KeyToUniqueName() { |
27 if (!key_->IsUniqueName()) { | 29 if (!key_->IsUniqueName()) { |
28 key_ = key_->GetIsolate()->factory()->InternalizeString( | 30 key_ = key_->GetIsolate()->factory()->InternalizeString( |
29 Handle<String>::cast(key_)); | 31 Handle<String>::cast(key_)); |
30 } | 32 } |
31 } | 33 } |
32 | 34 |
33 Handle<Name> GetKey() const { return key_; } | 35 Handle<Name> GetKey() const { return key_; } |
34 Handle<Object> GetValue() const { return value_; } | 36 Handle<Object> GetValue() const { return value_; } |
35 PropertyDetails GetDetails() const { return details_; } | 37 PropertyDetails GetDetails() const { return details_; } |
36 | 38 |
37 void SetSortedKeyIndex(int index) { details_ = details_.set_pointer(index); } | 39 void SetSortedKeyIndex(int index) { details_ = details_.set_pointer(index); } |
38 | 40 |
39 private: | 41 private: |
40 Handle<Name> key_; | 42 Handle<Name> key_; |
41 Handle<Object> value_; | 43 Handle<Object> value_; |
42 PropertyDetails details_; | 44 PropertyDetails details_; |
43 | 45 |
44 protected: | 46 protected: |
45 Descriptor() : details_(Smi::FromInt(0)) {} | |
46 | |
47 void Init(Handle<Name> key, Handle<Object> value, PropertyDetails details) { | 47 void Init(Handle<Name> key, Handle<Object> value, PropertyDetails details) { |
48 key_ = key; | 48 key_ = key; |
49 value_ = value; | 49 value_ = value; |
50 details_ = details; | 50 details_ = details; |
51 } | 51 } |
52 | 52 |
53 Descriptor(Handle<Name> key, Handle<Object> value, PropertyDetails details) | 53 Descriptor(Handle<Name> key, Handle<Object> value, PropertyDetails details) |
54 : key_(key), | 54 : key_(key), |
55 value_(value), | 55 value_(value), |
56 details_(details) { } | 56 details_(details) { } |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
488 int number_; | 488 int number_; |
489 bool cacheable_; | 489 bool cacheable_; |
490 PropertyDetails details_; | 490 PropertyDetails details_; |
491 }; | 491 }; |
492 | 492 |
493 | 493 |
494 OStream& operator<<(OStream& os, const LookupResult& r); | 494 OStream& operator<<(OStream& os, const LookupResult& r); |
495 } } // namespace v8::internal | 495 } } // namespace v8::internal |
496 | 496 |
497 #endif // V8_PROPERTY_H_ | 497 #endif // V8_PROPERTY_H_ |
OLD | NEW |