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(), |
danno
2013/06/25 15:56:59
nit: fit on one line, it makes one line fewer in t
mvstanton
2013/06/27 08:51:02
Done.
| |
8884 isolate()); | 8884 isolate()); |
danno
2013/06/25 15:56:59
nit: fit on one line, it makes one line fewer in t
mvstanton
2013/06/27 08:51:02
Done.
| |
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())); | 8885 CHECK_ALIVE(VisitArgument(expr->expression())); |
8889 HValue* constructor = HPushArgument::cast(Top())->argument(); | 8886 HValue* constructor = HPushArgument::cast(Top())->argument(); |
8890 CHECK_ALIVE(VisitArgumentList(expr->arguments())); | 8887 CHECK_ALIVE(VisitArgumentList(expr->arguments())); |
8891 HCallNew* call; | 8888 HCallNew* call; |
8892 if (use_call_new_array) { | 8889 if (expr->target().is_identical_to(array_function)) { |
8893 Handle<Cell> cell = expr->allocation_info_cell(); | 8890 Handle<Cell> cell = expr->allocation_info_cell(); |
8894 AddInstruction(new(zone()) HCheckFunction(constructor, array_function)); | 8891 AddInstruction(new(zone()) HCheckFunction(constructor, array_function)); |
8895 call = new(zone()) HCallNewArray(context, constructor, argument_count, | 8892 call = new(zone()) HCallNewArray(context, constructor, argument_count, |
8896 cell); | 8893 cell); |
8897 } else { | 8894 } else { |
8898 call = new(zone()) HCallNew(context, constructor, argument_count); | 8895 call = new(zone()) HCallNew(context, constructor, argument_count); |
8899 } | 8896 } |
8900 Drop(argument_count); | 8897 Drop(argument_count); |
8901 call->set_position(expr->position()); | 8898 call->set_position(expr->position()); |
8902 return ast_context()->ReturnInstruction(call, expr->id()); | 8899 return ast_context()->ReturnInstruction(call, expr->id()); |
(...skipping 2655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11558 if (ShouldProduceTraceOutput()) { | 11555 if (ShouldProduceTraceOutput()) { |
11559 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11556 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
11560 } | 11557 } |
11561 | 11558 |
11562 #ifdef DEBUG | 11559 #ifdef DEBUG |
11563 graph_->Verify(false); // No full verify. | 11560 graph_->Verify(false); // No full verify. |
11564 #endif | 11561 #endif |
11565 } | 11562 } |
11566 | 11563 |
11567 } } // namespace v8::internal | 11564 } } // namespace v8::internal |
OLD | NEW |