| 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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 bool old = allocation_allowed_; | 471 bool old = allocation_allowed_; |
| 472 allocation_allowed_ = new_state; | 472 allocation_allowed_ = new_state; |
| 473 return old; | 473 return old; |
| 474 } | 474 } |
| 475 | 475 |
| 476 #endif | 476 #endif |
| 477 | 477 |
| 478 | 478 |
| 479 void ExternalStringTable::AddString(String* string) { | 479 void ExternalStringTable::AddString(String* string) { |
| 480 ASSERT(string->IsExternalString()); | 480 ASSERT(string->IsExternalString()); |
| 481 if (HEAP->InNewSpace(string)) { | 481 if (heap_->InNewSpace(string)) { |
| 482 new_space_strings_.Add(string); | 482 new_space_strings_.Add(string); |
| 483 } else { | 483 } else { |
| 484 old_space_strings_.Add(string); | 484 old_space_strings_.Add(string); |
| 485 } | 485 } |
| 486 } | 486 } |
| 487 | 487 |
| 488 | 488 |
| 489 void ExternalStringTable::Iterate(ObjectVisitor* v) { | 489 void ExternalStringTable::Iterate(ObjectVisitor* v) { |
| 490 if (!new_space_strings_.is_empty()) { | 490 if (!new_space_strings_.is_empty()) { |
| 491 Object** start = &new_space_strings_[0]; | 491 Object** start = &new_space_strings_[0]; |
| 492 v->VisitPointers(start, start + new_space_strings_.length()); | 492 v->VisitPointers(start, start + new_space_strings_.length()); |
| 493 } | 493 } |
| 494 if (!old_space_strings_.is_empty()) { | 494 if (!old_space_strings_.is_empty()) { |
| 495 Object** start = &old_space_strings_[0]; | 495 Object** start = &old_space_strings_[0]; |
| 496 v->VisitPointers(start, start + old_space_strings_.length()); | 496 v->VisitPointers(start, start + old_space_strings_.length()); |
| 497 } | 497 } |
| 498 } | 498 } |
| 499 | 499 |
| 500 | 500 |
| 501 // Verify() is inline to avoid ifdef-s around its calls in release | 501 // Verify() is inline to avoid ifdef-s around its calls in release |
| 502 // mode. | 502 // mode. |
| 503 void ExternalStringTable::Verify() { | 503 void ExternalStringTable::Verify() { |
| 504 #ifdef DEBUG | 504 #ifdef DEBUG |
| 505 for (int i = 0; i < new_space_strings_.length(); ++i) { | 505 for (int i = 0; i < new_space_strings_.length(); ++i) { |
| 506 ASSERT(HEAP->InNewSpace(new_space_strings_[i])); | 506 ASSERT(heap_->InNewSpace(new_space_strings_[i])); |
| 507 ASSERT(new_space_strings_[i] != HEAP->raw_unchecked_null_value()); | 507 ASSERT(new_space_strings_[i] != HEAP->raw_unchecked_null_value()); |
| 508 } | 508 } |
| 509 for (int i = 0; i < old_space_strings_.length(); ++i) { | 509 for (int i = 0; i < old_space_strings_.length(); ++i) { |
| 510 ASSERT(!HEAP->InNewSpace(old_space_strings_[i])); | 510 ASSERT(!heap_->InNewSpace(old_space_strings_[i])); |
| 511 ASSERT(old_space_strings_[i] != HEAP->raw_unchecked_null_value()); | 511 ASSERT(old_space_strings_[i] != HEAP->raw_unchecked_null_value()); |
| 512 } | 512 } |
| 513 #endif | 513 #endif |
| 514 } | 514 } |
| 515 | 515 |
| 516 | 516 |
| 517 void ExternalStringTable::AddOldString(String* string) { | 517 void ExternalStringTable::AddOldString(String* string) { |
| 518 ASSERT(string->IsExternalString()); | 518 ASSERT(string->IsExternalString()); |
| 519 ASSERT(!HEAP->InNewSpace(string)); | 519 ASSERT(!heap_->InNewSpace(string)); |
| 520 old_space_strings_.Add(string); | 520 old_space_strings_.Add(string); |
| 521 } | 521 } |
| 522 | 522 |
| 523 | 523 |
| 524 void ExternalStringTable::ShrinkNewStrings(int position) { | 524 void ExternalStringTable::ShrinkNewStrings(int position) { |
| 525 new_space_strings_.Rewind(position); | 525 new_space_strings_.Rewind(position); |
| 526 Verify(); | 526 Verify(); |
| 527 } | 527 } |
| 528 | 528 |
| 529 | 529 |
| 530 void Heap::ClearInstanceofCache() { | 530 void Heap::ClearInstanceofCache() { |
| 531 set_instanceof_cache_function(HEAP->the_hole_value()); | 531 set_instanceof_cache_function(the_hole_value()); |
| 532 } | 532 } |
| 533 | 533 |
| 534 | 534 |
| 535 Object* Heap::ToBoolean(bool condition) { | 535 Object* Heap::ToBoolean(bool condition) { |
| 536 return condition ? true_value() : false_value(); | 536 return condition ? true_value() : false_value(); |
| 537 } | 537 } |
| 538 | 538 |
| 539 | 539 |
| 540 void Heap::CompletelyClearInstanceofCache() { | 540 void Heap::CompletelyClearInstanceofCache() { |
| 541 set_instanceof_cache_map(the_hole_value()); | 541 set_instanceof_cache_map(the_hole_value()); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 #ifdef DEBUG | 590 #ifdef DEBUG |
| 591 UpdateLiveObjectCount(obj); | 591 UpdateLiveObjectCount(obj); |
| 592 #endif | 592 #endif |
| 593 obj->SetMark(); | 593 obj->SetMark(); |
| 594 } | 594 } |
| 595 | 595 |
| 596 | 596 |
| 597 } } // namespace v8::internal | 597 } } // namespace v8::internal |
| 598 | 598 |
| 599 #endif // V8_HEAP_INL_H_ | 599 #endif // V8_HEAP_INL_H_ |
| OLD | NEW |