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