Commit 930e31e6 authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[csa] Enforce using BIND macro

This CL enforces passing an AssemblerDebugInfo object to Bind, most convently
acheived by the BIND macro.

Change-Id: I092714f10803f529d01d2fe716b96275b2bee806
Reviewed-on: https://chromium-review.googlesource.com/508729Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45433}
parent bd951778
......@@ -885,7 +885,7 @@ TF_BUILTIN(FastArrayPop, CodeStubAssembler) {
}
args.PopAndReturn(AllocateHeapNumberWithValue(value));
Bind(&fast_elements);
BIND(&fast_elements);
{
Node* value = LoadFixedArrayElement(elements, new_length);
StoreFixedArrayElement(elements, new_length, TheHoleConstant());
......@@ -1136,7 +1136,7 @@ TF_BUILTIN(FastArrayShift, CodeStubAssembler) {
}
args.PopAndReturn(AllocateHeapNumberWithValue(value));
Bind(&fast_elements_tagged);
BIND(&fast_elements_tagged);
{
Node* value = LoadFixedArrayElement(elements, 0);
BuildFastLoop(IntPtrConstant(0), new_length,
......@@ -1153,7 +1153,7 @@ TF_BUILTIN(FastArrayShift, CodeStubAssembler) {
args.PopAndReturn(value);
}
Bind(&fast_elements_untagged);
BIND(&fast_elements_untagged);
{
Node* value = LoadFixedArrayElement(elements, 0);
Node* memmove =
......
......@@ -469,36 +469,36 @@ void SharedArrayBufferBuiltinsAssembler::AtomicBinopBuiltinCommon(
Switch(instance_type, &other, case_values, case_labels,
arraysize(case_labels));
Bind(&i8);
BIND(&i8);
Return(SmiFromWord32((this->*function)(MachineType::Int8(), backing_store,
index_word, value_word32)));
Bind(&u8);
BIND(&u8);
Return(SmiFromWord32((this->*function)(MachineType::Uint8(), backing_store,
index_word, value_word32)));
Bind(&i16);
BIND(&i16);
Return(
SmiFromWord32((this->*function)(MachineType::Int16(), backing_store,
WordShl(index_word, 1), value_word32)));
Bind(&u16);
BIND(&u16);
Return(
SmiFromWord32((this->*function)(MachineType::Uint16(), backing_store,
WordShl(index_word, 1), value_word32)));
Bind(&i32);
BIND(&i32);
Return(ChangeInt32ToTagged(
(this->*function)(MachineType::Int32(), backing_store,
WordShl(index_word, 2), value_word32)));
Bind(&u32);
BIND(&u32);
Return(ChangeUint32ToTagged(
(this->*function)(MachineType::Uint32(), backing_store,
WordShl(index_word, 2), value_word32)));
// This shouldn't happen, we've already validated the type.
Bind(&other);
BIND(&other);
Unreachable();
#endif // V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_PPC64
// || V8_TARGET_ARCH_PPC || V8_TARGET_ARCH_S390 || V8_TARGET_ARCH_S390X
......
This diff is collapsed.
......@@ -77,7 +77,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
typedef base::Flags<AllocationFlag> AllocationFlags;
enum ParameterMode { SMI_PARAMETERS, INTPTR_PARAMETERS };
// On 32-bit platforms, there is a slight performance advantage to doing all
// of the array offset/index arithmetic with SMIs, since it's possible
// to save a few tag/untag operations without paying an extra expense when
......@@ -302,6 +301,12 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
Node* WordIsWordAligned(Node* word);
Node* WordIsPowerOfTwo(Node* value);
#if DEBUG
void Bind(Label* label, AssemblerDebugInfo debug_info);
#else
void Bind(Label* label);
#endif // DEBUG
void BranchIfSmiEqual(Node* a, Node* b, Label* if_true, Label* if_false) {
Branch(SmiEqual(a, b), if_true, if_false);
}
......@@ -1498,6 +1503,13 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
// Implements DescriptorArray::GetKey.
Node* DescriptorArrayGetKey(Node* descriptors, Node* descriptor_number);
Node* CollectFeedbackForString(Node* instance_type);
void GenerateEqual_Same(Node* value, Label* if_equal, Label* if_notequal,
Variable* var_type_feedback = nullptr);
Node* AllocAndCopyStringCharacters(Node* context, Node* from,
Node* from_instance_type, Node* from_index,
Node* character_count);
static const int kElementLoopUnrollThreshold = 8;
};
......@@ -1622,13 +1634,16 @@ class ToDirectStringAssembler : public CodeStubAssembler {
#define CSA_ASSERT_JS_ARGC_EQ(csa, expected) \
CSA_ASSERT_JS_ARGC_OP(csa, Word32Equal, ==, expected)
#define BIND(label) Bind(label, {#label, __FILE__, __LINE__})
#define CSA_DEBUG_INFO(name) \
, { #name, __FILE__, __LINE__ }
#define BIND(label) Bind(label CSA_DEBUG_INFO(label))
#define VARIABLE(name, ...) \
Variable name(this, {#name, __FILE__, __LINE__}, __VA_ARGS__);
Variable name(this CSA_DEBUG_INFO(name), __VA_ARGS__);
#else // DEBUG
#define CSA_ASSERT(csa, x) ((void)0)
#define CSA_ASSERT_JS_ARGC_EQ(csa, expected) ((void)0)
#define CSA_DEBUG_INFO(name)
#define BIND(label) Bind(label);
#define VARIABLE(name, ...) Variable name(this, __VA_ARGS__);
#endif // DEBUG
......
This diff is collapsed.
This diff is collapsed.
......@@ -89,7 +89,7 @@ Node* IntrinsicsGenerator::InvokeIntrinsic(Node* function_id, Node* context,
__ Switch(function_id, &abort, cases, labels, arraysize(cases));
#define HANDLE_CASE(name, lower_case, expected_arg_count) \
__ Bind(&lower_case); \
__ BIND(&lower_case); \
if (FLAG_debug_code && expected_arg_count >= 0) { \
AbortIfArgCountMismatch(expected_arg_count, arg_count); \
} \
......@@ -98,14 +98,14 @@ Node* IntrinsicsGenerator::InvokeIntrinsic(Node* function_id, Node* context,
INTRINSICS_LIST(HANDLE_CASE)
#undef HANDLE_CASE
__ Bind(&abort);
__ BIND(&abort);
{
__ Abort(BailoutReason::kUnexpectedFunctionIDForInvokeIntrinsic);
result.Bind(__ UndefinedConstant());
__ Goto(&end);
}
__ Bind(&end);
__ BIND(&end);
return result.value();
}
......@@ -133,19 +133,19 @@ Node* IntrinsicsGenerator::IsInstanceType(Node* input, int type) {
Node* condition = CompareInstanceType(arg, type, kInstanceTypeEqual);
__ Branch(condition, &return_true, &return_false);
__ Bind(&return_true);
__ BIND(&return_true);
{
return_value.Bind(__ BooleanConstant(true));
__ Goto(&end);
}
__ Bind(&return_false);
__ BIND(&return_false);
{
return_value.Bind(__ BooleanConstant(false));
__ Goto(&end);
}
__ Bind(&end);
__ BIND(&end);
return return_value.value();
}
......@@ -166,19 +166,19 @@ Node* IntrinsicsGenerator::IsJSReceiver(Node* input, Node* arg_count,
kInstanceTypeGreaterThanOrEqual);
__ Branch(condition, &return_true, &return_false);
__ Bind(&return_true);
__ BIND(&return_true);
{
return_value.Bind(__ BooleanConstant(true));
__ Goto(&end);
}
__ Bind(&return_false);
__ BIND(&return_false);
{
return_value.Bind(__ BooleanConstant(false));
__ Goto(&end);
}
__ Bind(&end);
__ BIND(&end);
return return_value.value();
}
......@@ -237,19 +237,19 @@ Node* IntrinsicsGenerator::IsSmi(Node* input, Node* arg_count, Node* context) {
Node* arg = __ LoadRegister(input);
__ Branch(__ TaggedIsSmi(arg), &if_smi, &if_not_smi);
__ Bind(&if_smi);
__ BIND(&if_smi);
{
return_value.Bind(__ BooleanConstant(true));
__ Goto(&end);
}
__ Bind(&if_not_smi);
__ BIND(&if_not_smi);
{
return_value.Bind(__ BooleanConstant(false));
__ Goto(&end);
}
__ Bind(&end);
__ BIND(&end);
return return_value.value();
}
......@@ -335,7 +335,7 @@ Node* IntrinsicsGenerator::Call(Node* args_reg, Node* arg_count,
__ GotoIfNot(comparison, &arg_count_positive);
__ Abort(kWrongArgumentCountForInvokeIntrinsic);
__ Goto(&arg_count_positive);
__ Bind(&arg_count_positive);
__ BIND(&arg_count_positive);
}
Node* result = __ CallJS(function, context, receiver_arg, target_args_count,
......@@ -374,7 +374,7 @@ Node* IntrinsicsGenerator::CreateAsyncFromSyncIterator(Node* args_reg,
return_value.Bind(iterator);
__ Goto(&done);
__ Bind(&not_receiver);
__ BIND(&not_receiver);
{
return_value.Bind(
__ CallRuntime(Runtime::kThrowSymbolIteratorInvalid, context));
......@@ -383,7 +383,7 @@ Node* IntrinsicsGenerator::CreateAsyncFromSyncIterator(Node* args_reg,
__ Goto(&done);
}
__ Bind(&done);
__ BIND(&done);
return return_value.value();
}
......@@ -452,7 +452,7 @@ void IntrinsicsGenerator::AbortIfArgCountMismatch(int expected, Node* actual) {
__ GotoIf(comparison, &match);
__ Abort(kWrongArgumentCountForInvokeIntrinsic);
__ Goto(&match);
__ Bind(&match);
__ BIND(&match);
}
} // namespace interpreter
......
......@@ -140,18 +140,18 @@ TEST(TryProbeStubCache) {
m.TryProbeStubCache(&stub_cache, receiver, name, &if_handler, &var_handler,
&if_miss);
m.Bind(&if_handler);
m.BIND(&if_handler);
m.Branch(m.WordEqual(expected_handler, var_handler.value()), &passed,
&failed);
m.Bind(&if_miss);
m.BIND(&if_miss);
m.Branch(m.WordEqual(expected_handler, m.IntPtrConstant(0)), &passed,
&failed);
m.Bind(&passed);
m.BIND(&passed);
m.Return(m.BooleanConstant(true));
m.Bind(&failed);
m.BIND(&failed);
m.Return(m.BooleanConstant(false));
}
......
......@@ -351,29 +351,29 @@ TEST(TryToName) {
m.TryToName(key, &if_keyisindex, &var_index, &if_keyisunique, &var_unique,
&if_bailout);
m.Bind(&if_keyisindex);
m.BIND(&if_keyisindex);
m.GotoIfNot(m.WordEqual(expected_result,
m.SmiConstant(Smi::FromInt(kKeyIsIndex))),
&failed);
m.Branch(m.WordEqual(m.SmiUntag(expected_arg), var_index.value()),
&passed, &failed);
m.Bind(&if_keyisunique);
m.BIND(&if_keyisunique);
m.GotoIfNot(m.WordEqual(expected_result,
m.SmiConstant(Smi::FromInt(kKeyIsUnique))),
&failed);
m.Branch(m.WordEqual(expected_arg, var_unique.value()), &passed, &failed);
}
m.Bind(&if_bailout);
m.BIND(&if_bailout);
m.Branch(
m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kBailout))),
&passed, &failed);
m.Bind(&passed);
m.BIND(&passed);
m.Return(m.BooleanConstant(true));
m.Bind(&failed);
m.BIND(&failed);
m.Return(m.BooleanConstant(false));
}
......@@ -535,22 +535,22 @@ void TestNameDictionaryLookup() {
m.NameDictionaryLookup<Dictionary>(dictionary, unique_name, &if_found,
&var_name_index, &if_not_found);
m.Bind(&if_found);
m.BIND(&if_found);
m.GotoIfNot(
m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kFound))),
&failed);
m.Branch(m.WordEqual(m.SmiUntag(expected_arg), var_name_index.value()),
&passed, &failed);
m.Bind(&if_not_found);
m.BIND(&if_not_found);
m.Branch(
m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kNotFound))),
&passed, &failed);
m.Bind(&passed);
m.BIND(&passed);
m.Return(m.BooleanConstant(true));
m.Bind(&failed);
m.BIND(&failed);
m.Return(m.BooleanConstant(false));
}
......@@ -642,22 +642,22 @@ void TestNumberDictionaryLookup() {
m.NumberDictionaryLookup<Dictionary>(dictionary, key, &if_found, &var_entry,
&if_not_found);
m.Bind(&if_found);
m.BIND(&if_found);
m.GotoIfNot(
m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kFound))),
&failed);
m.Branch(m.WordEqual(m.SmiUntag(expected_arg), var_entry.value()), &passed,
&failed);
m.Bind(&if_not_found);
m.BIND(&if_not_found);
m.Branch(
m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kNotFound))),
&passed, &failed);
m.Bind(&passed);
m.BIND(&passed);
m.Return(m.BooleanConstant(true));
m.Bind(&failed);
m.BIND(&failed);
m.Return(m.BooleanConstant(false));
}
......@@ -782,24 +782,24 @@ TEST(TryHasOwnProperty) {
m.TryHasOwnProperty(object, map, instance_type, unique_name, &if_found,
&if_not_found, &if_bailout);
m.Bind(&if_found);
m.BIND(&if_found);
m.Branch(m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kFound))),
&passed, &failed);
m.Bind(&if_not_found);
m.BIND(&if_not_found);
m.Branch(
m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kNotFound))),
&passed, &failed);
m.Bind(&if_bailout);
m.BIND(&if_bailout);
m.Branch(
m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kBailout))),
&passed, &failed);
m.Bind(&passed);
m.BIND(&passed);
m.Return(m.BooleanConstant(true));
m.Bind(&failed);
m.BIND(&failed);
m.Return(m.BooleanConstant(false));
}
......@@ -971,13 +971,13 @@ TEST(TryGetOwnProperty) {
unique_name, &if_found, &var_value, &if_not_found,
&if_bailout);
m.Bind(&if_found);
m.BIND(&if_found);
m.Return(var_value.value());
m.Bind(&if_not_found);
m.BIND(&if_not_found);
m.Return(m.HeapConstant(not_found_symbol));
m.Bind(&if_bailout);
m.BIND(&if_bailout);
m.Return(m.HeapConstant(bailout_symbol));
}
......@@ -1186,28 +1186,28 @@ TEST(TryLookupElement) {
m.TryLookupElement(object, map, instance_type, index, &if_found, &if_absent,
&if_not_found, &if_bailout);
m.Bind(&if_found);
m.BIND(&if_found);
m.Branch(m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kFound))),
&passed, &failed);
m.Bind(&if_absent);
m.BIND(&if_absent);
m.Branch(m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kAbsent))),
&passed, &failed);
m.Bind(&if_not_found);
m.BIND(&if_not_found);
m.Branch(
m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kNotFound))),
&passed, &failed);
m.Bind(&if_bailout);
m.BIND(&if_bailout);
m.Branch(
m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kBailout))),
&passed, &failed);
m.Bind(&passed);
m.BIND(&passed);
m.Return(m.BooleanConstant(true));
m.Bind(&failed);
m.BIND(&failed);
m.Return(m.BooleanConstant(false));
}
......@@ -1757,9 +1757,9 @@ TEST(IsDebugActive) {
CodeAssemblerLabel if_active(&m), if_not_active(&m);
m.Branch(m.IsDebugActive(), &if_active, &if_not_active);
m.Bind(&if_active);
m.BIND(&if_active);
m.Return(m.TrueConstant());
m.Bind(&if_not_active);
m.BIND(&if_not_active);
m.Return(m.FalseConstant());
Handle<Code> code = data.GenerateCode();
......@@ -1811,7 +1811,7 @@ class AppendJSArrayCodeStubAssembler : public CodeStubAssembler {
arg_index, &bailout);
Return(length);
Bind(&bailout);
BIND(&bailout);
Return(SmiTag(IntPtrAdd(arg_index.value(), IntPtrConstant(2))));
Handle<Code> code = tester->GenerateCode();
......@@ -2486,7 +2486,7 @@ TEST(DirectMemoryTest8BitWord32Immediate) {
m.Return(m.SmiConstant(1));
m.Bind(&bad);
m.BIND(&bad);
m.Return(m.SmiConstant(0));
Handle<Code> code = data.GenerateCode();
......@@ -2523,7 +2523,7 @@ TEST(DirectMemoryTest16BitWord32Immediate) {
m.Return(m.SmiConstant(1));
m.Bind(&bad);
m.BIND(&bad);
m.Return(m.SmiConstant(0));
Handle<Code> code = data.GenerateCode();
......@@ -2572,7 +2572,7 @@ TEST(DirectMemoryTest8BitWord32) {
m.Return(m.SmiConstant(1));
m.Bind(&bad);
m.BIND(&bad);
m.Return(m.SmiConstant(0));
Handle<Code> code = data.GenerateCode();
......@@ -2635,7 +2635,7 @@ TEST(DirectMemoryTest16BitWord32) {
m.Return(m.SmiConstant(1));
m.Bind(&bad);
m.BIND(&bad);
m.Return(m.SmiConstant(0));
Handle<Code> code = data.GenerateCode();
......
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