OLD | NEW |
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 2974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2985 | 2985 |
2986 | 2986 |
2987 void HGraphBuilder::VisitForControl(Expression* expr, | 2987 void HGraphBuilder::VisitForControl(Expression* expr, |
2988 HBasicBlock* true_block, | 2988 HBasicBlock* true_block, |
2989 HBasicBlock* false_block) { | 2989 HBasicBlock* false_block) { |
2990 TestContext for_test(this, expr, true_block, false_block); | 2990 TestContext for_test(this, expr, true_block, false_block); |
2991 Visit(expr); | 2991 Visit(expr); |
2992 } | 2992 } |
2993 | 2993 |
2994 | 2994 |
2995 HValue* HGraphBuilder::VisitArgument(Expression* expr) { | 2995 void HGraphBuilder::VisitArgument(Expression* expr) { |
2996 VisitForValue(expr); | 2996 CHECK_ALIVE(VisitForValue(expr)); |
2997 if (HasStackOverflow() || current_block() == NULL) return NULL; | 2997 Push(AddInstruction(new(zone()) HPushArgument(Pop()))); |
2998 HValue* value = Pop(); | |
2999 Push(AddInstruction(new(zone()) HPushArgument(value))); | |
3000 return value; | |
3001 } | 2998 } |
3002 | 2999 |
3003 | 3000 |
3004 void HGraphBuilder::VisitArgumentList(ZoneList<Expression*>* arguments) { | 3001 void HGraphBuilder::VisitArgumentList(ZoneList<Expression*>* arguments) { |
3005 for (int i = 0; i < arguments->length(); i++) { | 3002 for (int i = 0; i < arguments->length(); i++) { |
3006 CHECK_ALIVE(VisitArgument(arguments->at(i))); | 3003 CHECK_ALIVE(VisitArgument(arguments->at(i))); |
3007 } | 3004 } |
3008 } | 3005 } |
3009 | 3006 |
3010 | 3007 |
(...skipping 4432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7443 receiver->DeleteAndReplaceWith(NULL); | 7440 receiver->DeleteAndReplaceWith(NULL); |
7444 check->DeleteAndReplaceWith(NULL); | 7441 check->DeleteAndReplaceWith(NULL); |
7445 environment()->SetExpressionStackAt(receiver_index, function); | 7442 environment()->SetExpressionStackAt(receiver_index, function); |
7446 HInstruction* call = PreProcessCall( | 7443 HInstruction* call = PreProcessCall( |
7447 new(zone()) HCallNew(context, function, argument_count)); | 7444 new(zone()) HCallNew(context, function, argument_count)); |
7448 call->set_position(expr->position()); | 7445 call->set_position(expr->position()); |
7449 return ast_context()->ReturnInstruction(call, expr->id()); | 7446 return ast_context()->ReturnInstruction(call, expr->id()); |
7450 } else { | 7447 } else { |
7451 // The constructor function is both an operand to the instruction and an | 7448 // The constructor function is both an operand to the instruction and an |
7452 // argument to the construct call. | 7449 // argument to the construct call. |
7453 HValue* constructor = NULL; | 7450 CHECK_ALIVE(VisitArgument(expr->expression())); |
7454 CHECK_ALIVE(constructor = VisitArgument(expr->expression())); | 7451 HValue* constructor = HPushArgument::cast(Top())->argument(); |
7455 CHECK_ALIVE(VisitArgumentList(expr->arguments())); | 7452 CHECK_ALIVE(VisitArgumentList(expr->arguments())); |
7456 HInstruction* call = | 7453 HInstruction* call = |
7457 new(zone()) HCallNew(context, constructor, argument_count); | 7454 new(zone()) HCallNew(context, constructor, argument_count); |
7458 Drop(argument_count); | 7455 Drop(argument_count); |
7459 call->set_position(expr->position()); | 7456 call->set_position(expr->position()); |
7460 return ast_context()->ReturnInstruction(call, expr->id()); | 7457 return ast_context()->ReturnInstruction(call, expr->id()); |
7461 } | 7458 } |
7462 } | 7459 } |
7463 | 7460 |
7464 | 7461 |
(...skipping 2111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9576 } | 9573 } |
9577 } | 9574 } |
9578 | 9575 |
9579 #ifdef DEBUG | 9576 #ifdef DEBUG |
9580 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 9577 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
9581 if (allocator_ != NULL) allocator_->Verify(); | 9578 if (allocator_ != NULL) allocator_->Verify(); |
9582 #endif | 9579 #endif |
9583 } | 9580 } |
9584 | 9581 |
9585 } } // namespace v8::internal | 9582 } } // namespace v8::internal |
OLD | NEW |