| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 int offset, | 84 int offset, |
| 85 int* object_offset) { | 85 int* object_offset) { |
| 86 if (name->Equals(property_name)) { | 86 if (name->Equals(property_name)) { |
| 87 *object_offset = offset; | 87 *object_offset = offset; |
| 88 return true; | 88 return true; |
| 89 } | 89 } |
| 90 return false; | 90 return false; |
| 91 } | 91 } |
| 92 | 92 |
| 93 | 93 |
| 94 bool Accessors::IsJSObjectFieldAccessor(Handle<HeapType> type, | 94 // Returns true for properties that are accessors to object fields. |
| 95 // If true, *object_offset contains offset of object field. |
| 96 template <class T> |
| 97 bool Accessors::IsJSObjectFieldAccessor(typename T::TypeHandle type, |
| 95 Handle<String> name, | 98 Handle<String> name, |
| 96 int* object_offset) { | 99 int* object_offset) { |
| 97 Isolate* isolate = name->GetIsolate(); | 100 Isolate* isolate = name->GetIsolate(); |
| 98 | 101 |
| 99 if (type->Is(HeapType::String())) { | 102 if (type->Is(T::String())) { |
| 100 return CheckForName(name, isolate->heap()->length_string(), | 103 return CheckForName(name, isolate->heap()->length_string(), |
| 101 String::kLengthOffset, object_offset); | 104 String::kLengthOffset, object_offset); |
| 102 } | 105 } |
| 103 | 106 |
| 104 if (!type->IsClass()) return false; | 107 if (!type->IsClass()) return false; |
| 105 Handle<Map> map = type->AsClass(); | 108 Handle<Map> map = type->AsClass(); |
| 106 | 109 |
| 107 switch (map->instance_type()) { | 110 switch (map->instance_type()) { |
| 108 case JS_ARRAY_TYPE: | 111 case JS_ARRAY_TYPE: |
| 109 return | 112 return |
| (...skipping 20 matching lines...) Expand all Loading... |
| 130 CheckForName(name, isolate->heap()->byte_offset_string(), | 133 CheckForName(name, isolate->heap()->byte_offset_string(), |
| 131 JSDataView::kByteOffsetOffset, object_offset) || | 134 JSDataView::kByteOffsetOffset, object_offset) || |
| 132 CheckForName(name, isolate->heap()->buffer_string(), | 135 CheckForName(name, isolate->heap()->buffer_string(), |
| 133 JSDataView::kBufferOffset, object_offset); | 136 JSDataView::kBufferOffset, object_offset); |
| 134 default: | 137 default: |
| 135 return false; | 138 return false; |
| 136 } | 139 } |
| 137 } | 140 } |
| 138 | 141 |
| 139 | 142 |
| 143 template |
| 144 bool Accessors::IsJSObjectFieldAccessor<Type>(Type* type, |
| 145 Handle<String> name, |
| 146 int* object_offset); |
| 147 |
| 148 |
| 149 template |
| 150 bool Accessors::IsJSObjectFieldAccessor<HeapType>(Handle<HeapType> type, |
| 151 Handle<String> name, |
| 152 int* object_offset); |
| 153 |
| 154 |
| 140 // | 155 // |
| 141 // Accessors::ArrayLength | 156 // Accessors::ArrayLength |
| 142 // | 157 // |
| 143 | 158 |
| 144 | 159 |
| 145 MaybeObject* Accessors::ArrayGetLength(Isolate* isolate, | 160 MaybeObject* Accessors::ArrayGetLength(Isolate* isolate, |
| 146 Object* object, | 161 Object* object, |
| 147 void*) { | 162 void*) { |
| 148 // Traverse the prototype chain until we reach an array. | 163 // Traverse the prototype chain until we reach an array. |
| 149 JSArray* holder = FindInstanceOf<JSArray>(isolate, object); | 164 JSArray* holder = FindInstanceOf<JSArray>(isolate, object); |
| (...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 info->set_data(Smi::FromInt(index)); | 988 info->set_data(Smi::FromInt(index)); |
| 974 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); | 989 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); |
| 975 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); | 990 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); |
| 976 info->set_getter(*getter); | 991 info->set_getter(*getter); |
| 977 if (!(attributes & ReadOnly)) info->set_setter(*setter); | 992 if (!(attributes & ReadOnly)) info->set_setter(*setter); |
| 978 return info; | 993 return info; |
| 979 } | 994 } |
| 980 | 995 |
| 981 | 996 |
| 982 } } // namespace v8::internal | 997 } } // namespace v8::internal |
| OLD | NEW |