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

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

Issue 584943002: Make Map::Create always use the Object function, and remove the unused inobject properties (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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/runtime.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 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 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 // Increase the chance of 'bump-the-pointer' allocation in old space. 985 // Increase the chance of 'bump-the-pointer' allocation in old space.
986 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); 986 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
987 987
988 v8::HandleScope scope(CcTest::isolate()); 988 v8::HandleScope scope(CcTest::isolate());
989 989
990 // The plan: create JSObject which references objects in new space. 990 // The plan: create JSObject which references objects in new space.
991 // Then clone this object (forcing it to go into old space) and check 991 // Then clone this object (forcing it to go into old space) and check
992 // that region dirty marks are updated correctly. 992 // that region dirty marks are updated correctly.
993 993
994 // Step 1: prepare a map for the object. We add 1 inobject property to it. 994 // Step 1: prepare a map for the object. We add 1 inobject property to it.
995 Handle<JSFunction> object_ctor( 995 Handle<JSFunction> object_ctor(
Jakob Kummerow 2014/09/19 14:56:05 I think we can drop this variable entirely.
996 CcTest::i_isolate()->native_context()->object_function()); 996 CcTest::i_isolate()->native_context()->object_function());
997 CHECK(object_ctor->has_initial_map()); 997 CHECK(object_ctor->has_initial_map());
998 // Create a map with single inobject property. 998 // Create a map with single inobject property.
999 Handle<Map> my_map = Map::Create(object_ctor, 1); 999 Handle<Map> my_map = Map::Create(CcTest::i_isolate(), 1);
1000 int n_properties = my_map->inobject_properties(); 1000 int n_properties = my_map->inobject_properties();
1001 CHECK_GT(n_properties, 0); 1001 CHECK_GT(n_properties, 0);
1002 1002
1003 int object_size = my_map->instance_size(); 1003 int object_size = my_map->instance_size();
1004 1004
1005 // Step 2: allocate a lot of objects so to almost fill new space: we need 1005 // Step 2: allocate a lot of objects so to almost fill new space: we need
1006 // just enough room to allocate JSObject and thus fill the newspace. 1006 // just enough room to allocate JSObject and thus fill the newspace.
1007 1007
1008 int allocation_amount = Min(FixedArray::kMaxSize, 1008 int allocation_amount = Min(FixedArray::kMaxSize,
1009 Page::kMaxRegularHeapObjectSize + kPointerSize); 1009 Page::kMaxRegularHeapObjectSize + kPointerSize);
(...skipping 3444 matching lines...) Expand 10 before | Expand all | Expand 10 after
4454 4454
4455 4455
4456 TEST(Regress388880) { 4456 TEST(Regress388880) {
4457 i::FLAG_expose_gc = true; 4457 i::FLAG_expose_gc = true;
4458 CcTest::InitializeVM(); 4458 CcTest::InitializeVM();
4459 v8::HandleScope scope(CcTest::isolate()); 4459 v8::HandleScope scope(CcTest::isolate());
4460 Isolate* isolate = CcTest::i_isolate(); 4460 Isolate* isolate = CcTest::i_isolate();
4461 Factory* factory = isolate->factory(); 4461 Factory* factory = isolate->factory();
4462 Heap* heap = isolate->heap(); 4462 Heap* heap = isolate->heap();
4463 4463
4464 Handle<Map> map1 = Map::Create(isolate->object_function(), 1); 4464 Handle<Map> map1 = Map::Create(isolate, 1);
4465 Handle<Map> map2 = 4465 Handle<Map> map2 =
4466 Map::CopyWithField(map1, factory->NewStringFromStaticChars("foo"), 4466 Map::CopyWithField(map1, factory->NewStringFromStaticChars("foo"),
4467 HeapType::Any(isolate), NONE, Representation::Tagged(), 4467 HeapType::Any(isolate), NONE, Representation::Tagged(),
4468 OMIT_TRANSITION).ToHandleChecked(); 4468 OMIT_TRANSITION).ToHandleChecked();
4469 4469
4470 int desired_offset = Page::kPageSize - map1->instance_size(); 4470 int desired_offset = Page::kPageSize - map1->instance_size();
4471 4471
4472 // Allocate fixed array in old pointer space so, that object allocated 4472 // Allocate fixed array in old pointer space so, that object allocated
4473 // afterwards would end at the end of the page. 4473 // afterwards would end at the end of the page.
4474 { 4474 {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
4508 #ifdef DEBUG 4508 #ifdef DEBUG
4509 TEST(PathTracer) { 4509 TEST(PathTracer) {
4510 CcTest::InitializeVM(); 4510 CcTest::InitializeVM();
4511 v8::HandleScope scope(CcTest::isolate()); 4511 v8::HandleScope scope(CcTest::isolate());
4512 4512
4513 v8::Local<v8::Value> result = CompileRun("'abc'"); 4513 v8::Local<v8::Value> result = CompileRun("'abc'");
4514 Handle<Object> o = v8::Utils::OpenHandle(*result); 4514 Handle<Object> o = v8::Utils::OpenHandle(*result);
4515 CcTest::i_isolate()->heap()->TracePathToObject(*o); 4515 CcTest::i_isolate()->heap()->TracePathToObject(*o);
4516 } 4516 }
4517 #endif // DEBUG 4517 #endif // DEBUG
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698