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 1989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2000 function_return_(NULL), | 2000 function_return_(NULL), |
2001 test_context_(NULL), | 2001 test_context_(NULL), |
2002 outer_(owner->function_state()) { | 2002 outer_(owner->function_state()) { |
2003 if (outer_ != NULL) { | 2003 if (outer_ != NULL) { |
2004 // State for an inline function. | 2004 // State for an inline function. |
2005 if (owner->ast_context()->IsTest()) { | 2005 if (owner->ast_context()->IsTest()) { |
2006 HBasicBlock* if_true = owner->graph()->CreateBasicBlock(); | 2006 HBasicBlock* if_true = owner->graph()->CreateBasicBlock(); |
2007 HBasicBlock* if_false = owner->graph()->CreateBasicBlock(); | 2007 HBasicBlock* if_false = owner->graph()->CreateBasicBlock(); |
2008 if_true->MarkAsInlineReturnTarget(); | 2008 if_true->MarkAsInlineReturnTarget(); |
2009 if_false->MarkAsInlineReturnTarget(); | 2009 if_false->MarkAsInlineReturnTarget(); |
| 2010 Expression* cond = TestContext::cast(owner->ast_context())->condition(); |
2010 // The AstContext constructor pushed on the context stack. This newed | 2011 // The AstContext constructor pushed on the context stack. This newed |
2011 // instance is the reason that AstContext can't be BASE_EMBEDDED. | 2012 // instance is the reason that AstContext can't be BASE_EMBEDDED. |
2012 test_context_ = new TestContext(owner, if_true, if_false); | 2013 test_context_ = new TestContext(owner, cond, if_true, if_false); |
2013 } else { | 2014 } else { |
2014 function_return_ = owner->graph()->CreateBasicBlock(); | 2015 function_return_ = owner->graph()->CreateBasicBlock(); |
2015 function_return()->MarkAsInlineReturnTarget(); | 2016 function_return()->MarkAsInlineReturnTarget(); |
2016 } | 2017 } |
2017 // Set this after possibly allocating a new TestContext above. | 2018 // Set this after possibly allocating a new TestContext above. |
2018 call_context_ = owner->ast_context(); | 2019 call_context_ = owner->ast_context(); |
2019 } | 2020 } |
2020 | 2021 |
2021 // Push on the state stack. | 2022 // Push on the state stack. |
2022 owner->set_function_state(this); | 2023 owner->set_function_state(this); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2172 ValueContext for_value(this, ARGUMENTS_NOT_ALLOWED); | 2173 ValueContext for_value(this, ARGUMENTS_NOT_ALLOWED); |
2173 for_value.set_for_typeof(true); | 2174 for_value.set_for_typeof(true); |
2174 Visit(expr); | 2175 Visit(expr); |
2175 } | 2176 } |
2176 | 2177 |
2177 | 2178 |
2178 | 2179 |
2179 void HGraphBuilder::VisitForControl(Expression* expr, | 2180 void HGraphBuilder::VisitForControl(Expression* expr, |
2180 HBasicBlock* true_block, | 2181 HBasicBlock* true_block, |
2181 HBasicBlock* false_block) { | 2182 HBasicBlock* false_block) { |
2182 TestContext for_test(this, true_block, false_block); | 2183 TestContext for_test(this, expr, true_block, false_block); |
2183 Visit(expr); | 2184 Visit(expr); |
2184 } | 2185 } |
2185 | 2186 |
2186 | 2187 |
2187 void HGraphBuilder::VisitArgument(Expression* expr) { | 2188 void HGraphBuilder::VisitArgument(Expression* expr) { |
2188 CHECK_ALIVE(VisitForValue(expr)); | 2189 CHECK_ALIVE(VisitForValue(expr)); |
2189 Push(AddInstruction(new(zone()) HPushArgument(Pop()))); | 2190 Push(AddInstruction(new(zone()) HPushArgument(Pop()))); |
2190 } | 2191 } |
2191 | 2192 |
2192 | 2193 |
(...skipping 4208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6401 } | 6402 } |
6402 } | 6403 } |
6403 | 6404 |
6404 #ifdef DEBUG | 6405 #ifdef DEBUG |
6405 if (graph_ != NULL) graph_->Verify(); | 6406 if (graph_ != NULL) graph_->Verify(); |
6406 if (allocator_ != NULL) allocator_->Verify(); | 6407 if (allocator_ != NULL) allocator_->Verify(); |
6407 #endif | 6408 #endif |
6408 } | 6409 } |
6409 | 6410 |
6410 } } // namespace v8::internal | 6411 } } // namespace v8::internal |
OLD | NEW |