OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3754 | 3754 |
3755 void JSBuiltinsObject::set_javascript_builtin_code(Builtins::JavaScript id, | 3755 void JSBuiltinsObject::set_javascript_builtin_code(Builtins::JavaScript id, |
3756 Code* value) { | 3756 Code* value) { |
3757 ASSERT(id < kJSBuiltinsCount); // id is unsigned. | 3757 ASSERT(id < kJSBuiltinsCount); // id is unsigned. |
3758 WRITE_FIELD(this, OffsetOfCodeWithId(id), value); | 3758 WRITE_FIELD(this, OffsetOfCodeWithId(id), value); |
3759 ASSERT(!HEAP->InNewSpace(value)); | 3759 ASSERT(!HEAP->InNewSpace(value)); |
3760 } | 3760 } |
3761 | 3761 |
3762 | 3762 |
3763 ACCESSORS(JSProxy, handler, Object, kHandlerOffset) | 3763 ACCESSORS(JSProxy, handler, Object, kHandlerOffset) |
3764 ACCESSORS(JSProxy, padding, Object, kPaddingOffset) | |
3764 | 3765 |
3765 | 3766 |
3766 Address Foreign::address() { | 3767 Address Foreign::address() { |
3767 return AddressFrom<Address>(READ_INTPTR_FIELD(this, kAddressOffset)); | 3768 return AddressFrom<Address>(READ_INTPTR_FIELD(this, kAddressOffset)); |
3768 } | 3769 } |
3769 | 3770 |
3770 | 3771 |
3771 void Foreign::set_address(Address value) { | 3772 void Foreign::set_address(Address value) { |
3772 WRITE_INTPTR_FIELD(this, kAddressOffset, OffsetFrom(value)); | 3773 WRITE_INTPTR_FIELD(this, kAddressOffset, OffsetFrom(value)); |
3773 } | 3774 } |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4149 } | 4150 } |
4150 return SlowAsArrayIndex(index); | 4151 return SlowAsArrayIndex(index); |
4151 } | 4152 } |
4152 | 4153 |
4153 | 4154 |
4154 Object* JSReceiver::GetPrototype() { | 4155 Object* JSReceiver::GetPrototype() { |
4155 return HeapObject::cast(this)->map()->prototype(); | 4156 return HeapObject::cast(this)->map()->prototype(); |
4156 } | 4157 } |
4157 | 4158 |
4158 | 4159 |
4160 bool JSReceiver::HasProperty(String* name) { | |
4161 if (IsJSProxy()) { | |
4162 return JSProxy::cast(this)->HasPropertyWithHandler(name); | |
4163 } | |
4164 return GetPropertyAttribute(name) != ABSENT; | |
4165 } | |
4166 | |
Mads Ager (chromium)
2011/07/19 08:18:05
Add an extra newline. We usually have two newlines
rossberg
2011/07/19 09:29:52
Done.
| |
4167 bool JSReceiver::HasLocalProperty(String* name) { | |
4168 if (IsJSProxy()) { | |
4169 return JSProxy::cast(this)->HasPropertyWithHandler(name); | |
4170 } | |
4171 return GetLocalPropertyAttribute(name) != ABSENT; | |
4172 } | |
4173 | |
4174 | |
4159 PropertyAttributes JSReceiver::GetPropertyAttribute(String* key) { | 4175 PropertyAttributes JSReceiver::GetPropertyAttribute(String* key) { |
4160 return GetPropertyAttributeWithReceiver(this, key); | 4176 return GetPropertyAttributeWithReceiver(this, key); |
4161 } | 4177 } |
4162 | 4178 |
4163 // TODO(504): this may be useful in other places too where JSGlobalProxy | 4179 // TODO(504): this may be useful in other places too where JSGlobalProxy |
4164 // is used. | 4180 // is used. |
4165 Object* JSObject::BypassGlobalProxy() { | 4181 Object* JSObject::BypassGlobalProxy() { |
4166 if (IsJSGlobalProxy()) { | 4182 if (IsJSGlobalProxy()) { |
4167 Object* proto = GetPrototype(); | 4183 Object* proto = GetPrototype(); |
4168 if (proto->IsNull()) return GetHeap()->undefined_value(); | 4184 if (proto->IsNull()) return GetHeap()->undefined_value(); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4463 #undef WRITE_INT_FIELD | 4479 #undef WRITE_INT_FIELD |
4464 #undef READ_SHORT_FIELD | 4480 #undef READ_SHORT_FIELD |
4465 #undef WRITE_SHORT_FIELD | 4481 #undef WRITE_SHORT_FIELD |
4466 #undef READ_BYTE_FIELD | 4482 #undef READ_BYTE_FIELD |
4467 #undef WRITE_BYTE_FIELD | 4483 #undef WRITE_BYTE_FIELD |
4468 | 4484 |
4469 | 4485 |
4470 } } // namespace v8::internal | 4486 } } // namespace v8::internal |
4471 | 4487 |
4472 #endif // V8_OBJECTS_INL_H_ | 4488 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |