| OLD | NEW | 
|    1 // Copyright 2012 the V8 project authors. All rights reserved. |    1 // Copyright 2012 the V8 project authors. All rights reserved. | 
|    2 // Use of this source code is governed by a BSD-style license that can be |    2 // Use of this source code is governed by a BSD-style license that can be | 
|    3 // found in the LICENSE file. |    3 // found in the LICENSE file. | 
|    4  |    4  | 
|    5 #include "src/parsing/rewriter.h" |    5 #include "src/parsing/rewriter.h" | 
|    6  |    6  | 
|    7 #include "src/ast/ast.h" |    7 #include "src/ast/ast.h" | 
|    8 #include "src/ast/scopes.h" |    8 #include "src/ast/scopes.h" | 
|    9 #include "src/parsing/parser.h" |    9 #include "src/parsing/parser.h" | 
|   10  |   10  | 
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  218 void Processor::VisitTryFinallyStatement(TryFinallyStatement* node) { |  218 void Processor::VisitTryFinallyStatement(TryFinallyStatement* node) { | 
|  219   // Rewrite both try and finally block (in reverse order). |  219   // Rewrite both try and finally block (in reverse order). | 
|  220   bool set_after = is_set_; |  220   bool set_after = is_set_; | 
|  221   is_set_ = true;  // Don't normally need to assign in finally block. |  221   is_set_ = true;  // Don't normally need to assign in finally block. | 
|  222   Visit(node->finally_block()); |  222   Visit(node->finally_block()); | 
|  223   node->set_finally_block(replacement_->AsBlock()); |  223   node->set_finally_block(replacement_->AsBlock()); | 
|  224   {  // Save .result value at the beginning of the finally block and restore it |  224   {  // Save .result value at the beginning of the finally block and restore it | 
|  225      // at the end again: ".backup = .result; ...; .result = .backup" |  225      // at the end again: ".backup = .result; ...; .result = .backup" | 
|  226      // This is necessary because the finally block does not normally contribute |  226      // This is necessary because the finally block does not normally contribute | 
|  227      // to the completion value. |  227      // to the completion value. | 
 |  228     CHECK(scope() != nullptr); | 
|  228     Variable* backup = scope()->NewTemporary( |  229     Variable* backup = scope()->NewTemporary( | 
|  229         factory()->ast_value_factory()->dot_result_string()); |  230         factory()->ast_value_factory()->dot_result_string()); | 
|  230     Expression* backup_proxy = factory()->NewVariableProxy(backup); |  231     Expression* backup_proxy = factory()->NewVariableProxy(backup); | 
|  231     Expression* result_proxy = factory()->NewVariableProxy(result_); |  232     Expression* result_proxy = factory()->NewVariableProxy(result_); | 
|  232     Expression* save = factory()->NewAssignment( |  233     Expression* save = factory()->NewAssignment( | 
|  233         Token::ASSIGN, backup_proxy, result_proxy, RelocInfo::kNoPosition); |  234         Token::ASSIGN, backup_proxy, result_proxy, RelocInfo::kNoPosition); | 
|  234     Expression* restore = factory()->NewAssignment( |  235     Expression* restore = factory()->NewAssignment( | 
|  235         Token::ASSIGN, result_proxy, backup_proxy, RelocInfo::kNoPosition); |  236         Token::ASSIGN, result_proxy, backup_proxy, RelocInfo::kNoPosition); | 
|  236     node->finally_block()->statements()->InsertAt( |  237     node->finally_block()->statements()->InsertAt( | 
|  237         0, factory()->NewExpressionStatement(save, RelocInfo::kNoPosition), |  238         0, factory()->NewExpressionStatement(save, RelocInfo::kNoPosition), | 
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  394           processor.SetResult(undef), expr->position()); |  395           processor.SetResult(undef), expr->position()); | 
|  395       body->Add(completion, factory->zone()); |  396       body->Add(completion, factory->zone()); | 
|  396     } |  397     } | 
|  397   } |  398   } | 
|  398   return true; |  399   return true; | 
|  399 } |  400 } | 
|  400  |  401  | 
|  401  |  402  | 
|  402 }  // namespace internal |  403 }  // namespace internal | 
|  403 }  // namespace v8 |  404 }  // namespace v8 | 
| OLD | NEW |