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 3943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3954 HCompareMap* compare = | 3954 HCompareMap* compare = |
3955 new(zone()) HCompareMap(receiver, map, if_true, if_false); | 3955 new(zone()) HCompareMap(receiver, map, if_true, if_false); |
3956 current_block()->Finish(compare); | 3956 current_block()->Finish(compare); |
3957 | 3957 |
3958 set_current_block(if_true); | 3958 set_current_block(if_true); |
3959 AddCheckConstantFunction(expr, receiver, map, false); | 3959 AddCheckConstantFunction(expr, receiver, map, false); |
3960 if (FLAG_trace_inlining && FLAG_polymorphic_inlining) { | 3960 if (FLAG_trace_inlining && FLAG_polymorphic_inlining) { |
3961 PrintF("Trying to inline the polymorphic call to %s\n", | 3961 PrintF("Trying to inline the polymorphic call to %s\n", |
3962 *name->ToCString()); | 3962 *name->ToCString()); |
3963 } | 3963 } |
3964 if (!FLAG_polymorphic_inlining || !TryInline(expr)) { | 3964 if (FLAG_polymorphic_inlining && TryInline(expr)) { |
| 3965 // Trying to inline will signal that we should bailout from the |
| 3966 // entire compilation by setting stack overflow on the visitor. |
| 3967 if (HasStackOverflow()) return; |
| 3968 } else { |
3965 HCallConstantFunction* call = | 3969 HCallConstantFunction* call = |
3966 new(zone()) HCallConstantFunction(expr->target(), argument_count); | 3970 new(zone()) HCallConstantFunction(expr->target(), argument_count); |
3967 call->set_position(expr->position()); | 3971 call->set_position(expr->position()); |
3968 PreProcessCall(call); | 3972 PreProcessCall(call); |
3969 AddInstruction(call); | 3973 AddInstruction(call); |
3970 if (!ast_context()->IsEffect()) Push(call); | 3974 if (!ast_context()->IsEffect()) Push(call); |
3971 } | 3975 } |
3972 | 3976 |
3973 if (current_block() != NULL) current_block()->Goto(join); | 3977 if (current_block() != NULL) current_block()->Goto(join); |
3974 set_current_block(if_false); | 3978 set_current_block(if_false); |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4507 // Replace the global object with the global receiver. | 4511 // Replace the global object with the global receiver. |
4508 HGlobalReceiver* global_receiver = | 4512 HGlobalReceiver* global_receiver = |
4509 new(zone()) HGlobalReceiver(global_object); | 4513 new(zone()) HGlobalReceiver(global_object); |
4510 // Index of the receiver from the top of the expression stack. | 4514 // Index of the receiver from the top of the expression stack. |
4511 const int receiver_index = argument_count - 1; | 4515 const int receiver_index = argument_count - 1; |
4512 AddInstruction(global_receiver); | 4516 AddInstruction(global_receiver); |
4513 ASSERT(environment()->ExpressionStackAt(receiver_index)-> | 4517 ASSERT(environment()->ExpressionStackAt(receiver_index)-> |
4514 IsGlobalObject()); | 4518 IsGlobalObject()); |
4515 environment()->SetExpressionStackAt(receiver_index, global_receiver); | 4519 environment()->SetExpressionStackAt(receiver_index, global_receiver); |
4516 | 4520 |
4517 if (TryInline(expr)) { | 4521 if (TryInline(expr)) return; |
4518 return; | |
4519 } | |
4520 call = PreProcessCall(new(zone()) HCallKnownGlobal(expr->target(), | 4522 call = PreProcessCall(new(zone()) HCallKnownGlobal(expr->target(), |
4521 argument_count)); | 4523 argument_count)); |
4522 } else { | 4524 } else { |
4523 HContext* context = new(zone()) HContext; | 4525 HContext* context = new(zone()) HContext; |
4524 AddInstruction(context); | 4526 AddInstruction(context); |
4525 PushAndAdd(new(zone()) HGlobalObject(context)); | 4527 PushAndAdd(new(zone()) HGlobalObject(context)); |
4526 CHECK_ALIVE(VisitExpressions(expr->arguments())); | 4528 CHECK_ALIVE(VisitExpressions(expr->arguments())); |
4527 | 4529 |
4528 call = PreProcessCall(new(zone()) HCallGlobal(context, | 4530 call = PreProcessCall(new(zone()) HCallGlobal(context, |
4529 var->name(), | 4531 var->name(), |
(...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6124 } | 6126 } |
6125 } | 6127 } |
6126 | 6128 |
6127 #ifdef DEBUG | 6129 #ifdef DEBUG |
6128 if (graph_ != NULL) graph_->Verify(); | 6130 if (graph_ != NULL) graph_->Verify(); |
6129 if (allocator_ != NULL) allocator_->Verify(); | 6131 if (allocator_ != NULL) allocator_->Verify(); |
6130 #endif | 6132 #endif |
6131 } | 6133 } |
6132 | 6134 |
6133 } } // namespace v8::internal | 6135 } } // namespace v8::internal |
OLD | NEW |