| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 5028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5039 IsCompatibleForLoad(Representation::Tagged())); | 5039 IsCompatibleForLoad(Representation::Tagged())); |
| 5040 return this->RawFastPropertyAt( | 5040 return this->RawFastPropertyAt( |
| 5041 descriptors->GetFieldIndex(sorted_index)); | 5041 descriptors->GetFieldIndex(sorted_index)); |
| 5042 } else { | 5042 } else { |
| 5043 return GetHeap()->undefined_value(); | 5043 return GetHeap()->undefined_value(); |
| 5044 } | 5044 } |
| 5045 } else { | 5045 } else { |
| 5046 return GetHeap()->undefined_value(); | 5046 return GetHeap()->undefined_value(); |
| 5047 } | 5047 } |
| 5048 } else { | 5048 } else { |
| 5049 PropertyAttributes attributes; | 5049 LookupResult result(GetIsolate()); |
| 5050 // You can't install a getter on a property indexed by the hidden string, | 5050 LocalLookupRealNamedProperty(GetHeap()->hidden_string(), &result); |
| 5051 // so we can be sure that GetLocalPropertyPostInterceptor returns a real | 5051 if (result.IsFound()) { |
| 5052 // object. | 5052 ASSERT(result.IsNormal()); |
| 5053 return GetLocalPropertyPostInterceptor(this, | 5053 ASSERT(result.holder() == this); |
| 5054 GetHeap()->hidden_string(), | 5054 Object* value = GetNormalizedProperty(&result); |
| 5055 &attributes)->ToObjectUnchecked(); | 5055 if (!value->IsTheHole()) return value; |
| 5056 } |
| 5057 return GetHeap()->undefined_value(); |
| 5056 } | 5058 } |
| 5057 } | 5059 } |
| 5058 | 5060 |
| 5059 Handle<ObjectHashTable> JSObject::GetOrCreateHiddenPropertiesHashtable( | 5061 Handle<ObjectHashTable> JSObject::GetOrCreateHiddenPropertiesHashtable( |
| 5060 Handle<JSObject> object) { | 5062 Handle<JSObject> object) { |
| 5061 Isolate* isolate = object->GetIsolate(); | 5063 Isolate* isolate = object->GetIsolate(); |
| 5062 | 5064 |
| 5063 static const int kInitialCapacity = 4; | 5065 static const int kInitialCapacity = 4; |
| 5064 Handle<Object> inline_value(object->GetHiddenPropertiesHashTable(), isolate); | 5066 Handle<Object> inline_value(object->GetHiddenPropertiesHashTable(), isolate); |
| 5065 if (inline_value->IsHashTable()) { | 5067 if (inline_value->IsHashTable()) { |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5847 copy->GetLocalPropertyNames(*names, 0); | 5849 copy->GetLocalPropertyNames(*names, 0); |
| 5848 for (int i = 0; i < names->length(); i++) { | 5850 for (int i = 0; i < names->length(); i++) { |
| 5849 ASSERT(names->get(i)->IsString()); | 5851 ASSERT(names->get(i)->IsString()); |
| 5850 Handle<String> key_string(String::cast(names->get(i))); | 5852 Handle<String> key_string(String::cast(names->get(i))); |
| 5851 PropertyAttributes attributes = | 5853 PropertyAttributes attributes = |
| 5852 JSReceiver::GetLocalPropertyAttribute(copy, key_string); | 5854 JSReceiver::GetLocalPropertyAttribute(copy, key_string); |
| 5853 // Only deep copy fields from the object literal expression. | 5855 // Only deep copy fields from the object literal expression. |
| 5854 // In particular, don't try to copy the length attribute of | 5856 // In particular, don't try to copy the length attribute of |
| 5855 // an array. | 5857 // an array. |
| 5856 if (attributes != NONE) continue; | 5858 if (attributes != NONE) continue; |
| 5857 Handle<Object> value( | 5859 Handle<Object> value = Object::GetProperty(copy, key_string); |
| 5858 copy->GetProperty(*key_string, &attributes)->ToObjectUnchecked(), | 5860 CHECK_NOT_EMPTY_HANDLE(isolate, value); |
| 5859 isolate); | |
| 5860 if (value->IsJSObject()) { | 5861 if (value->IsJSObject()) { |
| 5861 Handle<JSObject> result = VisitElementOrProperty( | 5862 Handle<JSObject> result = VisitElementOrProperty( |
| 5862 copy, Handle<JSObject>::cast(value)); | 5863 copy, Handle<JSObject>::cast(value)); |
| 5863 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<JSObject>()); | 5864 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<JSObject>()); |
| 5864 if (copying) { | 5865 if (copying) { |
| 5865 // Creating object copy for literals. No strict mode needed. | 5866 // Creating object copy for literals. No strict mode needed. |
| 5866 JSObject::SetProperty( | 5867 JSObject::SetProperty( |
| 5867 copy, key_string, result, NONE, SLOPPY).Assert(); | 5868 copy, key_string, result, NONE, SLOPPY).Assert(); |
| 5868 } | 5869 } |
| 5869 } | 5870 } |
| (...skipping 7437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13307 } else { | 13308 } else { |
| 13308 // Continue searching via the prototype chain. | 13309 // Continue searching via the prototype chain. |
| 13309 Handle<Object> prototype(object->GetPrototype(), isolate); | 13310 Handle<Object> prototype(object->GetPrototype(), isolate); |
| 13310 *attributes = ABSENT; | 13311 *attributes = ABSENT; |
| 13311 if (prototype->IsNull()) return isolate->factory()->undefined_value(); | 13312 if (prototype->IsNull()) return isolate->factory()->undefined_value(); |
| 13312 return GetPropertyWithReceiver(prototype, receiver, name, attributes); | 13313 return GetPropertyWithReceiver(prototype, receiver, name, attributes); |
| 13313 } | 13314 } |
| 13314 } | 13315 } |
| 13315 | 13316 |
| 13316 | 13317 |
| 13317 MaybeObject* JSObject::GetLocalPropertyPostInterceptor( | |
| 13318 Object* receiver, | |
| 13319 Name* name, | |
| 13320 PropertyAttributes* attributes) { | |
| 13321 // Check local property in holder, ignore interceptor. | |
| 13322 LookupResult result(GetIsolate()); | |
| 13323 LocalLookupRealNamedProperty(name, &result); | |
| 13324 if (result.IsFound()) { | |
| 13325 return GetProperty(receiver, &result, name, attributes); | |
| 13326 } | |
| 13327 return GetHeap()->undefined_value(); | |
| 13328 } | |
| 13329 | |
| 13330 | |
| 13331 MaybeHandle<Object> JSObject::GetPropertyWithInterceptor( | 13318 MaybeHandle<Object> JSObject::GetPropertyWithInterceptor( |
| 13332 Handle<JSObject> object, | 13319 Handle<JSObject> object, |
| 13333 Handle<Object> receiver, | 13320 Handle<Object> receiver, |
| 13334 Handle<Name> name, | 13321 Handle<Name> name, |
| 13335 PropertyAttributes* attributes) { | 13322 PropertyAttributes* attributes) { |
| 13336 Isolate* isolate = object->GetIsolate(); | 13323 Isolate* isolate = object->GetIsolate(); |
| 13337 | 13324 |
| 13338 // TODO(rossberg): Support symbols in the API. | 13325 // TODO(rossberg): Support symbols in the API. |
| 13339 if (name->IsSymbol()) return isolate->factory()->undefined_value(); | 13326 if (name->IsSymbol()) return isolate->factory()->undefined_value(); |
| 13340 | 13327 |
| (...skipping 3325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16666 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16653 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16667 static const char* error_messages_[] = { | 16654 static const char* error_messages_[] = { |
| 16668 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16655 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16669 }; | 16656 }; |
| 16670 #undef ERROR_MESSAGES_TEXTS | 16657 #undef ERROR_MESSAGES_TEXTS |
| 16671 return error_messages_[reason]; | 16658 return error_messages_[reason]; |
| 16672 } | 16659 } |
| 16673 | 16660 |
| 16674 | 16661 |
| 16675 } } // namespace v8::internal | 16662 } } // namespace v8::internal |
| OLD | NEW |