| Index: src/hydrogen.cc
|
| ===================================================================
|
| --- src/hydrogen.cc (revision 11394)
|
| +++ src/hydrogen.cc (working copy)
|
| @@ -3928,7 +3928,8 @@
|
| boilerplate,
|
| length,
|
| expr->literal_index(),
|
| - expr->depth());
|
| + expr->depth(),
|
| + expr->constant_elements());
|
| }
|
|
|
| // The array is expected in the bailout environment during computation
|
| @@ -7153,13 +7154,25 @@
|
| }
|
|
|
|
|
| +HInstruction* HGraphBuilder::BuildThisFunction() {
|
| + // If we share optimized code between different closures, the
|
| + // this-function is not a constant, except inside an inlined body.
|
| + if (function_state()->outer() != NULL) {
|
| + return new(zone()) HConstant(
|
| + function_state()->compilation_info()->closure(),
|
| + Representation::Tagged());
|
| + } else {
|
| + return new(zone()) HThisFunction;
|
| + }
|
| +}
|
| +
|
| +
|
| void HGraphBuilder::VisitThisFunction(ThisFunction* expr) {
|
| ASSERT(!HasStackOverflow());
|
| ASSERT(current_block() != NULL);
|
| ASSERT(current_block()->HasPredecessor());
|
| - HThisFunction* self = new(zone()) HThisFunction(
|
| - function_state()->compilation_info()->closure());
|
| - return ast_context()->ReturnInstruction(self, expr->id());
|
| + HInstruction* instr = BuildThisFunction();
|
| + return ast_context()->ReturnInstruction(instr, expr->id());
|
| }
|
|
|
|
|
|
|