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

Unified Diff: src/objects.cc

Issue 11575007: Make embedded maps in optimized code weak. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 1ef8f58f293f73341318838f7487ba49b60f46e9..0825b64c3367e5d2d92bcd5a8374b3ec616eef6e 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -9480,6 +9480,34 @@ void Map::ZapPrototypeTransitions() {
}
+Handle<DependentCodes> DependentCodes::Append(Handle<DependentCodes> codes,
+ Handle<Code> value) {
+ int append_index = codes->number_of_codes();
+ if (append_index > 0 && codes->code_at(append_index - 1) == *value) {
+ // Do not append the code if it is already in the array.
+ // It is sufficient to just check only the last element because
+ // we process embedded maps of an optimized code in one batch.
+ return codes;
+ }
+ if (codes->length() < kCodesIndex + append_index + 1) {
+ Factory* factory = codes->GetIsolate()->factory();
+ int capacity = kCodesIndex + append_index + 1;
+ if (capacity > 5) capacity = capacity * 5 / 4;
+ Handle<DependentCodes> new_codes = Handle<DependentCodes>::cast(
+ factory->CopySizeFixedArray(codes, capacity));
+ // The number of codes can change after GC.
+ append_index = codes->number_of_codes();
+ for (int i = 0; i < append_index; i++) {
+ codes->clear_code_at(i);
+ }
+ codes = new_codes;
+ }
+ codes->set_code_at(append_index, *value);
+ codes->set_number_of_codes(append_index + 1);
+ return codes;
+}
+
+
MaybeObject* JSReceiver::SetPrototype(Object* value,
bool skip_hidden_prototypes) {
#ifdef DEBUG
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698