Check that external references are registered in the serializer.
Inspired by a patch by Slava Chigrin <vchigrin@yandex-team.ru> R=jkummerow@chromium.org, vchigrin@yandex-team.ru Review URL: https://codereview.chromium.org/441983002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22896 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
cbb12d66f6
commit
0fb57e51d4
@ -42,6 +42,7 @@ def _V8PresubmitChecks(input_api, output_api):
|
||||
from presubmit import CppLintProcessor
|
||||
from presubmit import SourceProcessor
|
||||
from presubmit import CheckGeneratedRuntimeTests
|
||||
from presubmit import CheckExternalReferenceRegistration
|
||||
|
||||
results = []
|
||||
if not CppLintProcessor().Run(input_api.PresubmitLocalPath()):
|
||||
@ -53,6 +54,9 @@ def _V8PresubmitChecks(input_api, output_api):
|
||||
if not CheckGeneratedRuntimeTests(input_api.PresubmitLocalPath()):
|
||||
results.append(output_api.PresubmitError(
|
||||
"Generated runtime tests check failed"))
|
||||
if not CheckExternalReferenceRegistration(input_api.PresubmitLocalPath()):
|
||||
results.append(output_api.PresubmitError(
|
||||
"External references registration check failed"))
|
||||
return results
|
||||
|
||||
|
||||
|
@ -797,6 +797,7 @@ void MathExpGenerator::EmitMathExp(MacroAssembler* masm,
|
||||
DCHECK(!temp1.is(temp3));
|
||||
DCHECK(!temp2.is(temp3));
|
||||
DCHECK(ExternalReference::math_exp_constants(0).address() != NULL);
|
||||
DCHECK(!masm->serializer_enabled()); // External references not serializable.
|
||||
|
||||
Label zero, infinity, done;
|
||||
|
||||
|
@ -520,6 +520,7 @@ void MathExpGenerator::EmitMathExp(MacroAssembler* masm,
|
||||
double_temp1, double_temp2,
|
||||
temp1, temp2, temp3));
|
||||
DCHECK(ExternalReference::math_exp_constants(0).address() != NULL);
|
||||
DCHECK(!masm->serializer_enabled()); // External references not serializable.
|
||||
|
||||
Label done;
|
||||
DoubleRegister double_temp3 = result;
|
||||
|
@ -105,9 +105,6 @@ struct DoubleConstant BASE_EMBEDDED {
|
||||
double min_int;
|
||||
double one_half;
|
||||
double minus_one_half;
|
||||
double minus_zero;
|
||||
double zero;
|
||||
double uint8_max_value;
|
||||
double negative_infinity;
|
||||
double canonical_non_hole_nan;
|
||||
double the_hole_nan;
|
||||
@ -905,9 +902,6 @@ void ExternalReference::SetUp() {
|
||||
double_constants.min_int = kMinInt;
|
||||
double_constants.one_half = 0.5;
|
||||
double_constants.minus_one_half = -0.5;
|
||||
double_constants.minus_zero = -0.0;
|
||||
double_constants.uint8_max_value = 255;
|
||||
double_constants.zero = 0.0;
|
||||
double_constants.canonical_non_hole_nan = base::OS::nan_value();
|
||||
double_constants.the_hole_nan = BitCast<double>(kHoleNanInt64);
|
||||
double_constants.negative_infinity = -V8_INFINITY;
|
||||
@ -1165,13 +1159,6 @@ ExternalReference ExternalReference::new_space_allocation_top_address(
|
||||
}
|
||||
|
||||
|
||||
ExternalReference ExternalReference::heap_always_allocate_scope_depth(
|
||||
Isolate* isolate) {
|
||||
Heap* heap = isolate->heap();
|
||||
return ExternalReference(heap->always_allocate_scope_depth_address());
|
||||
}
|
||||
|
||||
|
||||
ExternalReference ExternalReference::new_space_allocation_limit_address(
|
||||
Isolate* isolate) {
|
||||
return ExternalReference(isolate->heap()->NewSpaceAllocationLimitAddress());
|
||||
@ -1264,23 +1251,6 @@ ExternalReference ExternalReference::address_of_minus_one_half() {
|
||||
}
|
||||
|
||||
|
||||
ExternalReference ExternalReference::address_of_minus_zero() {
|
||||
return ExternalReference(
|
||||
reinterpret_cast<void*>(&double_constants.minus_zero));
|
||||
}
|
||||
|
||||
|
||||
ExternalReference ExternalReference::address_of_zero() {
|
||||
return ExternalReference(reinterpret_cast<void*>(&double_constants.zero));
|
||||
}
|
||||
|
||||
|
||||
ExternalReference ExternalReference::address_of_uint8_max_value() {
|
||||
return ExternalReference(
|
||||
reinterpret_cast<void*>(&double_constants.uint8_max_value));
|
||||
}
|
||||
|
||||
|
||||
ExternalReference ExternalReference::address_of_negative_infinity() {
|
||||
return ExternalReference(
|
||||
reinterpret_cast<void*>(&double_constants.negative_infinity));
|
||||
|
@ -866,8 +866,6 @@ class ExternalReference BASE_EMBEDDED {
|
||||
// Static variable Heap::NewSpaceStart()
|
||||
static ExternalReference new_space_start(Isolate* isolate);
|
||||
static ExternalReference new_space_mask(Isolate* isolate);
|
||||
static ExternalReference heap_always_allocate_scope_depth(Isolate* isolate);
|
||||
static ExternalReference new_space_mark_bits(Isolate* isolate);
|
||||
|
||||
// Write barrier.
|
||||
static ExternalReference store_buffer_top(Isolate* isolate);
|
||||
@ -901,9 +899,6 @@ class ExternalReference BASE_EMBEDDED {
|
||||
static ExternalReference address_of_min_int();
|
||||
static ExternalReference address_of_one_half();
|
||||
static ExternalReference address_of_minus_one_half();
|
||||
static ExternalReference address_of_minus_zero();
|
||||
static ExternalReference address_of_zero();
|
||||
static ExternalReference address_of_uint8_max_value();
|
||||
static ExternalReference address_of_negative_infinity();
|
||||
static ExternalReference address_of_canonical_non_hole_nan();
|
||||
static ExternalReference address_of_the_hole_nan();
|
||||
|
@ -929,6 +929,7 @@ void MathExpGenerator::EmitMathExp(MacroAssembler* masm,
|
||||
DCHECK(!result.is(double_scratch));
|
||||
DCHECK(!temp1.is(temp2));
|
||||
DCHECK(ExternalReference::math_exp_constants(0).address() != NULL);
|
||||
DCHECK(!masm->serializer_enabled()); // External references not serializable.
|
||||
|
||||
Label done;
|
||||
|
||||
|
@ -3128,6 +3128,7 @@ void MacroAssembler::CheckPageFlagForMap(
|
||||
Label::Distance condition_met_distance) {
|
||||
DCHECK(cc == zero || cc == not_zero);
|
||||
Page* page = Page::FromAddress(map->address());
|
||||
DCHECK(!serializer_enabled()); // Serializer cannot match page_flags.
|
||||
ExternalReference reference(ExternalReference::page_flags(page));
|
||||
// The inlined static address check of the page's flags relies
|
||||
// on maps never being compacted.
|
||||
|
@ -1099,6 +1099,7 @@ void MathExpGenerator::EmitMathExp(MacroAssembler* masm,
|
||||
DCHECK(!temp1.is(temp3));
|
||||
DCHECK(!temp2.is(temp3));
|
||||
DCHECK(ExternalReference::math_exp_constants(0).address() != NULL);
|
||||
DCHECK(!masm->serializer_enabled()); // External references not serializable.
|
||||
|
||||
Label zero, infinity, done;
|
||||
|
||||
|
428
src/serialize.cc
428
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.
|
||||
|
@ -17,17 +17,16 @@ namespace internal {
|
||||
// A TypeCode is used to distinguish different kinds of external reference.
|
||||
// It is a single bit to make testing for types easy.
|
||||
enum TypeCode {
|
||||
UNCLASSIFIED, // One-of-a-kind references.
|
||||
UNCLASSIFIED, // One-of-a-kind references.
|
||||
C_BUILTIN,
|
||||
BUILTIN,
|
||||
RUNTIME_FUNCTION,
|
||||
IC_UTILITY,
|
||||
STATS_COUNTER,
|
||||
TOP_ADDRESS,
|
||||
C_BUILTIN,
|
||||
EXTENSION,
|
||||
ACCESSOR,
|
||||
RUNTIME_ENTRY,
|
||||
STUB_CACHE_TABLE,
|
||||
RUNTIME_ENTRY,
|
||||
LAZY_DEOPTIMIZATION
|
||||
};
|
||||
|
||||
@ -81,8 +80,12 @@ class ExternalReferenceTable {
|
||||
// For other types of references, the caller will figure out the address.
|
||||
void Add(Address address, TypeCode type, uint16_t id, const char* name);
|
||||
|
||||
void Add(Address address, const char* name) {
|
||||
Add(address, UNCLASSIFIED, ++max_id_[UNCLASSIFIED], name);
|
||||
}
|
||||
|
||||
List<ExternalReferenceEntry> refs_;
|
||||
int max_id_[kTypeCodeCount];
|
||||
uint16_t max_id_[kTypeCodeCount];
|
||||
};
|
||||
|
||||
|
||||
|
@ -585,6 +585,7 @@ void MathExpGenerator::EmitMathExp(MacroAssembler* masm,
|
||||
DCHECK(!result.is(double_scratch));
|
||||
DCHECK(!temp1.is(temp2));
|
||||
DCHECK(ExternalReference::math_exp_constants(0).address() != NULL);
|
||||
DCHECK(!masm->serializer_enabled()); // External references not serializable.
|
||||
|
||||
Label done;
|
||||
|
||||
|
@ -116,21 +116,21 @@ TEST(ExternalReferenceEncoder) {
|
||||
encoder.Encode(total_compile_size.address()));
|
||||
ExternalReference stack_limit_address =
|
||||
ExternalReference::address_of_stack_limit(isolate);
|
||||
CHECK_EQ(make_code(UNCLASSIFIED, 4),
|
||||
CHECK_EQ(make_code(UNCLASSIFIED, 2),
|
||||
encoder.Encode(stack_limit_address.address()));
|
||||
ExternalReference real_stack_limit_address =
|
||||
ExternalReference::address_of_real_stack_limit(isolate);
|
||||
CHECK_EQ(make_code(UNCLASSIFIED, 5),
|
||||
encoder.Encode(real_stack_limit_address.address()));
|
||||
CHECK_EQ(make_code(UNCLASSIFIED, 16),
|
||||
encoder.Encode(ExternalReference::debug_break(isolate).address()));
|
||||
CHECK_EQ(make_code(UNCLASSIFIED, 10),
|
||||
encoder.Encode(
|
||||
ExternalReference::new_space_start(isolate).address()));
|
||||
CHECK_EQ(make_code(UNCLASSIFIED, 3),
|
||||
encoder.Encode(
|
||||
ExternalReference::roots_array_start(isolate).address()));
|
||||
CHECK_EQ(make_code(UNCLASSIFIED, 52),
|
||||
encoder.Encode(real_stack_limit_address.address()));
|
||||
CHECK_EQ(make_code(UNCLASSIFIED, 8),
|
||||
encoder.Encode(ExternalReference::debug_break(isolate).address()));
|
||||
CHECK_EQ(
|
||||
make_code(UNCLASSIFIED, 4),
|
||||
encoder.Encode(ExternalReference::new_space_start(isolate).address()));
|
||||
CHECK_EQ(
|
||||
make_code(UNCLASSIFIED, 1),
|
||||
encoder.Encode(ExternalReference::roots_array_start(isolate).address()));
|
||||
CHECK_EQ(make_code(UNCLASSIFIED, 34),
|
||||
encoder.Encode(ExternalReference::cpu_features().address()));
|
||||
}
|
||||
|
||||
@ -153,13 +153,13 @@ TEST(ExternalReferenceDecoder) {
|
||||
make_code(STATS_COUNTER,
|
||||
Counters::k_total_compile_size)));
|
||||
CHECK_EQ(ExternalReference::address_of_stack_limit(isolate).address(),
|
||||
decoder.Decode(make_code(UNCLASSIFIED, 4)));
|
||||
decoder.Decode(make_code(UNCLASSIFIED, 2)));
|
||||
CHECK_EQ(ExternalReference::address_of_real_stack_limit(isolate).address(),
|
||||
decoder.Decode(make_code(UNCLASSIFIED, 5)));
|
||||
decoder.Decode(make_code(UNCLASSIFIED, 3)));
|
||||
CHECK_EQ(ExternalReference::debug_break(isolate).address(),
|
||||
decoder.Decode(make_code(UNCLASSIFIED, 16)));
|
||||
decoder.Decode(make_code(UNCLASSIFIED, 8)));
|
||||
CHECK_EQ(ExternalReference::new_space_start(isolate).address(),
|
||||
decoder.Decode(make_code(UNCLASSIFIED, 10)));
|
||||
decoder.Decode(make_code(UNCLASSIFIED, 4)));
|
||||
}
|
||||
|
||||
|
||||
|
43
tools/external-reference-check.py
Normal file
43
tools/external-reference-check.py
Normal file
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright 2014 the V8 project authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
|
||||
DECLARE_FILE = "src/assembler.h"
|
||||
REGISTER_FILE = "src/serialize.cc"
|
||||
DECLARE_RE = re.compile("\s*static ExternalReference ([^(]+)\(")
|
||||
REGISTER_RE = re.compile("\s*Add\(ExternalReference::([^(]+)\(")
|
||||
|
||||
WORKSPACE = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), ".."))
|
||||
|
||||
# Ignore those.
|
||||
BLACKLISTED = [
|
||||
"page_flags",
|
||||
"math_exp_constants",
|
||||
"math_exp_log_table",
|
||||
"ForDeoptEntry",
|
||||
]
|
||||
|
||||
def Find(filename, re):
|
||||
references = []
|
||||
with open(filename, "r") as f:
|
||||
for line in f:
|
||||
match = re.match(line)
|
||||
if match:
|
||||
references.append(match.group(1))
|
||||
return references
|
||||
|
||||
def Main():
|
||||
declarations = Find(DECLARE_FILE, DECLARE_RE)
|
||||
registrations = Find(REGISTER_FILE, REGISTER_RE)
|
||||
difference = list(set(declarations) - set(registrations) - set(BLACKLISTED))
|
||||
for reference in difference:
|
||||
print("Declared but not registered: ExternalReference::%s" % reference)
|
||||
return len(difference) > 0
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(Main())
|
@ -423,6 +423,12 @@ def CheckGeneratedRuntimeTests(workspace):
|
||||
return code == 0
|
||||
|
||||
|
||||
def CheckExternalReferenceRegistration(workspace):
|
||||
code = subprocess.call(
|
||||
[sys.executable, join(workspace, "tools", "external-reference-check.py")])
|
||||
return code == 0
|
||||
|
||||
|
||||
def GetOptions():
|
||||
result = optparse.OptionParser()
|
||||
result.add_option('--no-lint', help="Do not run cpplint", default=False,
|
||||
@ -442,6 +448,7 @@ def Main():
|
||||
"two empty lines between declarations check..."
|
||||
success = SourceProcessor().Run(workspace) and success
|
||||
success = CheckGeneratedRuntimeTests(workspace) and success
|
||||
success = CheckExternalReferenceRegistration(workspace) and success
|
||||
if success:
|
||||
return 0
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user