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