| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 | 276 |
| 277 Object* Heap::PrepareForCompare(String* str) { | 277 Object* Heap::PrepareForCompare(String* str) { |
| 278 // Always flatten small strings and force flattening of long strings | 278 // Always flatten small strings and force flattening of long strings |
| 279 // after we have accumulated a certain amount we failed to flatten. | 279 // after we have accumulated a certain amount we failed to flatten. |
| 280 static const int kMaxAlwaysFlattenLength = 32; | 280 static const int kMaxAlwaysFlattenLength = 32; |
| 281 static const int kFlattenLongThreshold = 16*KB; | 281 static const int kFlattenLongThreshold = 16*KB; |
| 282 | 282 |
| 283 const int length = str->length(); | 283 const int length = str->length(); |
| 284 Object* obj = str->TryFlatten(); | 284 Object* obj = str->TryFlatten(); |
| 285 if (length <= kMaxAlwaysFlattenLength || | 285 if (length <= kMaxAlwaysFlattenLength || |
| 286 unflattended_strings_length_ >= kFlattenLongThreshold) { | 286 unflattened_strings_length_ >= kFlattenLongThreshold) { |
| 287 return obj; | 287 return obj; |
| 288 } | 288 } |
| 289 if (obj->IsFailure()) { | 289 if (obj->IsFailure()) { |
| 290 unflattended_strings_length_ += length; | 290 unflattened_strings_length_ += length; |
| 291 } | 291 } |
| 292 return str; | 292 return str; |
| 293 } | 293 } |
| 294 | 294 |
| 295 | 295 |
| 296 int Heap::AdjustAmountOfExternalAllocatedMemory(int change_in_bytes) { | 296 int Heap::AdjustAmountOfExternalAllocatedMemory(int change_in_bytes) { |
| 297 ASSERT(HasBeenSetup()); | 297 ASSERT(HasBeenSetup()); |
| 298 int amount = amount_of_external_allocated_memory_ + change_in_bytes; | 298 int amount = amount_of_external_allocated_memory_ + change_in_bytes; |
| 299 if (change_in_bytes >= 0) { | 299 if (change_in_bytes >= 0) { |
| 300 // Avoid overflow. | 300 // Avoid overflow. |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 | 434 |
| 435 | 435 |
| 436 void ExternalStringTable::ShrinkNewStrings(int position) { | 436 void ExternalStringTable::ShrinkNewStrings(int position) { |
| 437 new_space_strings_.Rewind(position); | 437 new_space_strings_.Rewind(position); |
| 438 Verify(); | 438 Verify(); |
| 439 } | 439 } |
| 440 | 440 |
| 441 } } // namespace v8::internal | 441 } } // namespace v8::internal |
| 442 | 442 |
| 443 #endif // V8_HEAP_INL_H_ | 443 #endif // V8_HEAP_INL_H_ |
| OLD | NEW |