OLD | NEW |
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 3158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3169 // number string cache. | 3169 // number string cache. |
3170 AllocateFullSizeNumberStringCache(); | 3170 AllocateFullSizeNumberStringCache(); |
3171 return; | 3171 return; |
3172 } | 3172 } |
3173 number_string_cache()->set(hash * 2, number); | 3173 number_string_cache()->set(hash * 2, number); |
3174 number_string_cache()->set(hash * 2 + 1, string); | 3174 number_string_cache()->set(hash * 2 + 1, string); |
3175 } | 3175 } |
3176 | 3176 |
3177 | 3177 |
3178 MaybeObject* Heap::NumberToString(Object* number, | 3178 MaybeObject* Heap::NumberToString(Object* number, |
3179 bool check_number_string_cache) { | 3179 bool check_number_string_cache, |
| 3180 PretenureFlag pretenure) { |
3180 isolate_->counters()->number_to_string_runtime()->Increment(); | 3181 isolate_->counters()->number_to_string_runtime()->Increment(); |
3181 if (check_number_string_cache) { | 3182 if (check_number_string_cache) { |
3182 Object* cached = GetNumberStringCache(number); | 3183 Object* cached = GetNumberStringCache(number); |
3183 if (cached != undefined_value()) { | 3184 if (cached != undefined_value()) { |
3184 return cached; | 3185 return cached; |
3185 } | 3186 } |
3186 } | 3187 } |
3187 | 3188 |
3188 char arr[100]; | 3189 char arr[100]; |
3189 Vector<char> buffer(arr, ARRAY_SIZE(arr)); | 3190 Vector<char> buffer(arr, ARRAY_SIZE(arr)); |
3190 const char* str; | 3191 const char* str; |
3191 if (number->IsSmi()) { | 3192 if (number->IsSmi()) { |
3192 int num = Smi::cast(number)->value(); | 3193 int num = Smi::cast(number)->value(); |
3193 str = IntToCString(num, buffer); | 3194 str = IntToCString(num, buffer); |
3194 } else { | 3195 } else { |
3195 double num = HeapNumber::cast(number)->value(); | 3196 double num = HeapNumber::cast(number)->value(); |
3196 str = DoubleToCString(num, buffer); | 3197 str = DoubleToCString(num, buffer); |
3197 } | 3198 } |
3198 | 3199 |
3199 Object* js_string; | 3200 Object* js_string; |
3200 MaybeObject* maybe_js_string = AllocateStringFromOneByte(CStrVector(str)); | 3201 MaybeObject* maybe_js_string = |
| 3202 AllocateStringFromOneByte(CStrVector(str), pretenure); |
3201 if (maybe_js_string->ToObject(&js_string)) { | 3203 if (maybe_js_string->ToObject(&js_string)) { |
3202 SetNumberStringCache(number, String::cast(js_string)); | 3204 SetNumberStringCache(number, String::cast(js_string)); |
3203 } | 3205 } |
3204 return maybe_js_string; | 3206 return maybe_js_string; |
3205 } | 3207 } |
3206 | 3208 |
3207 | 3209 |
3208 MaybeObject* Heap::Uint32ToString(uint32_t value, | 3210 MaybeObject* Heap::Uint32ToString(uint32_t value, |
3209 bool check_number_string_cache) { | 3211 bool check_number_string_cache) { |
3210 Object* number; | 3212 Object* number; |
(...skipping 4674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7885 if (FLAG_parallel_recompilation) { | 7887 if (FLAG_parallel_recompilation) { |
7886 heap_->relocation_mutex_->Lock(); | 7888 heap_->relocation_mutex_->Lock(); |
7887 #ifdef DEBUG | 7889 #ifdef DEBUG |
7888 heap_->relocation_mutex_locked_by_optimizer_thread_ = | 7890 heap_->relocation_mutex_locked_by_optimizer_thread_ = |
7889 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); | 7891 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); |
7890 #endif // DEBUG | 7892 #endif // DEBUG |
7891 } | 7893 } |
7892 } | 7894 } |
7893 | 7895 |
7894 } } // namespace v8::internal | 7896 } } // namespace v8::internal |
OLD | NEW |