Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2600)

Unified Diff: src/serialize.cc

Issue 441983002: Check that external references are registered in the serializer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/serialize.h ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/serialize.cc
diff --git a/src/serialize.cc b/src/serialize.cc
index 5a54543910883b3aee59865838fb4d3fe2b1e0e5..7dab02f18dadcf03b5640f6c40b6f60de9b831e7 100644
--- a/src/serialize.cc
+++ b/src/serialize.cc
@@ -100,6 +100,8 @@ void ExternalReferenceTable::Add(Address address,
entry.code = EncodeExternal(type, id);
entry.name = name;
DCHECK_NE(0, entry.code);
+ // Assert that the code is added in ascending order to rule out duplicates.
+ DCHECK((size() == 0) || (code(size() - 1) < entry.code));
refs_.Add(entry);
if (id > max_id_[type]) max_id_[type] = id;
}
@@ -110,6 +112,144 @@ void ExternalReferenceTable::PopulateTable(Isolate* isolate) {
max_id_[type_code] = 0;
}
+ // Miscellaneous
+ Add(ExternalReference::roots_array_start(isolate).address(),
+ "Heap::roots_array_start()");
+ Add(ExternalReference::address_of_stack_limit(isolate).address(),
+ "StackGuard::address_of_jslimit()");
+ Add(ExternalReference::address_of_real_stack_limit(isolate).address(),
+ "StackGuard::address_of_real_jslimit()");
+ Add(ExternalReference::new_space_start(isolate).address(),
+ "Heap::NewSpaceStart()");
+ Add(ExternalReference::new_space_mask(isolate).address(),
+ "Heap::NewSpaceMask()");
+ Add(ExternalReference::new_space_allocation_limit_address(isolate).address(),
+ "Heap::NewSpaceAllocationLimitAddress()");
+ Add(ExternalReference::new_space_allocation_top_address(isolate).address(),
+ "Heap::NewSpaceAllocationTopAddress()");
+ Add(ExternalReference::debug_break(isolate).address(), "Debug::Break()");
+ Add(ExternalReference::debug_step_in_fp_address(isolate).address(),
+ "Debug::step_in_fp_addr()");
+ Add(ExternalReference::mod_two_doubles_operation(isolate).address(),
+ "mod_two_doubles");
+ // Keyed lookup cache.
+ Add(ExternalReference::keyed_lookup_cache_keys(isolate).address(),
+ "KeyedLookupCache::keys()");
+ Add(ExternalReference::keyed_lookup_cache_field_offsets(isolate).address(),
+ "KeyedLookupCache::field_offsets()");
+ Add(ExternalReference::handle_scope_next_address(isolate).address(),
+ "HandleScope::next");
+ Add(ExternalReference::handle_scope_limit_address(isolate).address(),
+ "HandleScope::limit");
+ Add(ExternalReference::handle_scope_level_address(isolate).address(),
+ "HandleScope::level");
+ Add(ExternalReference::new_deoptimizer_function(isolate).address(),
+ "Deoptimizer::New()");
+ Add(ExternalReference::compute_output_frames_function(isolate).address(),
+ "Deoptimizer::ComputeOutputFrames()");
+ Add(ExternalReference::address_of_min_int().address(),
+ "LDoubleConstant::min_int");
+ Add(ExternalReference::address_of_one_half().address(),
+ "LDoubleConstant::one_half");
+ Add(ExternalReference::isolate_address(isolate).address(), "isolate");
+ Add(ExternalReference::address_of_negative_infinity().address(),
+ "LDoubleConstant::negative_infinity");
+ Add(ExternalReference::power_double_double_function(isolate).address(),
+ "power_double_double_function");
+ Add(ExternalReference::power_double_int_function(isolate).address(),
+ "power_double_int_function");
+ Add(ExternalReference::math_log_double_function(isolate).address(),
+ "std::log");
+ Add(ExternalReference::store_buffer_top(isolate).address(),
+ "store_buffer_top");
+ Add(ExternalReference::address_of_canonical_non_hole_nan().address(),
+ "canonical_nan");
+ Add(ExternalReference::address_of_the_hole_nan().address(), "the_hole_nan");
+ Add(ExternalReference::get_date_field_function(isolate).address(),
+ "JSDate::GetField");
+ Add(ExternalReference::date_cache_stamp(isolate).address(),
+ "date_cache_stamp");
+ Add(ExternalReference::address_of_pending_message_obj(isolate).address(),
+ "address_of_pending_message_obj");
+ Add(ExternalReference::address_of_has_pending_message(isolate).address(),
+ "address_of_has_pending_message");
+ Add(ExternalReference::address_of_pending_message_script(isolate).address(),
+ "pending_message_script");
+ Add(ExternalReference::get_make_code_young_function(isolate).address(),
+ "Code::MakeCodeYoung");
+ Add(ExternalReference::cpu_features().address(), "cpu_features");
+ Add(ExternalReference(Runtime::kAllocateInNewSpace, isolate).address(),
+ "Runtime::AllocateInNewSpace");
+ Add(ExternalReference(Runtime::kAllocateInTargetSpace, isolate).address(),
+ "Runtime::AllocateInTargetSpace");
+ Add(ExternalReference::old_pointer_space_allocation_top_address(isolate)
+ .address(),
+ "Heap::OldPointerSpaceAllocationTopAddress");
+ Add(ExternalReference::old_pointer_space_allocation_limit_address(isolate)
+ .address(),
+ "Heap::OldPointerSpaceAllocationLimitAddress");
+ Add(ExternalReference::old_data_space_allocation_top_address(isolate)
+ .address(),
+ "Heap::OldDataSpaceAllocationTopAddress");
+ Add(ExternalReference::old_data_space_allocation_limit_address(isolate)
+ .address(),
+ "Heap::OldDataSpaceAllocationLimitAddress");
+ Add(ExternalReference::allocation_sites_list_address(isolate).address(),
+ "Heap::allocation_sites_list_address()");
+ Add(ExternalReference::address_of_uint32_bias().address(), "uint32_bias");
+ Add(ExternalReference::get_mark_code_as_executed_function(isolate).address(),
+ "Code::MarkCodeAsExecuted");
+ Add(ExternalReference::is_profiling_address(isolate).address(),
+ "CpuProfiler::is_profiling");
+ Add(ExternalReference::scheduled_exception_address(isolate).address(),
+ "Isolate::scheduled_exception");
+ Add(ExternalReference::invoke_function_callback(isolate).address(),
+ "InvokeFunctionCallback");
+ Add(ExternalReference::invoke_accessor_getter_callback(isolate).address(),
+ "InvokeAccessorGetterCallback");
+ Add(ExternalReference::flush_icache_function(isolate).address(),
+ "CpuFeatures::FlushICache");
+ Add(ExternalReference::log_enter_external_function(isolate).address(),
+ "Logger::EnterExternal");
+ Add(ExternalReference::log_leave_external_function(isolate).address(),
+ "Logger::LeaveExternal");
+ Add(ExternalReference::address_of_minus_one_half().address(),
+ "double_constants.minus_one_half");
+ Add(ExternalReference::stress_deopt_count(isolate).address(),
+ "Isolate::stress_deopt_count_address()");
+ Add(ExternalReference::incremental_marking_record_write_function(isolate)
+ .address(),
+ "IncrementalMarking::RecordWriteFromCode");
+
+ // Debug addresses
+ Add(ExternalReference::debug_after_break_target_address(isolate).address(),
+ "Debug::after_break_target_address()");
+ Add(ExternalReference::debug_restarter_frame_function_pointer_address(isolate)
+ .address(),
+ "Debug::restarter_frame_function_pointer_address()");
+ Add(ExternalReference::debug_is_active_address(isolate).address(),
+ "Debug::is_active_address()");
+
+#ifndef V8_INTERPRETED_REGEXP
+ Add(ExternalReference::re_case_insensitive_compare_uc16(isolate).address(),
+ "NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16()");
+ Add(ExternalReference::re_check_stack_guard_state(isolate).address(),
+ "RegExpMacroAssembler*::CheckStackGuardState()");
+ Add(ExternalReference::re_grow_stack(isolate).address(),
+ "NativeRegExpMacroAssembler::GrowStack()");
+ Add(ExternalReference::re_word_character_map().address(),
+ "NativeRegExpMacroAssembler::word_character_map");
+ Add(ExternalReference::address_of_regexp_stack_limit(isolate).address(),
+ "RegExpStack::limit_address()");
+ Add(ExternalReference::address_of_regexp_stack_memory_address(isolate)
+ .address(),
+ "RegExpStack::memory_address()");
+ Add(ExternalReference::address_of_regexp_stack_memory_size(isolate).address(),
+ "RegExpStack::memory_size()");
+ Add(ExternalReference::address_of_static_offsets_vector(isolate).address(),
+ "OffsetsVector::static_offsets_vector");
+#endif // V8_INTERPRETED_REGEXP
+
// The following populates all of the different type of external references
// into the ExternalReferenceTable.
//
@@ -240,292 +380,26 @@ void ExternalReferenceTable::PopulateTable(Isolate* isolate) {
// Stub cache tables
Add(stub_cache->key_reference(StubCache::kPrimary).address(),
- STUB_CACHE_TABLE,
- 1,
- "StubCache::primary_->key");
+ STUB_CACHE_TABLE, 1, "StubCache::primary_->key");
Add(stub_cache->value_reference(StubCache::kPrimary).address(),
- STUB_CACHE_TABLE,
- 2,
- "StubCache::primary_->value");
+ STUB_CACHE_TABLE, 2, "StubCache::primary_->value");
Add(stub_cache->map_reference(StubCache::kPrimary).address(),
- STUB_CACHE_TABLE,
- 3,
- "StubCache::primary_->map");
+ STUB_CACHE_TABLE, 3, "StubCache::primary_->map");
Add(stub_cache->key_reference(StubCache::kSecondary).address(),
- STUB_CACHE_TABLE,
- 4,
- "StubCache::secondary_->key");
+ STUB_CACHE_TABLE, 4, "StubCache::secondary_->key");
Add(stub_cache->value_reference(StubCache::kSecondary).address(),
- STUB_CACHE_TABLE,
- 5,
- "StubCache::secondary_->value");
+ STUB_CACHE_TABLE, 5, "StubCache::secondary_->value");
Add(stub_cache->map_reference(StubCache::kSecondary).address(),
- STUB_CACHE_TABLE,
- 6,
- "StubCache::secondary_->map");
+ STUB_CACHE_TABLE, 6, "StubCache::secondary_->map");
// Runtime entries
Add(ExternalReference::delete_handle_scope_extensions(isolate).address(),
- RUNTIME_ENTRY,
- 4,
- "HandleScope::DeleteExtensions");
- Add(ExternalReference::
- incremental_marking_record_write_function(isolate).address(),
- RUNTIME_ENTRY,
- 5,
- "IncrementalMarking::RecordWrite");
+ RUNTIME_ENTRY, 1, "HandleScope::DeleteExtensions");
+ Add(ExternalReference::incremental_marking_record_write_function(isolate)
+ .address(),
+ RUNTIME_ENTRY, 2, "IncrementalMarking::RecordWrite");
Add(ExternalReference::store_buffer_overflow_function(isolate).address(),
- RUNTIME_ENTRY,
- 6,
- "StoreBuffer::StoreBufferOverflow");
-
- // Miscellaneous
- Add(ExternalReference::roots_array_start(isolate).address(),
- UNCLASSIFIED,
- 3,
- "Heap::roots_array_start()");
- Add(ExternalReference::address_of_stack_limit(isolate).address(),
- UNCLASSIFIED,
- 4,
- "StackGuard::address_of_jslimit()");
- Add(ExternalReference::address_of_real_stack_limit(isolate).address(),
- UNCLASSIFIED,
- 5,
- "StackGuard::address_of_real_jslimit()");
-#ifndef V8_INTERPRETED_REGEXP
- Add(ExternalReference::address_of_regexp_stack_limit(isolate).address(),
- UNCLASSIFIED,
- 6,
- "RegExpStack::limit_address()");
- Add(ExternalReference::address_of_regexp_stack_memory_address(
- isolate).address(),
- UNCLASSIFIED,
- 7,
- "RegExpStack::memory_address()");
- Add(ExternalReference::address_of_regexp_stack_memory_size(isolate).address(),
- UNCLASSIFIED,
- 8,
- "RegExpStack::memory_size()");
- Add(ExternalReference::address_of_static_offsets_vector(isolate).address(),
- UNCLASSIFIED,
- 9,
- "OffsetsVector::static_offsets_vector");
-#endif // V8_INTERPRETED_REGEXP
- Add(ExternalReference::new_space_start(isolate).address(),
- UNCLASSIFIED,
- 10,
- "Heap::NewSpaceStart()");
- Add(ExternalReference::new_space_mask(isolate).address(),
- UNCLASSIFIED,
- 11,
- "Heap::NewSpaceMask()");
- Add(ExternalReference::new_space_allocation_limit_address(isolate).address(),
- UNCLASSIFIED,
- 14,
- "Heap::NewSpaceAllocationLimitAddress()");
- Add(ExternalReference::new_space_allocation_top_address(isolate).address(),
- UNCLASSIFIED,
- 15,
- "Heap::NewSpaceAllocationTopAddress()");
- Add(ExternalReference::debug_break(isolate).address(),
- UNCLASSIFIED,
- 16,
- "Debug::Break()");
- Add(ExternalReference::debug_step_in_fp_address(isolate).address(),
- UNCLASSIFIED,
- 17,
- "Debug::step_in_fp_addr()");
- Add(ExternalReference::mod_two_doubles_operation(isolate).address(),
- UNCLASSIFIED,
- 22,
- "mod_two_doubles");
-#ifndef V8_INTERPRETED_REGEXP
- Add(ExternalReference::re_case_insensitive_compare_uc16(isolate).address(),
- UNCLASSIFIED,
- 24,
- "NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16()");
- Add(ExternalReference::re_check_stack_guard_state(isolate).address(),
- UNCLASSIFIED,
- 25,
- "RegExpMacroAssembler*::CheckStackGuardState()");
- Add(ExternalReference::re_grow_stack(isolate).address(),
- UNCLASSIFIED,
- 26,
- "NativeRegExpMacroAssembler::GrowStack()");
- Add(ExternalReference::re_word_character_map().address(),
- UNCLASSIFIED,
- 27,
- "NativeRegExpMacroAssembler::word_character_map");
-#endif // V8_INTERPRETED_REGEXP
- // Keyed lookup cache.
- Add(ExternalReference::keyed_lookup_cache_keys(isolate).address(),
- UNCLASSIFIED,
- 28,
- "KeyedLookupCache::keys()");
- Add(ExternalReference::keyed_lookup_cache_field_offsets(isolate).address(),
- UNCLASSIFIED,
- 29,
- "KeyedLookupCache::field_offsets()");
- Add(ExternalReference::handle_scope_next_address(isolate).address(),
- UNCLASSIFIED,
- 31,
- "HandleScope::next");
- Add(ExternalReference::handle_scope_limit_address(isolate).address(),
- UNCLASSIFIED,
- 32,
- "HandleScope::limit");
- Add(ExternalReference::handle_scope_level_address(isolate).address(),
- UNCLASSIFIED,
- 33,
- "HandleScope::level");
- Add(ExternalReference::new_deoptimizer_function(isolate).address(),
- UNCLASSIFIED,
- 34,
- "Deoptimizer::New()");
- Add(ExternalReference::compute_output_frames_function(isolate).address(),
- UNCLASSIFIED,
- 35,
- "Deoptimizer::ComputeOutputFrames()");
- Add(ExternalReference::address_of_min_int().address(),
- UNCLASSIFIED,
- 36,
- "LDoubleConstant::min_int");
- Add(ExternalReference::address_of_one_half().address(),
- UNCLASSIFIED,
- 37,
- "LDoubleConstant::one_half");
- Add(ExternalReference::isolate_address(isolate).address(),
- UNCLASSIFIED,
- 38,
- "isolate");
- Add(ExternalReference::address_of_minus_zero().address(),
- UNCLASSIFIED,
- 39,
- "LDoubleConstant::minus_zero");
- Add(ExternalReference::address_of_negative_infinity().address(),
- UNCLASSIFIED,
- 40,
- "LDoubleConstant::negative_infinity");
- Add(ExternalReference::power_double_double_function(isolate).address(),
- UNCLASSIFIED,
- 41,
- "power_double_double_function");
- Add(ExternalReference::power_double_int_function(isolate).address(),
- UNCLASSIFIED,
- 42,
- "power_double_int_function");
- Add(ExternalReference::store_buffer_top(isolate).address(),
- UNCLASSIFIED,
- 43,
- "store_buffer_top");
- Add(ExternalReference::address_of_canonical_non_hole_nan().address(),
- UNCLASSIFIED,
- 44,
- "canonical_nan");
- Add(ExternalReference::address_of_the_hole_nan().address(),
- UNCLASSIFIED,
- 45,
- "the_hole_nan");
- Add(ExternalReference::get_date_field_function(isolate).address(),
- UNCLASSIFIED,
- 46,
- "JSDate::GetField");
- Add(ExternalReference::date_cache_stamp(isolate).address(),
- UNCLASSIFIED,
- 47,
- "date_cache_stamp");
- Add(ExternalReference::address_of_pending_message_obj(isolate).address(),
- UNCLASSIFIED,
- 48,
- "address_of_pending_message_obj");
- Add(ExternalReference::address_of_has_pending_message(isolate).address(),
- UNCLASSIFIED,
- 49,
- "address_of_has_pending_message");
- Add(ExternalReference::address_of_pending_message_script(isolate).address(),
- UNCLASSIFIED,
- 50,
- "pending_message_script");
- Add(ExternalReference::get_make_code_young_function(isolate).address(),
- UNCLASSIFIED,
- 51,
- "Code::MakeCodeYoung");
- Add(ExternalReference::cpu_features().address(),
- UNCLASSIFIED,
- 52,
- "cpu_features");
- Add(ExternalReference(Runtime::kAllocateInNewSpace, isolate).address(),
- UNCLASSIFIED,
- 53,
- "Runtime::AllocateInNewSpace");
- Add(ExternalReference(Runtime::kAllocateInTargetSpace, isolate).address(),
- UNCLASSIFIED,
- 54,
- "Runtime::AllocateInTargetSpace");
- Add(ExternalReference::old_pointer_space_allocation_top_address(
- isolate).address(),
- UNCLASSIFIED,
- 55,
- "Heap::OldPointerSpaceAllocationTopAddress");
- Add(ExternalReference::old_pointer_space_allocation_limit_address(
- isolate).address(),
- UNCLASSIFIED,
- 56,
- "Heap::OldPointerSpaceAllocationLimitAddress");
- Add(ExternalReference::old_data_space_allocation_top_address(
- isolate).address(),
- UNCLASSIFIED,
- 57,
- "Heap::OldDataSpaceAllocationTopAddress");
- Add(ExternalReference::old_data_space_allocation_limit_address(
- isolate).address(),
- UNCLASSIFIED,
- 58,
- "Heap::OldDataSpaceAllocationLimitAddress");
- Add(ExternalReference::allocation_sites_list_address(isolate).address(),
- UNCLASSIFIED,
- 59,
- "Heap::allocation_sites_list_address()");
- Add(ExternalReference::address_of_uint32_bias().address(),
- UNCLASSIFIED,
- 60,
- "uint32_bias");
- Add(ExternalReference::get_mark_code_as_executed_function(isolate).address(),
- UNCLASSIFIED,
- 61,
- "Code::MarkCodeAsExecuted");
-
- Add(ExternalReference::is_profiling_address(isolate).address(),
- UNCLASSIFIED,
- 62,
- "CpuProfiler::is_profiling");
-
- Add(ExternalReference::scheduled_exception_address(isolate).address(),
- UNCLASSIFIED,
- 63,
- "Isolate::scheduled_exception");
-
- Add(ExternalReference::invoke_function_callback(isolate).address(),
- UNCLASSIFIED,
- 64,
- "InvokeFunctionCallback");
-
- Add(ExternalReference::invoke_accessor_getter_callback(isolate).address(),
- UNCLASSIFIED,
- 65,
- "InvokeAccessorGetterCallback");
-
- // Debug addresses
- Add(ExternalReference::debug_after_break_target_address(isolate).address(),
- UNCLASSIFIED,
- 66,
- "Debug::after_break_target_address()");
-
- Add(ExternalReference::debug_restarter_frame_function_pointer_address(
- isolate).address(),
- UNCLASSIFIED,
- 67,
- "Debug::restarter_frame_function_pointer_address()");
+ RUNTIME_ENTRY, 3, "StoreBuffer::StoreBufferOverflow");
// Add a small set of deopt entry addresses to encoder without generating the
// deopt table code, which isn't possible at deserialization time.
« no previous file with comments | « src/serialize.h ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698