54 return static_cast<uint32_t
>(type) << 16 |
id;
58 static int* GetInternalPointer(StatsCounter* counter) {
61 static int dummy_counter = 0;
62 return counter->Enabled() ? counter->GetInternalPointer() : &dummy_counter;
68 isolate->external_reference_table();
69 if (external_reference_table ==
NULL) {
71 isolate->set_external_reference_table(external_reference_table);
73 return external_reference_table;
77 void ExternalReferenceTable::AddFromId(
TypeCode type,
84 ExternalReference ref(static_cast<Builtins::CFunctionId>(
id), isolate);
85 address = ref.address();
89 ExternalReference ref(static_cast<Builtins::Name>(
id), isolate);
90 address = ref.address();
94 ExternalReference ref(static_cast<Runtime::FunctionId>(
id), isolate);
95 address = ref.address();
99 ExternalReference ref(IC_Utility(static_cast<IC::UtilityId>(
id)),
101 address = ref.address();
108 Add(address, type,
id, name);
112 void ExternalReferenceTable::Add(
Address address,
117 ExternalReferenceEntry entry;
119 entry.code = EncodeExternal(type,
id);
123 if (
id > max_id_[type]) max_id_[type] = id;
127 void ExternalReferenceTable::PopulateTable(Isolate* isolate) {
128 for (
int type_code = 0; type_code <
kTypeCodeCount; type_code++) {
129 max_id_[type_code] = 0;
140 struct RefTableEntry {
146 static const RefTableEntry ref_table[] = {
148 #define DEF_ENTRY_C(name, ignored) \
150 Builtins::c_##name, \
151 "Builtins::" #name },
156 #define DEF_ENTRY_C(name, ignored) \
159 "Builtins::" #name },
160 #define DEF_ENTRY_A(name, kind, state, extra) DEF_ENTRY_C(name, ignored)
169 #define RUNTIME_ENTRY(name, nargs, ressize) \
170 { RUNTIME_FUNCTION, \
178 #define IC_ENTRY(name) \
187 for (
size_t i = 0; i <
ARRAY_SIZE(ref_table); ++i) {
188 AddFromId(ref_table[i].type,
194 #ifdef ENABLE_DEBUGGER_SUPPORT
196 Add(Debug_Address(Debug::k_after_break_target_address).
address(isolate),
199 "Debug::after_break_target_address()");
200 Add(Debug_Address(Debug::k_debug_break_slot_address).
address(isolate),
203 "Debug::debug_break_slot_address()");
204 Add(Debug_Address(Debug::k_debug_break_return_address).
address(isolate),
207 "Debug::debug_break_return_address()");
208 Add(Debug_Address(Debug::k_restarter_frame_function_pointer).
address(isolate),
211 "Debug::restarter_frame_function_pointer_address()");
215 struct StatsRefTableEntry {
216 StatsCounter* (Counters::*counter)();
221 const StatsRefTableEntry stats_ref_table[] = {
222 #define COUNTER_ENTRY(name, caption) \
224 Counters::k_##name, \
225 "Counters::" #name },
232 Counters* counters = isolate->counters();
233 for (
size_t i = 0; i <
ARRAY_SIZE(stats_ref_table); ++i) {
234 Add(reinterpret_cast<Address>(GetInternalPointer(
235 (counters->*(stats_ref_table[i].counter))())),
237 stats_ref_table[i].id,
238 stats_ref_table[i].name);
243 const char* AddressNames[] = {
244 #define BUILD_NAME_LITERAL(CamelName, hacker_name) \
245 "Isolate::" #hacker_name "_address",
248 #undef BUILD_NAME_LITERAL
257 #define ACCESSOR_DESCRIPTOR_DECLARATION(name) \
258 Add((Address)&Accessors::name, \
260 Accessors::k##name, \
261 "Accessors::" #name);
264 #undef ACCESSOR_DESCRIPTOR_DECLARATION
266 StubCache* stub_cache = isolate->stub_cache();
272 "StubCache::primary_->key");
276 "StubCache::primary_->value");
280 "StubCache::primary_->map");
284 "StubCache::secondary_->key");
288 "StubCache::secondary_->value");
292 "StubCache::secondary_->map");
295 Add(ExternalReference::perform_gc_function(isolate).
address(),
298 "Runtime::PerformGC");
299 Add(ExternalReference::fill_heap_number_with_random_function(
303 "V8::FillHeapNumberWithRandom");
304 Add(ExternalReference::random_uint32_function(isolate).
address(),
308 Add(ExternalReference::delete_handle_scope_extensions(isolate).
address(),
311 "HandleScope::DeleteExtensions");
312 Add(ExternalReference::
313 incremental_marking_record_write_function(isolate).
address(),
316 "IncrementalMarking::RecordWrite");
317 Add(ExternalReference::store_buffer_overflow_function(isolate).
address(),
320 "StoreBuffer::StoreBufferOverflow");
321 Add(ExternalReference::
322 incremental_evacuation_record_write_function(isolate).
address(),
325 "IncrementalMarking::RecordWrite");
330 Add(ExternalReference::roots_array_start(isolate).
address(),
333 "Heap::roots_array_start()");
334 Add(ExternalReference::address_of_stack_limit(isolate).
address(),
337 "StackGuard::address_of_jslimit()");
338 Add(ExternalReference::address_of_real_stack_limit(isolate).
address(),
341 "StackGuard::address_of_real_jslimit()");
342 #ifndef V8_INTERPRETED_REGEXP
343 Add(ExternalReference::address_of_regexp_stack_limit(isolate).
address(),
346 "RegExpStack::limit_address()");
347 Add(ExternalReference::address_of_regexp_stack_memory_address(
351 "RegExpStack::memory_address()");
352 Add(ExternalReference::address_of_regexp_stack_memory_size(isolate).
address(),
355 "RegExpStack::memory_size()");
356 Add(ExternalReference::address_of_static_offsets_vector(isolate).
address(),
359 "OffsetsVector::static_offsets_vector");
360 #endif // V8_INTERPRETED_REGEXP
361 Add(ExternalReference::new_space_start(isolate).
address(),
364 "Heap::NewSpaceStart()");
365 Add(ExternalReference::new_space_mask(isolate).
address(),
368 "Heap::NewSpaceMask()");
369 Add(ExternalReference::heap_always_allocate_scope_depth(isolate).
address(),
372 "Heap::always_allocate_scope_depth()");
373 Add(ExternalReference::new_space_allocation_limit_address(isolate).
address(),
376 "Heap::NewSpaceAllocationLimitAddress()");
377 Add(ExternalReference::new_space_allocation_top_address(isolate).
address(),
380 "Heap::NewSpaceAllocationTopAddress()");
381 #ifdef ENABLE_DEBUGGER_SUPPORT
382 Add(ExternalReference::debug_break(isolate).
address(),
386 Add(ExternalReference::debug_step_in_fp_address(isolate).
address(),
389 "Debug::step_in_fp_addr()");
407 Add(ExternalReference::double_fp_operation(Token::MOD, isolate).
address(),
411 Add(ExternalReference::compare_doubles(isolate).
address(),
415 #ifndef V8_INTERPRETED_REGEXP
416 Add(ExternalReference::re_case_insensitive_compare_uc16(isolate).
address(),
419 "NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16()");
420 Add(ExternalReference::re_check_stack_guard_state(isolate).
address(),
423 "RegExpMacroAssembler*::CheckStackGuardState()");
424 Add(ExternalReference::re_grow_stack(isolate).
address(),
427 "NativeRegExpMacroAssembler::GrowStack()");
428 Add(ExternalReference::re_word_character_map().
address(),
431 "NativeRegExpMacroAssembler::word_character_map");
432 #endif // V8_INTERPRETED_REGEXP
434 Add(ExternalReference::keyed_lookup_cache_keys(isolate).
address(),
437 "KeyedLookupCache::keys()");
438 Add(ExternalReference::keyed_lookup_cache_field_offsets(isolate).
address(),
441 "KeyedLookupCache::field_offsets()");
442 Add(ExternalReference::transcendental_cache_array_address(isolate).
address(),
445 "TranscendentalCache::caches()");
446 Add(ExternalReference::handle_scope_next_address().
address(),
449 "HandleScope::next");
450 Add(ExternalReference::handle_scope_limit_address().
address(),
453 "HandleScope::limit");
454 Add(ExternalReference::handle_scope_level_address().
address(),
457 "HandleScope::level");
458 Add(ExternalReference::new_deoptimizer_function(isolate).
address(),
461 "Deoptimizer::New()");
462 Add(ExternalReference::compute_output_frames_function(isolate).
address(),
465 "Deoptimizer::ComputeOutputFrames()");
466 Add(ExternalReference::address_of_min_int().
address(),
469 "LDoubleConstant::min_int");
470 Add(ExternalReference::address_of_one_half().
address(),
473 "LDoubleConstant::one_half");
474 Add(ExternalReference::isolate_address().
address(),
478 Add(ExternalReference::address_of_minus_zero().
address(),
481 "LDoubleConstant::minus_zero");
482 Add(ExternalReference::address_of_negative_infinity().
address(),
485 "LDoubleConstant::negative_infinity");
486 Add(ExternalReference::power_double_double_function(isolate).
address(),
489 "power_double_double_function");
490 Add(ExternalReference::power_double_int_function(isolate).
address(),
493 "power_double_int_function");
494 Add(ExternalReference::store_buffer_top(isolate).
address(),
498 Add(ExternalReference::address_of_canonical_non_hole_nan().
address(),
502 Add(ExternalReference::address_of_the_hole_nan().
address(),
506 Add(ExternalReference::get_date_field_function(isolate).
address(),
510 Add(ExternalReference::date_cache_stamp(isolate).
address(),
514 Add(ExternalReference::address_of_pending_message_obj(isolate).
address(),
517 "address_of_pending_message_obj");
518 Add(ExternalReference::address_of_has_pending_message(isolate).
address(),
521 "address_of_has_pending_message");
522 Add(ExternalReference::address_of_pending_message_script(isolate).
address(),
525 "pending_message_script");
534 for (
int i = 0; i < external_references->
size(); ++i) {
535 Put(external_references->
address(i), i);
541 int index = IndexOf(key);
549 int index = IndexOf(key);
555 int ExternalReferenceEncoder::IndexOf(
Address key)
const {
556 if (key ==
NULL)
return -1;
557 HashMap::Entry* entry =
558 const_cast<HashMap&
>(encodings_).Lookup(key, Hash(key),
false);
561 :
static_cast<int>(
reinterpret_cast<intptr_t
>(entry->value));
565 void ExternalReferenceEncoder::Put(
Address key,
int index) {
566 HashMap::Entry* entry = encodings_.
Lookup(key, Hash(key),
true);
567 entry->value =
reinterpret_cast<void*
>(index);
577 int max = external_references->
max_id(type) + 1;
578 encodings_[type] = NewArray<Address>(max + 1);
580 for (
int i = 0; i < external_references->
size(); ++i) {
581 Put(external_references->
code(i), external_references->
address(i));
601 external_reference_decoder_(
NULL) {
603 reservations_[i] = kUninitializedReservation;
609 isolate_ = Isolate::Current();
623 isolate_->
heap()->undefined_value());
627 Object* source = isolate_->
heap()->natives_source_cache()->get(i);
628 if (!source->IsUndefined()) {
640 isolate_ = Isolate::Current();
642 ASSERT(reservations_[i] != kUninitializedReservation);
645 if (external_reference_decoder_ ==
NULL) {
664 if (external_reference_decoder_) {
665 delete external_reference_decoder_;
666 external_reference_decoder_ =
NULL;
673 void Deserializer::VisitPointers(
Object** start,
Object** end) {
685 void Deserializer::ReadObject(
int space_number,
688 Address address = Allocate(space_number, size);
692 if (FLAG_log_snapshot_positions) {
693 LOG(isolate_, SnapshotPositionEvent(address, source_->
position()));
695 ReadChunk(current, limit, space_number, address);
697 bool is_codespace = (space_number ==
CODE_SPACE);
702 void Deserializer::ReadChunk(
Object** current,
705 Address current_object_address) {
706 Isolate*
const isolate = isolate_;
710 bool write_barrier_needed = (current_object_address !=
NULL &&
715 while (current < limit) {
716 int data = source_->
Get();
718 #define CASE_STATEMENT(where, how, within, space_number) \
719 case where + how + within + space_number: \
720 ASSERT((where & ~kPointedToMask) == 0); \
721 ASSERT((how & ~kHowToCodeMask) == 0); \
722 ASSERT((within & ~kWhereToPointMask) == 0); \
723 ASSERT((space_number & ~kSpaceMask) == 0);
725 #define CASE_BODY(where, how, within, space_number_if_any) \
727 bool emit_write_barrier = false; \
728 bool current_was_incremented = false; \
729 int space_number = space_number_if_any == kAnyOldSpace ? \
730 (data & kSpaceMask) : space_number_if_any; \
731 if (where == kNewObject && how == kPlain && within == kStartOfObject) {\
732 ReadObject(space_number, current); \
733 emit_write_barrier = (space_number == NEW_SPACE); \
735 Object* new_object = NULL; \
736 if (where == kNewObject) { \
737 ReadObject(space_number, &new_object); \
738 } else if (where == kRootArray) { \
739 int root_id = source_->GetInt(); \
740 new_object = isolate->heap()->roots_array_start()[root_id]; \
741 emit_write_barrier = isolate->heap()->InNewSpace(new_object); \
742 } else if (where == kPartialSnapshotCache) { \
743 int cache_index = source_->GetInt(); \
744 new_object = isolate->serialize_partial_snapshot_cache() \
746 emit_write_barrier = isolate->heap()->InNewSpace(new_object); \
747 } else if (where == kExternalReference) { \
748 int skip = source_->GetInt(); \
749 current = reinterpret_cast<Object**>(reinterpret_cast<Address>( \
751 int reference_id = source_->GetInt(); \
752 Address address = external_reference_decoder_-> \
753 Decode(reference_id); \
754 new_object = reinterpret_cast<Object*>(address); \
755 } else if (where == kBackref) { \
756 emit_write_barrier = (space_number == NEW_SPACE); \
757 new_object = GetAddressFromEnd(data & kSpaceMask); \
759 ASSERT(where == kBackrefWithSkip); \
760 int skip = source_->GetInt(); \
761 current = reinterpret_cast<Object**>( \
762 reinterpret_cast<Address>(current) + skip); \
763 emit_write_barrier = (space_number == NEW_SPACE); \
764 new_object = GetAddressFromEnd(data & kSpaceMask); \
766 if (within == kInnerPointer) { \
767 if (space_number != CODE_SPACE || new_object->IsCode()) { \
768 Code* new_code_object = reinterpret_cast<Code*>(new_object); \
769 new_object = reinterpret_cast<Object*>( \
770 new_code_object->instruction_start()); \
772 ASSERT(space_number == CODE_SPACE); \
773 JSGlobalPropertyCell* cell = \
774 JSGlobalPropertyCell::cast(new_object); \
775 new_object = reinterpret_cast<Object*>( \
776 cell->ValueAddress()); \
779 if (how == kFromCode) { \
780 Address location_of_branch_data = \
781 reinterpret_cast<Address>(current); \
782 Assembler::deserialization_set_special_target_at( \
783 location_of_branch_data, \
784 reinterpret_cast<Address>(new_object)); \
785 location_of_branch_data += Assembler::kSpecialTargetSize; \
786 current = reinterpret_cast<Object**>(location_of_branch_data); \
787 current_was_incremented = true; \
789 *current = new_object; \
792 if (emit_write_barrier && write_barrier_needed) { \
793 Address current_address = reinterpret_cast<Address>(current); \
794 isolate->heap()->RecordWrite( \
795 current_object_address, \
796 static_cast<int>(current_address - current_object_address)); \
798 if (!current_was_incremented) { \
807 #define ALL_SPACES(where, how, within) \
808 CASE_STATEMENT(where, how, within, NEW_SPACE) \
809 CASE_BODY(where, how, within, NEW_SPACE) \
810 CASE_STATEMENT(where, how, within, OLD_DATA_SPACE) \
811 CASE_STATEMENT(where, how, within, OLD_POINTER_SPACE) \
812 CASE_STATEMENT(where, how, within, CODE_SPACE) \
813 CASE_STATEMENT(where, how, within, CELL_SPACE) \
814 CASE_STATEMENT(where, how, within, MAP_SPACE) \
815 CASE_BODY(where, how, within, kAnyOldSpace)
817 #define FOUR_CASES(byte_code) \
819 case byte_code + 1: \
820 case byte_code + 2: \
823 #define SIXTEEN_CASES(byte_code) \
824 FOUR_CASES(byte_code) \
825 FOUR_CASES(byte_code + 4) \
826 FOUR_CASES(byte_code + 8) \
827 FOUR_CASES(byte_code + 12)
829 #define COMMON_RAW_LENGTHS(f) \
864 #define RAW_CASE(index) \
865 case kRawData + index: { \
866 byte* raw_data_out = reinterpret_cast<byte*>(current); \
867 source_->CopyRaw(raw_data_out, index * kPointerSize); \
869 reinterpret_cast<Object**>(raw_data_out + index * kPointerSize); \
878 int size = source_->
GetInt();
879 byte* raw_data_out =
reinterpret_cast<byte*
>(current);
880 source_->
CopyRaw(raw_data_out, size);
887 Object*
object = isolate->heap()->roots_array_start()[root_id];
888 ASSERT(!isolate->heap()->InNewSpace(
object));
896 int skip = source_->
GetInt();
897 current =
reinterpret_cast<Object**
>(
898 reinterpret_cast<intptr_t
>(current) + skip);
899 Object*
object = isolate->heap()->roots_array_start()[root_id];
900 ASSERT(!isolate->heap()->InNewSpace(
object));
906 int repeats = source_->
GetInt();
907 Object*
object = current[-1];
908 ASSERT(!isolate->heap()->InNewSpace(
object));
909 for (
int i = 0; i < repeats; i++) current[i] =
object;
922 Object*
object = current[-1];
923 ASSERT(!isolate->heap()->InNewSpace(
object));
924 for (
int i = 0; i < repeats; i++) current[i] =
object;
944 #if V8_TARGET_ARCH_MIPS
960 ALL_SPACES(kBackref, kFromCode, kInnerPointer)
961 ALL_SPACES(kBackrefWithSkip, kFromCode, kInnerPointer)
963 ALL_SPACES(kBackrefWithSkip, kPlain, kInnerPointer)
967 CASE_BODY(kRootArray, kPlain, kStartOfObject, 0)
997 #undef CASE_STATEMENT
1002 int size = source_->
GetInt();
1003 current =
reinterpret_cast<Object**
>(
1004 reinterpret_cast<intptr_t
>(current) + size);
1009 int index = source_->
Get();
1011 NativesExternalStringResource* resource =
1012 new NativesExternalStringResource(isolate->bootstrapper(),
1013 source_vector.start(),
1014 source_vector.length());
1015 *current++ =
reinterpret_cast<Object*
>(resource);
1034 ASSERT(integer < 1 << 22);
1037 if (integer > 0xff) bytes = 2;
1038 if (integer > 0xffff) bytes = 3;
1040 Put(static_cast<int>(integer & 0xff),
"IntPart1");
1041 if (bytes > 1)
Put(static_cast<int>((integer >> 8) & 0xff),
"IntPart2");
1042 if (bytes > 2)
Put(static_cast<int>((integer >> 16) & 0xff),
"IntPart3");
1048 current_root_index_(0),
1050 root_index_wave_front_(0) {
1067 Isolate* isolate = Isolate::Current();
1069 CHECK_EQ(
NULL, Isolate::Current()->thread_manager()->FirstThreadStateInUse());
1081 this->VisitPointer(
object);
1087 Isolate* isolate = Isolate::Current();
1089 for (
Object** current = start; current < end; current++) {
1094 if (reinterpret_cast<Address>(current) ==
1098 }
else if ((*current)->IsSmi()) {
1101 sink_->
Put(reinterpret_cast<byte*>(current)[i],
"Byte");
1120 Isolate* isolate = Isolate::Current();
1121 for (
int i = 0; ; i++) {
1122 if (isolate->serialize_partial_snapshot_cache_length() <= i) {
1127 Object** cache = isolate->serialize_partial_snapshot_cache();
1128 visitor->VisitPointers(&cache[i], &cache[i + 1]);
1131 if (cache[i] == isolate->
heap()->undefined_value()) {
1139 Isolate* isolate = Isolate::Current();
1142 i < isolate->serialize_partial_snapshot_cache_length();
1144 Object* entry = isolate->serialize_partial_snapshot_cache()[i];
1145 if (entry == heap_object)
return i;
1151 int length = isolate->serialize_partial_snapshot_cache_length();
1153 startup_serializer_->VisitPointer(reinterpret_cast<Object**>(&heap_object));
1156 ASSERT(length == isolate->serialize_partial_snapshot_cache_length() - 1);
1166 if (!root->IsSmi() && root == heap_object) {
1167 #if V8_TARGET_ARCH_MIPS
1168 if (from == kFromCode) {
1197 sink_->
Put(kBackref + how_to_code + where_to_point + space,
"BackRefSer");
1199 sink_->
Put(kBackrefWithSkip + how_to_code + where_to_point + space,
1200 "BackRefSerWithSkip");
1212 CHECK(o->IsHeapObject());
1217 PutRoot(root_index, heap_object, how_to_code, where_to_point, skip);
1252 Isolate* isolate = Isolate::Current();
1253 Object* undefined = isolate->
heap()->undefined_value();
1254 VisitPointer(&undefined);
1265 if (how_to_code == kPlain &&
1266 where_to_point == kStartOfObject &&
1268 !
HEAP->InNewSpace(
object)) {
1282 sink_->
Put(kRootArray + how_to_code + where_to_point,
"RootSerialization");
1293 CHECK(o->IsHeapObject());
1296 if (heap_object->IsMap()) {
1300 heap_object->
GetHeap()->raw_unchecked_empty_fixed_array());
1305 PutRoot(root_index, heap_object, how_to_code, where_to_point, skip);
1312 sink_->
PutInt(skip,
"SkipDistanceFromSerializeObject");
1316 sink_->
Put(kPartialSnapshotCache + how_to_code + where_to_point,
1317 "PartialSnapshotCache");
1318 sink_->
PutInt(cache_index,
"partial_snapshot_cache_index");
1328 ASSERT(!heap_object->IsSymbol());
1341 sink_->
PutInt(skip,
"SkipDistanceFromSerializeObject");
1356 int size = object_->
Size();
1358 sink_->
Put(kNewObject + reference_representation_ + space,
1359 "ObjectSerialization");
1362 LOG(i::Isolate::Current(),
1366 int offset = serializer_->
Allocate(space, size);
1373 CHECK_EQ(0, bytes_processed_so_far_);
1376 OutputRawData(object_->
address() + size);
1382 Object** current = start;
1383 while (current < end) {
1384 while (current < end && (*current)->IsSmi()) current++;
1385 if (current < end) OutputRawData(reinterpret_cast<Address>(current));
1387 while (current < end && !(*current)->IsSmi()) {
1389 int root_index = serializer_->RootIndex(current_contents, kPlain);
1393 if (current != start &&
1396 current_contents == current[-1]) {
1398 int repeat_count = 1;
1399 while (current < end - 1 && current[repeat_count] == current_contents) {
1402 current += repeat_count;
1403 bytes_processed_so_far_ += repeat_count *
kPointerSize;
1411 serializer_->SerializeObject(
1412 current_contents, kPlain, kStartOfObject, 0);
1422 Object** current = rinfo->target_object_address();
1424 int skip = OutputRawData(rinfo->target_address_address(),
1425 kCanReturnSkipInsteadOfSkipping);
1426 HowToCode representation = rinfo->IsCodedSpecially() ? kFromCode :
kPlain;
1427 serializer_->SerializeObject(*current, representation, kStartOfObject, skip);
1428 bytes_processed_so_far_ += rinfo->target_address_size();
1435 int skip = OutputRawData(references_start, kCanReturnSkipInsteadOfSkipping);
1437 for (
Address* current = start; current < end; current++) {
1438 sink_->
Put(kExternalReference + kPlain + kStartOfObject,
"ExternalRef");
1441 int reference_id = serializer_->EncodeExternalReference(*current);
1444 bytes_processed_so_far_ +=
static_cast<int>((end - start) *
kPointerSize);
1449 Address references_start = rinfo->target_address_address();
1450 int skip = OutputRawData(references_start, kCanReturnSkipInsteadOfSkipping);
1452 Address* current = rinfo->target_reference_address();
1453 int representation = rinfo->IsCodedSpecially() ?
1455 sink_->
Put(kExternalReference + representation,
"ExternalRef");
1457 int reference_id = serializer_->EncodeExternalReference(*current);
1459 bytes_processed_so_far_ += rinfo->target_address_size();
1464 Address target_start = rinfo->target_address_address();
1465 int skip = OutputRawData(target_start, kCanReturnSkipInsteadOfSkipping);
1466 Address target = rinfo->target_address();
1467 uint32_t encoding = serializer_->EncodeExternalReference(target);
1468 CHECK(target ==
NULL ? encoding == 0 : encoding != 0);
1471 if (rinfo->IsCodedSpecially()) {
1472 representation = kStartOfObject +
kFromCode;
1474 representation = kStartOfObject +
kPlain;
1476 sink_->
Put(kExternalReference + representation,
"ExternalReference");
1479 bytes_processed_so_far_ += rinfo->target_address_size();
1484 CHECK(RelocInfo::IsCodeTarget(rinfo->rmode()));
1485 Address target_start = rinfo->target_address_address();
1486 int skip = OutputRawData(target_start, kCanReturnSkipInsteadOfSkipping);
1488 serializer_->SerializeObject(target, kFromCode, kInnerPointer, skip);
1489 bytes_processed_so_far_ += rinfo->target_address_size();
1495 int skip = OutputRawData(entry_address, kCanReturnSkipInsteadOfSkipping);
1496 serializer_->SerializeObject(target, kPlain, kInnerPointer, skip);
1502 ASSERT(rinfo->rmode() == RelocInfo::GLOBAL_PROPERTY_CELL);
1505 int skip = OutputRawData(rinfo->pc(), kCanReturnSkipInsteadOfSkipping);
1506 serializer_->SerializeObject(cell, kPlain, kInnerPointer, skip);
1512 Address references_start =
reinterpret_cast<Address>(resource_pointer);
1513 OutputRawData(references_start);
1515 Object* source =
HEAP->natives_source_cache()->get(i);
1516 if (!source->IsUndefined()) {
1519 const Resource* resource =
string->resource();
1520 if (resource == *resource_pointer) {
1523 bytes_processed_so_far_ +=
sizeof(resource);
1534 int Serializer::ObjectSerializer::OutputRawData(
1535 Address up_to, Serializer::ObjectSerializer::ReturnSkip return_skip) {
1536 Address object_start = object_->address();
1537 Address base = object_start + bytes_processed_so_far_;
1538 int up_to_offset =
static_cast<int>(up_to - object_start);
1539 int to_skip = up_to_offset - bytes_processed_so_far_;
1540 int bytes_to_output = to_skip;
1541 bytes_processed_so_far_ += to_skip;
1545 bool outputting_code =
false;
1546 if (to_skip != 0 && code_object_ && !code_has_been_output_) {
1548 bytes_to_output = object_->Size() + to_skip - bytes_processed_so_far_;
1549 outputting_code =
true;
1550 code_has_been_output_ =
true;
1552 if (bytes_to_output != 0 &&
1553 (!code_object_ || outputting_code)) {
1554 #define RAW_CASE(index) \
1555 if (!outputting_code && bytes_to_output == index * kPointerSize && \
1556 index * kPointerSize == to_skip) { \
1557 sink_->PutSection(kRawData + index, "RawDataFixed"); \
1567 for (
int i = 0; i < bytes_to_output; i++) {
1568 unsigned int data = base[i];
1572 if (to_skip != 0 && return_skip == kIgnoringReturn) {
1584 if (
HEAP->InSpace(
object, s)) {
1596 int allocation_address =
fullness_[space];
1597 fullness_[space] = allocation_address + size;
1598 return allocation_address;
1614 for (
unsigned i = 0; i <
sizeof(
int32_t) - 1; i++) {
1621 if (0u + length_ - position_ > 2 *
sizeof(uint32_t))
return false;
1622 for (
int x = position_; x < length_; x++) {
Object ** roots_array_start()
virtual void SerializeObject(Object *o, HowToCode how_to_code, WhereToPoint where_to_point, int skip)=0
static const int kInvalidRootIndex
void VisitCodeTarget(RelocInfo *target)
int CurrentAllocationAddress(int space)
SerializationAddressMapper address_mapper_
#define CHECK_EQ(expected, value)
static int CodePageAreaSize()
void CopyRaw(byte *to, int number_of_bytes)
void AddMapping(HeapObject *obj, int to)
bool InNewSpace(Object *object)
virtual void Serialize(Object **o)
HandleScopeImplementer * handle_scope_implementer()
static bool too_late_to_enable_now_
bool IsMapped(HeapObject *obj)
#define SIXTEEN_CASES(byte_code)
void IterateWeakRoots(ObjectVisitor *v, VisitMode mode)
static Smi * FromInt(int value)
#define LOG(isolate, Call)
static int RootArrayConstantFromByteCode(int byte_code)
static Object * GetObjectFromEntryAddress(Address location_of_address)
#define ACCESSOR_DESCRIPTOR_DECLARATION(name)
static Vector< const char > GetRawScriptSource(int index)
static HeapObject * cast(Object *obj)
virtual void SerializeStrongReferences()
static const int kOldSpaceRoots
static Map * cast(Object *obj)
void SerializeWeakReferences()
Serializer(SnapshotByteSink *sink)
int SpaceAreaSize(int space)
void VisitRuntimeEntry(RelocInfo *reloc)
void IterateStrongRoots(ObjectVisitor *v, VisitMode mode)
#define ASSERT(condition)
#define CASE_BODY(where, how, within, space_number_if_any)
const int kPointerSizeLog2
void VisitPointers(Object **start, Object **end)
ThreadManager * thread_manager()
void DeserializePartial(Object **root)
static int CodeForRepeats(int repeats)
static void Iterate(ObjectVisitor *visitor)
void PutInt(uintptr_t integer, const char *description)
static ExternalAsciiString * cast(Object *obj)
intptr_t root_index_wave_front_
static const int kPageSize
static Code * cast(Object *obj)
bool IsDefaultIsolate() const
void PutRoot(int index, HeapObject *object, HowToCode how, WhereToPoint where, int skip)
#define RUNTIME_FUNCTION_LIST(F)
StoreBuffer * store_buffer()
void VisitCodeEntry(Address entry_address)
#define ALL_SPACES(where, how, within)
void VisitPointers(Object **start, Object **end)
#define STATS_COUNTER_LIST_2(SC)
void IterateBody(InstanceType type, int object_size, ObjectVisitor *v)
static int GetBuiltinsCount()
void RepairFreeListsAfterBoot()
STATIC_ASSERT((FixedDoubleArray::kHeaderSize &kDoubleAlignmentMask)==0)
int fullness_[LAST_SPACE+1]
static const int kConstantRepeat
ExternalReferenceDecoder()
static const int kMaxRepeats
int NumberOfWeakHandles()
Deserializer(SnapshotByteSource *source)
static const int kRawData
virtual int PartialSnapshotCacheIndex(HeapObject *o)
static const int kRootArrayConstants
MemoryAllocator * memory_allocator()
static int SpaceOfObject(HeapObject *object)
#define FOUR_CASES(byte_code)
T * NewArray(size_t size)
SerializationAddressMapper * address_mapper()
#define COUNTER_ENTRY(name, caption)
#define DEF_ENTRY_A(name, kind, state, extra)
virtual void SerializeObject(Object *o, HowToCode how_to_code, WhereToPoint where_to_point, int skip)
GlobalHandles * global_handles()
ExternalReferenceEncoder * external_reference_encoder_
Entry * Lookup(void *key, uint32_t hash, bool insert, AllocationPolicy allocator=AllocationPolicy())
void ReserveSpace(int *sizes, Address *addresses)
int Allocate(int space, int size)
static const int kNumberOfSpaces
static Code * GetCodeFromTargetAddress(Address address)
static const int kRootArrayNumberOfConstantEncodings
uint32_t Encode(Address key) const
static bool serialization_enabled_
static int RepeatsForCode(int byte_code)
#define COMMON_RAW_LENGTHS(f)
void VisitExternalReferences(Address *start, Address *end)
void SerializeReferenceToPreviousObject(int space, int address, HowToCode how_to_code, WhereToPoint where_to_point, int skip)
bool has_installed_extensions()
~ExternalReferenceDecoder()
List< internal::Object ** > * blocks()
static const int kObjectStartOffset
void PushToPartialSnapshotCache(Object *obj)
#define ACCESSOR_DESCRIPTOR_LIST(V)
#define BUILTIN_LIST_DEBUG_A(V)
#define IC_UTIL_LIST(ICU)
#define FOR_EACH_ISOLATE_ADDRESS_NAME(C)
static JSGlobalPropertyCell * cast(Object *obj)
const int kObjectAlignmentBits
#define CASE_STATEMENT(where, how, within, space_number)
void VisitExternalAsciiString(v8::String::ExternalAsciiStringResource **resource)
#define ASSERT_EQ(v1, v2)
virtual void SerializeObject(Object *o, HowToCode how_to_code, WhereToPoint where_to_point, int skip)
InstanceType instance_type()
static HeapObject * FromAddress(Address address)
static const int kSynchronize
#define ASSERT_NE(v1, v2)
void Add(const T &element, AllocationPolicy allocator=AllocationPolicy())
#define BUILD_NAME_LITERAL(CamelName, hacker_name)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 and VFP2 enable use of VFP2 instructions if available enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of MIPS FPU instructions if NULL
static const int kNativesStringResource
int RootIndex(HeapObject *heap_object, HowToCode from)
void DeleteArray(T *array)
#define DEF_ENTRY_C(name, ignored)
virtual void Put(int byte, const char *description)=0
#define LOG_CODE_EVENT(isolate, Call)
void VisitGlobalPropertyCell(RelocInfo *rinfo)
static ExternalReferenceTable * instance(Isolate *isolate)
virtual bool ShouldBeInThePartialSnapshotCache(HeapObject *o)
#define BUILTIN_LIST_C(V)
ThreadState * FirstThreadStateInUse()
int MappedTo(HeapObject *obj)
#define STATS_COUNTER_LIST_1(SC)
#define BUILTIN_LIST_A(V)
virtual void PutSection(int byte, const char *description)
void VisitExternalReference(RelocInfo *rinfo)
void VisitEmbeddedPointer(RelocInfo *target)
ExternalReferenceEncoder()
void set_native_contexts_list(Object *object)
const char * NameOfAddress(Address key) const