OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 2, | 293 2, |
294 "V8::FillHeapNumberWithRandom"); | 294 "V8::FillHeapNumberWithRandom"); |
295 Add(ExternalReference::random_uint32_function(isolate).address(), | 295 Add(ExternalReference::random_uint32_function(isolate).address(), |
296 RUNTIME_ENTRY, | 296 RUNTIME_ENTRY, |
297 3, | 297 3, |
298 "V8::Random"); | 298 "V8::Random"); |
299 Add(ExternalReference::delete_handle_scope_extensions(isolate).address(), | 299 Add(ExternalReference::delete_handle_scope_extensions(isolate).address(), |
300 RUNTIME_ENTRY, | 300 RUNTIME_ENTRY, |
301 4, | 301 4, |
302 "HandleScope::DeleteExtensions"); | 302 "HandleScope::DeleteExtensions"); |
| 303 Add(ExternalReference:: |
| 304 incremental_marking_record_write_function(isolate).address(), |
| 305 RUNTIME_ENTRY, |
| 306 5, |
| 307 "IncrementalMarking::RecordWrite"); |
| 308 Add(ExternalReference::store_buffer_overflow_function(isolate).address(), |
| 309 RUNTIME_ENTRY, |
| 310 6, |
| 311 "StoreBuffer::StoreBufferOverflow"); |
| 312 Add(ExternalReference:: |
| 313 incremental_evacuation_record_write_function(isolate).address(), |
| 314 RUNTIME_ENTRY, |
| 315 7, |
| 316 "IncrementalMarking::RecordWrite"); |
| 317 |
| 318 |
303 | 319 |
304 // Miscellaneous | 320 // Miscellaneous |
305 Add(ExternalReference::the_hole_value_location(isolate).address(), | 321 Add(ExternalReference::the_hole_value_location(isolate).address(), |
306 UNCLASSIFIED, | 322 UNCLASSIFIED, |
307 2, | 323 2, |
308 "Factory::the_hole_value().location()"); | 324 "Factory::the_hole_value().location()"); |
309 Add(ExternalReference::roots_address(isolate).address(), | 325 Add(ExternalReference::roots_address(isolate).address(), |
310 UNCLASSIFIED, | 326 UNCLASSIFIED, |
311 3, | 327 3, |
312 "Heap::roots_address()"); | 328 "Heap::roots_address()"); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 Add(ExternalReference::new_space_mask(isolate).address(), | 360 Add(ExternalReference::new_space_mask(isolate).address(), |
345 UNCLASSIFIED, | 361 UNCLASSIFIED, |
346 11, | 362 11, |
347 "Heap::NewSpaceMask()"); | 363 "Heap::NewSpaceMask()"); |
348 Add(ExternalReference::heap_always_allocate_scope_depth(isolate).address(), | 364 Add(ExternalReference::heap_always_allocate_scope_depth(isolate).address(), |
349 UNCLASSIFIED, | 365 UNCLASSIFIED, |
350 12, | 366 12, |
351 "Heap::always_allocate_scope_depth()"); | 367 "Heap::always_allocate_scope_depth()"); |
352 Add(ExternalReference::new_space_allocation_limit_address(isolate).address(), | 368 Add(ExternalReference::new_space_allocation_limit_address(isolate).address(), |
353 UNCLASSIFIED, | 369 UNCLASSIFIED, |
354 13, | 370 14, |
355 "Heap::NewSpaceAllocationLimitAddress()"); | 371 "Heap::NewSpaceAllocationLimitAddress()"); |
356 Add(ExternalReference::new_space_allocation_top_address(isolate).address(), | 372 Add(ExternalReference::new_space_allocation_top_address(isolate).address(), |
357 UNCLASSIFIED, | 373 UNCLASSIFIED, |
358 14, | 374 15, |
359 "Heap::NewSpaceAllocationTopAddress()"); | 375 "Heap::NewSpaceAllocationTopAddress()"); |
360 #ifdef ENABLE_DEBUGGER_SUPPORT | 376 #ifdef ENABLE_DEBUGGER_SUPPORT |
361 Add(ExternalReference::debug_break(isolate).address(), | 377 Add(ExternalReference::debug_break(isolate).address(), |
362 UNCLASSIFIED, | 378 UNCLASSIFIED, |
363 15, | 379 16, |
364 "Debug::Break()"); | 380 "Debug::Break()"); |
365 Add(ExternalReference::debug_step_in_fp_address(isolate).address(), | 381 Add(ExternalReference::debug_step_in_fp_address(isolate).address(), |
366 UNCLASSIFIED, | 382 UNCLASSIFIED, |
367 16, | 383 17, |
368 "Debug::step_in_fp_addr()"); | 384 "Debug::step_in_fp_addr()"); |
369 #endif | 385 #endif |
370 Add(ExternalReference::double_fp_operation(Token::ADD, isolate).address(), | 386 Add(ExternalReference::double_fp_operation(Token::ADD, isolate).address(), |
371 UNCLASSIFIED, | 387 UNCLASSIFIED, |
372 17, | 388 18, |
373 "add_two_doubles"); | 389 "add_two_doubles"); |
374 Add(ExternalReference::double_fp_operation(Token::SUB, isolate).address(), | 390 Add(ExternalReference::double_fp_operation(Token::SUB, isolate).address(), |
375 UNCLASSIFIED, | 391 UNCLASSIFIED, |
376 18, | 392 19, |
377 "sub_two_doubles"); | 393 "sub_two_doubles"); |
378 Add(ExternalReference::double_fp_operation(Token::MUL, isolate).address(), | 394 Add(ExternalReference::double_fp_operation(Token::MUL, isolate).address(), |
379 UNCLASSIFIED, | 395 UNCLASSIFIED, |
380 19, | 396 20, |
381 "mul_two_doubles"); | 397 "mul_two_doubles"); |
382 Add(ExternalReference::double_fp_operation(Token::DIV, isolate).address(), | 398 Add(ExternalReference::double_fp_operation(Token::DIV, isolate).address(), |
383 UNCLASSIFIED, | 399 UNCLASSIFIED, |
384 20, | 400 21, |
385 "div_two_doubles"); | 401 "div_two_doubles"); |
386 Add(ExternalReference::double_fp_operation(Token::MOD, isolate).address(), | 402 Add(ExternalReference::double_fp_operation(Token::MOD, isolate).address(), |
387 UNCLASSIFIED, | 403 UNCLASSIFIED, |
388 21, | 404 22, |
389 "mod_two_doubles"); | 405 "mod_two_doubles"); |
390 Add(ExternalReference::compare_doubles(isolate).address(), | 406 Add(ExternalReference::compare_doubles(isolate).address(), |
391 UNCLASSIFIED, | 407 UNCLASSIFIED, |
392 22, | 408 23, |
393 "compare_doubles"); | 409 "compare_doubles"); |
394 #ifndef V8_INTERPRETED_REGEXP | 410 #ifndef V8_INTERPRETED_REGEXP |
395 Add(ExternalReference::re_case_insensitive_compare_uc16(isolate).address(), | 411 Add(ExternalReference::re_case_insensitive_compare_uc16(isolate).address(), |
396 UNCLASSIFIED, | 412 UNCLASSIFIED, |
397 23, | 413 24, |
398 "NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16()"); | 414 "NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16()"); |
399 Add(ExternalReference::re_check_stack_guard_state(isolate).address(), | 415 Add(ExternalReference::re_check_stack_guard_state(isolate).address(), |
400 UNCLASSIFIED, | 416 UNCLASSIFIED, |
401 24, | 417 25, |
402 "RegExpMacroAssembler*::CheckStackGuardState()"); | 418 "RegExpMacroAssembler*::CheckStackGuardState()"); |
403 Add(ExternalReference::re_grow_stack(isolate).address(), | 419 Add(ExternalReference::re_grow_stack(isolate).address(), |
404 UNCLASSIFIED, | 420 UNCLASSIFIED, |
405 25, | 421 26, |
406 "NativeRegExpMacroAssembler::GrowStack()"); | 422 "NativeRegExpMacroAssembler::GrowStack()"); |
407 Add(ExternalReference::re_word_character_map().address(), | 423 Add(ExternalReference::re_word_character_map().address(), |
408 UNCLASSIFIED, | 424 UNCLASSIFIED, |
409 26, | 425 27, |
410 "NativeRegExpMacroAssembler::word_character_map"); | 426 "NativeRegExpMacroAssembler::word_character_map"); |
411 #endif // V8_INTERPRETED_REGEXP | 427 #endif // V8_INTERPRETED_REGEXP |
412 // Keyed lookup cache. | 428 // Keyed lookup cache. |
413 Add(ExternalReference::keyed_lookup_cache_keys(isolate).address(), | 429 Add(ExternalReference::keyed_lookup_cache_keys(isolate).address(), |
414 UNCLASSIFIED, | 430 UNCLASSIFIED, |
415 27, | 431 28, |
416 "KeyedLookupCache::keys()"); | 432 "KeyedLookupCache::keys()"); |
417 Add(ExternalReference::keyed_lookup_cache_field_offsets(isolate).address(), | 433 Add(ExternalReference::keyed_lookup_cache_field_offsets(isolate).address(), |
418 UNCLASSIFIED, | 434 UNCLASSIFIED, |
419 28, | 435 29, |
420 "KeyedLookupCache::field_offsets()"); | 436 "KeyedLookupCache::field_offsets()"); |
421 Add(ExternalReference::transcendental_cache_array_address(isolate).address(), | 437 Add(ExternalReference::transcendental_cache_array_address(isolate).address(), |
422 UNCLASSIFIED, | 438 UNCLASSIFIED, |
423 29, | 439 30, |
424 "TranscendentalCache::caches()"); | 440 "TranscendentalCache::caches()"); |
425 Add(ExternalReference::handle_scope_next_address().address(), | 441 Add(ExternalReference::handle_scope_next_address().address(), |
426 UNCLASSIFIED, | 442 UNCLASSIFIED, |
427 30, | 443 31, |
428 "HandleScope::next"); | 444 "HandleScope::next"); |
429 Add(ExternalReference::handle_scope_limit_address().address(), | 445 Add(ExternalReference::handle_scope_limit_address().address(), |
430 UNCLASSIFIED, | 446 UNCLASSIFIED, |
431 31, | 447 32, |
432 "HandleScope::limit"); | 448 "HandleScope::limit"); |
433 Add(ExternalReference::handle_scope_level_address().address(), | 449 Add(ExternalReference::handle_scope_level_address().address(), |
434 UNCLASSIFIED, | 450 UNCLASSIFIED, |
435 32, | 451 33, |
436 "HandleScope::level"); | 452 "HandleScope::level"); |
437 Add(ExternalReference::new_deoptimizer_function(isolate).address(), | 453 Add(ExternalReference::new_deoptimizer_function(isolate).address(), |
438 UNCLASSIFIED, | 454 UNCLASSIFIED, |
439 33, | 455 34, |
440 "Deoptimizer::New()"); | 456 "Deoptimizer::New()"); |
441 Add(ExternalReference::compute_output_frames_function(isolate).address(), | 457 Add(ExternalReference::compute_output_frames_function(isolate).address(), |
442 UNCLASSIFIED, | 458 UNCLASSIFIED, |
443 34, | 459 35, |
444 "Deoptimizer::ComputeOutputFrames()"); | 460 "Deoptimizer::ComputeOutputFrames()"); |
445 Add(ExternalReference::address_of_min_int().address(), | 461 Add(ExternalReference::address_of_min_int().address(), |
446 UNCLASSIFIED, | 462 UNCLASSIFIED, |
447 35, | 463 36, |
448 "LDoubleConstant::min_int"); | 464 "LDoubleConstant::min_int"); |
449 Add(ExternalReference::address_of_one_half().address(), | 465 Add(ExternalReference::address_of_one_half().address(), |
450 UNCLASSIFIED, | 466 UNCLASSIFIED, |
451 36, | 467 37, |
452 "LDoubleConstant::one_half"); | 468 "LDoubleConstant::one_half"); |
453 Add(ExternalReference::isolate_address().address(), | 469 Add(ExternalReference::isolate_address().address(), |
454 UNCLASSIFIED, | 470 UNCLASSIFIED, |
455 37, | 471 38, |
456 "isolate"); | 472 "isolate"); |
457 Add(ExternalReference::address_of_minus_zero().address(), | 473 Add(ExternalReference::address_of_minus_zero().address(), |
458 UNCLASSIFIED, | 474 UNCLASSIFIED, |
459 38, | 475 39, |
460 "LDoubleConstant::minus_zero"); | 476 "LDoubleConstant::minus_zero"); |
461 Add(ExternalReference::address_of_negative_infinity().address(), | 477 Add(ExternalReference::address_of_negative_infinity().address(), |
462 UNCLASSIFIED, | 478 UNCLASSIFIED, |
463 39, | 479 40, |
464 "LDoubleConstant::negative_infinity"); | 480 "LDoubleConstant::negative_infinity"); |
465 Add(ExternalReference::power_double_double_function(isolate).address(), | 481 Add(ExternalReference::power_double_double_function(isolate).address(), |
466 UNCLASSIFIED, | 482 UNCLASSIFIED, |
467 40, | 483 41, |
468 "power_double_double_function"); | 484 "power_double_double_function"); |
469 Add(ExternalReference::power_double_int_function(isolate).address(), | 485 Add(ExternalReference::power_double_int_function(isolate).address(), |
470 UNCLASSIFIED, | 486 UNCLASSIFIED, |
471 41, | 487 42, |
472 "power_double_int_function"); | 488 "power_double_int_function"); |
| 489 Add(ExternalReference::store_buffer_top(isolate).address(), |
| 490 UNCLASSIFIED, |
| 491 43, |
| 492 "store_buffer_top"); |
473 Add(ExternalReference::arguments_marker_location(isolate).address(), | 493 Add(ExternalReference::arguments_marker_location(isolate).address(), |
474 UNCLASSIFIED, | 494 UNCLASSIFIED, |
475 42, | 495 44, |
476 "Factory::arguments_marker().location()"); | 496 "Factory::arguments_marker().location()"); |
477 } | 497 } |
478 | 498 |
479 | 499 |
480 ExternalReferenceEncoder::ExternalReferenceEncoder() | 500 ExternalReferenceEncoder::ExternalReferenceEncoder() |
481 : encodings_(Match), | 501 : encodings_(Match), |
482 isolate_(Isolate::Current()) { | 502 isolate_(Isolate::Current()) { |
483 ExternalReferenceTable* external_references = | 503 ExternalReferenceTable* external_references = |
484 ExternalReferenceTable::instance(isolate_); | 504 ExternalReferenceTable::instance(isolate_); |
485 for (int i = 0; i < external_references->size(); ++i) { | 505 for (int i = 0; i < external_references->size(); ++i) { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 ASSERT(!SpaceIsPaged(space_index) || | 582 ASSERT(!SpaceIsPaged(space_index) || |
563 size <= Page::kPageSize - Page::kObjectStartOffset); | 583 size <= Page::kPageSize - Page::kObjectStartOffset); |
564 MaybeObject* maybe_new_allocation; | 584 MaybeObject* maybe_new_allocation; |
565 if (space_index == NEW_SPACE) { | 585 if (space_index == NEW_SPACE) { |
566 maybe_new_allocation = | 586 maybe_new_allocation = |
567 reinterpret_cast<NewSpace*>(space)->AllocateRaw(size); | 587 reinterpret_cast<NewSpace*>(space)->AllocateRaw(size); |
568 } else { | 588 } else { |
569 maybe_new_allocation = | 589 maybe_new_allocation = |
570 reinterpret_cast<PagedSpace*>(space)->AllocateRaw(size); | 590 reinterpret_cast<PagedSpace*>(space)->AllocateRaw(size); |
571 } | 591 } |
| 592 ASSERT(!maybe_new_allocation->IsFailure()); |
572 Object* new_allocation = maybe_new_allocation->ToObjectUnchecked(); | 593 Object* new_allocation = maybe_new_allocation->ToObjectUnchecked(); |
573 HeapObject* new_object = HeapObject::cast(new_allocation); | 594 HeapObject* new_object = HeapObject::cast(new_allocation); |
574 address = new_object->address(); | 595 address = new_object->address(); |
575 high_water_[space_index] = address + size; | 596 high_water_[space_index] = address + size; |
576 } else { | 597 } else { |
577 ASSERT(SpaceIsLarge(space_index)); | 598 ASSERT(SpaceIsLarge(space_index)); |
578 LargeObjectSpace* lo_space = reinterpret_cast<LargeObjectSpace*>(space); | 599 LargeObjectSpace* lo_space = reinterpret_cast<LargeObjectSpace*>(space); |
579 Object* new_allocation; | 600 Object* new_allocation; |
580 if (space_index == kLargeData) { | 601 if (space_index == kLargeData || space_index == kLargeFixedArray) { |
581 new_allocation = lo_space->AllocateRaw(size)->ToObjectUnchecked(); | |
582 } else if (space_index == kLargeFixedArray) { | |
583 new_allocation = | 602 new_allocation = |
584 lo_space->AllocateRawFixedArray(size)->ToObjectUnchecked(); | 603 lo_space->AllocateRaw(size, NOT_EXECUTABLE)->ToObjectUnchecked(); |
585 } else { | 604 } else { |
586 ASSERT_EQ(kLargeCode, space_index); | 605 ASSERT_EQ(kLargeCode, space_index); |
587 new_allocation = lo_space->AllocateRawCode(size)->ToObjectUnchecked(); | 606 new_allocation = |
| 607 lo_space->AllocateRaw(size, EXECUTABLE)->ToObjectUnchecked(); |
588 } | 608 } |
589 HeapObject* new_object = HeapObject::cast(new_allocation); | 609 HeapObject* new_object = HeapObject::cast(new_allocation); |
590 // Record all large objects in the same space. | 610 // Record all large objects in the same space. |
591 address = new_object->address(); | 611 address = new_object->address(); |
592 pages_[LO_SPACE].Add(address); | 612 pages_[LO_SPACE].Add(address); |
593 } | 613 } |
594 last_object_address_ = address; | 614 last_object_address_ = address; |
595 return address; | 615 return address; |
596 } | 616 } |
597 | 617 |
(...skipping 24 matching lines...) Expand all Loading... |
622 ASSERT(SpaceIsPaged(space)); | 642 ASSERT(SpaceIsPaged(space)); |
623 int page_of_pointee = offset >> kPageSizeBits; | 643 int page_of_pointee = offset >> kPageSizeBits; |
624 Address object_address = pages_[space][page_of_pointee] + | 644 Address object_address = pages_[space][page_of_pointee] + |
625 (offset & Page::kPageAlignmentMask); | 645 (offset & Page::kPageAlignmentMask); |
626 return HeapObject::FromAddress(object_address); | 646 return HeapObject::FromAddress(object_address); |
627 } | 647 } |
628 | 648 |
629 | 649 |
630 void Deserializer::Deserialize() { | 650 void Deserializer::Deserialize() { |
631 isolate_ = Isolate::Current(); | 651 isolate_ = Isolate::Current(); |
| 652 ASSERT(isolate_ != NULL); |
632 // Don't GC while deserializing - just expand the heap. | 653 // Don't GC while deserializing - just expand the heap. |
633 AlwaysAllocateScope always_allocate; | 654 AlwaysAllocateScope always_allocate; |
634 // Don't use the free lists while deserializing. | 655 // Don't use the free lists while deserializing. |
635 LinearAllocationScope allocate_linearly; | 656 LinearAllocationScope allocate_linearly; |
636 // No active threads. | 657 // No active threads. |
637 ASSERT_EQ(NULL, isolate_->thread_manager()->FirstThreadStateInUse()); | 658 ASSERT_EQ(NULL, isolate_->thread_manager()->FirstThreadStateInUse()); |
638 // No active handles. | 659 // No active handles. |
639 ASSERT(isolate_->handle_scope_implementer()->blocks()->is_empty()); | 660 ASSERT(isolate_->handle_scope_implementer()->blocks()->is_empty()); |
640 // Make sure the entire partial snapshot cache is traversed, filling it with | 661 // Make sure the entire partial snapshot cache is traversed, filling it with |
641 // valid object pointers. | 662 // valid object pointers. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 void Deserializer::VisitPointers(Object** start, Object** end) { | 699 void Deserializer::VisitPointers(Object** start, Object** end) { |
679 // The space must be new space. Any other space would cause ReadChunk to try | 700 // The space must be new space. Any other space would cause ReadChunk to try |
680 // to update the remembered using NULL as the address. | 701 // to update the remembered using NULL as the address. |
681 ReadChunk(start, end, NEW_SPACE, NULL); | 702 ReadChunk(start, end, NEW_SPACE, NULL); |
682 } | 703 } |
683 | 704 |
684 | 705 |
685 // This routine writes the new object into the pointer provided and then | 706 // This routine writes the new object into the pointer provided and then |
686 // returns true if the new object was in young space and false otherwise. | 707 // returns true if the new object was in young space and false otherwise. |
687 // The reason for this strange interface is that otherwise the object is | 708 // The reason for this strange interface is that otherwise the object is |
688 // written very late, which means the ByteArray map is not set up by the | 709 // written very late, which means the FreeSpace map is not set up by the |
689 // time we need to use it to mark the space at the end of a page free (by | 710 // time we need to use it to mark the space at the end of a page free. |
690 // making it into a byte array). | |
691 void Deserializer::ReadObject(int space_number, | 711 void Deserializer::ReadObject(int space_number, |
692 Space* space, | 712 Space* space, |
693 Object** write_back) { | 713 Object** write_back) { |
694 int size = source_->GetInt() << kObjectAlignmentBits; | 714 int size = source_->GetInt() << kObjectAlignmentBits; |
695 Address address = Allocate(space_number, space, size); | 715 Address address = Allocate(space_number, space, size); |
696 *write_back = HeapObject::FromAddress(address); | 716 *write_back = HeapObject::FromAddress(address); |
697 Object** current = reinterpret_cast<Object**>(address); | 717 Object** current = reinterpret_cast<Object**>(address); |
698 Object** limit = current + (size >> kPointerSizeLog2); | 718 Object** limit = current + (size >> kPointerSizeLog2); |
699 if (FLAG_log_snapshot_positions) { | 719 if (FLAG_log_snapshot_positions) { |
700 LOG(isolate_, SnapshotPositionEvent(address, source_->position())); | 720 LOG(isolate_, SnapshotPositionEvent(address, source_->position())); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 | 771 |
752 #define CASE_BODY(where, how, within, space_number_if_any, offset_from_start) \ | 772 #define CASE_BODY(where, how, within, space_number_if_any, offset_from_start) \ |
753 { \ | 773 { \ |
754 bool emit_write_barrier = false; \ | 774 bool emit_write_barrier = false; \ |
755 bool current_was_incremented = false; \ | 775 bool current_was_incremented = false; \ |
756 int space_number = space_number_if_any == kAnyOldSpace ? \ | 776 int space_number = space_number_if_any == kAnyOldSpace ? \ |
757 (data & kSpaceMask) : space_number_if_any; \ | 777 (data & kSpaceMask) : space_number_if_any; \ |
758 if (where == kNewObject && how == kPlain && within == kStartOfObject) {\ | 778 if (where == kNewObject && how == kPlain && within == kStartOfObject) {\ |
759 ASSIGN_DEST_SPACE(space_number) \ | 779 ASSIGN_DEST_SPACE(space_number) \ |
760 ReadObject(space_number, dest_space, current); \ | 780 ReadObject(space_number, dest_space, current); \ |
761 emit_write_barrier = \ | 781 emit_write_barrier = (space_number == NEW_SPACE && \ |
762 (space_number == NEW_SPACE && source_space != NEW_SPACE); \ | 782 source_space != NEW_SPACE && \ |
| 783 source_space != CELL_SPACE); \ |
763 } else { \ | 784 } else { \ |
764 Object* new_object = NULL; /* May not be a real Object pointer. */ \ | 785 Object* new_object = NULL; /* May not be a real Object pointer. */ \ |
765 if (where == kNewObject) { \ | 786 if (where == kNewObject) { \ |
766 ASSIGN_DEST_SPACE(space_number) \ | 787 ASSIGN_DEST_SPACE(space_number) \ |
767 ReadObject(space_number, dest_space, &new_object); \ | 788 ReadObject(space_number, dest_space, &new_object); \ |
768 } else if (where == kRootArray) { \ | 789 } else if (where == kRootArray) { \ |
769 int root_id = source_->GetInt(); \ | 790 int root_id = source_->GetInt(); \ |
770 new_object = isolate->heap()->roots_address()[root_id]; \ | 791 new_object = isolate->heap()->roots_address()[root_id]; \ |
771 } else if (where == kPartialSnapshotCache) { \ | 792 } else if (where == kPartialSnapshotCache) { \ |
772 int cache_index = source_->GetInt(); \ | 793 int cache_index = source_->GetInt(); \ |
773 new_object = isolate->serialize_partial_snapshot_cache() \ | 794 new_object = isolate->serialize_partial_snapshot_cache() \ |
774 [cache_index]; \ | 795 [cache_index]; \ |
775 } else if (where == kExternalReference) { \ | 796 } else if (where == kExternalReference) { \ |
776 int reference_id = source_->GetInt(); \ | 797 int reference_id = source_->GetInt(); \ |
777 Address address = external_reference_decoder_-> \ | 798 Address address = external_reference_decoder_-> \ |
778 Decode(reference_id); \ | 799 Decode(reference_id); \ |
779 new_object = reinterpret_cast<Object*>(address); \ | 800 new_object = reinterpret_cast<Object*>(address); \ |
780 } else if (where == kBackref) { \ | 801 } else if (where == kBackref) { \ |
781 emit_write_barrier = \ | 802 emit_write_barrier = (space_number == NEW_SPACE && \ |
782 (space_number == NEW_SPACE && source_space != NEW_SPACE); \ | 803 source_space != NEW_SPACE && \ |
| 804 source_space != CELL_SPACE); \ |
783 new_object = GetAddressFromEnd(data & kSpaceMask); \ | 805 new_object = GetAddressFromEnd(data & kSpaceMask); \ |
784 } else { \ | 806 } else { \ |
785 ASSERT(where == kFromStart); \ | 807 ASSERT(where == kFromStart); \ |
786 if (offset_from_start == kUnknownOffsetFromStart) { \ | 808 if (offset_from_start == kUnknownOffsetFromStart) { \ |
787 emit_write_barrier = \ | 809 emit_write_barrier = (space_number == NEW_SPACE && \ |
788 (space_number == NEW_SPACE && source_space != NEW_SPACE); \ | 810 source_space != NEW_SPACE && \ |
| 811 source_space != CELL_SPACE); \ |
789 new_object = GetAddressFromStart(data & kSpaceMask); \ | 812 new_object = GetAddressFromStart(data & kSpaceMask); \ |
790 } else { \ | 813 } else { \ |
791 Address object_address = pages_[space_number][0] + \ | 814 Address object_address = pages_[space_number][0] + \ |
792 (offset_from_start << kObjectAlignmentBits); \ | 815 (offset_from_start << kObjectAlignmentBits); \ |
793 new_object = HeapObject::FromAddress(object_address); \ | 816 new_object = HeapObject::FromAddress(object_address); \ |
794 } \ | 817 } \ |
795 } \ | 818 } \ |
796 if (within == kFirstInstruction) { \ | 819 if (within == kFirstInstruction) { \ |
797 Code* new_code_object = reinterpret_cast<Code*>(new_object); \ | 820 Code* new_code_object = reinterpret_cast<Code*>(new_object); \ |
798 new_object = reinterpret_cast<Object*>( \ | 821 new_object = reinterpret_cast<Object*>( \ |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 | 989 |
967 case kNewPage: { | 990 case kNewPage: { |
968 int space = source_->Get(); | 991 int space = source_->Get(); |
969 pages_[space].Add(last_object_address_); | 992 pages_[space].Add(last_object_address_); |
970 if (space == CODE_SPACE) { | 993 if (space == CODE_SPACE) { |
971 CPU::FlushICache(last_object_address_, Page::kPageSize); | 994 CPU::FlushICache(last_object_address_, Page::kPageSize); |
972 } | 995 } |
973 break; | 996 break; |
974 } | 997 } |
975 | 998 |
| 999 case kSkip: { |
| 1000 current++; |
| 1001 break; |
| 1002 } |
| 1003 |
976 case kNativesStringResource: { | 1004 case kNativesStringResource: { |
977 int index = source_->Get(); | 1005 int index = source_->Get(); |
978 Vector<const char> source_vector = Natives::GetRawScriptSource(index); | 1006 Vector<const char> source_vector = Natives::GetRawScriptSource(index); |
979 NativesExternalStringResource* resource = | 1007 NativesExternalStringResource* resource = |
980 new NativesExternalStringResource(isolate->bootstrapper(), | 1008 new NativesExternalStringResource(isolate->bootstrapper(), |
981 source_vector.start(), | 1009 source_vector.start(), |
982 source_vector.length()); | 1010 source_vector.length()); |
983 *current++ = reinterpret_cast<Object*>(resource); | 1011 *current++ = reinterpret_cast<Object*>(resource); |
984 break; | 1012 break; |
985 } | 1013 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1090 isolate->heap()->undefined_value(); | 1118 isolate->heap()->undefined_value(); |
1091 startup_serializer_->VisitPointer( | 1119 startup_serializer_->VisitPointer( |
1092 &isolate->serialize_partial_snapshot_cache()[index]); | 1120 &isolate->serialize_partial_snapshot_cache()[index]); |
1093 } | 1121 } |
1094 isolate->set_serialize_partial_snapshot_cache_length( | 1122 isolate->set_serialize_partial_snapshot_cache_length( |
1095 Isolate::kPartialSnapshotCacheCapacity); | 1123 Isolate::kPartialSnapshotCacheCapacity); |
1096 } | 1124 } |
1097 | 1125 |
1098 | 1126 |
1099 void Serializer::VisitPointers(Object** start, Object** end) { | 1127 void Serializer::VisitPointers(Object** start, Object** end) { |
| 1128 Isolate* isolate = Isolate::Current(); |
| 1129 |
1100 for (Object** current = start; current < end; current++) { | 1130 for (Object** current = start; current < end; current++) { |
1101 if ((*current)->IsSmi()) { | 1131 if (reinterpret_cast<Address>(current) == |
| 1132 isolate->heap()->store_buffer()->TopAddress()) { |
| 1133 sink_->Put(kSkip, "Skip"); |
| 1134 } else if ((*current)->IsSmi()) { |
1102 sink_->Put(kRawData, "RawData"); | 1135 sink_->Put(kRawData, "RawData"); |
1103 sink_->PutInt(kPointerSize, "length"); | 1136 sink_->PutInt(kPointerSize, "length"); |
1104 for (int i = 0; i < kPointerSize; i++) { | 1137 for (int i = 0; i < kPointerSize; i++) { |
1105 sink_->Put(reinterpret_cast<byte*>(current)[i], "Byte"); | 1138 sink_->Put(reinterpret_cast<byte*>(current)[i], "Byte"); |
1106 } | 1139 } |
1107 } else { | 1140 } else { |
1108 SerializeObject(*current, kPlain, kStartOfObject); | 1141 SerializeObject(*current, kPlain, kStartOfObject); |
1109 } | 1142 } |
1110 } | 1143 } |
1111 } | 1144 } |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1524 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); | 1557 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); |
1525 } | 1558 } |
1526 } | 1559 } |
1527 int allocation_address = fullness_[space]; | 1560 int allocation_address = fullness_[space]; |
1528 fullness_[space] = allocation_address + size; | 1561 fullness_[space] = allocation_address + size; |
1529 return allocation_address; | 1562 return allocation_address; |
1530 } | 1563 } |
1531 | 1564 |
1532 | 1565 |
1533 } } // namespace v8::internal | 1566 } } // namespace v8::internal |
OLD | NEW |