OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1978 function_return_(NULL), | 1978 function_return_(NULL), |
1979 test_context_(NULL), | 1979 test_context_(NULL), |
1980 outer_(owner->function_state()) { | 1980 outer_(owner->function_state()) { |
1981 if (outer_ != NULL) { | 1981 if (outer_ != NULL) { |
1982 // State for an inline function. | 1982 // State for an inline function. |
1983 if (owner->ast_context()->IsTest()) { | 1983 if (owner->ast_context()->IsTest()) { |
1984 HBasicBlock* if_true = owner->graph()->CreateBasicBlock(); | 1984 HBasicBlock* if_true = owner->graph()->CreateBasicBlock(); |
1985 HBasicBlock* if_false = owner->graph()->CreateBasicBlock(); | 1985 HBasicBlock* if_false = owner->graph()->CreateBasicBlock(); |
1986 if_true->MarkAsInlineReturnTarget(); | 1986 if_true->MarkAsInlineReturnTarget(); |
1987 if_false->MarkAsInlineReturnTarget(); | 1987 if_false->MarkAsInlineReturnTarget(); |
1988 Expression* cond = TestContext::cast(owner->ast_context())->condition(); | |
1988 // The AstContext constructor pushed on the context stack. This newed | 1989 // The AstContext constructor pushed on the context stack. This newed |
1989 // instance is the reason that AstContext can't be BASE_EMBEDDED. | 1990 // instance is the reason that AstContext can't be BASE_EMBEDDED. |
1990 test_context_ = new TestContext(owner, if_true, if_false); | 1991 test_context_ = new TestContext(owner, cond, if_true, if_false); |
Sven Panne
2011/06/09 10:07:57
Is this part of the change correct? I'm only 50% s
fschneider
2011/06/10 09:18:18
You probably want the call-instruction as the cond
Kevin Millikin (Chromium)
2011/06/10 09:35:06
I don't think you can specialize the individual re
| |
1991 } else { | 1992 } else { |
1992 function_return_ = owner->graph()->CreateBasicBlock(); | 1993 function_return_ = owner->graph()->CreateBasicBlock(); |
1993 function_return()->MarkAsInlineReturnTarget(); | 1994 function_return()->MarkAsInlineReturnTarget(); |
1994 } | 1995 } |
1995 // Set this after possibly allocating a new TestContext above. | 1996 // Set this after possibly allocating a new TestContext above. |
1996 call_context_ = owner->ast_context(); | 1997 call_context_ = owner->ast_context(); |
1997 } | 1998 } |
1998 | 1999 |
1999 // Push on the state stack. | 2000 // Push on the state stack. |
2000 owner->set_function_state(this); | 2001 owner->set_function_state(this); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2150 ValueContext for_value(this, ARGUMENTS_NOT_ALLOWED); | 2151 ValueContext for_value(this, ARGUMENTS_NOT_ALLOWED); |
2151 for_value.set_for_typeof(true); | 2152 for_value.set_for_typeof(true); |
2152 Visit(expr); | 2153 Visit(expr); |
2153 } | 2154 } |
2154 | 2155 |
2155 | 2156 |
2156 | 2157 |
2157 void HGraphBuilder::VisitForControl(Expression* expr, | 2158 void HGraphBuilder::VisitForControl(Expression* expr, |
2158 HBasicBlock* true_block, | 2159 HBasicBlock* true_block, |
2159 HBasicBlock* false_block) { | 2160 HBasicBlock* false_block) { |
2160 TestContext for_test(this, true_block, false_block); | 2161 TestContext for_test(this, expr, true_block, false_block); |
2161 Visit(expr); | 2162 Visit(expr); |
2162 } | 2163 } |
2163 | 2164 |
2164 | 2165 |
2165 void HGraphBuilder::VisitArgument(Expression* expr) { | 2166 void HGraphBuilder::VisitArgument(Expression* expr) { |
2166 CHECK_ALIVE(VisitForValue(expr)); | 2167 CHECK_ALIVE(VisitForValue(expr)); |
2167 Push(AddInstruction(new(zone()) HPushArgument(Pop()))); | 2168 Push(AddInstruction(new(zone()) HPushArgument(Pop()))); |
2168 } | 2169 } |
2169 | 2170 |
2170 | 2171 |
(...skipping 4168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6339 } | 6340 } |
6340 } | 6341 } |
6341 | 6342 |
6342 #ifdef DEBUG | 6343 #ifdef DEBUG |
6343 if (graph_ != NULL) graph_->Verify(); | 6344 if (graph_ != NULL) graph_->Verify(); |
6344 if (allocator_ != NULL) allocator_->Verify(); | 6345 if (allocator_ != NULL) allocator_->Verify(); |
6345 #endif | 6346 #endif |
6346 } | 6347 } |
6347 | 6348 |
6348 } } // namespace v8::internal | 6349 } } // namespace v8::internal |
OLD | NEW |