Commit e838e75e authored by Creddy's avatar Creddy Committed by Commit Bot

[CSA] Typing LoadFeedbackVector

Bug: v8:7796
Change-Id: If5e40fa943798cdc0d7dbdc640750c7b7ad4439b
Reviewed-on: https://chromium-review.googlesource.com/1087957
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53579}
parent c5ba2a60
......@@ -17,6 +17,8 @@ namespace internal {
using compiler::Node;
template <class T>
using TNode = compiler::TNode<T>;
template <class T>
using SloppyTNode = compiler::SloppyTNode<T>;
CodeStubAssembler::CodeStubAssembler(compiler::CodeAssemblerState* state)
: compiler::CodeAssembler(state) {
......@@ -8505,16 +8507,16 @@ TNode<BoolT> CodeStubAssembler::IsOffsetInBounds(SloppyTNode<IntPtrT> offset,
return IntPtrLessThanOrEqual(offset, last_offset);
}
Node* CodeStubAssembler::LoadFeedbackVector(Node* closure) {
Node* feedback_cell =
LoadObjectField(closure, JSFunction::kFeedbackCellOffset);
CSA_ASSERT(this, IsFeedbackCell(feedback_cell));
return LoadObjectField(feedback_cell, FeedbackCell::kValueOffset);
TNode<FeedbackVector> CodeStubAssembler::LoadFeedbackVector(
SloppyTNode<JSFunction> closure) {
TNode<FeedbackCell> feedback_cell =
CAST(LoadObjectField(closure, JSFunction::kFeedbackCellOffset));
return CAST(LoadObjectField(feedback_cell, FeedbackCell::kValueOffset));
}
Node* CodeStubAssembler::LoadFeedbackVectorForStub() {
Node* function =
LoadFromParentFrame(JavaScriptFrameConstants::kFunctionOffset);
TNode<FeedbackVector> CodeStubAssembler::LoadFeedbackVectorForStub() {
TNode<JSFunction> function =
CAST(LoadFromParentFrame(JavaScriptFrameConstants::kFunctionOffset));
return LoadFeedbackVector(function);
}
......
......@@ -2209,10 +2209,10 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
Node* OrdinaryHasInstance(Node* context, Node* callable, Node* object);
// Load type feedback vector from the stub caller's frame.
Node* LoadFeedbackVectorForStub();
TNode<FeedbackVector> LoadFeedbackVectorForStub();
// Load type feedback vector for the given closure.
Node* LoadFeedbackVector(Node* closure);
TNode<FeedbackVector> LoadFeedbackVector(SloppyTNode<JSFunction> closure);
// Update the type feedback vector.
void UpdateFeedback(Node* feedback, Node* feedback_vector, Node* slot_id);
......@@ -2717,8 +2717,9 @@ class CodeStubArguments {
// Iteration doesn't include the receiver. |first| and |last| are zero-based.
void ForEach(const ForEachBodyFunction& body, Node* first = nullptr,
Node* last = nullptr, CodeStubAssembler::ParameterMode mode =
CodeStubAssembler::INTPTR_PARAMETERS) {
Node* last = nullptr,
CodeStubAssembler::ParameterMode mode =
CodeStubAssembler::INTPTR_PARAMETERS) {
CodeStubAssembler::VariableList list(0, assembler_->zone());
ForEach(list, body, first, last);
}
......@@ -2726,8 +2727,9 @@ class CodeStubArguments {
// Iteration doesn't include the receiver. |first| and |last| are zero-based.
void ForEach(const CodeStubAssembler::VariableList& vars,
const ForEachBodyFunction& body, Node* first = nullptr,
Node* last = nullptr, CodeStubAssembler::ParameterMode mode =
CodeStubAssembler::INTPTR_PARAMETERS);
Node* last = nullptr,
CodeStubAssembler::ParameterMode mode =
CodeStubAssembler::INTPTR_PARAMETERS);
void PopAndReturn(Node* value);
......
......@@ -23,6 +23,8 @@ namespace interpreter {
using compiler::CodeAssemblerState;
using compiler::Node;
template <class T>
using TNode = compiler::TNode<T>;
InterpreterAssembler::InterpreterAssembler(CodeAssemblerState* state,
Bytecode bytecode,
......@@ -667,8 +669,8 @@ Node* InterpreterAssembler::LoadAndUntagConstantPoolEntryAtOperandIndex(
return SmiUntag(LoadConstantPoolEntryAtOperandIndex(operand_index));
}
Node* InterpreterAssembler::LoadFeedbackVector() {
Node* function = LoadRegister(Register::function_closure());
TNode<FeedbackVector> InterpreterAssembler::LoadFeedbackVector() {
TNode<JSFunction> function = CAST(LoadRegister(Register::function_closure()));
return CodeStubAssembler::LoadFeedbackVector(function);
}
......
......@@ -145,7 +145,7 @@ class V8_EXPORT_PRIVATE InterpreterAssembler : public CodeStubAssembler {
compiler::Node* LoadAndUntagConstantPoolEntry(compiler::Node* index);
// Load the FeedbackVector for the current function.
compiler::Node* LoadFeedbackVector();
compiler::TNode<FeedbackVector> LoadFeedbackVector();
// Increment the call count for a CALL_IC or construct call.
// The call count is located at feedback_vector[slot_id + 1].
......
......@@ -154,7 +154,7 @@ class InterpreterLoadGlobalAssembler : public InterpreterAssembler {
void LdaGlobal(int slot_operand_index, int name_operand_index,
TypeofMode typeof_mode) {
TNode<FeedbackVector> feedback_vector = CAST(LoadFeedbackVector());
TNode<FeedbackVector> feedback_vector = LoadFeedbackVector();
Node* feedback_slot = BytecodeOperandIdx(slot_operand_index);
AccessorAssembler accessor_asm(state());
......
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