OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 // Review notes: | 5 // Review notes: |
6 // | 6 // |
7 // - The use of macros in these inline functions may seem superfluous | 7 // - The use of macros in these inline functions may seem superfluous |
8 // but it is absolutely needed to make sure gcc generates optimal | 8 // but it is absolutely needed to make sure gcc generates optimal |
9 // code. gcc is not happy when attempting to inline too deep. | 9 // code. gcc is not happy when attempting to inline too deep. |
10 // | 10 // |
11 | 11 |
12 #ifndef V8_OBJECTS_INL_H_ | 12 #ifndef V8_OBJECTS_INL_H_ |
13 #define V8_OBJECTS_INL_H_ | 13 #define V8_OBJECTS_INL_H_ |
14 | 14 |
15 #include "src/base/atomicops.h" | 15 #include "src/base/atomicops.h" |
16 #include "src/contexts.h" | 16 #include "src/contexts.h" |
17 #include "src/conversions-inl.h" | 17 #include "src/conversions-inl.h" |
18 #include "src/elements.h" | 18 #include "src/elements.h" |
19 #include "src/factory.h" | 19 #include "src/factory.h" |
20 #include "src/field-index-inl.h" | 20 #include "src/field-index-inl.h" |
21 #include "src/heap-inl.h" | 21 #include "src/heap-inl.h" |
22 #include "src/heap.h" | 22 #include "src/heap.h" |
23 #include "src/incremental-marking.h" | 23 #include "src/incremental-marking.h" |
24 #include "src/isolate.h" | 24 #include "src/isolate.h" |
25 #include "src/lookup.h" | 25 #include "src/lookup.h" |
26 #include "src/objects.h" | 26 #include "src/objects.h" |
27 #include "src/objects-visiting.h" | 27 #include "src/objects-visiting.h" |
28 #include "src/property.h" | 28 #include "src/property.h" |
| 29 #include "src/prototype.h" |
29 #include "src/spaces.h" | 30 #include "src/spaces.h" |
30 #include "src/store-buffer.h" | 31 #include "src/store-buffer.h" |
31 #include "src/transitions-inl.h" | 32 #include "src/transitions-inl.h" |
32 #include "src/v8memory.h" | 33 #include "src/v8memory.h" |
33 | 34 |
34 namespace v8 { | 35 namespace v8 { |
35 namespace internal { | 36 namespace internal { |
36 | 37 |
37 PropertyDetails::PropertyDetails(Smi* smi) { | 38 PropertyDetails::PropertyDetails(Smi* smi) { |
38 value_ = smi->value(); | 39 value_ = smi->value(); |
(...skipping 6530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6569 | 6570 |
6570 bool String::AsArrayIndex(uint32_t* index) { | 6571 bool String::AsArrayIndex(uint32_t* index) { |
6571 uint32_t field = hash_field(); | 6572 uint32_t field = hash_field(); |
6572 if (IsHashFieldComputed(field) && (field & kIsNotArrayIndexMask)) { | 6573 if (IsHashFieldComputed(field) && (field & kIsNotArrayIndexMask)) { |
6573 return false; | 6574 return false; |
6574 } | 6575 } |
6575 return SlowAsArrayIndex(index); | 6576 return SlowAsArrayIndex(index); |
6576 } | 6577 } |
6577 | 6578 |
6578 | 6579 |
6579 Object* JSReceiver::GetPrototype() const { | |
6580 return map()->prototype(); | |
6581 } | |
6582 | |
6583 | |
6584 Object* JSReceiver::GetConstructor() { | 6580 Object* JSReceiver::GetConstructor() { |
6585 return map()->constructor(); | 6581 return map()->constructor(); |
6586 } | 6582 } |
6587 | 6583 |
6588 | 6584 |
6589 bool JSReceiver::HasProperty(Handle<JSReceiver> object, | 6585 bool JSReceiver::HasProperty(Handle<JSReceiver> object, |
6590 Handle<Name> name) { | 6586 Handle<Name> name) { |
6591 if (object->IsJSProxy()) { | 6587 if (object->IsJSProxy()) { |
6592 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); | 6588 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); |
6593 return JSProxy::HasPropertyWithHandler(proxy, name); | 6589 return JSProxy::HasPropertyWithHandler(proxy, name); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6626 Handle<JSObject>::cast(object), object, index, true); | 6622 Handle<JSObject>::cast(object), object, index, true); |
6627 } | 6623 } |
6628 | 6624 |
6629 | 6625 |
6630 bool JSGlobalObject::IsDetached() { | 6626 bool JSGlobalObject::IsDetached() { |
6631 return JSGlobalProxy::cast(global_proxy())->IsDetachedFrom(this); | 6627 return JSGlobalProxy::cast(global_proxy())->IsDetachedFrom(this); |
6632 } | 6628 } |
6633 | 6629 |
6634 | 6630 |
6635 bool JSGlobalProxy::IsDetachedFrom(GlobalObject* global) const { | 6631 bool JSGlobalProxy::IsDetachedFrom(GlobalObject* global) const { |
6636 return GetPrototype() != global; | 6632 const PrototypeIterator iter(this->GetIsolate(), |
| 6633 const_cast<JSGlobalProxy*>(this)); |
| 6634 return iter.GetCurrent() != global; |
6637 } | 6635 } |
6638 | 6636 |
6639 | 6637 |
6640 Handle<Smi> JSReceiver::GetOrCreateIdentityHash(Handle<JSReceiver> object) { | 6638 Handle<Smi> JSReceiver::GetOrCreateIdentityHash(Handle<JSReceiver> object) { |
6641 return object->IsJSProxy() | 6639 return object->IsJSProxy() |
6642 ? JSProxy::GetOrCreateIdentityHash(Handle<JSProxy>::cast(object)) | 6640 ? JSProxy::GetOrCreateIdentityHash(Handle<JSProxy>::cast(object)) |
6643 : JSObject::GetOrCreateIdentityHash(Handle<JSObject>::cast(object)); | 6641 : JSObject::GetOrCreateIdentityHash(Handle<JSObject>::cast(object)); |
6644 } | 6642 } |
6645 | 6643 |
6646 | 6644 |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7169 #undef READ_SHORT_FIELD | 7167 #undef READ_SHORT_FIELD |
7170 #undef WRITE_SHORT_FIELD | 7168 #undef WRITE_SHORT_FIELD |
7171 #undef READ_BYTE_FIELD | 7169 #undef READ_BYTE_FIELD |
7172 #undef WRITE_BYTE_FIELD | 7170 #undef WRITE_BYTE_FIELD |
7173 #undef NOBARRIER_READ_BYTE_FIELD | 7171 #undef NOBARRIER_READ_BYTE_FIELD |
7174 #undef NOBARRIER_WRITE_BYTE_FIELD | 7172 #undef NOBARRIER_WRITE_BYTE_FIELD |
7175 | 7173 |
7176 } } // namespace v8::internal | 7174 } } // namespace v8::internal |
7177 | 7175 |
7178 #endif // V8_OBJECTS_INL_H_ | 7176 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |