MaybeObject* Heap::NumberToString(Object* number,
- bool check_number_string_cache,
- PretenureFlag pretenure) {
+ bool check_number_string_cache) {
isolate_->counters()->number_to_string_runtime()->Increment();
if (check_number_string_cache) {
Object* cached = GetNumberStringCache(number);
}
Object* js_string;
+
+ // We tenure the allocated string since it is referenced from the
+ // number-string cache which lives in the old space.
MaybeObject* maybe_js_string =
- AllocateStringFromOneByte(CStrVector(str), pretenure);
+ AllocateStringFromOneByte(CStrVector(str), TENURED);
if (maybe_js_string->ToObject(&js_string)) {
SetNumberStringCache(number, String::cast(js_string));
}
bool RootCanBeTreatedAsConstant(RootListIndex root_index);
MUST_USE_RESULT MaybeObject* NumberToString(
- Object* number, bool check_number_string_cache = true,
- PretenureFlag pretenure = NOT_TENURED);
+ Object* number, bool check_number_string_cache = true);
MUST_USE_RESULT MaybeObject* Uint32ToString(
uint32_t value, bool check_number_string_cache = true);
constant_properties,
&is_result_from_cache);
+ PretenureFlag pretenure_flag =
+ isolate->heap()->InNewSpace(*literals) ? NOT_TENURED : TENURED;
+
Handle<JSObject> boilerplate =
- isolate->factory()->NewJSObjectFromMap(
- map, isolate->heap()->GetPretenureMode());
+ isolate->factory()->NewJSObjectFromMap(map, pretenure_flag);
// Normalize the elements of the boilerplate to save space if needed.
if (!should_have_fast_elements) JSObject::NormalizeElements(boilerplate);
Handle<JSFunction> constructor(
JSFunction::NativeContextFromLiterals(*literals)->array_function());
+ PretenureFlag pretenure_flag =
+ isolate->heap()->InNewSpace(*literals) ? NOT_TENURED : TENURED;
+
Handle<JSArray> object = Handle<JSArray>::cast(
- isolate->factory()->NewJSObject(
- constructor, isolate->heap()->GetPretenureMode()));
+ isolate->factory()->NewJSObject(constructor, pretenure_flag));
ElementsKind constant_elements_kind =
static_cast<ElementsKind>(Smi::cast(elements->get(0))->value());
Object* number = args[0];
RUNTIME_ASSERT(number->IsNumber());
- return isolate->heap()->NumberToString(
- number, false, isolate->heap()->GetPretenureMode());
+ return isolate->heap()->NumberToString(number, false);
}