Commit 3b99189b authored by jgruber's avatar jgruber Committed by Commit Bot

Add external references macro list

The macro list avoids duplication in external-reference-table and will
allow us to statically determine the size of the table in a follow-up.

TBR=mlippautz@chromium.org

Bug: v8:6666
Change-Id: I06bb2e8c25970b3c1047dafd6c63d7ca291fe37e
Reviewed-on: https://chromium-review.googlesource.com/956187
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51850}
parent f008d17c
......@@ -1951,7 +1951,7 @@ void MacroAssembler::AssertUndefinedOrAllocationSite(Register object,
void TurboAssembler::CheckFor32DRegs(Register scratch) {
mov(scratch, Operand(ExternalReference::cpu_features()));
mov(scratch, Operand(ExternalReference::cpu_features(isolate())));
ldr(scratch, MemOperand(scratch));
tst(scratch, Operand(1u << VFP32DREGS));
}
......
This diff is collapsed.
......@@ -198,6 +198,13 @@ ExternalReference ExternalReference::date_cache_stamp(Isolate* isolate) {
return ExternalReference(isolate->date_cache()->stamp_address());
}
// static
ExternalReference
ExternalReference::runtime_function_table_address_for_unittests(
Isolate* isolate) {
return runtime_function_table_address(isolate);
}
void ExternalReference::set_redirector(
Isolate* isolate, ExternalReferenceRedirector* redirector) {
// We can't stack them.
......@@ -492,47 +499,53 @@ ExternalReference ExternalReference::address_of_pending_message_obj(
return ExternalReference(isolate->pending_message_obj_address());
}
ExternalReference ExternalReference::address_of_min_int() {
ExternalReference ExternalReference::address_of_min_int(Isolate* isolate) {
return ExternalReference(reinterpret_cast<void*>(&double_constants.min_int));
}
ExternalReference ExternalReference::address_of_one_half() {
ExternalReference ExternalReference::address_of_one_half(Isolate* isolate) {
return ExternalReference(reinterpret_cast<void*>(&double_constants.one_half));
}
ExternalReference ExternalReference::address_of_minus_one_half() {
ExternalReference ExternalReference::address_of_minus_one_half(
Isolate* isolate) {
return ExternalReference(
reinterpret_cast<void*>(&double_constants.minus_one_half));
}
ExternalReference ExternalReference::address_of_negative_infinity() {
ExternalReference ExternalReference::address_of_negative_infinity(
Isolate* isolate) {
return ExternalReference(
reinterpret_cast<void*>(&double_constants.negative_infinity));
}
ExternalReference ExternalReference::address_of_the_hole_nan() {
ExternalReference ExternalReference::address_of_the_hole_nan(Isolate* isolate) {
return ExternalReference(
reinterpret_cast<void*>(&double_constants.the_hole_nan));
}
ExternalReference ExternalReference::address_of_uint32_bias() {
ExternalReference ExternalReference::address_of_uint32_bias(Isolate* isolate) {
return ExternalReference(
reinterpret_cast<void*>(&double_constants.uint32_bias));
}
ExternalReference ExternalReference::address_of_float_abs_constant() {
ExternalReference ExternalReference::address_of_float_abs_constant(
Isolate* isolate) {
return ExternalReference(reinterpret_cast<void*>(&float_absolute_constant));
}
ExternalReference ExternalReference::address_of_float_neg_constant() {
ExternalReference ExternalReference::address_of_float_neg_constant(
Isolate* isolate) {
return ExternalReference(reinterpret_cast<void*>(&float_negate_constant));
}
ExternalReference ExternalReference::address_of_double_abs_constant() {
ExternalReference ExternalReference::address_of_double_abs_constant(
Isolate* isolate) {
return ExternalReference(reinterpret_cast<void*>(&double_absolute_constant));
}
ExternalReference ExternalReference::address_of_double_neg_constant() {
ExternalReference ExternalReference::address_of_double_neg_constant(
Isolate* isolate) {
return ExternalReference(reinterpret_cast<void*>(&double_negate_constant));
}
......@@ -595,7 +608,7 @@ ExternalReference ExternalReference::re_case_insensitive_compare_uc16(
FUNCTION_ADDR(NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16)));
}
ExternalReference ExternalReference::re_word_character_map() {
ExternalReference ExternalReference::re_word_character_map(Isolate* isolate) {
return ExternalReference(
NativeRegExpMacroAssembler::word_character_map_address());
}
......@@ -761,6 +774,26 @@ ExternalReference ExternalReference::search_string_raw(Isolate* isolate) {
return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f)));
}
ExternalReference ExternalReference::search_string_raw_one_one(
Isolate* isolate) {
return search_string_raw<const uint8_t, const uint8_t>(isolate);
}
ExternalReference ExternalReference::search_string_raw_one_two(
Isolate* isolate) {
return search_string_raw<const uint8_t, const uc16>(isolate);
}
ExternalReference ExternalReference::search_string_raw_two_one(
Isolate* isolate) {
return search_string_raw<const uc16, const uint8_t>(isolate);
}
ExternalReference ExternalReference::search_string_raw_two_two(
Isolate* isolate) {
return search_string_raw<const uc16, const uc16>(isolate);
}
ExternalReference ExternalReference::orderedhashmap_gethash_raw(
Isolate* isolate) {
auto f = OrderedHashMap::GetHash;
......@@ -842,7 +875,7 @@ ExternalReference ExternalReference::ForDeoptEntry(Address entry) {
return ExternalReference(entry);
}
ExternalReference ExternalReference::cpu_features() {
ExternalReference ExternalReference::cpu_features(Isolate* isolate) {
DCHECK(CpuFeatures::initialized_);
return ExternalReference(&CpuFeatures::supported_);
}
......@@ -948,7 +981,8 @@ ExternalReference ExternalReference::debug_restart_fp_address(
return ExternalReference(isolate->debug()->restart_fp_address());
}
ExternalReference ExternalReference::fixed_typed_array_base_data_offset() {
ExternalReference ExternalReference::fixed_typed_array_base_data_offset(
Isolate* isolate) {
return ExternalReference(reinterpret_cast<void*>(
FixedTypedArrayBase::kDataOffset - kHeapObjectTag));
}
......
This diff is collapsed.
......@@ -3198,7 +3198,8 @@ AllocationResult Heap::AllocateFixedTypedArray(int length,
FixedTypedArrayBase* elements = FixedTypedArrayBase::cast(object);
elements->set_base_pointer(elements, SKIP_WRITE_BARRIER);
elements->set_external_pointer(
ExternalReference::fixed_typed_array_base_data_offset().address(),
ExternalReference::fixed_typed_array_base_data_offset(isolate())
.address(),
SKIP_WRITE_BARRIER);
elements->set_length(length);
if (initialize) memset(elements->DataPtr(), 0, elements->DataSize());
......
......@@ -195,7 +195,8 @@ void MacroAssembler::DoubleToI(Register result_reg, XMMRegister input_reg,
void TurboAssembler::LoadUint32(XMMRegister dst, Operand src) {
Label done;
cmp(src, Immediate(0));
ExternalReference uint32_bias = ExternalReference::address_of_uint32_bias();
ExternalReference uint32_bias =
ExternalReference::address_of_uint32_bias(isolate());
Cvtsi2sd(dst, src);
j(not_sign, &done, Label::kNear);
addsd(dst, Operand::StaticVariable(uint32_bias));
......
......@@ -374,7 +374,8 @@ void FixedTypedArray<Traits>::FixedTypedArrayVerify() {
Traits::kInstanceType);
if (base_pointer() == this) {
CHECK(external_pointer() ==
ExternalReference::fixed_typed_array_base_data_offset().address());
ExternalReference::fixed_typed_array_base_data_offset(GetIsolate())
.address());
} else {
CHECK_NULL(base_pointer());
}
......
......@@ -575,7 +575,7 @@ bool RegExpMacroAssemblerARM::CheckSpecialCharacterClass(uc16 type,
__ cmp(current_character(), Operand('z'));
BranchOrBacktrack(hi, on_no_match);
}
ExternalReference map = ExternalReference::re_word_character_map();
ExternalReference map = ExternalReference::re_word_character_map(isolate());
__ mov(r0, Operand(map));
__ ldrb(r0, MemOperand(r0, current_character()));
__ cmp(r0, Operand::Zero());
......@@ -589,7 +589,7 @@ bool RegExpMacroAssemblerARM::CheckSpecialCharacterClass(uc16 type,
__ cmp(current_character(), Operand('z'));
__ b(hi, &done);
}
ExternalReference map = ExternalReference::re_word_character_map();
ExternalReference map = ExternalReference::re_word_character_map(isolate());
__ mov(r0, Operand(map));
__ ldrb(r0, MemOperand(r0, current_character()));
__ cmp(r0, Operand::Zero());
......
......@@ -650,7 +650,7 @@ bool RegExpMacroAssemblerARM64::CheckSpecialCharacterClass(uc16 type,
// Table is 256 entries, so all Latin1 characters can be tested.
CompareAndBranchOrBacktrack(current_character(), 'z', hi, on_no_match);
}
ExternalReference map = ExternalReference::re_word_character_map();
ExternalReference map = ExternalReference::re_word_character_map(isolate());
__ Mov(x10, map);
__ Ldrb(w10, MemOperand(x10, current_character(), UXTW));
CompareAndBranchOrBacktrack(w10, 0, eq, on_no_match);
......@@ -663,7 +663,7 @@ bool RegExpMacroAssemblerARM64::CheckSpecialCharacterClass(uc16 type,
__ Cmp(current_character(), 'z');
__ B(hi, &done);
}
ExternalReference map = ExternalReference::re_word_character_map();
ExternalReference map = ExternalReference::re_word_character_map(isolate());
__ Mov(x10, map);
__ Ldrb(w10, MemOperand(x10, current_character(), UXTW));
CompareAndBranchOrBacktrack(w10, 0, ne, on_no_match);
......
......@@ -582,7 +582,8 @@ bool RegExpMacroAssemblerIA32::CheckSpecialCharacterClass(uc16 type,
BranchOrBacktrack(above, on_no_match);
}
DCHECK_EQ(0, word_character_map[0]); // Character '\0' is not a word char.
ExternalReference word_map = ExternalReference::re_word_character_map();
ExternalReference word_map =
ExternalReference::re_word_character_map(isolate());
__ test_b(current_character(),
Operand::StaticArray(current_character(), times_1, word_map));
BranchOrBacktrack(zero, on_no_match);
......@@ -596,7 +597,8 @@ bool RegExpMacroAssemblerIA32::CheckSpecialCharacterClass(uc16 type,
__ j(above, &done);
}
DCHECK_EQ(0, word_character_map[0]); // Character '\0' is not a word char.
ExternalReference word_map = ExternalReference::re_word_character_map();
ExternalReference word_map =
ExternalReference::re_word_character_map(isolate());
__ test_b(current_character(),
Operand::StaticArray(current_character(), times_1, word_map));
BranchOrBacktrack(not_zero, on_no_match);
......
......@@ -569,7 +569,7 @@ bool RegExpMacroAssemblerMIPS::CheckSpecialCharacterClass(uc16 type,
// Table is 256 entries, so all Latin1 characters can be tested.
BranchOrBacktrack(on_no_match, hi, current_character(), Operand('z'));
}
ExternalReference map = ExternalReference::re_word_character_map();
ExternalReference map = ExternalReference::re_word_character_map(isolate());
__ li(a0, Operand(map));
__ Addu(a0, a0, current_character());
__ lbu(a0, MemOperand(a0, 0));
......@@ -582,7 +582,7 @@ bool RegExpMacroAssemblerMIPS::CheckSpecialCharacterClass(uc16 type,
// Table is 256 entries, so all Latin1 characters can be tested.
__ Branch(&done, hi, current_character(), Operand('z'));
}
ExternalReference map = ExternalReference::re_word_character_map();
ExternalReference map = ExternalReference::re_word_character_map(isolate());
__ li(a0, Operand(map));
__ Addu(a0, a0, current_character());
__ lbu(a0, MemOperand(a0, 0));
......
......@@ -600,7 +600,7 @@ bool RegExpMacroAssemblerMIPS::CheckSpecialCharacterClass(uc16 type,
// Table is 256 entries, so all Latin1 characters can be tested.
BranchOrBacktrack(on_no_match, hi, current_character(), Operand('z'));
}
ExternalReference map = ExternalReference::re_word_character_map();
ExternalReference map = ExternalReference::re_word_character_map(isolate());
__ li(a0, Operand(map));
__ Daddu(a0, a0, current_character());
__ Lbu(a0, MemOperand(a0, 0));
......@@ -613,7 +613,7 @@ bool RegExpMacroAssemblerMIPS::CheckSpecialCharacterClass(uc16 type,
// Table is 256 entries, so all Latin1 characters can be tested.
__ Branch(&done, hi, current_character(), Operand('z'));
}
ExternalReference map = ExternalReference::re_word_character_map();
ExternalReference map = ExternalReference::re_word_character_map(isolate());
__ li(a0, Operand(map));
__ Daddu(a0, a0, current_character());
__ Lbu(a0, MemOperand(a0, 0));
......
......@@ -591,7 +591,8 @@ bool RegExpMacroAssemblerPPC::CheckSpecialCharacterClass(uc16 type,
__ cmpi(current_character(), Operand('z'));
BranchOrBacktrack(gt, on_no_match);
}
ExternalReference map = ExternalReference::re_word_character_map();
ExternalReference map =
ExternalReference::re_word_character_map(isolate());
__ mov(r3, Operand(map));
__ lbzx(r3, MemOperand(r3, current_character()));
__ cmpli(r3, Operand::Zero());
......@@ -605,7 +606,8 @@ bool RegExpMacroAssemblerPPC::CheckSpecialCharacterClass(uc16 type,
__ cmpli(current_character(), Operand('z'));
__ bgt(&done);
}
ExternalReference map = ExternalReference::re_word_character_map();
ExternalReference map =
ExternalReference::re_word_character_map(isolate());
__ mov(r3, Operand(map));
__ lbzx(r3, MemOperand(r3, current_character()));
__ cmpli(r3, Operand::Zero());
......
......@@ -562,7 +562,8 @@ bool RegExpMacroAssemblerS390::CheckSpecialCharacterClass(uc16 type,
__ CmpP(current_character(), Operand('z'));
BranchOrBacktrack(gt, on_no_match);
}
ExternalReference map = ExternalReference::re_word_character_map();
ExternalReference map =
ExternalReference::re_word_character_map(isolate());
__ mov(r2, Operand(map));
__ LoadlB(r2, MemOperand(r2, current_character()));
__ CmpLogicalP(r2, Operand::Zero());
......@@ -576,7 +577,8 @@ bool RegExpMacroAssemblerS390::CheckSpecialCharacterClass(uc16 type,
__ CmpLogicalP(current_character(), Operand('z'));
__ bgt(&done);
}
ExternalReference map = ExternalReference::re_word_character_map();
ExternalReference map =
ExternalReference::re_word_character_map(isolate());
__ mov(r2, Operand(map));
__ LoadlB(r2, MemOperand(r2, current_character()));
__ CmpLogicalP(r2, Operand::Zero());
......
......@@ -623,7 +623,7 @@ bool RegExpMacroAssemblerX64::CheckSpecialCharacterClass(uc16 type,
__ cmpl(current_character(), Immediate('z'));
BranchOrBacktrack(above, on_no_match);
}
__ Move(rbx, ExternalReference::re_word_character_map());
__ Move(rbx, ExternalReference::re_word_character_map(isolate()));
DCHECK_EQ(0, word_character_map[0]); // Character '\0' is not a word char.
__ testb(Operand(rbx, current_character(), times_1, 0),
current_character());
......@@ -637,7 +637,7 @@ bool RegExpMacroAssemblerX64::CheckSpecialCharacterClass(uc16 type,
__ cmpl(current_character(), Immediate('z'));
__ j(above, &done);
}
__ Move(rbx, ExternalReference::re_word_character_map());
__ Move(rbx, ExternalReference::re_word_character_map(isolate()));
DCHECK_EQ(0, word_character_map[0]); // Character '\0' is not a word char.
__ testb(Operand(rbx, current_character(), times_1, 0),
current_character());
......
......@@ -1178,23 +1178,23 @@ void TurboAssembler::Move(XMMRegister dst, uint64_t src) {
// ----------------------------------------------------------------------------
void MacroAssembler::Absps(XMMRegister dst) {
Andps(dst,
ExternalOperand(ExternalReference::address_of_float_abs_constant()));
Andps(dst, ExternalOperand(
ExternalReference::address_of_float_abs_constant(isolate())));
}
void MacroAssembler::Negps(XMMRegister dst) {
Xorps(dst,
ExternalOperand(ExternalReference::address_of_float_neg_constant()));
Xorps(dst, ExternalOperand(
ExternalReference::address_of_float_neg_constant(isolate())));
}
void MacroAssembler::Abspd(XMMRegister dst) {
Andps(dst,
ExternalOperand(ExternalReference::address_of_double_abs_constant()));
Andps(dst, ExternalOperand(
ExternalReference::address_of_double_abs_constant(isolate())));
}
void MacroAssembler::Negpd(XMMRegister dst) {
Xorps(dst,
ExternalOperand(ExternalReference::address_of_double_neg_constant()));
Xorps(dst, ExternalOperand(
ExternalReference::address_of_double_neg_constant(isolate())));
}
void MacroAssembler::Cmp(Register dst, Handle<Object> source) {
......
......@@ -339,15 +339,17 @@ TEST(JSGraph_GetCachedNodes_number) {
TEST(JSGraph_GetCachedNodes_external) {
JSConstantCacheTester T;
ExternalReference constants[] = {ExternalReference::address_of_min_int(),
ExternalReference::address_of_min_int(),
ExternalReference::address_of_min_int(),
ExternalReference::address_of_one_half(),
ExternalReference::address_of_one_half(),
ExternalReference::address_of_min_int(),
ExternalReference::address_of_the_hole_nan(),
ExternalReference::address_of_one_half()};
Isolate* isolate = T.main_isolate();
ExternalReference constants[] = {
ExternalReference::address_of_min_int(isolate),
ExternalReference::address_of_min_int(isolate),
ExternalReference::address_of_min_int(isolate),
ExternalReference::address_of_one_half(isolate),
ExternalReference::address_of_one_half(isolate),
ExternalReference::address_of_min_int(isolate),
ExternalReference::address_of_the_hole_nan(isolate),
ExternalReference::address_of_one_half(isolate)};
for (size_t i = 0; i < arraysize(constants); i++) {
size_t count_before = T.graph()->NodeCount();
......@@ -366,6 +368,7 @@ TEST(JSGraph_GetCachedNodes_external) {
TEST(JSGraph_GetCachedNodes_together) {
JSConstantCacheTester T;
Isolate* isolate = T.main_isolate();
Node* constants[] = {
T.TrueConstant(),
......@@ -385,7 +388,7 @@ TEST(JSGraph_GetCachedNodes_together) {
T.Float64Constant(V8_INFINITY),
T.Constant(0.99),
T.Constant(1.11),
T.ExternalConstant(ExternalReference::address_of_one_half())};
T.ExternalConstant(ExternalReference::address_of_one_half(isolate))};
NodeVector nodes(T.main_zone());
T.GetCachedNodes(&nodes);
......
......@@ -512,7 +512,8 @@ TARGET_TEST_F(InterpreterAssemblerTest, CallRuntime) {
Node* context = m.IntPtrConstant(4);
Matcher<Node*> function_table = c::IsExternalConstant(
ExternalReference::runtime_function_table_address(isolate()));
ExternalReference::runtime_function_table_address_for_unittests(
isolate()));
Matcher<Node*> function = c::IsIntPtrAdd(
function_table,
c::IsChangeUint32ToWord(c::IsInt32Mul(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment