| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 2711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2722 | 2722 |
| 2723 void TestContext::BuildBranch(HValue* value) { | 2723 void TestContext::BuildBranch(HValue* value) { |
| 2724 // We expect the graph to be in edge-split form: there is no edge that | 2724 // We expect the graph to be in edge-split form: there is no edge that |
| 2725 // connects a branch node to a join node. We conservatively ensure that | 2725 // connects a branch node to a join node. We conservatively ensure that |
| 2726 // property by always adding an empty block on the outgoing edges of this | 2726 // property by always adding an empty block on the outgoing edges of this |
| 2727 // branch. | 2727 // branch. |
| 2728 HOptimizedGraphBuilder* builder = owner(); | 2728 HOptimizedGraphBuilder* builder = owner(); |
| 2729 if (value != NULL && value->CheckFlag(HValue::kIsArguments)) { | 2729 if (value != NULL && value->CheckFlag(HValue::kIsArguments)) { |
| 2730 builder->Bailout(kArgumentsObjectValueInATestContext); | 2730 builder->Bailout(kArgumentsObjectValueInATestContext); |
| 2731 } | 2731 } |
| 2732 if (value->IsConstant()) { | |
| 2733 HConstant* constant_value = HConstant::cast(value); | |
| 2734 if (constant_value->BooleanValue()) { | |
| 2735 builder->current_block()->Goto(if_true(), builder->function_state()); | |
| 2736 } else { | |
| 2737 builder->current_block()->Goto(if_false(), builder->function_state()); | |
| 2738 } | |
| 2739 builder->set_current_block(NULL); | |
| 2740 return; | |
| 2741 } | |
| 2742 HBasicBlock* empty_true = builder->graph()->CreateBasicBlock(); | 2732 HBasicBlock* empty_true = builder->graph()->CreateBasicBlock(); |
| 2743 HBasicBlock* empty_false = builder->graph()->CreateBasicBlock(); | 2733 HBasicBlock* empty_false = builder->graph()->CreateBasicBlock(); |
| 2744 ToBooleanStub::Types expected(condition()->to_boolean_types()); | 2734 ToBooleanStub::Types expected(condition()->to_boolean_types()); |
| 2745 HBranch* test = new(zone()) HBranch(value, expected, empty_true, empty_false); | 2735 HBranch* test = new(zone()) HBranch(value, expected, empty_true, empty_false); |
| 2746 builder->current_block()->Finish(test); | 2736 builder->current_block()->Finish(test); |
| 2747 | 2737 |
| 2748 empty_true->Goto(if_true(), builder->function_state()); | 2738 empty_true->Goto(if_true(), builder->function_state()); |
| 2749 empty_false->Goto(if_false(), builder->function_state()); | 2739 empty_false->Goto(if_false(), builder->function_state()); |
| 2750 builder->set_current_block(NULL); | 2740 builder->set_current_block(NULL); |
| 2751 } | 2741 } |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3076 } | 3066 } |
| 3077 | 3067 |
| 3078 environment()->Bind(scope->arguments(), | 3068 environment()->Bind(scope->arguments(), |
| 3079 graph()->GetArgumentsObject()); | 3069 graph()->GetArgumentsObject()); |
| 3080 } | 3070 } |
| 3081 } | 3071 } |
| 3082 | 3072 |
| 3083 | 3073 |
| 3084 void HOptimizedGraphBuilder::VisitStatements(ZoneList<Statement*>* statements) { | 3074 void HOptimizedGraphBuilder::VisitStatements(ZoneList<Statement*>* statements) { |
| 3085 for (int i = 0; i < statements->length(); i++) { | 3075 for (int i = 0; i < statements->length(); i++) { |
| 3086 CHECK_ALIVE(Visit(statements->at(i))); | 3076 Statement* stmt = statements->at(i); |
| 3077 CHECK_ALIVE(Visit(stmt)); |
| 3078 if (stmt->IsJump()) break; |
| 3087 } | 3079 } |
| 3088 } | 3080 } |
| 3089 | 3081 |
| 3090 | 3082 |
| 3091 void HOptimizedGraphBuilder::VisitBlock(Block* stmt) { | 3083 void HOptimizedGraphBuilder::VisitBlock(Block* stmt) { |
| 3092 ASSERT(!HasStackOverflow()); | 3084 ASSERT(!HasStackOverflow()); |
| 3093 ASSERT(current_block() != NULL); | 3085 ASSERT(current_block() != NULL); |
| 3094 ASSERT(current_block()->HasPredecessor()); | 3086 ASSERT(current_block()->HasPredecessor()); |
| 3095 if (stmt->scope() != NULL) { | 3087 if (stmt->scope() != NULL) { |
| 3096 return Bailout(kScopedBlock); | 3088 return Bailout(kScopedBlock); |
| (...skipping 2261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5358 // We don't optimize functions with invalid left-hand sides in | 5350 // We don't optimize functions with invalid left-hand sides in |
| 5359 // assignments, count operations, or for-in. Consequently throw can | 5351 // assignments, count operations, or for-in. Consequently throw can |
| 5360 // currently only occur in an effect context. | 5352 // currently only occur in an effect context. |
| 5361 ASSERT(ast_context()->IsEffect()); | 5353 ASSERT(ast_context()->IsEffect()); |
| 5362 CHECK_ALIVE(VisitForValue(expr->exception())); | 5354 CHECK_ALIVE(VisitForValue(expr->exception())); |
| 5363 | 5355 |
| 5364 HValue* value = environment()->Pop(); | 5356 HValue* value = environment()->Pop(); |
| 5365 HThrow* instr = Add<HThrow>(value); | 5357 HThrow* instr = Add<HThrow>(value); |
| 5366 instr->set_position(expr->position()); | 5358 instr->set_position(expr->position()); |
| 5367 Add<HSimulate>(expr->id()); | 5359 Add<HSimulate>(expr->id()); |
| 5368 current_block()->FinishExit(new(zone()) HAbnormalExit); | |
| 5369 set_current_block(NULL); | |
| 5370 } | 5360 } |
| 5371 | 5361 |
| 5372 | 5362 |
| 5373 HLoadNamedField* HGraphBuilder::BuildLoadNamedField(HValue* object, | 5363 HLoadNamedField* HGraphBuilder::BuildLoadNamedField(HValue* object, |
| 5374 HObjectAccess access, | 5364 HObjectAccess access, |
| 5375 HValue* typecheck) { | 5365 HValue* typecheck) { |
| 5376 if (FLAG_track_double_fields && access.representation().IsDouble()) { | 5366 if (FLAG_track_double_fields && access.representation().IsDouble()) { |
| 5377 // load the heap number | 5367 // load the heap number |
| 5378 HLoadNamedField* heap_number = Add<HLoadNamedField>( | 5368 HLoadNamedField* heap_number = Add<HLoadNamedField>( |
| 5379 object, access.WithRepresentation(Representation::Tagged())); | 5369 object, access.WithRepresentation(Representation::Tagged())); |
| (...skipping 4473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9853 if (ShouldProduceTraceOutput()) { | 9843 if (ShouldProduceTraceOutput()) { |
| 9854 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9844 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 9855 } | 9845 } |
| 9856 | 9846 |
| 9857 #ifdef DEBUG | 9847 #ifdef DEBUG |
| 9858 graph_->Verify(false); // No full verify. | 9848 graph_->Verify(false); // No full verify. |
| 9859 #endif | 9849 #endif |
| 9860 } | 9850 } |
| 9861 | 9851 |
| 9862 } } // namespace v8::internal | 9852 } } // namespace v8::internal |
| OLD | NEW |