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 8861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8872 receiver->DeleteAndReplaceWith(NULL); | 8872 receiver->DeleteAndReplaceWith(NULL); |
8873 check->DeleteAndReplaceWith(NULL); | 8873 check->DeleteAndReplaceWith(NULL); |
8874 environment()->SetExpressionStackAt(receiver_index, function); | 8874 environment()->SetExpressionStackAt(receiver_index, function); |
8875 HInstruction* call = PreProcessCall( | 8875 HInstruction* call = PreProcessCall( |
8876 new(zone()) HCallNew(context, function, argument_count)); | 8876 new(zone()) HCallNew(context, function, argument_count)); |
8877 call->set_position(expr->position()); | 8877 call->set_position(expr->position()); |
8878 return ast_context()->ReturnInstruction(call, expr->id()); | 8878 return ast_context()->ReturnInstruction(call, expr->id()); |
8879 } else { | 8879 } else { |
8880 // The constructor function is both an operand to the instruction and an | 8880 // The constructor function is both an operand to the instruction and an |
8881 // argument to the construct call. | 8881 // argument to the construct call. |
8882 Handle<JSFunction> array_function = | 8882 Handle<JSFunction> array_function( |
8883 Handle<JSFunction>(isolate()->global_context()->array_function(), | 8883 isolate()->global_context()->array_function(), isolate()); |
8884 isolate()); | |
8885 bool use_call_new_array = FLAG_optimize_constructed_arrays && | |
8886 expr->target().is_identical_to(array_function); | |
8887 | |
8888 CHECK_ALIVE(VisitArgument(expr->expression())); | 8884 CHECK_ALIVE(VisitArgument(expr->expression())); |
8889 HValue* constructor = HPushArgument::cast(Top())->argument(); | 8885 HValue* constructor = HPushArgument::cast(Top())->argument(); |
8890 CHECK_ALIVE(VisitArgumentList(expr->arguments())); | 8886 CHECK_ALIVE(VisitArgumentList(expr->arguments())); |
8891 HCallNew* call; | 8887 HCallNew* call; |
8892 if (use_call_new_array) { | 8888 if (expr->target().is_identical_to(array_function)) { |
8893 Handle<Cell> cell = expr->allocation_info_cell(); | 8889 Handle<Cell> cell = expr->allocation_info_cell(); |
8894 AddInstruction(new(zone()) HCheckFunction(constructor, array_function)); | 8890 AddInstruction(new(zone()) HCheckFunction(constructor, array_function)); |
8895 call = new(zone()) HCallNewArray(context, constructor, argument_count, | 8891 call = new(zone()) HCallNewArray(context, constructor, argument_count, |
8896 cell); | 8892 cell); |
8897 } else { | 8893 } else { |
8898 call = new(zone()) HCallNew(context, constructor, argument_count); | 8894 call = new(zone()) HCallNew(context, constructor, argument_count); |
8899 } | 8895 } |
8900 Drop(argument_count); | 8896 Drop(argument_count); |
8901 call->set_position(expr->position()); | 8897 call->set_position(expr->position()); |
8902 return ast_context()->ReturnInstruction(call, expr->id()); | 8898 return ast_context()->ReturnInstruction(call, expr->id()); |
(...skipping 2655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11558 if (ShouldProduceTraceOutput()) { | 11554 if (ShouldProduceTraceOutput()) { |
11559 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11555 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
11560 } | 11556 } |
11561 | 11557 |
11562 #ifdef DEBUG | 11558 #ifdef DEBUG |
11563 graph_->Verify(false); // No full verify. | 11559 graph_->Verify(false); // No full verify. |
11564 #endif | 11560 #endif |
11565 } | 11561 } |
11566 | 11562 |
11567 } } // namespace v8::internal | 11563 } } // namespace v8::internal |
OLD | NEW |