Commit 00ffe4a6 authored by Tobias Tebbi's avatar Tobias Tebbi Committed by Commit Bot

[torque] enable multiple inheritance from Torque-generated assemblers

This enables more seamless interop between Torque and CSA:

Since CodeStubAssembler can now inherit from the Torque base namespace,
macros defined in the base namespace can be used in CodeStubAssembler
macros, even without qualification.
At the same time, macros in the base namespace can refer to
CodeStubAssembler macros. The only new limitation is that types defined
in code-stub-assembler.h cannot be referenced in the signature of macros
defined in the base namespace, since this would produce a cyclic header
dependency. A work-around for this woud be to put such types (like int31
in this CL) into a separate header included by both. I (mis-)used
code-assembler.h for that.
Another side-effec is that types and enums defined in CodeStubAssembler
have to be accessed in a qualified way from Torque.

Other assemblers can now inherit from their Torque equivalent, so
porting macros into the corresponding Torque namespace doesn't require
any change to the existing use-sites.

To avoid C++ ambiguities, the Torque-generated assemblers must not define
anything also defined in Code(Stub)Assembler. This includes the type
aliases for TNode, PLabel, ...
My workaround is to qualify everything in the generated C++.

As a drive-by fix, I had to change the formatter to avoid a situation
where it doesn't compute a fixed point: putting a keyword at the
beginning of a line removes the '\s' in front of it, so I replaced that
with '\b'.

Bug: v8:7793
Change-Id: If3b9e9ad967a181b380a10d5673615606abd1041
Reviewed-on: https://chromium-review.googlesource.com/c/1341955Reviewed-by: 's avatarDaniel Clifford <danno@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57645}
parent 105f7d92
......@@ -3,8 +3,8 @@
// found in the LICENSE file.
type Arguments constexpr 'CodeStubArguments*';
type void generates 'void';
type never generates 'void';
type void;
type never;
type Tagged generates 'TNode<Object>';
type Smi extends Tagged generates 'TNode<Smi>';
......@@ -20,7 +20,8 @@ type float64 generates 'TNode<Float64T>' constexpr 'double';
type bool generates 'TNode<BoolT>' constexpr 'bool';
type string constexpr 'const char*';
type int31 extends int32 generates 'TNode<Int32T>' constexpr 'int31_t';
type int31 extends int32
generates 'TNode<Int32T>' constexpr 'int31_t';
type RawPtr generates 'TNode<RawPtrT>' constexpr 'void*';
type AbstractCode extends HeapObject generates 'TNode<AbstractCode>';
type Code extends AbstractCode generates 'TNode<Code>';
......@@ -86,14 +87,17 @@ type InstanceType generates 'TNode<Int32T>' constexpr 'InstanceType';
type ElementsKind generates 'TNode<Int32T>' constexpr 'ElementsKind';
type LanguageMode generates 'TNode<Smi>' constexpr 'LanguageMode';
type ExtractFixedArrayFlags
generates 'TNode<Smi>' constexpr 'ExtractFixedArrayFlags';
type ParameterMode generates 'TNode<Int32T>' constexpr 'ParameterMode';
generates 'TNode<Smi>'
constexpr 'CodeStubAssembler::ExtractFixedArrayFlags';
type ParameterMode
generates 'TNode<Int32T>' constexpr 'ParameterMode';
type RootIndex generates 'TNode<Int32T>' constexpr 'RootIndex';
type WriteBarrierMode
generates 'TNode<Int32T>' constexpr 'WriteBarrierMode';
type MessageTemplate constexpr 'MessageTemplate';
type ToIntegerTruncationMode constexpr 'ToIntegerTruncationMode';
type ToIntegerTruncationMode
constexpr 'CodeStubAssembler::ToIntegerTruncationMode';
type AllocationFlags constexpr 'AllocationFlags';
const NO_ELEMENTS: constexpr ElementsKind generates 'NO_ELEMENTS';
......@@ -131,7 +135,8 @@ const BIGUINT64_ELEMENTS:
const BIGINT64_ELEMENTS:
constexpr ElementsKind generates 'BIGINT64_ELEMENTS';
const kNone: constexpr AllocationFlags generates 'kNone';
const kNone:
constexpr AllocationFlags generates 'CodeStubAssembler::kNone';
const kDoubleAlignment:
constexpr AllocationFlags generates 'kDoubleAlignment';
const kPretenured: constexpr AllocationFlags generates 'kPretenured';
......@@ -151,11 +156,11 @@ type FixedBigUint64Array extends FixedTypedArray;
type FixedBigInt64Array extends FixedTypedArray;
const kFixedDoubleArrays: constexpr ExtractFixedArrayFlags
generates 'ExtractFixedArrayFlag::kFixedDoubleArrays';
generates 'CodeStubAssembler::ExtractFixedArrayFlag::kFixedDoubleArrays';
const kAllFixedArrays: constexpr ExtractFixedArrayFlags
generates 'ExtractFixedArrayFlag::kAllFixedArrays';
generates 'CodeStubAssembler::ExtractFixedArrayFlag::kAllFixedArrays';
const kFixedArrays: constexpr ExtractFixedArrayFlags
generates 'ExtractFixedArrayFlag::kFixedArrays';
generates 'CodeStubAssembler::ExtractFixedArrayFlag::kFixedArrays';
const kFixedCOWArrayMapRootIndex:
constexpr RootIndex generates 'RootIndex::kFixedCOWArrayMap';
......@@ -195,7 +200,8 @@ const kSloppyArgumentsParameterMapStart: constexpr int31
generates 'SloppyArgumentsElements::kParameterMapStart';
const kTruncateMinusZero: constexpr ToIntegerTruncationMode
generates 'ToIntegerTruncationMode::kTruncateMinusZero';
generates 'CodeStubAssembler::ToIntegerTruncationMode::kTruncateMinusZero'
;
const kNotTypedArray: constexpr MessageTemplate
generates 'MessageTemplate::kNotTypedArray';
......@@ -234,9 +240,10 @@ const false: constexpr bool generates 'false';
const kStrict: constexpr LanguageMode generates 'LanguageMode::kStrict';
const kSloppy: constexpr LanguageMode generates 'LanguageMode::kSloppy';
const SMI_PARAMETERS: constexpr ParameterMode generates 'SMI_PARAMETERS';
const INTPTR_PARAMETERS:
constexpr ParameterMode generates 'INTPTR_PARAMETERS';
const SMI_PARAMETERS: constexpr ParameterMode
generates 'CodeStubAssembler::SMI_PARAMETERS';
const INTPTR_PARAMETERS: constexpr ParameterMode
generates 'CodeStubAssembler::INTPTR_PARAMETERS';
const SKIP_WRITE_BARRIER:
constexpr WriteBarrierMode generates 'SKIP_WRITE_BARRIER';
......
......@@ -1848,10 +1848,10 @@ TF_BUILTIN(ArrayPrototypeFindIndex, ArrayBuiltinsAssembler) {
MissingPropertyMode::kUseUndefined, ForEachDirection::kForward);
}
class ArrayPopulatorAssembler : public BaseBuiltinsFromDSLAssembler {
class ArrayPopulatorAssembler : public CodeStubAssembler {
public:
explicit ArrayPopulatorAssembler(compiler::CodeAssemblerState* state)
: BaseBuiltinsFromDSLAssembler(state) {}
: CodeStubAssembler(state) {}
TNode<Object> ConstructArrayLike(TNode<Context> context,
TNode<Object> receiver) {
......
......@@ -20,10 +20,11 @@ namespace internal {
template <class T>
using TVariable = compiler::TypedCodeAssemblerVariable<T>;
class BaseCollectionsAssembler : public CollectionsBuiltinsFromDSLAssembler {
class BaseCollectionsAssembler : public CodeStubAssembler,
public CollectionsBuiltinsFromDSLAssembler {
public:
explicit BaseCollectionsAssembler(compiler::CodeAssemblerState* state)
: CollectionsBuiltinsFromDSLAssembler(state) {}
: CodeStubAssembler(state), CollectionsBuiltinsFromDSLAssembler(state) {}
virtual ~BaseCollectionsAssembler() = default;
......@@ -312,7 +313,7 @@ void BaseCollectionsAssembler::AddConstructorEntriesFromIterable(
TNode<Object> add_func = GetAddFunction(variant, context, collection);
IteratorBuiltinsAssembler iterator_assembler(this->state());
IteratorBuiltinsFromDSLAssembler::IteratorRecord iterator =
IteratorBuiltinsAssembler::IteratorRecord iterator =
iterator_assembler.GetIterator(context, iterable);
CSA_ASSERT(this, Word32BinaryNot(IsUndefined(iterator.object)));
......
......@@ -47,7 +47,7 @@ TF_BUILTIN(FastFunctionPrototypeBind, CodeStubAssembler) {
Comment("Check descriptor array length");
TNode<DescriptorArray> descriptors = LoadMapDescriptors(receiver_map);
// Minimum descriptor array length required for fast path.
const int min_descriptors_length = DescriptorArray::LengthFor(Max(
const int min_descriptors_length = DescriptorArray::LengthFor(i::Max(
JSFunction::kLengthDescriptorIndex, JSFunction::kNameDescriptorIndex));
TNode<Smi> descriptors_length = LoadWeakFixedArrayLength(descriptors);
GotoIf(SmiLessThanOrEqual(descriptors_length,
......
......@@ -14,38 +14,37 @@ namespace internal {
using compiler::Node;
class IteratorBuiltinsAssembler : public CodeStubAssembler {
class IteratorBuiltinsAssembler : public CodeStubAssembler,
public IteratorBuiltinsFromDSLAssembler {
public:
explicit IteratorBuiltinsAssembler(compiler::CodeAssemblerState* state)
: CodeStubAssembler(state) {}
: CodeStubAssembler(state), IteratorBuiltinsFromDSLAssembler(state) {}
// Returns object[Symbol.iterator].
TNode<Object> GetIteratorMethod(Node* context, Node* object);
// https://tc39.github.io/ecma262/#sec-getiterator --- never used for
// @@asyncIterator.
IteratorBuiltinsFromDSLAssembler::IteratorRecord GetIterator(
Node* context, Node* object, Label* if_exception = nullptr,
Variable* exception = nullptr);
IteratorBuiltinsFromDSLAssembler::IteratorRecord GetIterator(
Node* context, Node* object, Node* method, Label* if_exception = nullptr,
Variable* exception = nullptr);
IteratorRecord GetIterator(Node* context, Node* object,
Label* if_exception = nullptr,
Variable* exception = nullptr);
IteratorRecord GetIterator(Node* context, Node* object, Node* method,
Label* if_exception = nullptr,
Variable* exception = nullptr);
// https://tc39.github.io/ecma262/#sec-iteratorstep
// Returns `false` if the iterator is done, otherwise returns an
// iterator result.
// `fast_iterator_result_map` refers to the map for the JSIteratorResult
// object, loaded from the native context.
TNode<Object> IteratorStep(
Node* context,
const IteratorBuiltinsFromDSLAssembler::IteratorRecord& iterator,
Label* if_done, Node* fast_iterator_result_map = nullptr,
Label* if_exception = nullptr, Variable* exception = nullptr);
TNode<Object> IteratorStep(Node* context, const IteratorRecord& iterator,
Label* if_done,
Node* fast_iterator_result_map = nullptr,
Label* if_exception = nullptr,
Variable* exception = nullptr);
TNode<Object> IteratorStep(
Node* context,
const IteratorBuiltinsFromDSLAssembler::IteratorRecord& iterator,
Node* fast_iterator_result_map, Label* if_done) {
TNode<Object> IteratorStep(Node* context, const IteratorRecord& iterator,
Node* fast_iterator_result_map, Label* if_done) {
return IteratorStep(context, iterator, if_done, fast_iterator_result_map);
}
......@@ -59,14 +58,10 @@ class IteratorBuiltinsAssembler : public CodeStubAssembler {
Variable* exception = nullptr);
// https://tc39.github.io/ecma262/#sec-iteratorclose
void IteratorCloseOnException(
Node* context,
const IteratorBuiltinsFromDSLAssembler::IteratorRecord& iterator,
Label* if_exception, Variable* exception);
void IteratorCloseOnException(
Node* context,
const IteratorBuiltinsFromDSLAssembler::IteratorRecord& iterator,
TNode<Object> exception);
void IteratorCloseOnException(Node* context, const IteratorRecord& iterator,
Label* if_exception, Variable* exception);
void IteratorCloseOnException(Node* context, const IteratorRecord& iterator,
TNode<Object> exception);
// #sec-iterabletolist
// Build a JSArray by iterating over {iterable} using {iterator_fn},
......
......@@ -18,7 +18,7 @@ namespace v8 {
namespace internal {
using compiler::Node;
using IteratorRecord = IteratorBuiltinsFromDSLAssembler::IteratorRecord;
using IteratorRecord = IteratorBuiltinsAssembler::IteratorRecord;
Node* PromiseBuiltinsAssembler::AllocateJSPromise(Node* context) {
Node* const native_context = LoadNativeContext(context);
......
......@@ -23,7 +23,7 @@ template <class T>
using SloppyTNode = compiler::SloppyTNode<T>;
CodeStubAssembler::CodeStubAssembler(compiler::CodeAssemblerState* state)
: compiler::CodeAssembler(state) {
: compiler::CodeAssembler(state), BaseBuiltinsFromDSLAssembler(state) {
if (DEBUG_BOOL && FLAG_csa_trap_on_node != nullptr) {
HandleBreakOnNode();
}
......
......@@ -18,6 +18,8 @@
#include "src/objects/smi.h"
#include "src/roots.h"
#include "torque-generated/builtins-base-from-dsl-gen.h"
namespace v8 {
namespace internal {
......@@ -195,30 +197,14 @@ enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol };
#define CSA_SLOW_ASSERT(csa, ...) ((void)0)
#endif
class int31_t {
public:
int31_t() : value_(0) {}
int31_t(int value) : value_(value) { // NOLINT(runtime/explicit)
DCHECK_EQ((value & 0x80000000) != 0, (value & 0x40000000) != 0);
}
int31_t& operator=(int value) {
DCHECK_EQ((value & 0x80000000) != 0, (value & 0x40000000) != 0);
value_ = value;
return *this;
}
int32_t value() const { return value_; }
operator int32_t() const { return value_; }
private:
int32_t value_;
};
// Provides JavaScript-specific "macro-assembler" functionality on top of the
// CodeAssembler. By factoring the JavaScript-isms out of the CodeAssembler,
// it's possible to add JavaScript-specific useful CodeAssembler "macros"
// without modifying files in the compiler directory (and requiring a review
// from a compiler directory OWNER).
class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
class V8_EXPORT_PRIVATE CodeStubAssembler
: public compiler::CodeAssembler,
public BaseBuiltinsFromDSLAssembler {
public:
using Node = compiler::Node;
template <class T>
......
......@@ -243,6 +243,24 @@ struct UnionT {
using Number = UnionT<Smi, HeapNumber>;
using Numeric = UnionT<Number, BigInt>;
class int31_t {
public:
int31_t() : value_(0) {}
int31_t(int value) : value_(value) { // NOLINT(runtime/explicit)
DCHECK_EQ((value & 0x80000000) != 0, (value & 0x40000000) != 0);
}
int31_t& operator=(int value) {
DCHECK_EQ((value & 0x80000000) != 0, (value & 0x40000000) != 0);
value_ = value;
return *this;
}
int32_t value() const { return value_; }
operator int32_t() const { return value_; }
private:
int32_t value_;
};
#define ENUM_ELEMENT(Name) k##Name,
#define ENUM_STRUCT_ELEMENT(NAME, Name, name) k##Name,
enum class ObjectType {
......@@ -733,8 +751,11 @@ class V8_EXPORT_PRIVATE CodeAssembler {
#define TO_STRING_LITERAL(x) STRINGIFY(x)
#define CAST(x) \
Cast(x, "CAST(" #x ") at " __FILE__ ":" TO_STRING_LITERAL(__LINE__))
#define TORQUE_CAST(x) \
ca_.Cast(x, "CAST(" #x ") at " __FILE__ ":" TO_STRING_LITERAL(__LINE__))
#else
#define CAST(x) Cast(x)
#define TORQUE_CAST(x) ca_.Cast(x)
#endif
#ifdef DEBUG
......
This diff is collapsed.
......@@ -233,6 +233,15 @@ void DeclarationVisitor::Visit(StructDeclaration* decl) {
void DeclarationVisitor::Visit(TypeDeclaration* decl) {
std::string generates = decl->generates ? *decl->generates : std::string("");
if (decl->generates) {
if (generates.length() < 7 || generates.substr(0, 6) != "TNode<" ||
generates.substr(generates.length() - 1, 1) != ">") {
ReportError("generated type \"", generates,
"\" should be of the form \"TNode<...>\"");
}
generates = generates.substr(6, generates.length() - 7);
}
const AbstractType* type = Declarations::DeclareAbstractType(
decl->name, decl->transient, generates, {}, decl->extends);
......
......@@ -68,16 +68,9 @@ void ImplementationVisitor::BeginNamespaceFile(Namespace* nspace) {
}
source << "\n";
source
<< "namespace v8 {\n"
<< "namespace internal {\n"
<< "\n"
<< "using Node = compiler::Node;\n"
<< "using CatchLabel = compiler::CodeAssemblerExceptionHandlerLabel;\n"
<< "using ScopedCatch = compiler::CodeAssemblerScopedExceptionHandler;\n"
<< "template <class... Ts>\n"
<< "using PLabel = compiler::CodeAssemblerParameterizedLabel<Ts...>;\n"
<< "\n";
source << "namespace v8 {\n"
<< "namespace internal {\n"
<< "\n";
std::string upper_name(nspace->name());
transform(upper_name.begin(), upper_name.end(), upper_name.begin(),
......@@ -86,26 +79,21 @@ void ImplementationVisitor::BeginNamespaceFile(Namespace* nspace) {
std::string("V8_TORQUE_") + upper_name + "_FROM_DSL_BASE_H__";
header << "#ifndef " << headerDefine << "\n";
header << "#define " << headerDefine << "\n\n";
header << "#include \"src/code-stub-assembler.h\"";
header << "\n\n ";
header << "#include \"src/compiler/code-assembler.h\"\n";
if (nspace != GlobalContext::GetDefaultNamespace()) {
header << "#include \"src/code-stub-assembler.h\"\n";
}
header << "\n";
header << "namespace v8 {\n"
<< "namespace internal {\n"
<< "\n";
header << "class " << nspace->ExternalName()
<< ": public CodeStubAssembler {\n";
header << "class " << nspace->ExternalName() << " {\n";
header << " public:\n";
header << " explicit " << nspace->ExternalName()
<< "(compiler::CodeAssemblerState* state) : CodeStubAssembler(state) "
"{}\n";
header << "\n";
header << " using Node = compiler::Node;\n";
header << " template <class T>\n";
header << " using TNode = compiler::TNode<T>;\n";
header << " template <class T>\n";
header << " using SloppyTNode = compiler::SloppyTNode<T>;\n\n";
<< "(compiler::CodeAssemblerState* state) : state_(state), ca_(state) "
"{ USE(state_, ca_); }\n";
}
void ImplementationVisitor::EndNamespaceFile(Namespace* nspace) {
......@@ -122,7 +110,10 @@ void ImplementationVisitor::EndNamespaceFile(Namespace* nspace) {
<< "} // namespace v8\n"
<< "\n";
header << "};\n\n";
header << " private:\n"
<< " compiler::CodeAssemblerState* const state_;\n"
<< " compiler::CodeAssembler ca_;"
<< "}; \n\n";
header << "} // namespace internal\n"
<< "} // namespace v8\n"
<< "\n";
......@@ -340,8 +331,10 @@ void ImplementationVisitor::Visit(Builtin* builtin) {
CurrentScope::Scope current_scope(builtin);
const std::string& name = builtin->ExternalName();
const Signature& signature = builtin->signature();
source_out() << "TF_BUILTIN(" << name << ", "
<< CurrentNamespace()->ExternalName() << ") {\n";
source_out() << "TF_BUILTIN(" << name << ", CodeStubAssembler) {\n"
<< " compiler::CodeAssemblerState* state_ = state();"
<< " compiler::CodeAssembler ca_(state());\n";
CurrentCallable::Scope current_callable(builtin);
Stack<const Type*> parameter_types;
......@@ -1194,17 +1187,11 @@ void ImplementationVisitor::GenerateFunctionDeclaration(
std::cout << "generating source for declaration " << name << "\n";
}
// Quite a hack here. Make sure that TNode is namespace qualified if the
// macro/constant name is also qualified.
std::string return_type_name(signature.return_type->GetGeneratedTypeName());
if (const StructType* struct_type =
StructType::DynamicCast(signature.return_type)) {
o << struct_type->nspace()->ExternalName() << "::";
} else if (macro_prefix != "" && (return_type_name.length() > 5) &&
(return_type_name.substr(0, 5) == "TNode")) {
o << "compiler::";
if (signature.return_type->IsVoidOrNever()) {
o << "void";
} else {
o << signature.return_type->GetGeneratedTypeName();
}
o << return_type_name;
o << " " << macro_prefix << name << "(";
DCHECK_EQ(signature.types().size(), parameter_names.size());
......@@ -1226,10 +1213,10 @@ void ImplementationVisitor::GenerateFunctionDeclaration(
if (!first) {
o << ", ";
}
o << "Label* " << ExternalLabelName(label_info.name);
o << "compiler::CodeAssemblerLabel* " << ExternalLabelName(label_info.name);
size_t i = 0;
for (const Type* type : label_info.types) {
std::string generated_type_name("TVariable<");
std::string generated_type_name("compiler::TypedCodeAssemblerVariable<");
generated_type_name += type->GetGeneratedTNodeTypeName();
generated_type_name += ">*";
o << ", ";
......@@ -1528,7 +1515,9 @@ LocationReference ImplementationVisitor::GetLocationReference(
if (auto* constant = NamespaceConstant::DynamicCast(value)) {
if (constant->type()->IsConstexpr()) {
return LocationReference::Temporary(
VisitResult(constant->type(), constant->constant_name() + "()"),
VisitResult(constant->type(), constant->ExternalAssemblerName() +
"(state_)." +
constant->constant_name() + "()"),
"namespace constant " + expr->name);
}
assembler().Emit(NamespaceConstantInstruction{constant});
......@@ -1731,7 +1720,7 @@ VisitResult ImplementationVisitor::GenerateCall(
if (return_type->IsConstexpr()) {
DCHECK_EQ(0, arguments.labels.size());
std::stringstream result;
result << "(" << macro->external_assembler_name() << "(state())."
result << "(" << macro->external_assembler_name() << "(state_)."
<< macro->ExternalName() << "(";
bool first = true;
for (VisitResult arg : arguments.parameters) {
......
......@@ -75,10 +75,7 @@ bool Type::IsAbstractName(const std::string& name) const {
}
std::string AbstractType::GetGeneratedTNodeTypeName() const {
std::string result = GetGeneratedTypeName();
DCHECK_EQ(result.substr(0, 6), "TNode<");
result = result.substr(6, result.length() - 7);
return result;
return generated_type_;
}
std::string FunctionPointerType::ToExplicitString() const {
......
......@@ -171,7 +171,10 @@ class AbstractType final : public Type {
const std::string& name() const { return name_; }
std::string ToExplicitString() const override { return name(); }
std::string MangledName() const override { return "AT" + name(); }
std::string GetGeneratedTypeName() const override { return generated_type_; }
std::string GetGeneratedTypeName() const override {
return IsConstexpr() ? generated_type_
: "compiler::TNode<" + generated_type_ + ">";
}
std::string GetGeneratedTNodeTypeName() const override;
bool IsConstexpr() const override {
return name().substr(0, strlen(CONSTEXPR_TYPE_PREFIX)) ==
......@@ -266,7 +269,7 @@ class UnionType final : public Type {
std::string ToExplicitString() const override;
std::string MangledName() const override;
std::string GetGeneratedTypeName() const override {
return "TNode<" + GetGeneratedTNodeTypeName() + ">";
return "compiler::TNode<" + GetGeneratedTNodeTypeName() + ">";
}
std::string GetGeneratedTNodeTypeName() const override;
......
......@@ -29,12 +29,19 @@ namespace {
typedef CodeAssemblerLabel Label;
typedef CodeAssemblerVariable Variable;
class TestTorqueAssembler : public CodeStubAssembler,
public TestBuiltinsFromDSLAssembler {
public:
explicit TestTorqueAssembler(CodeAssemblerState* state)
: CodeStubAssembler(state), TestBuiltinsFromDSLAssembler(state) {}
};
} // namespace
TEST(TestConstexpr1) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
TestBuiltinsFromDSLAssembler m(asm_tester.state());
TestTorqueAssembler m(asm_tester.state());
{
m.TestConstexpr1();
m.Return(m.UndefinedConstant());
......@@ -46,7 +53,7 @@ TEST(TestConstexpr1) {
TEST(TestConstexprIf) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
TestBuiltinsFromDSLAssembler m(asm_tester.state());
TestTorqueAssembler m(asm_tester.state());
{
m.TestConstexprIf();
m.Return(m.UndefinedConstant());
......@@ -58,7 +65,7 @@ TEST(TestConstexprIf) {
TEST(TestConstexprReturn) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
TestBuiltinsFromDSLAssembler m(asm_tester.state());
TestTorqueAssembler m(asm_tester.state());
{
m.TestConstexprReturn();
m.Return(m.UndefinedConstant());
......@@ -70,7 +77,7 @@ TEST(TestConstexprReturn) {
TEST(TestGotoLabel) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
TestBuiltinsFromDSLAssembler m(asm_tester.state());
TestTorqueAssembler m(asm_tester.state());
{ m.Return(m.TestGotoLabel()); }
FunctionTester ft(asm_tester.GenerateCode(), 0);
ft.CheckCall(ft.true_value());
......@@ -79,7 +86,7 @@ TEST(TestGotoLabel) {
TEST(TestGotoLabelWithOneParameter) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
TestBuiltinsFromDSLAssembler m(asm_tester.state());
TestTorqueAssembler m(asm_tester.state());
{ m.Return(m.TestGotoLabelWithOneParameter()); }
FunctionTester ft(asm_tester.GenerateCode(), 0);
ft.CheckCall(ft.true_value());
......@@ -88,7 +95,7 @@ TEST(TestGotoLabelWithOneParameter) {
TEST(TestGotoLabelWithTwoParameters) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
TestBuiltinsFromDSLAssembler m(asm_tester.state());
TestTorqueAssembler m(asm_tester.state());
{ m.Return(m.TestGotoLabelWithTwoParameters()); }
FunctionTester ft(asm_tester.GenerateCode(), 0);
ft.CheckCall(ft.true_value());
......@@ -97,7 +104,7 @@ TEST(TestGotoLabelWithTwoParameters) {
TEST(TestPartiallyUnusedLabel) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
TestBuiltinsFromDSLAssembler m(asm_tester.state());
TestTorqueAssembler m(asm_tester.state());
{ m.Return(m.TestPartiallyUnusedLabel()); }
FunctionTester ft(asm_tester.GenerateCode(), 0);
ft.CheckCall(ft.true_value());
......@@ -106,7 +113,7 @@ TEST(TestPartiallyUnusedLabel) {
TEST(TestBuiltinSpecialization) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
TestBuiltinsFromDSLAssembler m(asm_tester.state());
TestTorqueAssembler m(asm_tester.state());
{
Node* temp = m.SmiConstant(0);
m.TestBuiltinSpecialization(m.UncheckedCast<Context>(temp));
......@@ -119,7 +126,7 @@ TEST(TestBuiltinSpecialization) {
TEST(TestMacroSpecialization) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
TestBuiltinsFromDSLAssembler m(asm_tester.state());
TestTorqueAssembler m(asm_tester.state());
{
m.TestMacroSpecialization();
m.Return(m.UndefinedConstant());
......@@ -132,7 +139,7 @@ TEST(TestFunctionPointers) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 0;
CodeAssemblerTester asm_tester(isolate, kNumParams);
TestBuiltinsFromDSLAssembler m(asm_tester.state());
TestTorqueAssembler m(asm_tester.state());
{
TNode<Context> context =
m.UncheckedCast<Context>(m.Parameter(kNumParams + 2));
......@@ -146,7 +153,7 @@ TEST(TestTernaryOperator) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
TestBuiltinsFromDSLAssembler m(asm_tester.state());
TestTorqueAssembler m(asm_tester.state());
{
TNode<Smi> arg = m.UncheckedCast<Smi>(m.Parameter(0));
m.Return(m.TestTernaryOperator(arg));
......@@ -163,7 +170,7 @@ TEST(TestTernaryOperator) {
TEST(TestFunctionPointerToGeneric) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
TestBuiltinsFromDSLAssembler m(asm_tester.state());
TestTorqueAssembler m(asm_tester.state());
{
Node* temp = m.SmiConstant(0);
m.TestFunctionPointerToGeneric(m.UncheckedCast<Context>(temp));
......@@ -176,7 +183,7 @@ TEST(TestFunctionPointerToGeneric) {
TEST(TestUnsafeCast) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
TestBuiltinsFromDSLAssembler m(asm_tester.state());
TestTorqueAssembler m(asm_tester.state());
{
Node* temp = m.SmiConstant(0);
Node* n = m.SmiConstant(10);
......@@ -190,7 +197,7 @@ TEST(TestUnsafeCast) {
TEST(TestHexLiteral) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
TestBuiltinsFromDSLAssembler m(asm_tester.state());
TestTorqueAssembler m(asm_tester.state());
{
m.TestHexLiteral();
m.Return(m.UndefinedConstant());
......@@ -202,7 +209,7 @@ TEST(TestHexLiteral) {
TEST(TestModuleConstBindings) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
TestBuiltinsFromDSLAssembler m(asm_tester.state());
TestTorqueAssembler m(asm_tester.state());
{
m.TestModuleConstBindings();
m.Return(m.UndefinedConstant());
......@@ -214,7 +221,7 @@ TEST(TestModuleConstBindings) {
TEST(TestLocalConstBindings) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
TestBuiltinsFromDSLAssembler m(asm_tester.state());
TestTorqueAssembler m(asm_tester.state());
{
m.TestLocalConstBindings();
m.Return(m.UndefinedConstant());
......@@ -226,7 +233,7 @@ TEST(TestLocalConstBindings) {
TEST(TestForLoop) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
TestBuiltinsFromDSLAssembler m(asm_tester.state());
TestTorqueAssembler m(asm_tester.state());
{
m.TestForLoop();
m.Return(m.UndefinedConstant());
......@@ -238,7 +245,7 @@ TEST(TestForLoop) {
TEST(TestTypeswitch) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
TestBuiltinsFromDSLAssembler m(asm_tester.state());
TestTorqueAssembler m(asm_tester.state());
{
m.TestTypeswitch();
m.Return(m.UndefinedConstant());
......@@ -250,7 +257,7 @@ TEST(TestTypeswitch) {
TEST(TestGenericOverload) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
TestBuiltinsFromDSLAssembler m(asm_tester.state());
TestTorqueAssembler m(asm_tester.state());
{
m.TestGenericOverload();
m.Return(m.UndefinedConstant());
......@@ -262,7 +269,7 @@ TEST(TestGenericOverload) {
TEST(TestLogicalOperators) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
TestBuiltinsFromDSLAssembler m(asm_tester.state());
TestTorqueAssembler m(asm_tester.state());
{
m.TestLogicalOperators();
m.Return(m.UndefinedConstant());
......@@ -274,7 +281,7 @@ TEST(TestLogicalOperators) {
TEST(TestOtherwiseAndLabels) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
TestBuiltinsFromDSLAssembler m(asm_tester.state());
TestTorqueAssembler m(asm_tester.state());
{
m.TestOtherwiseWithCode1();
m.TestOtherwiseWithCode2();
......@@ -293,7 +300,7 @@ TEST(TestCatch1) {
Handle<Context> context =
Utils::OpenHandle(*v8::Isolate::GetCurrent()->GetCurrentContext());
CodeAssemblerTester asm_tester(isolate, 0);
TestBuiltinsFromDSLAssembler m(asm_tester.state());
TestTorqueAssembler m(asm_tester.state());
{
TNode<Smi> result =
m.TestCatch1(m.UncheckedCast<Context>(m.HeapConstant(context)));
......@@ -312,7 +319,7 @@ TEST(TestCatch2) {
Handle<Context> context =
Utils::OpenHandle(*v8::Isolate::GetCurrent()->GetCurrentContext());
CodeAssemblerTester asm_tester(isolate, 0);
TestBuiltinsFromDSLAssembler m(asm_tester.state());
TestTorqueAssembler m(asm_tester.state());
{
TNode<Smi> result =
m.TestCatch2(m.UncheckedCast<Context>(m.HeapConstant(context)));
......@@ -331,7 +338,7 @@ TEST(TestCatch3) {
Handle<Context> context =
Utils::OpenHandle(*v8::Isolate::GetCurrent()->GetCurrentContext());
CodeAssemblerTester asm_tester(isolate, 0);
TestBuiltinsFromDSLAssembler m(asm_tester.state());
TestTorqueAssembler m(asm_tester.state());
{
TNode<Smi> result =
m.TestCatch3(m.UncheckedCast<Context>(m.HeapConstant(context)));
......@@ -346,7 +353,7 @@ TEST(TestCatch3) {
TEST(TestLookup) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
TestBuiltinsFromDSLAssembler m(asm_tester.state());
TestTorqueAssembler m(asm_tester.state());
{
m.TestQualifiedAccess();
m.Return(m.UndefinedConstant());
......
......@@ -35,9 +35,9 @@ def preprocess(input):
if old == input:
break;
input = re.sub(r'\sgenerates\s+\'([^\']+)\'\s*',
input = re.sub(r'\bgenerates\s+\'([^\']+)\'\s*',
r' _GeNeRaTeS00_/*\1@*/', input)
input = re.sub(r'\sconstexpr\s+\'([^\']+)\'\s*',
input = re.sub(r'\bconstexpr\s+\'([^\']+)\'\s*',
r' _CoNsExP_/*\1@*/', input)
input = re.sub(r'\notherwise',
r'\n otherwise', input)
......
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