Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: src/objects.cc

Issue 352813002: Wrap InitializeProperty around SetOwnPropertyIgnoreAttributes and switch over uses (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/allocation-site-scopes.h" 8 #include "src/allocation-site-scopes.h"
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/arguments.h" 10 #include "src/arguments.h"
(...skipping 4157 matching lines...) Expand 10 before | Expand all | Expand 10 after
4168 EnqueueChangeRecord(object, "update", name, old_value); 4168 EnqueueChangeRecord(object, "update", name, old_value);
4169 } 4169 }
4170 } 4170 }
4171 } 4171 }
4172 } 4172 }
4173 4173
4174 return result; 4174 return result;
4175 } 4175 }
4176 4176
4177 4177
4178 void JSObject::InitializeProperty(
4179 Handle<JSObject> object,
4180 Handle<Name> name,
4181 Handle<Object> value,
4182 PropertyAttributes attributes,
4183 ValueType value_type,
4184 StoreMode store_mode) {
4185 #ifdef DEBUG
4186 uint32_t index;
4187 ASSERT(!object->IsJSProxy());
4188 ASSERT(!name->AsArrayIndex(&index));
4189 LookupIterator it(object, name, LookupIterator::CHECK_OWN_REAL);
4190 GetPropertyAttributes(&it);
4191 ASSERT(!it.IsFound());
4192 ASSERT(object->map()->is_extensible());
4193 #endif
4194 SetOwnPropertyIgnoreAttributes(
4195 object, name, value, attributes, value_type, store_mode,
4196 OMIT_EXTENSIBILITY_CHECK).Check();
4197 }
4198
4199
4178 // Set a real own property, even if it is READ_ONLY. If the property is not 4200 // Set a real own property, even if it is READ_ONLY. If the property is not
4179 // present, add it with attributes NONE. This code is an exact clone of 4201 // present, add it with attributes NONE. This code is an exact clone of
4180 // SetProperty, with the check for IsReadOnly and the check for a 4202 // SetProperty, with the check for IsReadOnly and the check for a
4181 // callback setter removed. The two lines looking up the LookupResult 4203 // callback setter removed. The two lines looking up the LookupResult
4182 // result are also added. If one of the functions is changed, the other 4204 // result are also added. If one of the functions is changed, the other
4183 // should be. 4205 // should be.
4184 MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes( 4206 MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes(
4185 Handle<JSObject> object, 4207 Handle<JSObject> object,
4186 Handle<Name> name, 4208 Handle<Name> name,
4187 Handle<Object> value, 4209 Handle<Object> value,
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
5140 5162
5141 if (inline_value->IsSmi()) { 5163 if (inline_value->IsSmi()) {
5142 // We were storing the identity hash inline and now allocated an actual 5164 // We were storing the identity hash inline and now allocated an actual
5143 // dictionary. Put the identity hash into the new dictionary. 5165 // dictionary. Put the identity hash into the new dictionary.
5144 hashtable = ObjectHashTable::Put(hashtable, 5166 hashtable = ObjectHashTable::Put(hashtable,
5145 isolate->factory()->identity_hash_string(), 5167 isolate->factory()->identity_hash_string(),
5146 inline_value); 5168 inline_value);
5147 } 5169 }
5148 5170
5149 JSObject::SetOwnPropertyIgnoreAttributes( 5171 JSObject::SetOwnPropertyIgnoreAttributes(
5150 object, 5172 object, isolate->factory()->hidden_string(),
5151 isolate->factory()->hidden_string(), 5173 hashtable, DONT_ENUM).Assert();
5152 hashtable,
5153 DONT_ENUM,
5154 OPTIMAL_REPRESENTATION,
5155 ALLOW_AS_CONSTANT,
5156 OMIT_EXTENSIBILITY_CHECK).Assert();
5157 5174
5158 return hashtable; 5175 return hashtable;
5159 } 5176 }
5160 5177
5161 5178
5162 Handle<Object> JSObject::SetHiddenPropertiesHashTable(Handle<JSObject> object, 5179 Handle<Object> JSObject::SetHiddenPropertiesHashTable(Handle<JSObject> object,
5163 Handle<Object> value) { 5180 Handle<Object> value) {
5164 ASSERT(!object->IsJSGlobalProxy()); 5181 ASSERT(!object->IsJSGlobalProxy());
5165 5182
5166 Isolate* isolate = object->GetIsolate(); 5183 Isolate* isolate = object->GetIsolate();
(...skipping 11823 matching lines...) Expand 10 before | Expand all | Expand 10 after
16990 #define ERROR_MESSAGES_TEXTS(C, T) T, 17007 #define ERROR_MESSAGES_TEXTS(C, T) T,
16991 static const char* error_messages_[] = { 17008 static const char* error_messages_[] = {
16992 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 17009 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16993 }; 17010 };
16994 #undef ERROR_MESSAGES_TEXTS 17011 #undef ERROR_MESSAGES_TEXTS
16995 return error_messages_[reason]; 17012 return error_messages_[reason];
16996 } 17013 }
16997 17014
16998 17015
16999 } } // namespace v8::internal 17016 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698