Chromium Code Reviews| Index: src/compiler/code-stub-assembler.h |
| diff --git a/src/compiler/code-stub-assembler.h b/src/compiler/code-stub-assembler.h |
| index 6c2e299de95974c3a9502689b5398cbda08100bf..07d726f869ba67b95551911cb1c06102318c9015 100644 |
| --- a/src/compiler/code-stub-assembler.h |
| +++ b/src/compiler/code-stub-assembler.h |
| @@ -5,10 +5,14 @@ |
| #ifndef V8_COMPILER_CODE_STUB_ASSEMBLER_H_ |
| #define V8_COMPILER_CODE_STUB_ASSEMBLER_H_ |
| +#include <limits> |
| +#include <vector> |
| + |
| // Clients of this interface shouldn't depend on lots of compiler internals. |
| // Do not include anything from src/compiler here! |
| #include "src/allocation.h" |
| #include "src/builtins.h" |
| +#include "src/machine-type.h" |
| #include "src/runtime/runtime.h" |
| namespace v8 { |
| @@ -25,13 +29,22 @@ class Graph; |
| class Node; |
| class Operator; |
| class RawMachineAssembler; |
| +class RawMachineLabel; |
| class Schedule; |
| class CodeStubAssembler { |
| public: |
| + class Label; |
| + |
| + // Create with CallStub linkage. |
| CodeStubAssembler(Isolate* isolate, Zone* zone, |
| const CallInterfaceDescriptor& descriptor, |
| Code::Flags flags, const char* name); |
| + |
| + // Create with JSCall linkage. |
| + CodeStubAssembler(Isolate* isolate, Zone* zone, int parameter_count, |
| + Code::Flags flags, const char* name); |
| + |
| virtual ~CodeStubAssembler(); |
| Handle<Code> GenerateCode(); |
| @@ -41,10 +54,14 @@ class CodeStubAssembler { |
| Node* IntPtrConstant(intptr_t value); |
| Node* NumberConstant(double value); |
| Node* HeapConstant(Handle<HeapObject> object); |
| + Node* UndefinedConstant(); |
| Node* BooleanConstant(bool value); |
| + // Memory Operations. |
| + Node* Load(MachineType rep, Node* base); |
| + Node* Load(MachineType rep, Node* base, Node* index); |
| + |
| Node* Parameter(int value); |
| - void Return(Node* value); |
| // Tag and untag Smi values. |
| Node* SmiTag(Node* value); |
| @@ -54,41 +71,82 @@ class CodeStubAssembler { |
| Node* IntPtrAdd(Node* a, Node* b); |
| Node* IntPtrSub(Node* a, Node* b); |
| Node* WordShl(Node* value, int shift); |
| + Node* WordEqual(Node* a, Node* b); |
| + Node* WordOr(Node* a, Node* b); |
| + Node* WordAnd(Node* a, Node* b); |
| + Node* Int32GreaterThanOrEqual(Node* a, Node* b); |
| + Node* Int32LessThan(Node* a, Node* b); |
| - // Load a field from an object on the heap. |
| + // Heap objects. |
| Node* LoadObjectField(Node* object, int offset); |
| + Node* IsHeapObject(Node* tagged); |
| + Node* InstanceType(Node* object); |
| + |
| + // Returns a node that is true if the given bit is set in |word32|. |
| + template <typename T> |
| + Node* BitFieldValue(Node* word32) { |
| + return BitFieldValue(word32, T::kShift, T::kMask); |
| + } |
| + |
| + Node* BitFieldValue(Node* word32, uint32_t shift, uint32_t mask); |
| // Call runtime function. |
| - Node* CallRuntime(Runtime::FunctionId function_id, Node* context, Node* arg1); |
| - Node* CallRuntime(Runtime::FunctionId function_id, Node* context, Node* arg1, |
| - Node* arg2); |
| + Node* CallRuntime(Runtime::FunctionId function_id, Node* arg1); |
| + Node* CallRuntime(Runtime::FunctionId function_id, Node* arg1, Node* arg2); |
| - Node* TailCallRuntime(Runtime::FunctionId function_id, Node* context, |
| - Node* arg1); |
| - Node* TailCallRuntime(Runtime::FunctionId function_id, Node* context, |
| - Node* arg1, Node* arg2); |
| + Node* TailCallRuntime(Runtime::FunctionId function_id, Node* arg1); |
| + Node* TailCallRuntime(Runtime::FunctionId function_id, Node* arg1, |
| + Node* arg2); |
| + |
| + // Control flow. |
| + void Goto(Label* label); |
| + void Branch(Node* cond, Label* true_label, Label* false_label); |
| + void Bind(Label* label); |
| + void Return(Node* value); |
| + |
| + // Variables. |
| + Node* Phi(MachineRepresentation rep, Node* n1, Node* n2); |
| private: |
| friend class CodeStubAssemblerTester; |
| + Node* Context(); |
| Node* CallN(CallDescriptor* descriptor, Node* code_target, Node** args); |
| Node* TailCallN(CallDescriptor* descriptor, Node* code_target, Node** args); |
| Node* SmiShiftBitsConstant(); |
| + RawMachineLabel* GetOrCreateRawMachineLabel(Label* label); |
| // Private helpers which delegate to RawMachineAssembler. |
| Graph* graph(); |
| Isolate* isolate(); |
| Zone* zone(); |
| + enum class LinkageDescriptorType { kStubCall, kJSCall }; |
| + |
| base::SmartPointer<RawMachineAssembler> raw_assembler_; |
| Code::Flags flags_; |
| const char* name_; |
| bool code_generated_; |
| + std::vector<RawMachineLabel*> labels_; |
| + LinkageDescriptorType linkage_type_; |
| + int parameter_count_; |
| DISALLOW_COPY_AND_ASSIGN(CodeStubAssembler); |
| }; |
| + |
| +class CodeStubAssembler::Label { |
| + public: |
| + Label() : raw_label_(nullptr) {} |
| + |
| + private: |
| + friend class CodeStubAssembler; |
| + |
| + RawMachineLabel* raw_label_; |
|
Jarin
2016/02/08 10:25:04
Why is this a pointer? Can't it be an embedded fie
|
| +}; |
| + |
| + |
| } // namespace compiler |
| } // namespace internal |
| } // namespace v8 |