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

Side by Side 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 8 years 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 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 9666 matching lines...) Expand 10 before | Expand all | Expand 10 after
9677 9677
9678 9678
9679 void Map::ZapPrototypeTransitions() { 9679 void Map::ZapPrototypeTransitions() {
9680 FixedArray* proto_transitions = GetPrototypeTransitions(); 9680 FixedArray* proto_transitions = GetPrototypeTransitions();
9681 MemsetPointer(proto_transitions->data_start(), 9681 MemsetPointer(proto_transitions->data_start(),
9682 GetHeap()->the_hole_value(), 9682 GetHeap()->the_hole_value(),
9683 proto_transitions->length()); 9683 proto_transitions->length());
9684 } 9684 }
9685 9685
9686 9686
9687 Handle<FixedArray> DependentCodes::Append(Handle<FixedArray> codes,
9688 Handle<Code> value) {
9689 int append_index = number_of_codes(*codes);
9690 if (append_index > 0 && code(*codes, append_index - 1) == *value) {
9691 // Do not append the code if it is already in the array.
9692 // It is sufficient to just check only the last element because
9693 // we process embedded maps of an optimized code in one batch.
9694 return codes;
9695 }
9696 if (codes->length() < kCodesOffset + append_index + 1) {
9697 Factory* factory = codes->GetIsolate()->factory();
9698 int capacity = kCodesOffset + append_index + 1;
9699 if (capacity > 5) capacity = capacity * 5 / 4;
9700 Handle<FixedArray> new_codes = factory->NewFixedArray(capacity);
9701 // The number of codes can change after GC.
9702 append_index = number_of_codes(*codes);
9703 set_number_of_codes(*new_codes, append_index + 1);
9704 for (int i = 0; i < append_index; i++) {
9705 set_code(*new_codes, i, code(*codes, i));
9706 clear_code(*codes, i);
9707 }
9708 set_code(*new_codes, append_index, *value);
9709 for (int i = append_index + 1; kCodesOffset + i < capacity; i++) {
9710 clear_code(*new_codes, i);
9711 }
9712 return new_codes;
9713 }
9714 set_code(*codes, append_index, *value);
9715 set_number_of_codes(*codes, append_index + 1);
9716 return codes;
9717 }
9718
9719
9687 MaybeObject* JSReceiver::SetPrototype(Object* value, 9720 MaybeObject* JSReceiver::SetPrototype(Object* value,
9688 bool skip_hidden_prototypes) { 9721 bool skip_hidden_prototypes) {
9689 #ifdef DEBUG 9722 #ifdef DEBUG
9690 int size = Size(); 9723 int size = Size();
9691 #endif 9724 #endif
9692 9725
9693 Heap* heap = GetHeap(); 9726 Heap* heap = GetHeap();
9694 // Silently ignore the change if value is not a JSObject or null. 9727 // Silently ignore the change if value is not a JSObject or null.
9695 // SpiderMonkey behaves this way. 9728 // SpiderMonkey behaves this way.
9696 if (!value->IsJSReceiver() && !value->IsNull()) return value; 9729 if (!value->IsJSReceiver() && !value->IsNull()) return value;
(...skipping 4330 matching lines...) Expand 10 before | Expand all | Expand 10 after
14027 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 14060 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
14028 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 14061 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
14029 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 14062 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
14030 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 14063 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
14031 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 14064 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
14032 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 14065 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
14033 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 14066 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
14034 } 14067 }
14035 14068
14036 } } // namespace v8::internal 14069 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698