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

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

Issue 218633014: Replace CopyMap(constructor->initial_map()) by Map::Create(constructor) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 965
966 static int LenFromSize(int size) { 966 static int LenFromSize(int size) {
967 return (size - FixedArray::kHeaderSize) / kPointerSize; 967 return (size - FixedArray::kHeaderSize) / kPointerSize;
968 } 968 }
969 969
970 970
971 TEST(Regression39128) { 971 TEST(Regression39128) {
972 // Test case for crbug.com/39128. 972 // Test case for crbug.com/39128.
973 CcTest::InitializeVM(); 973 CcTest::InitializeVM();
974 Isolate* isolate = CcTest::i_isolate(); 974 Isolate* isolate = CcTest::i_isolate();
975 Factory* factory = isolate->factory();
976 Heap* heap = isolate->heap(); 975 Heap* heap = isolate->heap();
977 976
978 // Increase the chance of 'bump-the-pointer' allocation in old space. 977 // Increase the chance of 'bump-the-pointer' allocation in old space.
979 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); 978 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
980 979
981 v8::HandleScope scope(CcTest::isolate()); 980 v8::HandleScope scope(CcTest::isolate());
982 981
983 // The plan: create JSObject which references objects in new space. 982 // The plan: create JSObject which references objects in new space.
984 // Then clone this object (forcing it to go into old space) and check 983 // Then clone this object (forcing it to go into old space) and check
985 // that region dirty marks are updated correctly. 984 // that region dirty marks are updated correctly.
986 985
987 // Step 1: prepare a map for the object. We add 1 inobject property to it. 986 // Step 1: prepare a map for the object. We add 1 inobject property to it.
988 Handle<JSFunction> object_ctor( 987 Handle<JSFunction> object_ctor(
989 CcTest::i_isolate()->native_context()->object_function()); 988 CcTest::i_isolate()->native_context()->object_function());
990 CHECK(object_ctor->has_initial_map()); 989 CHECK(object_ctor->has_initial_map());
991 Handle<Map> object_map(object_ctor->initial_map());
992 // Create a map with single inobject property. 990 // Create a map with single inobject property.
993 Handle<Map> my_map = factory->CopyMap(object_map, 1); 991 Handle<Map> my_map = Map::Create(object_ctor, 1);
994 int n_properties = my_map->inobject_properties(); 992 int n_properties = my_map->inobject_properties();
995 CHECK_GT(n_properties, 0); 993 CHECK_GT(n_properties, 0);
996 994
997 int object_size = my_map->instance_size(); 995 int object_size = my_map->instance_size();
998 996
999 // Step 2: allocate a lot of objects so to almost fill new space: we need 997 // Step 2: allocate a lot of objects so to almost fill new space: we need
1000 // just enough room to allocate JSObject and thus fill the newspace. 998 // just enough room to allocate JSObject and thus fill the newspace.
1001 999
1002 int allocation_amount = Min(FixedArray::kMaxSize, 1000 int allocation_amount = Min(FixedArray::kMaxSize,
1003 Page::kMaxRegularHeapObjectSize + kPointerSize); 1001 Page::kMaxRegularHeapObjectSize + kPointerSize);
(...skipping 2931 matching lines...) Expand 10 before | Expand all | Expand 10 after
3935 v8::Context::Scope cscope(context); 3933 v8::Context::Scope cscope(context);
3936 3934
3937 v8::Local<v8::Value> result = CompileRun( 3935 v8::Local<v8::Value> result = CompileRun(
3938 "var locals = '';" 3936 "var locals = '';"
3939 "for (var i = 0; i < 512; i++) locals += 'var v' + i + '= 42;';" 3937 "for (var i = 0; i < 512; i++) locals += 'var v' + i + '= 42;';"
3940 "eval('function f() {' + locals + 'return function() { return v0; }; }');" 3938 "eval('function f() {' + locals + 'return function() { return v0; }; }');"
3941 "interrupt();" // This triggers a fake stack overflow in f. 3939 "interrupt();" // This triggers a fake stack overflow in f.
3942 "f()()"); 3940 "f()()");
3943 CHECK_EQ(42.0, result->ToNumber()->Value()); 3941 CHECK_EQ(42.0, result->ToNumber()->Value());
3944 } 3942 }
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