OLD | NEW |
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 Loading... |
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( | |
996 CcTest::i_isolate()->native_context()->object_function()); | |
997 CHECK(object_ctor->has_initial_map()); | |
998 // Create a map with single inobject property. | 995 // Create a map with single inobject property. |
999 Handle<Map> my_map = Map::Create(object_ctor, 1); | 996 Handle<Map> my_map = Map::Create(CcTest::i_isolate(), 1); |
1000 int n_properties = my_map->inobject_properties(); | 997 int n_properties = my_map->inobject_properties(); |
1001 CHECK_GT(n_properties, 0); | 998 CHECK_GT(n_properties, 0); |
1002 | 999 |
1003 int object_size = my_map->instance_size(); | 1000 int object_size = my_map->instance_size(); |
1004 | 1001 |
1005 // Step 2: allocate a lot of objects so to almost fill new space: we need | 1002 // 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. | 1003 // just enough room to allocate JSObject and thus fill the newspace. |
1007 | 1004 |
1008 int allocation_amount = Min(FixedArray::kMaxSize, | 1005 int allocation_amount = Min(FixedArray::kMaxSize, |
1009 Page::kMaxRegularHeapObjectSize + kPointerSize); | 1006 Page::kMaxRegularHeapObjectSize + kPointerSize); |
(...skipping 3444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4454 | 4451 |
4455 | 4452 |
4456 TEST(Regress388880) { | 4453 TEST(Regress388880) { |
4457 i::FLAG_expose_gc = true; | 4454 i::FLAG_expose_gc = true; |
4458 CcTest::InitializeVM(); | 4455 CcTest::InitializeVM(); |
4459 v8::HandleScope scope(CcTest::isolate()); | 4456 v8::HandleScope scope(CcTest::isolate()); |
4460 Isolate* isolate = CcTest::i_isolate(); | 4457 Isolate* isolate = CcTest::i_isolate(); |
4461 Factory* factory = isolate->factory(); | 4458 Factory* factory = isolate->factory(); |
4462 Heap* heap = isolate->heap(); | 4459 Heap* heap = isolate->heap(); |
4463 | 4460 |
4464 Handle<Map> map1 = Map::Create(isolate->object_function(), 1); | 4461 Handle<Map> map1 = Map::Create(isolate, 1); |
4465 Handle<Map> map2 = | 4462 Handle<Map> map2 = |
4466 Map::CopyWithField(map1, factory->NewStringFromStaticChars("foo"), | 4463 Map::CopyWithField(map1, factory->NewStringFromStaticChars("foo"), |
4467 HeapType::Any(isolate), NONE, Representation::Tagged(), | 4464 HeapType::Any(isolate), NONE, Representation::Tagged(), |
4468 OMIT_TRANSITION).ToHandleChecked(); | 4465 OMIT_TRANSITION).ToHandleChecked(); |
4469 | 4466 |
4470 int desired_offset = Page::kPageSize - map1->instance_size(); | 4467 int desired_offset = Page::kPageSize - map1->instance_size(); |
4471 | 4468 |
4472 // Allocate fixed array in old pointer space so, that object allocated | 4469 // Allocate fixed array in old pointer space so, that object allocated |
4473 // afterwards would end at the end of the page. | 4470 // afterwards would end at the end of the page. |
4474 { | 4471 { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4508 #ifdef DEBUG | 4505 #ifdef DEBUG |
4509 TEST(PathTracer) { | 4506 TEST(PathTracer) { |
4510 CcTest::InitializeVM(); | 4507 CcTest::InitializeVM(); |
4511 v8::HandleScope scope(CcTest::isolate()); | 4508 v8::HandleScope scope(CcTest::isolate()); |
4512 | 4509 |
4513 v8::Local<v8::Value> result = CompileRun("'abc'"); | 4510 v8::Local<v8::Value> result = CompileRun("'abc'"); |
4514 Handle<Object> o = v8::Utils::OpenHandle(*result); | 4511 Handle<Object> o = v8::Utils::OpenHandle(*result); |
4515 CcTest::i_isolate()->heap()->TracePathToObject(*o); | 4512 CcTest::i_isolate()->heap()->TracePathToObject(*o); |
4516 } | 4513 } |
4517 #endif // DEBUG | 4514 #endif // DEBUG |
OLD | NEW |