aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/src/compiler/code-generator.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/compiler/code-generator.h')
-rw-r--r--deps/v8/src/compiler/code-generator.h50
1 files changed, 40 insertions, 10 deletions
diff --git a/deps/v8/src/compiler/code-generator.h b/deps/v8/src/compiler/code-generator.h
index d1545d10b9..70bf81f5af 100644
--- a/deps/v8/src/compiler/code-generator.h
+++ b/deps/v8/src/compiler/code-generator.h
@@ -16,6 +16,7 @@ namespace internal {
namespace compiler {
// Forward declarations.
+class FrameAccessState;
class Linkage;
class OutOfLineCode;
@@ -27,6 +28,20 @@ struct BranchInfo {
};
+class InstructionOperandIterator {
+ public:
+ InstructionOperandIterator(Instruction* instr, size_t pos)
+ : instr_(instr), pos_(pos) {}
+
+ Instruction* instruction() const { return instr_; }
+ InstructionOperand* Advance() { return instr_->InputAt(pos_++); }
+
+ private:
+ Instruction* instr_;
+ size_t pos_;
+};
+
+
// Generates native code for a sequence of instructions.
class CodeGenerator final : public GapResolver::Assembler {
public:
@@ -37,7 +52,8 @@ class CodeGenerator final : public GapResolver::Assembler {
Handle<Code> GenerateCode();
InstructionSequence* code() const { return code_; }
- Frame* frame() const { return frame_; }
+ FrameAccessState* frame_access_state() const { return frame_access_state_; }
+ Frame* frame() const { return frame_access_state_->frame(); }
Isolate* isolate() const { return info_->isolate(); }
Linkage* linkage() const { return linkage_; }
@@ -94,7 +110,10 @@ class CodeGenerator final : public GapResolver::Assembler {
void AssembleReturn();
// Generates code to deconstruct a the caller's frame, including arguments.
- void AssembleDeconstructActivationRecord();
+ void AssembleDeconstructActivationRecord(int stack_param_delta);
+
+ // Generates code to manipulate the stack in preparation for a tail call.
+ void AssemblePrepareTailCall(int stack_param_delta);
// ===========================================================================
// ============== Architecture-specific gap resolver methods. ================
@@ -125,21 +144,33 @@ class CodeGenerator final : public GapResolver::Assembler {
void RecordCallPosition(Instruction* instr);
void PopulateDeoptimizationData(Handle<Code> code);
int DefineDeoptimizationLiteral(Handle<Object> literal);
- FrameStateDescriptor* GetFrameStateDescriptor(Instruction* instr,
- size_t frame_state_offset);
+ FrameStateDescriptor* GetFrameStateDescriptor(
+ Instruction* instr, size_t frame_access_state_offset);
int BuildTranslation(Instruction* instr, int pc_offset,
- size_t frame_state_offset,
+ size_t frame_access_state_offset,
OutputFrameStateCombine state_combine);
void BuildTranslationForFrameStateDescriptor(
- FrameStateDescriptor* descriptor, Instruction* instr,
- Translation* translation, size_t frame_state_offset,
- OutputFrameStateCombine state_combine);
+ FrameStateDescriptor* descriptor, InstructionOperandIterator* iter,
+ Translation* translation, OutputFrameStateCombine state_combine);
+ void TranslateStateValueDescriptor(StateValueDescriptor* desc,
+ Translation* translation,
+ InstructionOperandIterator* iter);
+ void TranslateFrameStateDescriptorOperands(FrameStateDescriptor* desc,
+ InstructionOperandIterator* iter,
+ OutputFrameStateCombine combine,
+ Translation* translation);
void AddTranslationForOperand(Translation* translation, Instruction* instr,
InstructionOperand* op, MachineType type);
void AddNopForSmiCodeInlining();
void EnsureSpaceForLazyDeopt();
void MarkLazyDeoptSite();
+ // Converts the delta in the number of stack parameter passed from a tail
+ // caller to the callee into the distance (in pointers) the SP must be
+ // adjusted, taking frame elision and other relevant factors into
+ // consideration.
+ int TailCallFrameStackSlotDelta(int stack_param_delta);
+
// ===========================================================================
struct DeoptimizationState : ZoneObject {
@@ -167,7 +198,7 @@ class CodeGenerator final : public GapResolver::Assembler {
friend class OutOfLineCode;
- Frame* const frame_;
+ FrameAccessState* frame_access_state_;
Linkage* const linkage_;
InstructionSequence* const code_;
CompilationInfo* const info_;
@@ -187,7 +218,6 @@ class CodeGenerator final : public GapResolver::Assembler {
JumpTable* jump_tables_;
OutOfLineCode* ools_;
int osr_pc_offset_;
- bool needs_frame_;
};
} // namespace compiler