summaryrefslogtreecommitdiff
path: root/deps/v8/src/compiler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/compiler.cc')
-rw-r--r--deps/v8/src/compiler.cc60
1 files changed, 37 insertions, 23 deletions
diff --git a/deps/v8/src/compiler.cc b/deps/v8/src/compiler.cc
index 03771d9c4a..420b809e7d 100644
--- a/deps/v8/src/compiler.cc
+++ b/deps/v8/src/compiler.cc
@@ -538,7 +538,7 @@ Handle<JSFunction> Compiler::BuildBoilerplate(FunctionLiteral* literal,
LOG(CodeCreateEvent(Logger::FUNCTION_TAG, *code, *literal->name()));
#ifdef ENABLE_OPROFILE_AGENT
- OProfileAgent::CreateNativeCodeRegion(*node->name(),
+ OProfileAgent::CreateNativeCodeRegion(*literal->name(),
code->instruction_start(),
code->instruction_size());
#endif
@@ -649,12 +649,6 @@ void CodeGenSelector::VisitStatements(ZoneList<Statement*>* stmts) {
void CodeGenSelector::VisitDeclaration(Declaration* decl) {
Property* prop = decl->proxy()->AsProperty();
if (prop != NULL) {
- // Property rewrites are shared, ensure we are not changing its
- // expression context state.
- ASSERT(prop->obj()->context() == Expression::kUninitialized ||
- prop->obj()->context() == Expression::kValue);
- ASSERT(prop->key()->context() == Expression::kUninitialized ||
- prop->key()->context() == Expression::kValue);
ProcessExpression(prop->obj(), Expression::kValue);
ProcessExpression(prop->key(), Expression::kValue);
}
@@ -746,7 +740,9 @@ void CodeGenSelector::VisitForInStatement(ForInStatement* stmt) {
void CodeGenSelector::VisitTryCatchStatement(TryCatchStatement* stmt) {
- BAILOUT("TryCatchStatement");
+ Visit(stmt->try_block());
+ CHECK_BAILOUT;
+ Visit(stmt->catch_block());
}
@@ -876,7 +872,9 @@ void CodeGenSelector::VisitArrayLiteral(ArrayLiteral* expr) {
void CodeGenSelector::VisitCatchExtensionObject(CatchExtensionObject* expr) {
- BAILOUT("CatchExtensionObject");
+ ProcessExpression(expr->key(), Expression::kValue);
+ CHECK_BAILOUT;
+ ProcessExpression(expr->value(), Expression::kValue);
}
@@ -890,6 +888,9 @@ void CodeGenSelector::VisitAssignment(Assignment* expr) {
Property* prop = expr->target()->AsProperty();
ASSERT(var == NULL || prop == NULL);
if (var != NULL) {
+ if (var->mode() == Variable::CONST) {
+ BAILOUT("Assignment to const");
+ }
// All global variables are supported.
if (!var->is_global()) {
ASSERT(var->slot() != NULL);
@@ -899,20 +900,12 @@ void CodeGenSelector::VisitAssignment(Assignment* expr) {
}
}
} else if (prop != NULL) {
- ASSERT(prop->obj()->context() == Expression::kUninitialized ||
- prop->obj()->context() == Expression::kValue);
ProcessExpression(prop->obj(), Expression::kValue);
CHECK_BAILOUT;
// We will only visit the key during code generation for keyed property
// stores. Leave its expression context uninitialized for named
// property stores.
- Literal* lit = prop->key()->AsLiteral();
- uint32_t ignored;
- if (lit == NULL ||
- !lit->handle()->IsSymbol() ||
- String::cast(*(lit->handle()))->AsArrayIndex(&ignored)) {
- ASSERT(prop->key()->context() == Expression::kUninitialized ||
- prop->key()->context() == Expression::kValue);
+ if (!prop->key()->IsPropertyName()) {
ProcessExpression(prop->key(), Expression::kValue);
CHECK_BAILOUT;
}
@@ -926,7 +919,7 @@ void CodeGenSelector::VisitAssignment(Assignment* expr) {
void CodeGenSelector::VisitThrow(Throw* expr) {
- BAILOUT("Throw");
+ ProcessExpression(expr->exception(), Expression::kValue);
}
@@ -1018,11 +1011,32 @@ void CodeGenSelector::VisitUnaryOperation(UnaryOperation* expr) {
void CodeGenSelector::VisitCountOperation(CountOperation* expr) {
- // We support postfix count operations on global variables.
- if (expr->is_prefix()) BAILOUT("Prefix CountOperation");
Variable* var = expr->expression()->AsVariableProxy()->AsVariable();
- if (var == NULL || !var->is_global()) BAILOUT("non-global postincrement");
- ProcessExpression(expr->expression(), Expression::kValue);
+ Property* prop = expr->expression()->AsProperty();
+ ASSERT(var == NULL || prop == NULL);
+ if (var != NULL) {
+ // All global variables are supported.
+ if (!var->is_global()) {
+ ASSERT(var->slot() != NULL);
+ Slot::Type type = var->slot()->type();
+ if (type == Slot::LOOKUP) {
+ BAILOUT("CountOperation with lookup slot");
+ }
+ }
+ } else if (prop != NULL) {
+ ProcessExpression(prop->obj(), Expression::kValue);
+ CHECK_BAILOUT;
+ // We will only visit the key during code generation for keyed property
+ // stores. Leave its expression context uninitialized for named
+ // property stores.
+ if (!prop->key()->IsPropertyName()) {
+ ProcessExpression(prop->key(), Expression::kValue);
+ CHECK_BAILOUT;
+ }
+ } else {
+ // This is a throw reference error.
+ BAILOUT("CountOperation non-variable/non-property expression");
+ }
}