| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 2529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2540 // Simplify the AST nodes by converting: | 2540 // Simplify the AST nodes by converting: |
| 2541 // 'try B0 catch B1 finally B2' | 2541 // 'try B0 catch B1 finally B2' |
| 2542 // to: | 2542 // to: |
| 2543 // 'try { try B0 catch B1 } finally B2' | 2543 // 'try { try B0 catch B1 } finally B2' |
| 2544 | 2544 |
| 2545 if (catch_block != NULL && finally_block != NULL) { | 2545 if (catch_block != NULL && finally_block != NULL) { |
| 2546 // If we have both, create an inner try/catch. | 2546 // If we have both, create an inner try/catch. |
| 2547 ASSERT(catch_scope != NULL && catch_variable != NULL); | 2547 ASSERT(catch_scope != NULL && catch_variable != NULL); |
| 2548 int index = current_function_state_->NextHandlerIndex(); | 2548 int index = current_function_state_->NextHandlerIndex(); |
| 2549 TryCatchStatement* statement = factory()->NewTryCatchStatement( | 2549 TryCatchStatement* statement = factory()->NewTryCatchStatement( |
| 2550 index, try_block, catch_scope, catch_variable, catch_block); | 2550 isolate(), index, try_block, catch_scope, catch_variable, catch_block); |
| 2551 statement->set_escaping_targets(try_collector.targets()); | 2551 statement->set_escaping_targets(try_collector.targets()); |
| 2552 try_block = factory()->NewBlock(NULL, 1, false); | 2552 try_block = factory()->NewBlock(NULL, 1, false); |
| 2553 try_block->AddStatement(statement, zone()); | 2553 try_block->AddStatement(statement, zone()); |
| 2554 catch_block = NULL; // Clear to indicate it's been handled. | 2554 catch_block = NULL; // Clear to indicate it's been handled. |
| 2555 } | 2555 } |
| 2556 | 2556 |
| 2557 TryStatement* result = NULL; | 2557 TryStatement* result = NULL; |
| 2558 if (catch_block != NULL) { | 2558 if (catch_block != NULL) { |
| 2559 ASSERT(finally_block == NULL); | 2559 ASSERT(finally_block == NULL); |
| 2560 ASSERT(catch_scope != NULL && catch_variable != NULL); | 2560 ASSERT(catch_scope != NULL && catch_variable != NULL); |
| 2561 int index = current_function_state_->NextHandlerIndex(); | 2561 int index = current_function_state_->NextHandlerIndex(); |
| 2562 result = factory()->NewTryCatchStatement( | 2562 result = factory()->NewTryCatchStatement( |
| 2563 index, try_block, catch_scope, catch_variable, catch_block); | 2563 isolate(), index, try_block, catch_scope, catch_variable, catch_block); |
| 2564 } else { | 2564 } else { |
| 2565 ASSERT(finally_block != NULL); | 2565 ASSERT(finally_block != NULL); |
| 2566 int index = current_function_state_->NextHandlerIndex(); | 2566 int index = current_function_state_->NextHandlerIndex(); |
| 2567 result = factory()->NewTryFinallyStatement(index, try_block, finally_block); | 2567 result = factory()->NewTryFinallyStatement(isolate(), index, try_block, |
| 2568 finally_block); |
| 2568 // Combine the jump targets of the try block and the possible catch block. | 2569 // Combine the jump targets of the try block and the possible catch block. |
| 2569 try_collector.targets()->AddAll(*catch_collector.targets(), zone()); | 2570 try_collector.targets()->AddAll(*catch_collector.targets(), zone()); |
| 2570 } | 2571 } |
| 2571 | 2572 |
| 2572 result->set_escaping_targets(try_collector.targets()); | 2573 result->set_escaping_targets(try_collector.targets()); |
| 2573 return result; | 2574 return result; |
| 2574 } | 2575 } |
| 2575 | 2576 |
| 2576 | 2577 |
| 2577 DoWhileStatement* Parser::ParseDoWhileStatement(ZoneStringList* labels, | 2578 DoWhileStatement* Parser::ParseDoWhileStatement(ZoneStringList* labels, |
| (...skipping 3347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5925 ASSERT(info()->isolate()->has_pending_exception()); | 5926 ASSERT(info()->isolate()->has_pending_exception()); |
| 5926 } else { | 5927 } else { |
| 5927 result = ParseProgram(); | 5928 result = ParseProgram(); |
| 5928 } | 5929 } |
| 5929 } | 5930 } |
| 5930 info()->SetFunction(result); | 5931 info()->SetFunction(result); |
| 5931 return (result != NULL); | 5932 return (result != NULL); |
| 5932 } | 5933 } |
| 5933 | 5934 |
| 5934 } } // namespace v8::internal | 5935 } } // namespace v8::internal |
| OLD | NEW |