Revision: 14095
Author: [email protected]
Date: Thu Mar 28 06:52:31 2013
Log: Always allocate symbols in old space.
Keys are expected to be tenured. This now not only includes internalized
strings, but also symbols.
[email protected]
BUG=
Review URL: https://chromiumcodereview.appspot.com/13158002
http://code.google.com/p/v8/source/detail?r=14095
Modified:
/branches/bleeding_edge/src/heap.cc
/branches/bleeding_edge/src/heap.h
/branches/bleeding_edge/test/mjsunit/harmony/symbols.js
=======================================
--- /branches/bleeding_edge/src/heap.cc Fri Mar 22 09:51:28 2013
+++ /branches/bleeding_edge/src/heap.cc Thu Mar 28 06:52:31 2013
@@ -5428,13 +5428,13 @@
}
-MaybeObject* Heap::AllocateSymbol(PretenureFlag pretenure) {
+MaybeObject* Heap::AllocateSymbol() {
// Statically ensure that it is safe to allocate symbols in paged spaces.
STATIC_ASSERT(Symbol::kSize <= Page::kNonCodeObjectAreaSize);
- AllocationSpace space = pretenure == TENURED ? OLD_POINTER_SPACE :
NEW_SPACE;
Object* result;
- MaybeObject* maybe = AllocateRaw(Symbol::kSize, space,
OLD_POINTER_SPACE);
+ MaybeObject* maybe =
+ AllocateRaw(Symbol::kSize, OLD_POINTER_SPACE, OLD_POINTER_SPACE);
if (!maybe->ToObject(&result)) return maybe;
HeapObject::cast(result)->set_map_no_write_barrier(symbol_map());
@@ -7470,6 +7470,9 @@
}
name = internalized_string;
}
+ // This cache is cleared only between mark compact passes, so we expect
the
+ // cache to only contain old space names.
+ ASSERT(!HEAP->InNewSpace(name));
int index = (Hash(map, name) & kHashMask);
// After a GC there will be free slots, so we use them in order (this may
=======================================
--- /branches/bleeding_edge/src/heap.h Fri Mar 22 09:33:50 2013
+++ /branches/bleeding_edge/src/heap.h Thu Mar 28 06:52:31 2013
@@ -882,12 +882,11 @@
void* external_pointer,
PretenureFlag pretenure);
- // Allocate a symbol.
+ // Allocate a symbol in old space.
// Returns Failure::RetryAfterGC(requested_bytes, space) if the
allocation
// failed.
// Please note this does not perform a garbage collection.
- MUST_USE_RESULT MaybeObject* AllocateSymbol(
- PretenureFlag pretenure = NOT_TENURED);
+ MUST_USE_RESULT MaybeObject* AllocateSymbol();
// Allocate a tenured JS global property cell.
// Returns Failure::RetryAfterGC(requested_bytes, space) if the
allocation
=======================================
--- /branches/bleeding_edge/test/mjsunit/harmony/symbols.js Thu Mar 28
05:01:46 2013
+++ /branches/bleeding_edge/test/mjsunit/harmony/symbols.js Thu Mar 28
06:52:31 2013
@@ -301,3 +301,19 @@
TestKeyDescriptor(obj)
TestKeyDelete(obj)
}
+
+
+function TestCachedKeyAfterScavenge() {
+ gc();
+ // Keyed property lookup are cached. Hereby we assume that the keys are
+ // tenured, so that we only have to clear the cache between mark
compacts,
+ // but not between scavenges. This must also apply for symbol keys.
+ var key = Symbol("key");
+ var a = {};
+ a[key] = "abc";
+
+ for (var i = 0; i < 1000000; i++) {
+ a[key] += "a"; // Allocations cause a scavenge.
+ }
+}
+TestCachedKeyAfterScavenge();
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.