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

Side by Side Diff: test/cctest/test-heap.cc

Issue 9195008: Fix prototype transition clearing during full GC. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Vyacheslav Egorov. Created 8 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/mark-compact.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 2
3 #include <stdlib.h> 3 #include <stdlib.h>
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "execution.h" 7 #include "execution.h"
8 #include "factory.h" 8 #include "factory.h"
9 #include "macro-assembler.h" 9 #include "macro-assembler.h"
10 #include "global-handles.h" 10 #include "global-handles.h"
(...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 v8::HandleScope scope; 1565 v8::HandleScope scope;
1566 v8::Handle<v8::Object> global = v8::Context::GetCurrent()->Global(); 1566 v8::Handle<v8::Object> global = v8::Context::GetCurrent()->Global();
1567 v8::Handle<v8::Function> g = 1567 v8::Handle<v8::Function> g =
1568 v8::Handle<v8::Function>::Cast(global->Get(v8_str("g"))); 1568 v8::Handle<v8::Function>::Cast(global->Get(v8_str("g")));
1569 g->Call(global, 0, NULL); 1569 g->Call(global, 0, NULL);
1570 } 1570 }
1571 1571
1572 HEAP->incremental_marking()->set_should_hurry(true); 1572 HEAP->incremental_marking()->set_should_hurry(true);
1573 HEAP->CollectGarbage(OLD_POINTER_SPACE); 1573 HEAP->CollectGarbage(OLD_POINTER_SPACE);
1574 } 1574 }
1575
1576
1577 TEST(PrototypeTransitionClearing) {
1578 InitializeVM();
1579 v8::HandleScope scope;
1580
1581 CompileRun(
1582 "var base = {};"
1583 "var live = [];"
1584 "for (var i = 0; i < 10; i++) {"
1585 " var object = {};"
1586 " var prototype = {};"
1587 " object.__proto__ = prototype;"
1588 " if (i >= 3) live.push(object, prototype);"
1589 "}");
1590
1591 Handle<JSObject> baseObject =
1592 v8::Utils::OpenHandle(
1593 *v8::Handle<v8::Object>::Cast(
1594 v8::Context::GetCurrent()->Global()->Get(v8_str("base"))));
1595
1596 // Verify that only dead prototype transitions are cleared.
1597 CHECK_EQ(10, baseObject->map()->NumberOfProtoTransitions());
1598 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
1599 CHECK_EQ(10 - 3, baseObject->map()->NumberOfProtoTransitions());
1600
1601 // Verify that prototype transitions array was compacted.
1602 FixedArray* trans = baseObject->map()->prototype_transitions();
1603 for (int i = 0; i < 10 - 3; i++) {
1604 int j = Map::kProtoTransitionHeaderSize +
1605 i * Map::kProtoTransitionElementsPerEntry;
1606 CHECK(trans->get(j + Map::kProtoTransitionMapOffset)->IsMap());
1607 CHECK(trans->get(j + Map::kProtoTransitionPrototypeOffset)->IsJSObject());
1608 }
1609 }
OLDNEW
« no previous file with comments | « src/mark-compact.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698