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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 unflattened_strings_length_ >= kFlattenLongThreshold) { | 453 unflattened_strings_length_ >= kFlattenLongThreshold) { |
454 return obj; | 454 return obj; |
455 } | 455 } |
456 if (obj->IsFailure()) { | 456 if (obj->IsFailure()) { |
457 unflattened_strings_length_ += length; | 457 unflattened_strings_length_ += length; |
458 } | 458 } |
459 return str; | 459 return str; |
460 } | 460 } |
461 | 461 |
462 | 462 |
463 int Heap::AdjustAmountOfExternalAllocatedMemory(int change_in_bytes) { | 463 intptr_t Heap::AdjustAmountOfExternalAllocatedMemory( |
| 464 intptr_t change_in_bytes) { |
464 ASSERT(HasBeenSetUp()); | 465 ASSERT(HasBeenSetUp()); |
465 int amount = amount_of_external_allocated_memory_ + change_in_bytes; | 466 intptr_t amount = amount_of_external_allocated_memory_ + change_in_bytes; |
466 if (change_in_bytes >= 0) { | 467 if (change_in_bytes >= 0) { |
467 // Avoid overflow. | 468 // Avoid overflow. |
468 if (amount > amount_of_external_allocated_memory_) { | 469 if (amount > amount_of_external_allocated_memory_) { |
469 amount_of_external_allocated_memory_ = amount; | 470 amount_of_external_allocated_memory_ = amount; |
470 } | 471 } |
471 int amount_since_last_global_gc = | 472 intptr_t amount_since_last_global_gc = |
472 amount_of_external_allocated_memory_ - | 473 amount_of_external_allocated_memory_ - |
473 amount_of_external_allocated_memory_at_last_global_gc_; | 474 amount_of_external_allocated_memory_at_last_global_gc_; |
474 if (amount_since_last_global_gc > external_allocation_limit_) { | 475 if (amount_since_last_global_gc > external_allocation_limit_) { |
475 CollectAllGarbage(kNoGCFlags, "external memory allocation limit reached"); | 476 CollectAllGarbage(kNoGCFlags, "external memory allocation limit reached"); |
476 } | 477 } |
477 } else { | 478 } else { |
478 // Avoid underflow. | 479 // Avoid underflow. |
479 if (amount >= 0) { | 480 if (amount >= 0) { |
480 amount_of_external_allocated_memory_ = amount; | 481 amount_of_external_allocated_memory_ = amount; |
481 } | 482 } |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 AssertNoAllocation::~AssertNoAllocation() { } | 784 AssertNoAllocation::~AssertNoAllocation() { } |
784 DisableAssertNoAllocation::DisableAssertNoAllocation() { } | 785 DisableAssertNoAllocation::DisableAssertNoAllocation() { } |
785 DisableAssertNoAllocation::~DisableAssertNoAllocation() { } | 786 DisableAssertNoAllocation::~DisableAssertNoAllocation() { } |
786 | 787 |
787 #endif | 788 #endif |
788 | 789 |
789 | 790 |
790 } } // namespace v8::internal | 791 } } // namespace v8::internal |
791 | 792 |
792 #endif // V8_HEAP_INL_H_ | 793 #endif // V8_HEAP_INL_H_ |
OLD | NEW |