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

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

Issue 22852024: Track JS allocations as they arrive with no affection on performance when tracking is switched off (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix tracking flag + encode allocation type instead of calling different methods Created 7 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
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 3211 matching lines...) Expand 10 before | Expand all | Expand 10 after
3222 3222
3223 3223
3224 TEST(Regress169928) { 3224 TEST(Regress169928) {
3225 i::FLAG_allow_natives_syntax = true; 3225 i::FLAG_allow_natives_syntax = true;
3226 i::FLAG_crankshaft = false; 3226 i::FLAG_crankshaft = false;
3227 CcTest::InitializeVM(); 3227 CcTest::InitializeVM();
3228 Isolate* isolate = CcTest::i_isolate(); 3228 Isolate* isolate = CcTest::i_isolate();
3229 Factory* factory = isolate->factory(); 3229 Factory* factory = isolate->factory();
3230 v8::HandleScope scope(CcTest::isolate()); 3230 v8::HandleScope scope(CcTest::isolate());
3231 3231
3232 HeapObjectsTracker tracker;
3233
3232 // Some flags turn Scavenge collections into Mark-sweep collections 3234 // Some flags turn Scavenge collections into Mark-sweep collections
3233 // and hence are incompatible with this test case. 3235 // and hence are incompatible with this test case.
3234 if (FLAG_gc_global || FLAG_stress_compaction) return; 3236 if (FLAG_gc_global || FLAG_stress_compaction) return;
3235 3237
3236 // Prepare the environment 3238 // Prepare the environment
3237 CompileRun("function fastliteralcase(literal, value) {" 3239 CompileRun("function fastliteralcase(literal, value) {"
3238 " literal[0] = value;" 3240 " literal[0] = value;"
3239 " return literal;" 3241 " return literal;"
3240 "}" 3242 "}"
3241 "function get_standard_literal() {" 3243 "function get_standard_literal() {"
3242 " var literal = [1, 2, 3];" 3244 " var literal = [1, 2, 3];"
3243 " return literal;" 3245 " return literal;"
3244 "}" 3246 "}"
3245 "obj = fastliteralcase(get_standard_literal(), 1);" 3247 "obj = fastliteralcase(get_standard_literal(), 1);"
3246 "obj = fastliteralcase(get_standard_literal(), 1.5);" 3248 "obj = fastliteralcase(get_standard_literal(), 1.5);"
3247 "obj = fastliteralcase(get_standard_literal(), 2);"); 3249 "obj = fastliteralcase(get_standard_literal(), 2);");
3248 3250
3249 // prepare the heap 3251 // prepare the heap
3250 v8::Local<v8::String> mote_code_string = 3252 v8::Local<v8::String> mote_code_string =
3251 v8_str("fastliteralcase(mote, 2.5);"); 3253 v8_str("fastliteralcase(mote, 2.5);");
3252 3254
3253 v8::Local<v8::String> array_name = v8_str("mote"); 3255 v8::Local<v8::String> array_name = v8_str("mote");
3254 v8::Context::GetCurrent()->Global()->Set(array_name, v8::Int32::New(0)); 3256 v8::Context::GetCurrent()->Global()->Set(array_name, v8::Int32::New(0));
3255
yurys 2013/09/25 10:41:12 Revert this.
Alexandra Mikhaylova 2013/09/25 14:33:40 Done.
3256 // First make sure we flip spaces 3257 // First make sure we flip spaces
3257 CcTest::heap()->CollectGarbage(NEW_SPACE); 3258 CcTest::heap()->CollectGarbage(NEW_SPACE);
3258 3259
3259 // Allocate the object. 3260 // Allocate the object.
3260 Handle<FixedArray> array_data = factory->NewFixedArray(2, NOT_TENURED); 3261 Handle<FixedArray> array_data = factory->NewFixedArray(2, NOT_TENURED);
3261 array_data->set(0, Smi::FromInt(1)); 3262 array_data->set(0, Smi::FromInt(1));
3262 array_data->set(1, Smi::FromInt(2)); 3263 array_data->set(1, Smi::FromInt(2));
3263 3264
3264 AllocateAllButNBytes(CcTest::heap()->new_space(), 3265 AllocateAllButNBytes(CcTest::heap()->new_space(),
3265 JSArray::kSize + AllocationMemento::kSize + 3266 JSArray::kSize + AllocationMemento::kSize +
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
3440 " var a = new Array(n);" 3441 " var a = new Array(n);"
3441 " for (var i = 0; i < n; i += 100) a[i] = i;" 3442 " for (var i = 0; i < n; i += 100) a[i] = i;"
3442 "};" 3443 "};"
3443 "f(10 * 1024 * 1024);"); 3444 "f(10 * 1024 * 1024);");
3444 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); 3445 IncrementalMarking* marking = CcTest::heap()->incremental_marking();
3445 if (marking->IsStopped()) marking->Start(); 3446 if (marking->IsStopped()) marking->Start();
3446 // This big step should be sufficient to mark the whole array. 3447 // This big step should be sufficient to mark the whole array.
3447 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); 3448 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD);
3448 ASSERT(marking->IsComplete()); 3449 ASSERT(marking->IsComplete());
3449 } 3450 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698