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

Side by Side Diff: src/handles.cc

Issue 598020: Refactor prototype setting code and expose SetPrototype to public V8 API. (Closed)
Patch Set: Next round of Mad's comments Created 10 years, 10 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
« no previous file with comments | « src/handles.h ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 Object); 293 Object);
294 } 294 }
295 295
296 296
297 Handle<Object> GetPrototype(Handle<Object> obj) { 297 Handle<Object> GetPrototype(Handle<Object> obj) {
298 Handle<Object> result(obj->GetPrototype()); 298 Handle<Object> result(obj->GetPrototype());
299 return result; 299 return result;
300 } 300 }
301 301
302 302
303 Handle<Object> SetPrototype(Handle<JSObject> obj, Handle<Object> value) {
304 const bool skip_hidden_prototypes = false;
305 CALL_HEAP_FUNCTION(obj->SetPrototype(*value, skip_hidden_prototypes), Object);
306 }
307
308
303 Handle<Object> GetHiddenProperties(Handle<JSObject> obj, 309 Handle<Object> GetHiddenProperties(Handle<JSObject> obj,
304 bool create_if_needed) { 310 bool create_if_needed) {
305 Object* holder = obj->BypassGlobalProxy(); 311 Object* holder = obj->BypassGlobalProxy();
306 if (holder->IsUndefined()) return Factory::undefined_value(); 312 if (holder->IsUndefined()) return Factory::undefined_value();
307 obj = Handle<JSObject>(JSObject::cast(holder)); 313 obj = Handle<JSObject>(JSObject::cast(holder));
308 314
309 if (obj->HasFastProperties()) { 315 if (obj->HasFastProperties()) {
310 // If the object has fast properties, check whether the first slot 316 // If the object has fast properties, check whether the first slot
311 // in the descriptor array matches the hidden symbol. Since the 317 // in the descriptor array matches the hidden symbol. Since the
312 // hidden symbols hash code is zero (and no other string has hash 318 // hidden symbols hash code is zero (and no other string has hash
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 Handle<Map> new_map = Factory::CopyMapDropTransitions(old_map); 828 Handle<Map> new_map = Factory::CopyMapDropTransitions(old_map);
823 obj->set_map(*new_map); 829 obj->set_map(*new_map);
824 new_map->set_needs_loading(true); 830 new_map->set_needs_loading(true);
825 // Store the lazy loading info in the constructor field. We'll 831 // Store the lazy loading info in the constructor field. We'll
826 // reestablish the constructor from the fixed array after loading. 832 // reestablish the constructor from the fixed array after loading.
827 new_map->set_constructor(*arr); 833 new_map->set_constructor(*arr);
828 ASSERT(!obj->IsLoaded()); 834 ASSERT(!obj->IsLoaded());
829 } 835 }
830 836
831 } } // namespace v8::internal 837 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/handles.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698