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

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

Issue 1138643005: Clean-up aligned allocation logic. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « test/cctest/cctest.h ('k') | test/cctest/test-spaces.cc » ('j') | 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 3961 matching lines...) Expand 10 before | Expand all | Expand 10 after
3972 Handle<JSArray> array = factory->NewJSArrayWithElements(array_data, 3972 Handle<JSArray> array = factory->NewJSArrayWithElements(array_data,
3973 FAST_SMI_ELEMENTS, 3973 FAST_SMI_ELEMENTS,
3974 NOT_TENURED); 3974 NOT_TENURED);
3975 3975
3976 CHECK_EQ(Smi::FromInt(2), array->length()); 3976 CHECK_EQ(Smi::FromInt(2), array->length());
3977 CHECK(array->HasFastSmiOrObjectElements()); 3977 CHECK(array->HasFastSmiOrObjectElements());
3978 3978
3979 // We need filler the size of AllocationMemento object, plus an extra 3979 // We need filler the size of AllocationMemento object, plus an extra
3980 // fill pointer value. 3980 // fill pointer value.
3981 HeapObject* obj = NULL; 3981 HeapObject* obj = NULL;
3982 AllocationResult allocation = CcTest::heap()->new_space()->AllocateRaw( 3982 AllocationResult allocation =
3983 AllocationMemento::kSize + kPointerSize); 3983 CcTest::heap()->new_space()->AllocateRawUnaligned(
3984 AllocationMemento::kSize + kPointerSize);
3984 CHECK(allocation.To(&obj)); 3985 CHECK(allocation.To(&obj));
3985 Address addr_obj = obj->address(); 3986 Address addr_obj = obj->address();
3986 CcTest::heap()->CreateFillerObjectAt( 3987 CcTest::heap()->CreateFillerObjectAt(
3987 addr_obj, AllocationMemento::kSize + kPointerSize); 3988 addr_obj, AllocationMemento::kSize + kPointerSize);
3988 3989
3989 // Give the array a name, making sure not to allocate strings. 3990 // Give the array a name, making sure not to allocate strings.
3990 v8::Handle<v8::Object> array_obj = v8::Utils::ToLocal(array); 3991 v8::Handle<v8::Object> array_obj = v8::Utils::ToLocal(array);
3991 CcTest::global()->Set(array_name, array_obj); 3992 CcTest::global()->Set(array_name, array_obj);
3992 3993
3993 // This should crash with a protection violation if we are running a build 3994 // This should crash with a protection violation if we are running a build
(...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after
5476 shared.SetWeak(&shared, SharedHasBeenCollected, 5477 shared.SetWeak(&shared, SharedHasBeenCollected,
5477 v8::WeakCallbackType::kParameter); 5478 v8::WeakCallbackType::kParameter);
5478 builtin_exports.SetWeak(&builtin_exports, BuiltinExportsHasBeenCollected, 5479 builtin_exports.SetWeak(&builtin_exports, BuiltinExportsHasBeenCollected,
5479 v8::WeakCallbackType::kParameter); 5480 v8::WeakCallbackType::kParameter);
5480 5481
5481 CcTest::heap()->CollectAllAvailableGarbage("fire weak callbacks"); 5482 CcTest::heap()->CollectAllAvailableGarbage("fire weak callbacks");
5482 5483
5483 CHECK(shared_has_been_collected); 5484 CHECK(shared_has_been_collected);
5484 CHECK(builtin_exports_has_been_collected); 5485 CHECK(builtin_exports_has_been_collected);
5485 } 5486 }
OLDNEW
« no previous file with comments | « test/cctest/cctest.h ('k') | test/cctest/test-spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698