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 4011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4022 EnqueueChangeRecord(self, "updated", name, old_value); | 4022 EnqueueChangeRecord(self, "updated", name, old_value); |
4023 } | 4023 } |
4024 } | 4024 } |
4025 } | 4025 } |
4026 } | 4026 } |
4027 | 4027 |
4028 return *hresult; | 4028 return *hresult; |
4029 } | 4029 } |
4030 | 4030 |
4031 | 4031 |
| 4032 MaybeObject* JSObject::SetLocalPropertyIgnoreAttributesTrampoline( |
| 4033 Name* key, |
| 4034 Object* value, |
| 4035 PropertyAttributes attributes, |
| 4036 ValueType value_type, |
| 4037 StoreMode mode, |
| 4038 ExtensibilityCheck extensibility_check) { |
| 4039 // TODO(mstarzinger): The trampoline is a giant hack, don't use it anywhere |
| 4040 // else or handlification people will start hating you for all eternity. |
| 4041 HandleScope scope(GetIsolate()); |
| 4042 IdempotentPointerToHandleCodeTrampoline trampoline(GetIsolate()); |
| 4043 return trampoline.CallWithReturnValue( |
| 4044 &JSObject::SetLocalPropertyIgnoreAttributes, |
| 4045 Handle<JSObject>(this), |
| 4046 Handle<Name>(key), |
| 4047 Handle<Object>(value, GetIsolate()), |
| 4048 attributes, |
| 4049 value_type, |
| 4050 mode, |
| 4051 extensibility_check); |
| 4052 } |
| 4053 |
| 4054 |
4032 // Set a real local property, even if it is READ_ONLY. If the property is not | 4055 // Set a real local property, even if it is READ_ONLY. If the property is not |
4033 // present, add it with attributes NONE. This code is an exact clone of | 4056 // present, add it with attributes NONE. This code is an exact clone of |
4034 // SetProperty, with the check for IsReadOnly and the check for a | 4057 // SetProperty, with the check for IsReadOnly and the check for a |
4035 // callback setter removed. The two lines looking up the LookupResult | 4058 // callback setter removed. The two lines looking up the LookupResult |
4036 // result are also added. If one of the functions is changed, the other | 4059 // result are also added. If one of the functions is changed, the other |
4037 // should be. | 4060 // should be. |
4038 // Note that this method cannot be used to set the prototype of a function | 4061 // Note that this method cannot be used to set the prototype of a function |
4039 // because ConvertDescriptorToField() which is called in "case CALLBACKS:" | 4062 // because ConvertDescriptorToField() which is called in "case CALLBACKS:" |
4040 // doesn't handle function prototypes correctly. | 4063 // doesn't handle function prototypes correctly. |
4041 Handle<Object> JSObject::SetLocalPropertyIgnoreAttributes( | 4064 Handle<Object> JSObject::SetLocalPropertyIgnoreAttributes( |
4042 Handle<JSObject> object, | 4065 Handle<JSObject> object, |
4043 Handle<Name> key, | 4066 Handle<Name> key, |
4044 Handle<Object> value, | 4067 Handle<Object> value, |
4045 PropertyAttributes attributes, | 4068 PropertyAttributes attributes, |
4046 ValueType value_type, | 4069 ValueType value_type, |
4047 StoreMode mode) { | 4070 StoreMode mode, |
| 4071 ExtensibilityCheck extensibility_check) { |
4048 CALL_HEAP_FUNCTION( | 4072 CALL_HEAP_FUNCTION( |
4049 object->GetIsolate(), | 4073 object->GetIsolate(), |
4050 object->SetLocalPropertyIgnoreAttributes( | 4074 object->SetLocalPropertyIgnoreAttributes( |
4051 *key, *value, attributes, value_type, mode), | 4075 *key, *value, attributes, value_type, mode, extensibility_check), |
4052 Object); | 4076 Object); |
4053 } | 4077 } |
4054 | 4078 |
4055 | 4079 |
4056 MaybeObject* JSObject::SetLocalPropertyIgnoreAttributes( | 4080 MaybeObject* JSObject::SetLocalPropertyIgnoreAttributes( |
4057 Name* name_raw, | 4081 Name* name_raw, |
4058 Object* value_raw, | 4082 Object* value_raw, |
4059 PropertyAttributes attributes, | 4083 PropertyAttributes attributes, |
4060 ValueType value_type, | 4084 ValueType value_type, |
4061 StoreMode mode, | 4085 StoreMode mode, |
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4944 // We were storing the identity hash inline and now allocated an actual | 4968 // We were storing the identity hash inline and now allocated an actual |
4945 // dictionary. Put the identity hash into the new dictionary. | 4969 // dictionary. Put the identity hash into the new dictionary. |
4946 MaybeObject* insert_result = | 4970 MaybeObject* insert_result = |
4947 hashtable->Put(GetHeap()->identity_hash_string(), inline_value); | 4971 hashtable->Put(GetHeap()->identity_hash_string(), inline_value); |
4948 ObjectHashTable* new_table; | 4972 ObjectHashTable* new_table; |
4949 if (!insert_result->To(&new_table)) return insert_result; | 4973 if (!insert_result->To(&new_table)) return insert_result; |
4950 // We expect no resizing for the first insert. | 4974 // We expect no resizing for the first insert. |
4951 ASSERT_EQ(hashtable, new_table); | 4975 ASSERT_EQ(hashtable, new_table); |
4952 } | 4976 } |
4953 | 4977 |
4954 MaybeObject* store_result = | 4978 MaybeObject* store_result = SetLocalPropertyIgnoreAttributesTrampoline( |
4955 SetLocalPropertyIgnoreAttributes(GetHeap()->hidden_string(), | 4979 GetHeap()->hidden_string(), |
4956 hashtable, | 4980 hashtable, |
4957 DONT_ENUM, | 4981 DONT_ENUM, |
4958 OPTIMAL_REPRESENTATION, | 4982 OPTIMAL_REPRESENTATION, |
4959 ALLOW_AS_CONSTANT, | 4983 ALLOW_AS_CONSTANT, |
4960 OMIT_EXTENSIBILITY_CHECK); | 4984 OMIT_EXTENSIBILITY_CHECK); |
4961 if (store_result->IsFailure()) return store_result; | 4985 if (store_result->IsFailure()) return store_result; |
4962 return hashtable; | 4986 return hashtable; |
4963 } | 4987 } |
4964 | 4988 |
4965 | 4989 |
4966 MaybeObject* JSObject::SetHiddenPropertiesHashTable(Object* value) { | 4990 MaybeObject* JSObject::SetHiddenPropertiesHashTable(Object* value) { |
4967 ASSERT(!IsJSGlobalProxy()); | 4991 ASSERT(!IsJSGlobalProxy()); |
4968 // We can store the identity hash inline iff there is no backing store | 4992 // We can store the identity hash inline iff there is no backing store |
4969 // for hidden properties yet. | 4993 // for hidden properties yet. |
4970 ASSERT(HasHiddenProperties() != value->IsSmi()); | 4994 ASSERT(HasHiddenProperties() != value->IsSmi()); |
4971 if (HasFastProperties()) { | 4995 if (HasFastProperties()) { |
4972 // If the object has fast properties, check whether the first slot | 4996 // If the object has fast properties, check whether the first slot |
4973 // in the descriptor array matches the hidden string. Since the | 4997 // in the descriptor array matches the hidden string. Since the |
4974 // hidden strings hash code is zero (and no other name has hash | 4998 // hidden strings hash code is zero (and no other name has hash |
4975 // code zero) it will always occupy the first entry if present. | 4999 // code zero) it will always occupy the first entry if present. |
4976 DescriptorArray* descriptors = this->map()->instance_descriptors(); | 5000 DescriptorArray* descriptors = this->map()->instance_descriptors(); |
4977 if (descriptors->number_of_descriptors() > 0) { | 5001 if (descriptors->number_of_descriptors() > 0) { |
4978 int sorted_index = descriptors->GetSortedKeyIndex(0); | 5002 int sorted_index = descriptors->GetSortedKeyIndex(0); |
4979 if (descriptors->GetKey(sorted_index) == GetHeap()->hidden_string() && | 5003 if (descriptors->GetKey(sorted_index) == GetHeap()->hidden_string() && |
4980 sorted_index < map()->NumberOfOwnDescriptors()) { | 5004 sorted_index < map()->NumberOfOwnDescriptors()) { |
4981 ASSERT(descriptors->GetType(sorted_index) == FIELD); | 5005 ASSERT(descriptors->GetType(sorted_index) == FIELD); |
4982 FastPropertyAtPut(descriptors->GetFieldIndex(sorted_index), value); | 5006 FastPropertyAtPut(descriptors->GetFieldIndex(sorted_index), value); |
4983 return this; | 5007 return this; |
4984 } | 5008 } |
4985 } | 5009 } |
4986 } | 5010 } |
4987 MaybeObject* store_result = | 5011 MaybeObject* store_result = SetLocalPropertyIgnoreAttributesTrampoline( |
4988 SetLocalPropertyIgnoreAttributes(GetHeap()->hidden_string(), | 5012 GetHeap()->hidden_string(), |
4989 value, | 5013 value, |
4990 DONT_ENUM, | 5014 DONT_ENUM, |
4991 OPTIMAL_REPRESENTATION, | 5015 OPTIMAL_REPRESENTATION, |
4992 ALLOW_AS_CONSTANT, | 5016 ALLOW_AS_CONSTANT, |
4993 OMIT_EXTENSIBILITY_CHECK); | 5017 OMIT_EXTENSIBILITY_CHECK); |
4994 if (store_result->IsFailure()) return store_result; | 5018 if (store_result->IsFailure()) return store_result; |
4995 return this; | 5019 return this; |
4996 } | 5020 } |
4997 | 5021 |
4998 | 5022 |
4999 Handle<Object> JSObject::DeletePropertyPostInterceptor(Handle<JSObject> object, | 5023 Handle<Object> JSObject::DeletePropertyPostInterceptor(Handle<JSObject> object, |
5000 Handle<Name> name, | 5024 Handle<Name> name, |
5001 DeleteMode mode) { | 5025 DeleteMode mode) { |
5002 // Check local property, ignore interceptor. | 5026 // Check local property, ignore interceptor. |
5003 Isolate* isolate = object->GetIsolate(); | 5027 Isolate* isolate = object->GetIsolate(); |
(...skipping 11049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16053 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16077 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16054 static const char* error_messages_[] = { | 16078 static const char* error_messages_[] = { |
16055 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16079 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16056 }; | 16080 }; |
16057 #undef ERROR_MESSAGES_TEXTS | 16081 #undef ERROR_MESSAGES_TEXTS |
16058 return error_messages_[reason]; | 16082 return error_messages_[reason]; |
16059 } | 16083 } |
16060 | 16084 |
16061 | 16085 |
16062 } } // namespace v8::internal | 16086 } } // namespace v8::internal |
OLD | NEW |