 Chromium Code Reviews
 Chromium Code Reviews Issue 501076:
  Fast-codegen: Adding support for try/catch and throw.  (Closed)
    
  
    Issue 501076:
  Fast-codegen: Adding support for try/catch and throw.  (Closed) 
  | OLD | NEW | 
|---|---|
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 739 BAILOUT("ForStatement"); | 739 BAILOUT("ForStatement"); | 
| 740 } | 740 } | 
| 741 | 741 | 
| 742 | 742 | 
| 743 void CodeGenSelector::VisitForInStatement(ForInStatement* stmt) { | 743 void CodeGenSelector::VisitForInStatement(ForInStatement* stmt) { | 
| 744 BAILOUT("ForInStatement"); | 744 BAILOUT("ForInStatement"); | 
| 745 } | 745 } | 
| 746 | 746 | 
| 747 | 747 | 
| 748 void CodeGenSelector::VisitTryCatchStatement(TryCatchStatement* stmt) { | 748 void CodeGenSelector::VisitTryCatchStatement(TryCatchStatement* stmt) { | 
| 749 BAILOUT("TryCatchStatement"); | 749 Visit(stmt->try_block()); | 
| 750 CHECK_BAILOUT; | |
| 751 Visit(stmt->catch_block()); | |
| 750 } | 752 } | 
| 751 | 753 | 
| 752 | 754 | 
| 753 void CodeGenSelector::VisitTryFinallyStatement(TryFinallyStatement* stmt) { | 755 void CodeGenSelector::VisitTryFinallyStatement(TryFinallyStatement* stmt) { | 
| 754 Visit(stmt->try_block()); | 756 Visit(stmt->try_block()); | 
| 755 CHECK_BAILOUT; | 757 CHECK_BAILOUT; | 
| 756 Visit(stmt->finally_block()); | 758 Visit(stmt->finally_block()); | 
| 757 } | 759 } | 
| 758 | 760 | 
| 759 | 761 | 
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 869 Expression* subexpr = subexprs->at(i); | 871 Expression* subexpr = subexprs->at(i); | 
| 870 if (subexpr->AsLiteral() != NULL) continue; | 872 if (subexpr->AsLiteral() != NULL) continue; | 
| 871 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; | 873 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; | 
| 872 ProcessExpression(subexpr, Expression::kValue); | 874 ProcessExpression(subexpr, Expression::kValue); | 
| 873 CHECK_BAILOUT; | 875 CHECK_BAILOUT; | 
| 874 } | 876 } | 
| 875 } | 877 } | 
| 876 | 878 | 
| 877 | 879 | 
| 878 void CodeGenSelector::VisitCatchExtensionObject(CatchExtensionObject* expr) { | 880 void CodeGenSelector::VisitCatchExtensionObject(CatchExtensionObject* expr) { | 
| 879 BAILOUT("CatchExtensionObject"); | 881 // Supported. | 
| 
Kevin Millikin (Chromium)
2009/12/17 14:36:16
It seems right to visit the subexpressions in a va
 | |
| 880 } | 882 } | 
| 881 | 883 | 
| 882 | 884 | 
| 883 void CodeGenSelector::VisitAssignment(Assignment* expr) { | 885 void CodeGenSelector::VisitAssignment(Assignment* expr) { | 
| 884 // We support plain non-compound assignments to properties, parameters and | 886 // We support plain non-compound assignments to properties, parameters and | 
| 885 // non-context (stack-allocated) locals, and global variables. | 887 // non-context (stack-allocated) locals, and global variables. | 
| 886 Token::Value op = expr->op(); | 888 Token::Value op = expr->op(); | 
| 887 if (op == Token::INIT_CONST) BAILOUT("initialize constant"); | 889 if (op == Token::INIT_CONST) BAILOUT("initialize constant"); | 
| 888 | 890 | 
| 889 Variable* var = expr->target()->AsVariableProxy()->AsVariable(); | 891 Variable* var = expr->target()->AsVariableProxy()->AsVariable(); | 
| (...skipping 29 matching lines...) Expand all Loading... | |
| 919 } else { | 921 } else { | 
| 920 // This is a throw reference error. | 922 // This is a throw reference error. | 
| 921 BAILOUT("non-variable/non-property assignment"); | 923 BAILOUT("non-variable/non-property assignment"); | 
| 922 } | 924 } | 
| 923 | 925 | 
| 924 ProcessExpression(expr->value(), Expression::kValue); | 926 ProcessExpression(expr->value(), Expression::kValue); | 
| 925 } | 927 } | 
| 926 | 928 | 
| 927 | 929 | 
| 928 void CodeGenSelector::VisitThrow(Throw* expr) { | 930 void CodeGenSelector::VisitThrow(Throw* expr) { | 
| 929 BAILOUT("Throw"); | 931 ProcessExpression(expr->exception(), Expression::kValue); | 
| 930 } | 932 } | 
| 931 | 933 | 
| 932 | 934 | 
| 933 void CodeGenSelector::VisitProperty(Property* expr) { | 935 void CodeGenSelector::VisitProperty(Property* expr) { | 
| 934 ProcessExpression(expr->obj(), Expression::kValue); | 936 ProcessExpression(expr->obj(), Expression::kValue); | 
| 935 CHECK_BAILOUT; | 937 CHECK_BAILOUT; | 
| 936 ProcessExpression(expr->key(), Expression::kValue); | 938 ProcessExpression(expr->key(), Expression::kValue); | 
| 937 } | 939 } | 
| 938 | 940 | 
| 939 | 941 | 
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1109 | 1111 | 
| 1110 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { | 1112 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { | 
| 1111 // ThisFunction is supported. | 1113 // ThisFunction is supported. | 
| 1112 } | 1114 } | 
| 1113 | 1115 | 
| 1114 #undef BAILOUT | 1116 #undef BAILOUT | 
| 1115 #undef CHECK_BAILOUT | 1117 #undef CHECK_BAILOUT | 
| 1116 | 1118 | 
| 1117 | 1119 | 
| 1118 } } // namespace v8::internal | 1120 } } // namespace v8::internal | 
| OLD | NEW |