Reviewers: rossberg,

Description:
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=


Please review this at https://chromiumcodereview.appspot.com/13158002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/heap.h
  M src/heap.cc
  M test/mjsunit/harmony/symbols.js


Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index 7c9a7fd63262f5168bb33482c456e6cf0bf3f6e7..ebf9c08b9f8da6623a9b0b846f369ce8201b41ce 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -5428,10 +5428,10 @@ MaybeObject* Heap::AllocateHashTable(int length, PretenureFlag pretenure) {
 }


-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;
+  AllocationSpace space = OLD_POINTER_SPACE;

   Object* result;
MaybeObject* maybe = AllocateRaw(Symbol::kSize, space, OLD_POINTER_SPACE);
Index: src/heap.h
diff --git a/src/heap.h b/src/heap.h
index 7a1d3c577ebeed2b3418001cb91fea4d07ff8fef..8992e318e274e5b79be10a3480f9ad0f528205af 100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -882,12 +882,11 @@ class Heap {
       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
Index: test/mjsunit/harmony/symbols.js
diff --git a/test/mjsunit/harmony/symbols.js b/test/mjsunit/harmony/symbols.js index c2002e6ac7298a24fa46d70a1ba57f06177d3905..16783e27276dcaa0a15a67de46eb0c7a7ffd5c0f 100644
--- a/test/mjsunit/harmony/symbols.js
+++ b/test/mjsunit/harmony/symbols.js
@@ -301,3 +301,12 @@ for (var i in objs) {
   TestKeyDescriptor(obj)
   TestKeyDelete(obj)
 }
+
+
+var key = Symbol("key");
+var a = {};
+a[key] = "abc";
+
+for (var i = 0; i < 1000000; i++) {
+  a[key] += "a";
+}


--
--
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.


Reply via email to