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

Unified Diff: src/heap.cc

Issue 12427: Merge regexp2000 back into bleeding_edge (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 1 month 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
Index: src/heap.cc
===================================================================
--- src/heap.cc (revision 830)
+++ src/heap.cc (working copy)
@@ -392,8 +392,7 @@
}
Counters::objs_since_last_young.Set(0);
- // Process weak handles post gc.
- GlobalHandles::PostGarbageCollectionProcessing();
+ PostGarbageCollectionProcessing();
if (collector == MARK_COMPACTOR) {
// Register the amount of external allocated memory.
@@ -408,6 +407,14 @@
}
+void Heap::PostGarbageCollectionProcessing() {
+ // Process weak handles post gc.
+ GlobalHandles::PostGarbageCollectionProcessing();
+ // Update flat string readers.
+ FlatStringReader::PostGarbageCollectionProcessing();
+}
+
+
void Heap::MarkCompact(GCTracer* tracer) {
gc_state_ = MARK_COMPACT;
mc_count_++;
@@ -1582,6 +1589,24 @@
}
+Object* Heap::AllocateByteArray(int length, PretenureFlag pretenure) {
+ if (pretenure == NOT_TENURED) {
+ return AllocateByteArray(length);
+ }
+ int size = ByteArray::SizeFor(length);
+ AllocationSpace space =
+ size > MaxHeapObjectSize() ? LO_SPACE : OLD_DATA_SPACE;
+
+ Object* result = AllocateRaw(size, space, OLD_DATA_SPACE);
+
+ if (result->IsFailure()) return result;
+
+ reinterpret_cast<Array*>(result)->set_map(byte_array_map());
+ reinterpret_cast<Array*>(result)->set_length(length);
+ return result;
+}
+
+
Object* Heap::AllocateByteArray(int length) {
int size = ByteArray::SizeFor(length);
AllocationSpace space =
@@ -1599,7 +1624,8 @@
Object* Heap::CreateCode(const CodeDesc& desc,
ScopeInfo<>* sinfo,
- Code::Flags flags) {
+ Code::Flags flags,
+ Code** self_reference) {
// Compute size
int body_size = RoundUp(desc.instr_size + desc.reloc_size, kObjectAlignment);
int sinfo_size = 0;
@@ -1622,7 +1648,16 @@
code->set_sinfo_size(sinfo_size);
code->set_flags(flags);
code->set_ic_flag(Code::IC_TARGET_IS_ADDRESS);
- code->CopyFrom(desc); // migrate generated code
+ // Allow self references to created code object.
+ if (self_reference != NULL) {
+ *self_reference = code;
+ }
+ // Migrate generated code.
+ // The generated code can contain Object** values (typically from handles)
+ // that are dereferenced during the copy to point directly to the actual heap
+ // objects. These pointers can include references to the code object itself,
+ // through the self_reference parameter.
+ code->CopyFrom(desc);
if (sinfo != NULL) sinfo->Serialize(code); // write scope info
#ifdef DEBUG

Powered by Google App Engine
This is Rietveld 408576698