OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 | 497 |
498 | 498 |
499 static inline void ExpectUndefined(const char* code) { | 499 static inline void ExpectUndefined(const char* code) { |
500 v8::Local<v8::Value> result = CompileRun(code); | 500 v8::Local<v8::Value> result = CompileRun(code); |
501 CHECK(result->IsUndefined()); | 501 CHECK(result->IsUndefined()); |
502 } | 502 } |
503 | 503 |
504 | 504 |
505 // Helper function that simulates a full new-space in the heap. | 505 // Helper function that simulates a full new-space in the heap. |
506 static inline bool FillUpOnePage(v8::internal::NewSpace* space) { | 506 static inline bool FillUpOnePage(v8::internal::NewSpace* space) { |
507 v8::internal::AllocationResult allocation = | 507 v8::internal::AllocationResult allocation = space->AllocateRawUnaligned( |
508 space->AllocateRaw(v8::internal::Page::kMaxRegularHeapObjectSize); | 508 v8::internal::Page::kMaxRegularHeapObjectSize); |
509 if (allocation.IsRetry()) return false; | 509 if (allocation.IsRetry()) return false; |
510 v8::internal::HeapObject* free_space = NULL; | 510 v8::internal::HeapObject* free_space = NULL; |
511 CHECK(allocation.To(&free_space)); | 511 CHECK(allocation.To(&free_space)); |
512 space->heap()->CreateFillerObjectAt( | 512 space->heap()->CreateFillerObjectAt( |
513 free_space->address(), v8::internal::Page::kMaxRegularHeapObjectSize); | 513 free_space->address(), v8::internal::Page::kMaxRegularHeapObjectSize); |
514 return true; | 514 return true; |
515 } | 515 } |
516 | 516 |
517 | 517 |
518 // Helper function that simulates a fill new-space in the heap. | 518 // Helper function that simulates a fill new-space in the heap. |
519 static inline void AllocateAllButNBytes(v8::internal::NewSpace* space, | 519 static inline void AllocateAllButNBytes(v8::internal::NewSpace* space, |
520 int extra_bytes) { | 520 int extra_bytes) { |
521 int space_remaining = static_cast<int>(*space->allocation_limit_address() - | 521 int space_remaining = static_cast<int>(*space->allocation_limit_address() - |
522 *space->allocation_top_address()); | 522 *space->allocation_top_address()); |
523 CHECK(space_remaining >= extra_bytes); | 523 CHECK(space_remaining >= extra_bytes); |
524 int new_linear_size = space_remaining - extra_bytes; | 524 int new_linear_size = space_remaining - extra_bytes; |
525 if (new_linear_size == 0) return; | 525 if (new_linear_size == 0) return; |
526 v8::internal::AllocationResult allocation = | 526 v8::internal::AllocationResult allocation = |
527 space->AllocateRaw(new_linear_size); | 527 space->AllocateRawUnaligned(new_linear_size); |
528 v8::internal::HeapObject* free_space = NULL; | 528 v8::internal::HeapObject* free_space = NULL; |
529 CHECK(allocation.To(&free_space)); | 529 CHECK(allocation.To(&free_space)); |
530 space->heap()->CreateFillerObjectAt(free_space->address(), new_linear_size); | 530 space->heap()->CreateFillerObjectAt(free_space->address(), new_linear_size); |
531 } | 531 } |
532 | 532 |
533 | 533 |
534 static inline void FillCurrentPage(v8::internal::NewSpace* space) { | 534 static inline void FillCurrentPage(v8::internal::NewSpace* space) { |
535 AllocateAllButNBytes(space, 0); | 535 AllocateAllButNBytes(space, 0); |
536 } | 536 } |
537 | 537 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 HandleAndZoneScope() {} | 616 HandleAndZoneScope() {} |
617 | 617 |
618 // Prefixing the below with main_ reduces a lot of naming clashes. | 618 // Prefixing the below with main_ reduces a lot of naming clashes. |
619 i::Zone* main_zone() { return &main_zone_; } | 619 i::Zone* main_zone() { return &main_zone_; } |
620 | 620 |
621 private: | 621 private: |
622 i::Zone main_zone_; | 622 i::Zone main_zone_; |
623 }; | 623 }; |
624 | 624 |
625 #endif // ifndef CCTEST_H_ | 625 #endif // ifndef CCTEST_H_ |
OLD | NEW |