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

Side by Side Diff: src/hydrogen.cc

Issue 10834247: Use the correct oracle in TestContext::BuildBranch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 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/hydrogen.h ('k') | no next file » | 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 2751 matching lines...) Expand 10 before | Expand all | Expand 10 after
2762 entry_(NULL), 2762 entry_(NULL),
2763 arguments_elements_(NULL), 2763 arguments_elements_(NULL),
2764 outer_(owner->function_state()) { 2764 outer_(owner->function_state()) {
2765 if (outer_ != NULL) { 2765 if (outer_ != NULL) {
2766 // State for an inline function. 2766 // State for an inline function.
2767 if (owner->ast_context()->IsTest()) { 2767 if (owner->ast_context()->IsTest()) {
2768 HBasicBlock* if_true = owner->graph()->CreateBasicBlock(); 2768 HBasicBlock* if_true = owner->graph()->CreateBasicBlock();
2769 HBasicBlock* if_false = owner->graph()->CreateBasicBlock(); 2769 HBasicBlock* if_false = owner->graph()->CreateBasicBlock();
2770 if_true->MarkAsInlineReturnTarget(); 2770 if_true->MarkAsInlineReturnTarget();
2771 if_false->MarkAsInlineReturnTarget(); 2771 if_false->MarkAsInlineReturnTarget();
2772 Expression* cond = TestContext::cast(owner->ast_context())->condition(); 2772 TestContext* outer_test_context = TestContext::cast(owner->ast_context());
2773 Expression* cond = outer_test_context->condition();
2774 TypeFeedbackOracle* outer_oracle = outer_test_context->oracle();
2773 // The AstContext constructor pushed on the context stack. This newed 2775 // The AstContext constructor pushed on the context stack. This newed
2774 // instance is the reason that AstContext can't be BASE_EMBEDDED. 2776 // instance is the reason that AstContext can't be BASE_EMBEDDED.
2775 test_context_ = new TestContext(owner, cond, if_true, if_false); 2777 test_context_ =
2778 new TestContext(owner, cond, outer_oracle, if_true, if_false);
2776 } else { 2779 } else {
2777 function_return_ = owner->graph()->CreateBasicBlock(); 2780 function_return_ = owner->graph()->CreateBasicBlock();
2778 function_return()->MarkAsInlineReturnTarget(); 2781 function_return()->MarkAsInlineReturnTarget();
2779 } 2782 }
2780 // Set this after possibly allocating a new TestContext above. 2783 // Set this after possibly allocating a new TestContext above.
2781 call_context_ = owner->ast_context(); 2784 call_context_ = owner->ast_context();
2782 } 2785 }
2783 2786
2784 // Push on the state stack. 2787 // Push on the state stack.
2785 owner->set_function_state(this); 2788 owner->set_function_state(this);
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
2932 // connects a branch node to a join node. We conservatively ensure that 2935 // connects a branch node to a join node. We conservatively ensure that
2933 // property by always adding an empty block on the outgoing edges of this 2936 // property by always adding an empty block on the outgoing edges of this
2934 // branch. 2937 // branch.
2935 HGraphBuilder* builder = owner(); 2938 HGraphBuilder* builder = owner();
2936 if (value != NULL && value->CheckFlag(HValue::kIsArguments)) { 2939 if (value != NULL && value->CheckFlag(HValue::kIsArguments)) {
2937 builder->Bailout("arguments object value in a test context"); 2940 builder->Bailout("arguments object value in a test context");
2938 } 2941 }
2939 HBasicBlock* empty_true = builder->graph()->CreateBasicBlock(); 2942 HBasicBlock* empty_true = builder->graph()->CreateBasicBlock();
2940 HBasicBlock* empty_false = builder->graph()->CreateBasicBlock(); 2943 HBasicBlock* empty_false = builder->graph()->CreateBasicBlock();
2941 TypeFeedbackId test_id = condition()->test_id(); 2944 TypeFeedbackId test_id = condition()->test_id();
2942 ToBooleanStub::Types expected(builder->oracle()->ToBooleanTypes(test_id)); 2945 ToBooleanStub::Types expected(oracle()->ToBooleanTypes(test_id));
2943 HBranch* test = new(zone()) HBranch(value, empty_true, empty_false, expected); 2946 HBranch* test = new(zone()) HBranch(value, empty_true, empty_false, expected);
2944 builder->current_block()->Finish(test); 2947 builder->current_block()->Finish(test);
2945 2948
2946 empty_true->Goto(if_true(), owner()->function_state()); 2949 empty_true->Goto(if_true(), owner()->function_state());
2947 empty_false->Goto(if_false(), owner()->function_state()); 2950 empty_false->Goto(if_false(), owner()->function_state());
2948 builder->set_current_block(NULL); 2951 builder->set_current_block(NULL);
2949 } 2952 }
2950 2953
2951 2954
2952 // HGraphBuilder infrastructure for bailing out and checking bailouts. 2955 // HGraphBuilder infrastructure for bailing out and checking bailouts.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2990 ValueContext for_value(this, ARGUMENTS_NOT_ALLOWED); 2993 ValueContext for_value(this, ARGUMENTS_NOT_ALLOWED);
2991 for_value.set_for_typeof(true); 2994 for_value.set_for_typeof(true);
2992 Visit(expr); 2995 Visit(expr);
2993 } 2996 }
2994 2997
2995 2998
2996 2999
2997 void HGraphBuilder::VisitForControl(Expression* expr, 3000 void HGraphBuilder::VisitForControl(Expression* expr,
2998 HBasicBlock* true_block, 3001 HBasicBlock* true_block,
2999 HBasicBlock* false_block) { 3002 HBasicBlock* false_block) {
3000 TestContext for_test(this, expr, true_block, false_block); 3003 TestContext for_test(this, expr, oracle(), true_block, false_block);
3001 Visit(expr); 3004 Visit(expr);
3002 } 3005 }
3003 3006
3004 3007
3005 void HGraphBuilder::VisitArgument(Expression* expr) { 3008 void HGraphBuilder::VisitArgument(Expression* expr) {
3006 CHECK_ALIVE(VisitForValue(expr)); 3009 CHECK_ALIVE(VisitForValue(expr));
3007 Push(AddInstruction(new(zone()) HPushArgument(Pop()))); 3010 Push(AddInstruction(new(zone()) HPushArgument(Pop())));
3008 } 3011 }
3009 3012
3010 3013
(...skipping 6612 matching lines...) Expand 10 before | Expand all | Expand 10 after
9623 } 9626 }
9624 } 9627 }
9625 9628
9626 #ifdef DEBUG 9629 #ifdef DEBUG
9627 if (graph_ != NULL) graph_->Verify(false); // No full verify. 9630 if (graph_ != NULL) graph_->Verify(false); // No full verify.
9628 if (allocator_ != NULL) allocator_->Verify(); 9631 if (allocator_ != NULL) allocator_->Verify();
9629 #endif 9632 #endif
9630 } 9633 }
9631 9634
9632 } } // namespace v8::internal 9635 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698