Remove RecordTypeFeedback() methods from some AST classes and move into typing.cc.
R=mvstanton@chromium.org BUG= Review URL: https://codereview.chromium.org/955243002 Cr-Commit-Position: refs/heads/master@{#26890}
This commit is contained in:
parent
4c80924d2b
commit
5c7b7b919b
23
src/ast.cc
23
src/ast.cc
@ -611,29 +611,6 @@ bool Call::ComputeGlobalTarget(Handle<GlobalObject> global,
|
||||
}
|
||||
|
||||
|
||||
void CallNew::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
|
||||
FeedbackVectorSlot allocation_site_feedback_slot =
|
||||
FLAG_pretenuring_call_new ? AllocationSiteFeedbackSlot()
|
||||
: CallNewFeedbackSlot();
|
||||
allocation_site_ =
|
||||
oracle->GetCallNewAllocationSite(allocation_site_feedback_slot);
|
||||
is_monomorphic_ = oracle->CallNewIsMonomorphic(CallNewFeedbackSlot());
|
||||
if (is_monomorphic_) {
|
||||
target_ = oracle->GetCallNewTarget(CallNewFeedbackSlot());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ObjectLiteral::Property::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
|
||||
DCHECK(!is_computed_name());
|
||||
TypeFeedbackId id = key()->AsLiteral()->LiteralFeedbackId();
|
||||
SmallMapList maps;
|
||||
oracle->CollectReceiverTypes(id, &maps);
|
||||
receiver_type_ = maps.length() == 1 ? maps.at(0)
|
||||
: Handle<Map>::null();
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Implementation of AstVisitor
|
||||
|
||||
|
10
src/ast.h
10
src/ast.h
@ -1414,7 +1414,6 @@ class ObjectLiteralProperty FINAL : public ZoneObject {
|
||||
Kind kind() { return kind_; }
|
||||
|
||||
// Type feedback information.
|
||||
void RecordTypeFeedback(TypeFeedbackOracle* oracle);
|
||||
bool IsMonomorphic() { return !receiver_type_.is_null(); }
|
||||
Handle<Map> GetReceiverType() { return receiver_type_; }
|
||||
|
||||
@ -1426,6 +1425,8 @@ class ObjectLiteralProperty FINAL : public ZoneObject {
|
||||
bool is_static() const { return is_static_; }
|
||||
bool is_computed_name() const { return is_computed_name_; }
|
||||
|
||||
void set_receiver_type(Handle<Map> map) { receiver_type_ = map; }
|
||||
|
||||
protected:
|
||||
friend class AstNodeFactory;
|
||||
|
||||
@ -1918,7 +1919,6 @@ class CallNew FINAL : public Expression {
|
||||
return CallNewFeedbackSlot().next();
|
||||
}
|
||||
|
||||
void RecordTypeFeedback(TypeFeedbackOracle* oracle);
|
||||
bool IsMonomorphic() OVERRIDE { return is_monomorphic_; }
|
||||
Handle<JSFunction> target() const { return target_; }
|
||||
Handle<AllocationSite> allocation_site() const {
|
||||
@ -1929,6 +1929,12 @@ class CallNew FINAL : public Expression {
|
||||
static int feedback_slots() { return 1; }
|
||||
BailoutId ReturnId() const { return BailoutId(local_id(0)); }
|
||||
|
||||
void set_allocation_site(Handle<AllocationSite> site) {
|
||||
allocation_site_ = site;
|
||||
}
|
||||
void set_is_monomorphic(bool monomorphic) { is_monomorphic_ = monomorphic; }
|
||||
void set_target(Handle<JSFunction> target) { target_ = target; }
|
||||
|
||||
protected:
|
||||
CallNew(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments,
|
||||
int pos)
|
||||
|
@ -410,7 +410,12 @@ void AstTyper::VisitObjectLiteral(ObjectLiteral* expr) {
|
||||
if (!prop->is_computed_name() &&
|
||||
prop->key()->AsLiteral()->value()->IsInternalizedString() &&
|
||||
prop->emit_store()) {
|
||||
prop->RecordTypeFeedback(oracle());
|
||||
// Record type feed back for the property.
|
||||
TypeFeedbackId id = prop->key()->AsLiteral()->LiteralFeedbackId();
|
||||
SmallMapList maps;
|
||||
oracle()->CollectReceiverTypes(id, &maps);
|
||||
prop->set_receiver_type(maps.length() == 1 ? maps.at(0)
|
||||
: Handle<Map>::null());
|
||||
}
|
||||
}
|
||||
|
||||
@ -562,7 +567,17 @@ void AstTyper::VisitCall(Call* expr) {
|
||||
|
||||
void AstTyper::VisitCallNew(CallNew* expr) {
|
||||
// Collect type feedback.
|
||||
expr->RecordTypeFeedback(oracle());
|
||||
FeedbackVectorSlot allocation_site_feedback_slot =
|
||||
FLAG_pretenuring_call_new ? expr->AllocationSiteFeedbackSlot()
|
||||
: expr->CallNewFeedbackSlot();
|
||||
expr->set_allocation_site(
|
||||
oracle()->GetCallNewAllocationSite(allocation_site_feedback_slot));
|
||||
bool monomorphic =
|
||||
oracle()->CallNewIsMonomorphic(expr->CallNewFeedbackSlot());
|
||||
expr->set_is_monomorphic(monomorphic);
|
||||
if (monomorphic) {
|
||||
expr->set_target(oracle()->GetCallNewTarget(expr->CallNewFeedbackSlot()));
|
||||
}
|
||||
|
||||
RECURSE(Visit(expr->expression()));
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
|
Loading…
Reference in New Issue
Block a user