| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 HeapObject::cast(this)->map() == | 143 HeapObject::cast(this)->map() == |
| 144 HeapObject::cast(this)->GetHeap()->external_map(); | 144 HeapObject::cast(this)->GetHeap()->external_map(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 | 147 |
| 148 bool Object::IsAccessorInfo() { | 148 bool Object::IsAccessorInfo() { |
| 149 return IsExecutableAccessorInfo() || IsDeclaredAccessorInfo(); | 149 return IsExecutableAccessorInfo() || IsDeclaredAccessorInfo(); |
| 150 } | 150 } |
| 151 | 151 |
| 152 | 152 |
| 153 bool Object::IsInstanceOf(FunctionTemplateInfo* expected) { | |
| 154 // There is a constraint on the object; check. | |
| 155 if (!this->IsJSObject()) return false; | |
| 156 // Fetch the constructor function of the object. | |
| 157 Object* cons_obj = JSObject::cast(this)->map()->constructor(); | |
| 158 if (!cons_obj->IsJSFunction()) return false; | |
| 159 JSFunction* fun = JSFunction::cast(cons_obj); | |
| 160 // Iterate through the chain of inheriting function templates to | |
| 161 // see if the required one occurs. | |
| 162 for (Object* type = fun->shared()->function_data(); | |
| 163 type->IsFunctionTemplateInfo(); | |
| 164 type = FunctionTemplateInfo::cast(type)->parent_template()) { | |
| 165 if (type == expected) return true; | |
| 166 } | |
| 167 // Didn't find the required type in the inheritance chain. | |
| 168 return false; | |
| 169 } | |
| 170 | |
| 171 | |
| 172 bool Object::IsSmi() { | 153 bool Object::IsSmi() { |
| 173 return HAS_SMI_TAG(this); | 154 return HAS_SMI_TAG(this); |
| 174 } | 155 } |
| 175 | 156 |
| 176 | 157 |
| 177 bool Object::IsHeapObject() { | 158 bool Object::IsHeapObject() { |
| 178 return Internals::HasHeapObjectTag(this); | 159 return Internals::HasHeapObjectTag(this); |
| 179 } | 160 } |
| 180 | 161 |
| 181 | 162 |
| (...skipping 5768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5950 | 5931 |
| 5951 | 5932 |
| 5952 void AccessorInfo::set_property_attributes(PropertyAttributes attributes) { | 5933 void AccessorInfo::set_property_attributes(PropertyAttributes attributes) { |
| 5953 set_flag(Smi::FromInt(AttributesField::update(flag()->value(), attributes))); | 5934 set_flag(Smi::FromInt(AttributesField::update(flag()->value(), attributes))); |
| 5954 } | 5935 } |
| 5955 | 5936 |
| 5956 | 5937 |
| 5957 bool AccessorInfo::IsCompatibleReceiver(Object* receiver) { | 5938 bool AccessorInfo::IsCompatibleReceiver(Object* receiver) { |
| 5958 Object* function_template = expected_receiver_type(); | 5939 Object* function_template = expected_receiver_type(); |
| 5959 if (!function_template->IsFunctionTemplateInfo()) return true; | 5940 if (!function_template->IsFunctionTemplateInfo()) return true; |
| 5960 return receiver->IsInstanceOf(FunctionTemplateInfo::cast(function_template)); | 5941 return FunctionTemplateInfo::cast(function_template)->IsTemplateFor(receiver); |
| 5961 } | 5942 } |
| 5962 | 5943 |
| 5963 | 5944 |
| 5964 void AccessorPair::set_access_flags(v8::AccessControl access_control) { | 5945 void AccessorPair::set_access_flags(v8::AccessControl access_control) { |
| 5965 int current = access_flags()->value(); | 5946 int current = access_flags()->value(); |
| 5966 current = BooleanBit::set(current, | 5947 current = BooleanBit::set(current, |
| 5967 kProhibitsOverwritingBit, | 5948 kProhibitsOverwritingBit, |
| 5968 access_control & PROHIBITS_OVERWRITING); | 5949 access_control & PROHIBITS_OVERWRITING); |
| 5969 current = BooleanBit::set(current, | 5950 current = BooleanBit::set(current, |
| 5970 kAllCanReadBit, | 5951 kAllCanReadBit, |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6430 #undef WRITE_UINT32_FIELD | 6411 #undef WRITE_UINT32_FIELD |
| 6431 #undef READ_SHORT_FIELD | 6412 #undef READ_SHORT_FIELD |
| 6432 #undef WRITE_SHORT_FIELD | 6413 #undef WRITE_SHORT_FIELD |
| 6433 #undef READ_BYTE_FIELD | 6414 #undef READ_BYTE_FIELD |
| 6434 #undef WRITE_BYTE_FIELD | 6415 #undef WRITE_BYTE_FIELD |
| 6435 | 6416 |
| 6436 | 6417 |
| 6437 } } // namespace v8::internal | 6418 } } // namespace v8::internal |
| 6438 | 6419 |
| 6439 #endif // V8_OBJECTS_INL_H_ | 6420 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |