Reviewers: mvstanton,
Description:
Remove RecordTypeFeedback() methods from some AST classes and move into
typing.cc.
[email protected]
BUG=
Please review this at https://codereview.chromium.org/955243002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+25, -27 lines):
M src/ast.h
M src/ast.cc
M src/typing.cc
Index: src/ast.cc
diff --git a/src/ast.cc b/src/ast.cc
index
ac81e751afb31f1ea89e8e47ac1cd68c6b198e2b..fff9db1ec08cf4a28ba43f4b8efaf6d9e07e6cc8
100644
--- a/src/ast.cc
+++ b/src/ast.cc
@@ -608,29 +608,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
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index
9b86d0b51292f6291b734962af0f8912e8218f4d..556ab2ed8855ee1db5acee24f9a80f046911da28
100644
--- a/src/ast.h
+++ b/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;
@@ -1911,7 +1912,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 {
@@ -1922,6 +1922,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)
Index: src/typing.cc
diff --git a/src/typing.cc b/src/typing.cc
index
48528705bf1e1abb605d2a243199eb7a7ab05e30..794accc48399d7095bea85aac88e0bb5954594cc
100644
--- a/src/typing.cc
+++ b/src/typing.cc
@@ -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();
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.