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

Unified Diff: src/typing.cc

Issue 112863002: Merge bleeding_edge 18021:18297 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years 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 | « src/typing.h ('k') | src/v8.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/typing.cc
diff --git a/src/typing.cc b/src/typing.cc
index 84f596859d76d48892d9cc4a976e8e6165439316..8487c05eb4af9fe472509c5afc34ae0eb1916053 100644
--- a/src/typing.cc
+++ b/src/typing.cc
@@ -200,7 +200,7 @@ void AstTyper::VisitSwitchStatement(SwitchStatement* stmt) {
for (int i = 0; i < clauses->length(); ++i) {
CaseClause* clause = clauses->at(i);
if (!clause->is_default())
- clause->RecordTypeFeedback(oracle());
+ clause->set_compare_type(oracle()->ClauseType(clause->CompareId()));
}
}
}
@@ -262,7 +262,8 @@ void AstTyper::VisitForStatement(ForStatement* stmt) {
void AstTyper::VisitForInStatement(ForInStatement* stmt) {
// Collect type feedback.
- stmt->RecordTypeFeedback(oracle());
+ stmt->set_for_in_type(static_cast<ForInStatement::ForInType>(
+ oracle()->ForInType(stmt->ForInFeedbackId())));
RECURSE(Visit(stmt->enumerable()));
store_.Forget(); // Control may transfer here via looping or 'continue'.
@@ -386,31 +387,35 @@ void AstTyper::VisitArrayLiteral(ArrayLiteral* expr) {
void AstTyper::VisitAssignment(Assignment* expr) {
- // TODO(rossberg): Can we clean this up?
- if (expr->is_compound()) {
- // Collect type feedback.
- Expression* target = expr->target();
- Property* prop = target->AsProperty();
- if (prop != NULL) {
- prop->RecordTypeFeedback(oracle(), zone());
- expr->RecordTypeFeedback(oracle(), zone());
- }
-
- RECURSE(Visit(expr->binary_operation()));
-
- NarrowType(expr, expr->binary_operation()->bounds());
- } else {
- // Collect type feedback.
- if (expr->target()->IsProperty()) {
- expr->RecordTypeFeedback(oracle(), zone());
+ // Collect type feedback.
+ Property* prop = expr->target()->AsProperty();
+ if (prop != NULL) {
+ TypeFeedbackId id = expr->AssignmentFeedbackId();
+ expr->set_is_uninitialized(oracle()->StoreIsUninitialized(id));
+ if (!expr->IsUninitialized()) {
+ expr->set_is_pre_monomorphic(oracle()->StoreIsPreMonomorphic(id));
+ expr->set_is_monomorphic(oracle()->StoreIsMonomorphicNormal(id));
+ ASSERT(!expr->IsPreMonomorphic() || !expr->IsMonomorphic());
+ if (prop->key()->IsPropertyName()) {
+ Literal* lit_key = prop->key()->AsLiteral();
+ ASSERT(lit_key != NULL && lit_key->value()->IsString());
+ Handle<String> name = Handle<String>::cast(lit_key->value());
+ oracle()->AssignmentReceiverTypes(id, name, expr->GetReceiverTypes());
+ } else {
+ KeyedAccessStoreMode store_mode;
+ oracle()->KeyedAssignmentReceiverTypes(
+ id, expr->GetReceiverTypes(), &store_mode);
+ expr->set_store_mode(store_mode);
+ }
}
-
- RECURSE(Visit(expr->target()));
- RECURSE(Visit(expr->value()));
-
- NarrowType(expr, expr->value()->bounds());
}
+ Expression* rhs =
+ expr->is_compound() ? expr->binary_operation() : expr->value();
+ RECURSE(Visit(expr->target()));
+ RECURSE(Visit(rhs));
+ NarrowType(expr, rhs->bounds());
+
VariableProxy* proxy = expr->target()->AsVariableProxy();
if (proxy != NULL && proxy->var()->IsStackAllocated()) {
store_.Seq(variable_index(proxy->var()), Effect(expr->bounds()));
@@ -436,7 +441,27 @@ void AstTyper::VisitThrow(Throw* expr) {
void AstTyper::VisitProperty(Property* expr) {
// Collect type feedback.
- expr->RecordTypeFeedback(oracle(), zone());
+ TypeFeedbackId id = expr->PropertyFeedbackId();
+ expr->set_is_uninitialized(oracle()->LoadIsUninitialized(id));
+ if (!expr->IsUninitialized()) {
+ expr->set_is_pre_monomorphic(oracle()->LoadIsPreMonomorphic(id));
+ expr->set_is_monomorphic(oracle()->LoadIsMonomorphicNormal(id));
+ ASSERT(!expr->IsPreMonomorphic() || !expr->IsMonomorphic());
+ if (expr->key()->IsPropertyName()) {
+ Literal* lit_key = expr->key()->AsLiteral();
+ ASSERT(lit_key != NULL && lit_key->value()->IsString());
+ Handle<String> name = Handle<String>::cast(lit_key->value());
+ bool is_prototype;
+ oracle()->PropertyReceiverTypes(
+ id, name, expr->GetReceiverTypes(), &is_prototype);
+ expr->set_is_function_prototype(is_prototype);
+ } else {
+ bool is_string;
+ oracle()->KeyedPropertyReceiverTypes(
+ id, expr->GetReceiverTypes(), &is_string);
+ expr->set_is_string_access(is_string);
+ }
+ }
RECURSE(Visit(expr->obj()));
RECURSE(Visit(expr->key()));
@@ -525,11 +550,12 @@ void AstTyper::VisitUnaryOperation(UnaryOperation* expr) {
void AstTyper::VisitCountOperation(CountOperation* expr) {
// Collect type feedback.
- expr->RecordTypeFeedback(oracle(), zone());
- Property* prop = expr->expression()->AsProperty();
- if (prop != NULL) {
- prop->RecordTypeFeedback(oracle(), zone());
- }
+ TypeFeedbackId store_id = expr->CountStoreFeedbackId();
+ expr->set_is_monomorphic(oracle()->StoreIsMonomorphicNormal(store_id));
+ expr->set_store_mode(oracle()->GetStoreMode(store_id));
+ oracle()->CountReceiverTypes(store_id, expr->GetReceiverTypes());
+ expr->set_type(oracle()->CountType(expr->CountBinOpFeedbackId()));
+ // TODO(rossberg): merge the count type with the generic expression type.
RECURSE(Visit(expr->expression()));
« no previous file with comments | « src/typing.h ('k') | src/v8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698