Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Unified Diff: src/ast.h

Issue 137403009: Adding a type vector to replace type cells. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Smarter vector allocation and refactoring. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/ast.cc » ('j') | src/ast.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index 07227b105c50818d32ff4219ef0038436ba28bfe..dc8383ff57deb35b2788fc2f4292fe64d51cf7aa 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -181,15 +181,27 @@ class AstProperties V8_FINAL BASE_EMBEDDED {
public:
class Flags : public EnumSet<AstPropertiesFlag, int> {};
- AstProperties() : node_count_(0) { }
+ AstProperties()
+ : node_count_(0),
+ minimum_feedback_slots_(0),
+ maximum_feedback_slots_(0) { }
Flags* flags() { return &flags_; }
int node_count() { return node_count_; }
void add_node_count(int count) { node_count_ += count; }
+ int minimum_feedback_slots() { return minimum_feedback_slots_; }
+ int maximum_feedback_slots() { return maximum_feedback_slots_; }
+ void increase_feedback_slots(int minimum, int maximum) {
+ minimum_feedback_slots_ += minimum;
+ maximum_feedback_slots_ += maximum;
Benedikt Meurer 2014/01/24 11:29:54 Can we have an ASSERT here to make sure that mini
mvstanton 2014/01/30 15:13:41 Changed the approach totally...
+ }
+
private:
Flags flags_;
int node_count_;
+ int minimum_feedback_slots_;
+ int maximum_feedback_slots_;
};
@@ -213,6 +225,13 @@ class AstNode: public ZoneObject {
virtual NodeType node_type() const = 0;
int position() const { return position_; }
+ static int MinimumFeedbackSlots() { return 0; }
+ static int MaximumFeedbackSlots() { return 0; }
+
+ virtual int ConsumeFeedbackSlots(Isolate* isolate, int current_slot) {
+ return current_slot;
+ }
+
// Type testing & conversion functions overridden by concrete subclasses.
#define DECLARE_NODE_FUNCTIONS(type) \
bool Is##type() { return node_type() == AstNode::k##type; } \
@@ -922,7 +941,16 @@ class ForInStatement V8_FINAL : public ForEachStatement {
return subject();
}
- TypeFeedbackId ForInFeedbackId() const { return reuse(PrepareId()); }
+ // Type feedback information.
+ static int MinimumFeedbackSlots() { return 1; }
+ static int MaximumFeedbackSlots() { return 1; }
+
+ virtual int ConsumeFeedbackSlots(Isolate* isolate, int current_slot) {
+ first_feedback_slot_ = current_slot;
+ return current_slot + 1;
+ }
+ int ForInFeedbackSlot() { return first_feedback_slot_; }
+
enum ForInType { FAST_FOR_IN, SLOW_FOR_IN };
ForInType for_in_type() const { return for_in_type_; }
void set_for_in_type(ForInType type) { for_in_type_ = type; }
@@ -936,11 +964,13 @@ class ForInStatement V8_FINAL : public ForEachStatement {
ForInStatement(Zone* zone, ZoneStringList* labels, int pos)
: ForEachStatement(zone, labels, pos),
for_in_type_(SLOW_FOR_IN),
+ first_feedback_slot_(0),
Benedikt Meurer 2014/01/24 11:29:54 Initialize to -1 as below. Extra points if you add
body_id_(GetNextId(zone)),
prepare_id_(GetNextId(zone)) {
}
ForInType for_in_type_;
+ int first_feedback_slot_;
const BailoutId body_id_;
const BailoutId prepare_id_;
};
@@ -1740,6 +1770,11 @@ class Call V8_FINAL : public Expression {
Expression* expression() const { return expression_; }
ZoneList<Expression*>* arguments() const { return arguments_; }
+ static int MinimumFeedbackSlots() { return 0; }
+ static int MaximumFeedbackSlots() { return 1; }
+ virtual int ConsumeFeedbackSlots(Isolate* isolate, int current_slot);
+ int CallFeedbackSlot() { return first_feedback_slot_; }
+
// Type feedback information.
TypeFeedbackId CallFeedbackId() const { return reuse(id()); }
void RecordTypeFeedback(TypeFeedbackOracle* oracle);
@@ -1811,6 +1846,7 @@ class Call V8_FINAL : public Expression {
is_monomorphic_(false),
keyed_array_call_is_holey_(true),
check_type_(RECEIVER_MAP_CHECK),
+ first_feedback_slot_(-1),
Benedikt Meurer 2014/01/24 11:29:54 Remember the extra points...? ;-)
return_id_(GetNextId(zone)) { }
private:
@@ -1824,6 +1860,7 @@ class Call V8_FINAL : public Expression {
Handle<JSFunction> target_;
Handle<JSObject> holder_;
Handle<Cell> cell_;
+ int first_feedback_slot_;
const BailoutId return_id_;
};
@@ -1837,6 +1874,15 @@ class CallNew V8_FINAL : public Expression {
ZoneList<Expression*>* arguments() const { return arguments_; }
// Type feedback information.
+ static int MinimumFeedbackSlots() { return 1; }
+ static int MaximumFeedbackSlots() { return 1; }
+
+ virtual int ConsumeFeedbackSlots(Isolate* isolate, int current_slot) {
+ first_feedback_slot_ = current_slot;
+ return current_slot + 1;
+ }
+ int CallNewFeedbackSlot() { return first_feedback_slot_; }
+
TypeFeedbackId CallNewFeedbackId() const { return reuse(id()); }
void RecordTypeFeedback(TypeFeedbackOracle* oracle);
virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; }
@@ -1846,6 +1892,8 @@ class CallNew V8_FINAL : public Expression {
return allocation_site_;
}
+ static int feedback_slots() { return 1; }
+
BailoutId ReturnId() const { return return_id_; }
protected:
@@ -1858,6 +1906,7 @@ class CallNew V8_FINAL : public Expression {
arguments_(arguments),
is_monomorphic_(false),
elements_kind_(GetInitialFastElementsKind()),
+ first_feedback_slot_(0),
Benedikt Meurer 2014/01/24 11:29:54 See above.
return_id_(GetNextId(zone)) { }
private:
@@ -1868,6 +1917,8 @@ class CallNew V8_FINAL : public Expression {
Handle<JSFunction> target_;
ElementsKind elements_kind_;
Handle<AllocationSite> allocation_site_;
+ Handle<Cell> allocation_info_cell_;
+ int first_feedback_slot_;
const BailoutId return_id_;
};
@@ -2353,6 +2404,15 @@ class FunctionLiteral V8_FINAL : public Expression {
}
int ast_node_count() { return ast_properties_.node_count(); }
+
+ int minimum_feedback_slots() {
+ return ast_properties_.minimum_feedback_slots();
+ }
+
+ int maximum_feedback_slots() {
+ return ast_properties_.maximum_feedback_slots();
+ }
+
AstProperties::Flags* flags() { return ast_properties_.flags(); }
void set_ast_properties(AstProperties* ast_properties) {
ast_properties_ = *ast_properties;
@@ -2896,6 +2956,9 @@ class AstConstructionVisitor BASE_EMBEDDED {
#undef DEF_VISIT
void increase_node_count() { properties_.add_node_count(1); }
+ void increase_feedback_slots(int count_fixed, int count_optional) {
+ properties_.increase_feedback_slots(count_fixed, count_optional);
+ }
void add_flag(AstPropertiesFlag flag) { properties_.flags()->Add(flag); }
void set_dont_optimize_reason(BailoutReason reason) {
dont_optimize_reason_ = reason;
« no previous file with comments | « no previous file | src/ast.cc » ('j') | src/ast.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698