Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: src/parser.cc

Issue 10910161: Partial ia32 implementation of optimized try/catch (by Kevin Millikin) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed build. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects-printer.cc ('k') | src/platform-solaris.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2807 matching lines...) Expand 10 before | Expand all | Expand 10 after
2818 // Simplify the AST nodes by converting: 2818 // Simplify the AST nodes by converting:
2819 // 'try B0 catch B1 finally B2' 2819 // 'try B0 catch B1 finally B2'
2820 // to: 2820 // to:
2821 // 'try { try B0 catch B1 } finally B2' 2821 // 'try { try B0 catch B1 } finally B2'
2822 2822
2823 if (catch_block != NULL && finally_block != NULL) { 2823 if (catch_block != NULL && finally_block != NULL) {
2824 // If we have both, create an inner try/catch. 2824 // If we have both, create an inner try/catch.
2825 ASSERT(catch_scope != NULL && catch_variable != NULL); 2825 ASSERT(catch_scope != NULL && catch_variable != NULL);
2826 int index = current_function_state_->NextHandlerIndex(); 2826 int index = current_function_state_->NextHandlerIndex();
2827 TryCatchStatement* statement = factory()->NewTryCatchStatement( 2827 TryCatchStatement* statement = factory()->NewTryCatchStatement(
2828 index, try_block, catch_scope, catch_variable, catch_block); 2828 isolate(), index, try_block, catch_scope, catch_variable, catch_block);
2829 statement->set_escaping_targets(try_collector.targets()); 2829 statement->set_escaping_targets(try_collector.targets());
2830 try_block = factory()->NewBlock(NULL, 1, false); 2830 try_block = factory()->NewBlock(NULL, 1, false);
2831 try_block->AddStatement(statement, zone()); 2831 try_block->AddStatement(statement, zone());
2832 catch_block = NULL; // Clear to indicate it's been handled. 2832 catch_block = NULL; // Clear to indicate it's been handled.
2833 } 2833 }
2834 2834
2835 TryStatement* result = NULL; 2835 TryStatement* result = NULL;
2836 if (catch_block != NULL) { 2836 if (catch_block != NULL) {
2837 ASSERT(finally_block == NULL); 2837 ASSERT(finally_block == NULL);
2838 ASSERT(catch_scope != NULL && catch_variable != NULL); 2838 ASSERT(catch_scope != NULL && catch_variable != NULL);
2839 int index = current_function_state_->NextHandlerIndex(); 2839 int index = current_function_state_->NextHandlerIndex();
2840 result = factory()->NewTryCatchStatement( 2840 result = factory()->NewTryCatchStatement(
2841 index, try_block, catch_scope, catch_variable, catch_block); 2841 isolate(), index, try_block, catch_scope, catch_variable, catch_block);
2842 } else { 2842 } else {
2843 ASSERT(finally_block != NULL); 2843 ASSERT(finally_block != NULL);
2844 int index = current_function_state_->NextHandlerIndex(); 2844 int index = current_function_state_->NextHandlerIndex();
2845 result = factory()->NewTryFinallyStatement(index, try_block, finally_block); 2845 result = factory()->NewTryFinallyStatement(isolate(), index, try_block,
2846 finally_block);
2846 // Combine the jump targets of the try block and the possible catch block. 2847 // Combine the jump targets of the try block and the possible catch block.
2847 try_collector.targets()->AddAll(*catch_collector.targets(), zone()); 2848 try_collector.targets()->AddAll(*catch_collector.targets(), zone());
2848 } 2849 }
2849 2850
2850 result->set_escaping_targets(try_collector.targets()); 2851 result->set_escaping_targets(try_collector.targets());
2851 return result; 2852 return result;
2852 } 2853 }
2853 2854
2854 2855
2855 DoWhileStatement* Parser::ParseDoWhileStatement(ZoneStringList* labels, 2856 DoWhileStatement* Parser::ParseDoWhileStatement(ZoneStringList* labels,
(...skipping 3248 matching lines...) Expand 10 before | Expand all | Expand 10 after
6104 ASSERT(info->isolate()->has_pending_exception()); 6105 ASSERT(info->isolate()->has_pending_exception());
6105 } else { 6106 } else {
6106 result = parser.ParseProgram(); 6107 result = parser.ParseProgram();
6107 } 6108 }
6108 } 6109 }
6109 info->SetFunction(result); 6110 info->SetFunction(result);
6110 return (result != NULL); 6111 return (result != NULL);
6111 } 6112 }
6112 6113
6113 } } // namespace v8::internal 6114 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-printer.cc ('k') | src/platform-solaris.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698