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 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.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 9462 matching lines...) Expand 10 before | Expand all | Expand 10 after
9473 9473
9474 9474
9475 void Map::ZapPrototypeTransitions() { 9475 void Map::ZapPrototypeTransitions() {
9476 FixedArray* proto_transitions = GetPrototypeTransitions(); 9476 FixedArray* proto_transitions = GetPrototypeTransitions();
9477 MemsetPointer(proto_transitions->data_start(), 9477 MemsetPointer(proto_transitions->data_start(),
9478 GetHeap()->the_hole_value(), 9478 GetHeap()->the_hole_value(),
9479 proto_transitions->length()); 9479 proto_transitions->length());
9480 } 9480 }
9481 9481
9482 9482
9483 Handle<DependentCodes> DependentCodes::Append(Handle<DependentCodes> codes,
9484 Handle<Code> value) {
9485 int append_index = codes->number_of_codes();
9486 if (append_index > 0 && codes->code_at(append_index - 1) == *value) {
9487 // Do not append the code if it is already in the array.
9488 // It is sufficient to just check only the last element because
9489 // we process embedded maps of an optimized code in one batch.
9490 return codes;
9491 }
9492 if (codes->length() < kCodesIndex + append_index + 1) {
9493 Factory* factory = codes->GetIsolate()->factory();
9494 int capacity = kCodesIndex + append_index + 1;
9495 if (capacity > 5) capacity = capacity * 5 / 4;
9496 Handle<DependentCodes> new_codes = Handle<DependentCodes>::cast(
9497 factory->CopySizeFixedArray(codes, capacity));
9498 // The number of codes can change after GC.
9499 append_index = codes->number_of_codes();
9500 for (int i = 0; i < append_index; i++) {
9501 codes->clear_code_at(i);
9502 }
9503 codes = new_codes;
9504 }
9505 codes->set_code_at(append_index, *value);
9506 codes->set_number_of_codes(append_index + 1);
9507 return codes;
9508 }
9509
9510
9483 MaybeObject* JSReceiver::SetPrototype(Object* value, 9511 MaybeObject* JSReceiver::SetPrototype(Object* value,
9484 bool skip_hidden_prototypes) { 9512 bool skip_hidden_prototypes) {
9485 #ifdef DEBUG 9513 #ifdef DEBUG
9486 int size = Size(); 9514 int size = Size();
9487 #endif 9515 #endif
9488 9516
9489 Heap* heap = GetHeap(); 9517 Heap* heap = GetHeap();
9490 // Silently ignore the change if value is not a JSObject or null. 9518 // Silently ignore the change if value is not a JSObject or null.
9491 // SpiderMonkey behaves this way. 9519 // SpiderMonkey behaves this way.
9492 if (!value->IsJSReceiver() && !value->IsNull()) return value; 9520 if (!value->IsJSReceiver() && !value->IsNull()) return value;
(...skipping 4334 matching lines...) Expand 10 before | Expand all | Expand 10 after
13827 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 13855 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
13828 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 13856 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
13829 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 13857 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
13830 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 13858 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
13831 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 13859 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
13832 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 13860 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
13833 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 13861 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
13834 } 13862 }
13835 13863
13836 } } // namespace v8::internal 13864 } } // namespace v8::internal
OLDNEW
« 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