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

Side by Side Diff: src/heap-inl.h

Issue 8551006: Version 3.7.9. (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 years, 1 month 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.cc ('k') | src/hydrogen.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 result = cell_space_->AllocateRaw(size_in_bytes); 222 result = cell_space_->AllocateRaw(size_in_bytes);
223 } else { 223 } else {
224 ASSERT(MAP_SPACE == space); 224 ASSERT(MAP_SPACE == space);
225 result = map_space_->AllocateRaw(size_in_bytes); 225 result = map_space_->AllocateRaw(size_in_bytes);
226 } 226 }
227 if (result->IsFailure()) old_gen_exhausted_ = true; 227 if (result->IsFailure()) old_gen_exhausted_ = true;
228 return result; 228 return result;
229 } 229 }
230 230
231 231
232 MaybeObject* Heap::NumberFromInt32(int32_t value) { 232 MaybeObject* Heap::NumberFromInt32(
233 int32_t value, PretenureFlag pretenure) {
233 if (Smi::IsValid(value)) return Smi::FromInt(value); 234 if (Smi::IsValid(value)) return Smi::FromInt(value);
234 // Bypass NumberFromDouble to avoid various redundant checks. 235 // Bypass NumberFromDouble to avoid various redundant checks.
235 return AllocateHeapNumber(FastI2D(value)); 236 return AllocateHeapNumber(FastI2D(value), pretenure);
236 } 237 }
237 238
238 239
239 MaybeObject* Heap::NumberFromUint32(uint32_t value) { 240 MaybeObject* Heap::NumberFromUint32(
241 uint32_t value, PretenureFlag pretenure) {
240 if ((int32_t)value >= 0 && Smi::IsValid((int32_t)value)) { 242 if ((int32_t)value >= 0 && Smi::IsValid((int32_t)value)) {
241 return Smi::FromInt((int32_t)value); 243 return Smi::FromInt((int32_t)value);
242 } 244 }
243 // Bypass NumberFromDouble to avoid various redundant checks. 245 // Bypass NumberFromDouble to avoid various redundant checks.
244 return AllocateHeapNumber(FastUI2D(value)); 246 return AllocateHeapNumber(FastUI2D(value), pretenure);
245 } 247 }
246 248
247 249
248 void Heap::FinalizeExternalString(String* string) { 250 void Heap::FinalizeExternalString(String* string) {
249 ASSERT(string->IsExternalString()); 251 ASSERT(string->IsExternalString());
250 v8::String::ExternalStringResourceBase** resource_addr = 252 v8::String::ExternalStringResourceBase** resource_addr =
251 reinterpret_cast<v8::String::ExternalStringResourceBase**>( 253 reinterpret_cast<v8::String::ExternalStringResourceBase**>(
252 reinterpret_cast<byte*>(string) + 254 reinterpret_cast<byte*>(string) +
253 ExternalString::kResourceOffset - 255 ExternalString::kResourceOffset -
254 kHeapObjectTag); 256 kHeapObjectTag);
255 257
258 // Clear pointer cache.
259 ExternalString::cast(string)->clear_data_cache();
260
256 // Dispose of the C++ object if it has not already been disposed. 261 // Dispose of the C++ object if it has not already been disposed.
257 if (*resource_addr != NULL) { 262 if (*resource_addr != NULL) {
258 (*resource_addr)->Dispose(); 263 (*resource_addr)->Dispose();
259 } 264 }
260 265
261 // Clear the resource pointer in the string. 266 // Clear the resource pointer in the string.
262 *resource_addr = NULL; 267 *resource_addr = NULL;
263 } 268 }
264 269
265 270
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 706
702 707
703 Heap* _inline_get_heap_() { 708 Heap* _inline_get_heap_() {
704 return HEAP; 709 return HEAP;
705 } 710 }
706 711
707 712
708 } } // namespace v8::internal 713 } } // namespace v8::internal
709 714
710 #endif // V8_HEAP_INL_H_ 715 #endif // V8_HEAP_INL_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698