OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 | 136 |
137 // External objects are not extensible, so the map check is enough. | 137 // External objects are not extensible, so the map check is enough. |
138 bool Object::IsExternal() { | 138 bool Object::IsExternal() { |
139 return Object::IsHeapObject() && | 139 return Object::IsHeapObject() && |
140 HeapObject::cast(this)->map() == | 140 HeapObject::cast(this)->map() == |
141 HeapObject::cast(this)->GetHeap()->external_map(); | 141 HeapObject::cast(this)->GetHeap()->external_map(); |
142 } | 142 } |
143 | 143 |
144 | 144 |
| 145 bool Object::IsAccessorInfo() { |
| 146 return IsExecutableAccessorInfo() || IsDeclaredAccessorInfo(); |
| 147 } |
| 148 |
| 149 |
145 bool Object::IsInstanceOf(FunctionTemplateInfo* expected) { | 150 bool Object::IsInstanceOf(FunctionTemplateInfo* expected) { |
146 // There is a constraint on the object; check. | 151 // There is a constraint on the object; check. |
147 if (!this->IsJSObject()) return false; | 152 if (!this->IsJSObject()) return false; |
148 // Fetch the constructor function of the object. | 153 // Fetch the constructor function of the object. |
149 Object* cons_obj = JSObject::cast(this)->map()->constructor(); | 154 Object* cons_obj = JSObject::cast(this)->map()->constructor(); |
150 if (!cons_obj->IsJSFunction()) return false; | 155 if (!cons_obj->IsJSFunction()) return false; |
151 JSFunction* fun = JSFunction::cast(cons_obj); | 156 JSFunction* fun = JSFunction::cast(cons_obj); |
152 // Iterate through the chain of inheriting function templates to | 157 // Iterate through the chain of inheriting function templates to |
153 // see if the required one occurs. | 158 // see if the required one occurs. |
154 for (Object* type = fun->shared()->function_data(); | 159 for (Object* type = fun->shared()->function_data(); |
(...skipping 2285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2440 CAST_ACCESSOR(ExternalByteArray) | 2445 CAST_ACCESSOR(ExternalByteArray) |
2441 CAST_ACCESSOR(ExternalUnsignedByteArray) | 2446 CAST_ACCESSOR(ExternalUnsignedByteArray) |
2442 CAST_ACCESSOR(ExternalShortArray) | 2447 CAST_ACCESSOR(ExternalShortArray) |
2443 CAST_ACCESSOR(ExternalUnsignedShortArray) | 2448 CAST_ACCESSOR(ExternalUnsignedShortArray) |
2444 CAST_ACCESSOR(ExternalIntArray) | 2449 CAST_ACCESSOR(ExternalIntArray) |
2445 CAST_ACCESSOR(ExternalUnsignedIntArray) | 2450 CAST_ACCESSOR(ExternalUnsignedIntArray) |
2446 CAST_ACCESSOR(ExternalFloatArray) | 2451 CAST_ACCESSOR(ExternalFloatArray) |
2447 CAST_ACCESSOR(ExternalDoubleArray) | 2452 CAST_ACCESSOR(ExternalDoubleArray) |
2448 CAST_ACCESSOR(ExternalPixelArray) | 2453 CAST_ACCESSOR(ExternalPixelArray) |
2449 CAST_ACCESSOR(Struct) | 2454 CAST_ACCESSOR(Struct) |
| 2455 CAST_ACCESSOR(AccessorInfo) |
2450 | 2456 |
2451 | 2457 |
2452 #define MAKE_STRUCT_CAST(NAME, Name, name) CAST_ACCESSOR(Name) | 2458 #define MAKE_STRUCT_CAST(NAME, Name, name) CAST_ACCESSOR(Name) |
2453 STRUCT_LIST(MAKE_STRUCT_CAST) | 2459 STRUCT_LIST(MAKE_STRUCT_CAST) |
2454 #undef MAKE_STRUCT_CAST | 2460 #undef MAKE_STRUCT_CAST |
2455 | 2461 |
2456 | 2462 |
2457 template <typename Shape, typename Key> | 2463 template <typename Shape, typename Key> |
2458 HashTable<Shape, Key>* HashTable<Shape, Key>::cast(Object* obj) { | 2464 HashTable<Shape, Key>* HashTable<Shape, Key>::cast(Object* obj) { |
2459 ASSERT(obj->IsHashTable()); | 2465 ASSERT(obj->IsHashTable()); |
(...skipping 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4095 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset) | 4101 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset) |
4096 ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset) | 4102 ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset) |
4097 | 4103 |
4098 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset) | 4104 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset) |
4099 ACCESSORS(GlobalObject, native_context, Context, kNativeContextOffset) | 4105 ACCESSORS(GlobalObject, native_context, Context, kNativeContextOffset) |
4100 ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset) | 4106 ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset) |
4101 ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset) | 4107 ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset) |
4102 | 4108 |
4103 ACCESSORS(JSGlobalProxy, native_context, Object, kNativeContextOffset) | 4109 ACCESSORS(JSGlobalProxy, native_context, Object, kNativeContextOffset) |
4104 | 4110 |
4105 ACCESSORS(AccessorInfo, getter, Object, kGetterOffset) | |
4106 ACCESSORS(AccessorInfo, setter, Object, kSetterOffset) | |
4107 ACCESSORS(AccessorInfo, data, Object, kDataOffset) | |
4108 ACCESSORS(AccessorInfo, name, Object, kNameOffset) | 4111 ACCESSORS(AccessorInfo, name, Object, kNameOffset) |
4109 ACCESSORS_TO_SMI(AccessorInfo, flag, kFlagOffset) | 4112 ACCESSORS_TO_SMI(AccessorInfo, flag, kFlagOffset) |
4110 ACCESSORS(AccessorInfo, expected_receiver_type, Object, | 4113 ACCESSORS(AccessorInfo, expected_receiver_type, Object, |
4111 kExpectedReceiverTypeOffset) | 4114 kExpectedReceiverTypeOffset) |
4112 | 4115 |
| 4116 ACCESSORS(DeclaredAccessorDescriptor, internal_field, Smi, kInternalFieldOffset) |
| 4117 |
| 4118 ACCESSORS(DeclaredAccessorInfo, descriptor, DeclaredAccessorDescriptor, |
| 4119 kDescriptorOffset) |
| 4120 |
| 4121 ACCESSORS(ExecutableAccessorInfo, getter, Object, kGetterOffset) |
| 4122 ACCESSORS(ExecutableAccessorInfo, setter, Object, kSetterOffset) |
| 4123 ACCESSORS(ExecutableAccessorInfo, data, Object, kDataOffset) |
| 4124 |
4113 ACCESSORS(AccessorPair, getter, Object, kGetterOffset) | 4125 ACCESSORS(AccessorPair, getter, Object, kGetterOffset) |
4114 ACCESSORS(AccessorPair, setter, Object, kSetterOffset) | 4126 ACCESSORS(AccessorPair, setter, Object, kSetterOffset) |
4115 | 4127 |
4116 ACCESSORS(AccessCheckInfo, named_callback, Object, kNamedCallbackOffset) | 4128 ACCESSORS(AccessCheckInfo, named_callback, Object, kNamedCallbackOffset) |
4117 ACCESSORS(AccessCheckInfo, indexed_callback, Object, kIndexedCallbackOffset) | 4129 ACCESSORS(AccessCheckInfo, indexed_callback, Object, kIndexedCallbackOffset) |
4118 ACCESSORS(AccessCheckInfo, data, Object, kDataOffset) | 4130 ACCESSORS(AccessCheckInfo, data, Object, kDataOffset) |
4119 | 4131 |
4120 ACCESSORS(InterceptorInfo, getter, Object, kGetterOffset) | 4132 ACCESSORS(InterceptorInfo, getter, Object, kGetterOffset) |
4121 ACCESSORS(InterceptorInfo, setter, Object, kSetterOffset) | 4133 ACCESSORS(InterceptorInfo, setter, Object, kSetterOffset) |
4122 ACCESSORS(InterceptorInfo, query, Object, kQueryOffset) | 4134 ACCESSORS(InterceptorInfo, query, Object, kQueryOffset) |
(...skipping 1767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5890 #undef WRITE_UINT32_FIELD | 5902 #undef WRITE_UINT32_FIELD |
5891 #undef READ_SHORT_FIELD | 5903 #undef READ_SHORT_FIELD |
5892 #undef WRITE_SHORT_FIELD | 5904 #undef WRITE_SHORT_FIELD |
5893 #undef READ_BYTE_FIELD | 5905 #undef READ_BYTE_FIELD |
5894 #undef WRITE_BYTE_FIELD | 5906 #undef WRITE_BYTE_FIELD |
5895 | 5907 |
5896 | 5908 |
5897 } } // namespace v8::internal | 5909 } } // namespace v8::internal |
5898 | 5910 |
5899 #endif // V8_OBJECTS_INL_H_ | 5911 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |