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

Side by Side Diff: src/handles.cc

Issue 19594002: Handlify JSFunction::SetPrototype method. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Toon Verwaest. Created 7 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
« 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 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 if (func->has_initial_map()) { 162 if (func->has_initial_map()) {
163 Handle<Map> new_initial_map = 163 Handle<Map> new_initial_map =
164 func->GetIsolate()->factory()->CopyMap( 164 func->GetIsolate()->factory()->CopyMap(
165 Handle<Map>(func->initial_map())); 165 Handle<Map>(func->initial_map()));
166 new_initial_map->set_unused_property_fields(nof); 166 new_initial_map->set_unused_property_fields(nof);
167 func->set_initial_map(*new_initial_map); 167 func->set_initial_map(*new_initial_map);
168 } 168 }
169 } 169 }
170 170
171 171
172 void SetPrototypeProperty(Handle<JSFunction> func, Handle<JSObject> value) {
173 CALL_HEAP_FUNCTION_VOID(func->GetIsolate(),
174 func->SetPrototype(*value));
175 }
176
177
178 static int ExpectedNofPropertiesFromEstimate(int estimate) { 172 static int ExpectedNofPropertiesFromEstimate(int estimate) {
179 // If no properties are added in the constructor, they are more likely 173 // If no properties are added in the constructor, they are more likely
180 // to be added later. 174 // to be added later.
181 if (estimate == 0) estimate = 2; 175 if (estimate == 0) estimate = 2;
182 176
183 // We do not shrink objects that go into a snapshot (yet), so we adjust 177 // We do not shrink objects that go into a snapshot (yet), so we adjust
184 // the estimate conservatively. 178 // the estimate conservatively.
185 if (Serializer::enabled()) return estimate + 2; 179 if (Serializer::enabled()) return estimate + 2;
186 180
187 // Inobject slack tracking will reclaim redundant inobject space later, 181 // Inobject slack tracking will reclaim redundant inobject space later,
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 data->next = prev_next_; 909 data->next = prev_next_;
916 data->limit = prev_limit_; 910 data->limit = prev_limit_;
917 #ifdef DEBUG 911 #ifdef DEBUG
918 handles_detached_ = true; 912 handles_detached_ = true;
919 #endif 913 #endif
920 return deferred; 914 return deferred;
921 } 915 }
922 916
923 917
924 } } // namespace v8::internal 918 } } // 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