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

Side by Side Diff: src/heap.cc

Issue 132003002: Remove globale pretenuring mode from runtime. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 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/heap.h ('k') | src/runtime.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 3544 matching lines...) Expand 10 before | Expand all | Expand 10 after
3555 // number string cache. 3555 // number string cache.
3556 AllocateFullSizeNumberStringCache(); 3556 AllocateFullSizeNumberStringCache();
3557 return; 3557 return;
3558 } 3558 }
3559 number_string_cache()->set(hash * 2, number); 3559 number_string_cache()->set(hash * 2, number);
3560 number_string_cache()->set(hash * 2 + 1, string); 3560 number_string_cache()->set(hash * 2 + 1, string);
3561 } 3561 }
3562 3562
3563 3563
3564 MaybeObject* Heap::NumberToString(Object* number, 3564 MaybeObject* Heap::NumberToString(Object* number,
3565 bool check_number_string_cache, 3565 bool check_number_string_cache) {
3566 PretenureFlag pretenure) {
3567 isolate_->counters()->number_to_string_runtime()->Increment(); 3566 isolate_->counters()->number_to_string_runtime()->Increment();
3568 if (check_number_string_cache) { 3567 if (check_number_string_cache) {
3569 Object* cached = GetNumberStringCache(number); 3568 Object* cached = GetNumberStringCache(number);
3570 if (cached != undefined_value()) { 3569 if (cached != undefined_value()) {
3571 return cached; 3570 return cached;
3572 } 3571 }
3573 } 3572 }
3574 3573
3575 char arr[100]; 3574 char arr[100];
3576 Vector<char> buffer(arr, ARRAY_SIZE(arr)); 3575 Vector<char> buffer(arr, ARRAY_SIZE(arr));
3577 const char* str; 3576 const char* str;
3578 if (number->IsSmi()) { 3577 if (number->IsSmi()) {
3579 int num = Smi::cast(number)->value(); 3578 int num = Smi::cast(number)->value();
3580 str = IntToCString(num, buffer); 3579 str = IntToCString(num, buffer);
3581 } else { 3580 } else {
3582 double num = HeapNumber::cast(number)->value(); 3581 double num = HeapNumber::cast(number)->value();
3583 str = DoubleToCString(num, buffer); 3582 str = DoubleToCString(num, buffer);
3584 } 3583 }
3585 3584
3586 Object* js_string; 3585 Object* js_string;
3586
3587 // We tenure the allocated string since it is referenced from the
3588 // number-string cache which lives in the old space.
3587 MaybeObject* maybe_js_string = 3589 MaybeObject* maybe_js_string =
3588 AllocateStringFromOneByte(CStrVector(str), pretenure); 3590 AllocateStringFromOneByte(CStrVector(str), TENURED);
3589 if (maybe_js_string->ToObject(&js_string)) { 3591 if (maybe_js_string->ToObject(&js_string)) {
3590 SetNumberStringCache(number, String::cast(js_string)); 3592 SetNumberStringCache(number, String::cast(js_string));
3591 } 3593 }
3592 return maybe_js_string; 3594 return maybe_js_string;
3593 } 3595 }
3594 3596
3595 3597
3596 MaybeObject* Heap::Uint32ToString(uint32_t value, 3598 MaybeObject* Heap::Uint32ToString(uint32_t value,
3597 bool check_number_string_cache) { 3599 bool check_number_string_cache) {
3598 Object* number; 3600 Object* number;
(...skipping 4139 matching lines...) Expand 10 before | Expand all | Expand 10 after
7738 static_cast<int>(object_sizes_last_time_[index])); 7740 static_cast<int>(object_sizes_last_time_[index]));
7739 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 7741 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
7740 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7742 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7741 7743
7742 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7744 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7743 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7745 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7744 ClearObjectStats(); 7746 ClearObjectStats();
7745 } 7747 }
7746 7748
7747 } } // namespace v8::internal 7749 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698