| Index: src/hydrogen.cc
|
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc
|
| index 914b04fb9db57aafa24b9a5bdd003e5b0f2c3952..7ad556476ecb873cd3ee6d143111e0360d534618 100644
|
| --- a/src/hydrogen.cc
|
| +++ b/src/hydrogen.cc
|
| @@ -1286,7 +1286,12 @@ class SparseSet {
|
| : capacity_(capacity),
|
| length_(0),
|
| dense_(zone->NewArray<int>(capacity)),
|
| - sparse_(zone->NewArray<int>(capacity)) {}
|
| + sparse_(zone->NewArray<int>(capacity)) {
|
| +#ifndef NVALGRIND
|
| + // Initialize the sparse array to make valgrind happy.
|
| + memset(sparse_, 0, sizeof(sparse_[0]) * capacity);
|
| +#endif
|
| + }
|
|
|
| bool Contains(int n) const {
|
| ASSERT(0 <= n && n < capacity_);
|
| @@ -2007,9 +2012,10 @@ FunctionState::FunctionState(HGraphBuilder* owner,
|
| HBasicBlock* if_false = owner->graph()->CreateBasicBlock();
|
| if_true->MarkAsInlineReturnTarget();
|
| if_false->MarkAsInlineReturnTarget();
|
| + Expression* cond = TestContext::cast(owner->ast_context())->condition();
|
| // The AstContext constructor pushed on the context stack. This newed
|
| // instance is the reason that AstContext can't be BASE_EMBEDDED.
|
| - test_context_ = new TestContext(owner, if_true, if_false);
|
| + test_context_ = new TestContext(owner, cond, if_true, if_false);
|
| } else {
|
| function_return_ = owner->graph()->CreateBasicBlock();
|
| function_return()->MarkAsInlineReturnTarget();
|
| @@ -2179,7 +2185,7 @@ void HGraphBuilder::VisitForTypeOf(Expression* expr) {
|
| void HGraphBuilder::VisitForControl(Expression* expr,
|
| HBasicBlock* true_block,
|
| HBasicBlock* false_block) {
|
| - TestContext for_test(this, true_block, false_block);
|
| + TestContext for_test(this, expr, true_block, false_block);
|
| Visit(expr);
|
| }
|
|
|
| @@ -2380,13 +2386,18 @@ void HGraphBuilder::SetupScope(Scope* scope) {
|
| // Handle the arguments and arguments shadow variables specially (they do
|
| // not have declarations).
|
| if (scope->arguments() != NULL) {
|
| - if (!scope->arguments()->IsStackAllocated()) {
|
| + if (!scope->arguments()->IsStackAllocated() ||
|
| + (scope->arguments_shadow() != NULL &&
|
| + !scope->arguments_shadow()->IsStackAllocated())) {
|
| return Bailout("context-allocated arguments");
|
| }
|
| HArgumentsObject* object = new(zone()) HArgumentsObject;
|
| AddInstruction(object);
|
| graph()->SetArgumentsObject(object);
|
| environment()->Bind(scope->arguments(), object);
|
| + if (scope->arguments_shadow() != NULL) {
|
| + environment()->Bind(scope->arguments_shadow(), object);
|
| + }
|
| }
|
| }
|
|
|
| @@ -3509,20 +3520,6 @@ void HGraphBuilder::HandleCompoundAssignment(Assignment* expr) {
|
| } else if (var->IsStackAllocated()) {
|
| Bind(var, Top());
|
| } else if (var->IsContextSlot()) {
|
| - // Bail out if we try to mutate a parameter value in a function using
|
| - // the arguments object. We do not (yet) correctly handle the
|
| - // arguments property of the function.
|
| - if (info()->scope()->arguments() != NULL) {
|
| - // Parameters will rewrite to context slots. We have no direct way
|
| - // to detect that the variable is a parameter.
|
| - int count = info()->scope()->num_parameters();
|
| - for (int i = 0; i < count; ++i) {
|
| - if (var == info()->scope()->parameter(i)) {
|
| - Bailout("assignment to parameter, function uses arguments object");
|
| - }
|
| - }
|
| - }
|
| -
|
| HValue* context = BuildContextChainWalk(var);
|
| int index = var->AsSlot()->index();
|
| HStoreContextSlot* instr =
|
| @@ -3646,20 +3643,6 @@ void HGraphBuilder::VisitAssignment(Assignment* expr) {
|
|
|
| } else if (var->IsContextSlot()) {
|
| ASSERT(var->mode() != Variable::CONST);
|
| - // Bail out if we try to mutate a parameter value in a function using
|
| - // the arguments object. We do not (yet) correctly handle the
|
| - // arguments property of the function.
|
| - if (info()->scope()->arguments() != NULL) {
|
| - // Parameters will rewrite to context slots. We have no direct way
|
| - // to detect that the variable is a parameter.
|
| - int count = info()->scope()->num_parameters();
|
| - for (int i = 0; i < count; ++i) {
|
| - if (var == info()->scope()->parameter(i)) {
|
| - Bailout("assignment to parameter, function uses arguments object");
|
| - }
|
| - }
|
| - }
|
| -
|
| CHECK_ALIVE(VisitForValue(expr->value()));
|
| HValue* context = BuildContextChainWalk(var);
|
| int index = var->AsSlot()->index();
|
| @@ -3925,7 +3908,6 @@ HInstruction* HGraphBuilder::BuildStoreKeyedSpecializedArrayElement(
|
| case JSObject::FAST_ELEMENTS:
|
| case JSObject::FAST_DOUBLE_ELEMENTS:
|
| case JSObject::DICTIONARY_ELEMENTS:
|
| - case JSObject::NON_STRICT_ARGUMENTS_ELEMENTS:
|
| UNREACHABLE();
|
| break;
|
| }
|
| @@ -4822,7 +4804,7 @@ void HGraphBuilder::VisitDelete(UnaryOperation* expr) {
|
| // Result of deleting parameters is false, even when they rewrite
|
| // to accesses on the arguments object.
|
| ast_context()->ReturnValue(graph()->GetConstantFalse());
|
| - } else {
|
| + } else {
|
| CHECK_ALIVE(VisitForValue(prop->obj()));
|
| CHECK_ALIVE(VisitForValue(prop->key()));
|
| HValue* key = Pop();
|
| @@ -5007,20 +4989,6 @@ void HGraphBuilder::VisitCountOperation(CountOperation* expr) {
|
| } else if (var->IsStackAllocated()) {
|
| Bind(var, after);
|
| } else if (var->IsContextSlot()) {
|
| - // Bail out if we try to mutate a parameter value in a function using
|
| - // the arguments object. We do not (yet) correctly handle the
|
| - // arguments property of the function.
|
| - if (info()->scope()->arguments() != NULL) {
|
| - // Parameters will rewrite to context slots. We have no direct way
|
| - // to detect that the variable is a parameter.
|
| - int count = info()->scope()->num_parameters();
|
| - for (int i = 0; i < count; ++i) {
|
| - if (var == info()->scope()->parameter(i)) {
|
| - Bailout("assignment to parameter, function uses arguments object");
|
| - }
|
| - }
|
| - }
|
| -
|
| HValue* context = BuildContextChainWalk(var);
|
| int index = var->AsSlot()->index();
|
| HStoreContextSlot* instr =
|
|
|