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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 Add(ExternalReference::fill_heap_number_with_random_function().address(), | 330 Add(ExternalReference::fill_heap_number_with_random_function().address(), |
331 RUNTIME_ENTRY, | 331 RUNTIME_ENTRY, |
332 2, | 332 2, |
333 "V8::FillHeapNumberWithRandom"); | 333 "V8::FillHeapNumberWithRandom"); |
334 | 334 |
335 Add(ExternalReference::random_uint32_function().address(), | 335 Add(ExternalReference::random_uint32_function().address(), |
336 RUNTIME_ENTRY, | 336 RUNTIME_ENTRY, |
337 3, | 337 3, |
338 "V8::Random"); | 338 "V8::Random"); |
339 | 339 |
| 340 Add(ExternalReference::delete_handle_scope_extensions().address(), |
| 341 RUNTIME_ENTRY, |
| 342 3, |
| 343 "HandleScope::DeleteExtensions"); |
| 344 |
340 // Miscellaneous | 345 // Miscellaneous |
341 Add(ExternalReference::the_hole_value_location().address(), | 346 Add(ExternalReference::the_hole_value_location().address(), |
342 UNCLASSIFIED, | 347 UNCLASSIFIED, |
343 2, | 348 2, |
344 "Factory::the_hole_value().location()"); | 349 "Factory::the_hole_value().location()"); |
345 Add(ExternalReference::roots_address().address(), | 350 Add(ExternalReference::roots_address().address(), |
346 UNCLASSIFIED, | 351 UNCLASSIFIED, |
347 3, | 352 3, |
348 "Heap::roots_address()"); | 353 "Heap::roots_address()"); |
349 Add(ExternalReference::address_of_stack_limit().address(), | 354 Add(ExternalReference::address_of_stack_limit().address(), |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 27, | 455 27, |
451 "KeyedLookupCache::keys()"); | 456 "KeyedLookupCache::keys()"); |
452 Add(ExternalReference::keyed_lookup_cache_field_offsets().address(), | 457 Add(ExternalReference::keyed_lookup_cache_field_offsets().address(), |
453 UNCLASSIFIED, | 458 UNCLASSIFIED, |
454 28, | 459 28, |
455 "KeyedLookupCache::field_offsets()"); | 460 "KeyedLookupCache::field_offsets()"); |
456 Add(ExternalReference::transcendental_cache_array_address().address(), | 461 Add(ExternalReference::transcendental_cache_array_address().address(), |
457 UNCLASSIFIED, | 462 UNCLASSIFIED, |
458 29, | 463 29, |
459 "TranscendentalCache::caches()"); | 464 "TranscendentalCache::caches()"); |
| 465 Add(ExternalReference::handle_scope_next_address().address(), |
| 466 UNCLASSIFIED, |
| 467 30, |
| 468 "HandleScope::next"); |
| 469 Add(ExternalReference::handle_scope_limit_address().address(), |
| 470 UNCLASSIFIED, |
| 471 31, |
| 472 "HandleScope::limit"); |
| 473 Add(ExternalReference::handle_scope_level_address().address(), |
| 474 UNCLASSIFIED, |
| 475 32, |
| 476 "HandleScope::level"); |
460 } | 477 } |
461 | 478 |
462 | 479 |
463 ExternalReferenceEncoder::ExternalReferenceEncoder() | 480 ExternalReferenceEncoder::ExternalReferenceEncoder() |
464 : encodings_(Match) { | 481 : encodings_(Match) { |
465 ExternalReferenceTable* external_references = | 482 ExternalReferenceTable* external_references = |
466 ExternalReferenceTable::instance(); | 483 ExternalReferenceTable::instance(); |
467 for (int i = 0; i < external_references->size(); ++i) { | 484 for (int i = 0; i < external_references->size(); ++i) { |
468 Put(external_references->address(i), i); | 485 Put(external_references->address(i), i); |
469 } | 486 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 | 548 |
532 | 549 |
533 // This routine both allocates a new object, and also keeps | 550 // This routine both allocates a new object, and also keeps |
534 // track of where objects have been allocated so that we can | 551 // track of where objects have been allocated so that we can |
535 // fix back references when deserializing. | 552 // fix back references when deserializing. |
536 Address Deserializer::Allocate(int space_index, Space* space, int size) { | 553 Address Deserializer::Allocate(int space_index, Space* space, int size) { |
537 Address address; | 554 Address address; |
538 if (!SpaceIsLarge(space_index)) { | 555 if (!SpaceIsLarge(space_index)) { |
539 ASSERT(!SpaceIsPaged(space_index) || | 556 ASSERT(!SpaceIsPaged(space_index) || |
540 size <= Page::kPageSize - Page::kObjectStartOffset); | 557 size <= Page::kPageSize - Page::kObjectStartOffset); |
541 Object* new_allocation; | 558 MaybeObject* maybe_new_allocation; |
542 if (space_index == NEW_SPACE) { | 559 if (space_index == NEW_SPACE) { |
543 new_allocation = reinterpret_cast<NewSpace*>(space)->AllocateRaw(size); | 560 maybe_new_allocation = |
| 561 reinterpret_cast<NewSpace*>(space)->AllocateRaw(size); |
544 } else { | 562 } else { |
545 new_allocation = reinterpret_cast<PagedSpace*>(space)->AllocateRaw(size); | 563 maybe_new_allocation = |
| 564 reinterpret_cast<PagedSpace*>(space)->AllocateRaw(size); |
546 } | 565 } |
| 566 Object* new_allocation = maybe_new_allocation->ToObjectUnchecked(); |
547 HeapObject* new_object = HeapObject::cast(new_allocation); | 567 HeapObject* new_object = HeapObject::cast(new_allocation); |
548 ASSERT(!new_object->IsFailure()); | |
549 address = new_object->address(); | 568 address = new_object->address(); |
550 high_water_[space_index] = address + size; | 569 high_water_[space_index] = address + size; |
551 } else { | 570 } else { |
552 ASSERT(SpaceIsLarge(space_index)); | 571 ASSERT(SpaceIsLarge(space_index)); |
553 ASSERT(size > Page::kPageSize - Page::kObjectStartOffset); | 572 ASSERT(size > Page::kPageSize - Page::kObjectStartOffset); |
554 LargeObjectSpace* lo_space = reinterpret_cast<LargeObjectSpace*>(space); | 573 LargeObjectSpace* lo_space = reinterpret_cast<LargeObjectSpace*>(space); |
555 Object* new_allocation; | 574 Object* new_allocation; |
556 if (space_index == kLargeData) { | 575 if (space_index == kLargeData) { |
557 new_allocation = lo_space->AllocateRaw(size); | 576 new_allocation = lo_space->AllocateRaw(size)->ToObjectUnchecked(); |
558 } else if (space_index == kLargeFixedArray) { | 577 } else if (space_index == kLargeFixedArray) { |
559 new_allocation = lo_space->AllocateRawFixedArray(size); | 578 new_allocation = |
| 579 lo_space->AllocateRawFixedArray(size)->ToObjectUnchecked(); |
560 } else { | 580 } else { |
561 ASSERT_EQ(kLargeCode, space_index); | 581 ASSERT_EQ(kLargeCode, space_index); |
562 new_allocation = lo_space->AllocateRawCode(size); | 582 new_allocation = lo_space->AllocateRawCode(size)->ToObjectUnchecked(); |
563 } | 583 } |
564 ASSERT(!new_allocation->IsFailure()); | |
565 HeapObject* new_object = HeapObject::cast(new_allocation); | 584 HeapObject* new_object = HeapObject::cast(new_allocation); |
566 // Record all large objects in the same space. | 585 // Record all large objects in the same space. |
567 address = new_object->address(); | 586 address = new_object->address(); |
568 pages_[LO_SPACE].Add(address); | 587 pages_[LO_SPACE].Add(address); |
569 } | 588 } |
570 last_object_address_ = address; | 589 last_object_address_ = address; |
571 return address; | 590 return address; |
572 } | 591 } |
573 | 592 |
574 | 593 |
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1468 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); | 1487 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); |
1469 } | 1488 } |
1470 } | 1489 } |
1471 int allocation_address = fullness_[space]; | 1490 int allocation_address = fullness_[space]; |
1472 fullness_[space] = allocation_address + size; | 1491 fullness_[space] = allocation_address + size; |
1473 return allocation_address; | 1492 return allocation_address; |
1474 } | 1493 } |
1475 | 1494 |
1476 | 1495 |
1477 } } // namespace v8::internal | 1496 } } // namespace v8::internal |
OLD | NEW |