Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(868)

Side by Side Diff: src/hydrogen.cc

Issue 9537004: Improve constructor inlining backout. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5870 matching lines...) Expand 10 before | Expand all | Expand 10 after
5881 5881
5882 if (FLAG_inline_construct && 5882 if (FLAG_inline_construct &&
5883 expr->IsMonomorphic() && 5883 expr->IsMonomorphic() &&
5884 IsAllocationInlineable(expr->target())) { 5884 IsAllocationInlineable(expr->target())) {
5885 // The constructor function is on the stack in the unoptimized code 5885 // The constructor function is on the stack in the unoptimized code
5886 // during evaluation of the arguments. 5886 // during evaluation of the arguments.
5887 CHECK_ALIVE(VisitForValue(expr->expression())); 5887 CHECK_ALIVE(VisitForValue(expr->expression()));
5888 HValue* function = Top(); 5888 HValue* function = Top();
5889 CHECK_ALIVE(VisitExpressions(expr->arguments())); 5889 CHECK_ALIVE(VisitExpressions(expr->arguments()));
5890 Handle<JSFunction> constructor = expr->target(); 5890 Handle<JSFunction> constructor = expr->target();
5891 AddInstruction(new(zone()) HCheckFunction(function, constructor)); 5891 HValue* check = AddInstruction(
5892 new(zone()) HCheckFunction(function, constructor));
5892 5893
5893 // Replace the constructor function with a newly allocated receiver. 5894 // Replace the constructor function with a newly allocated receiver.
5894 HInstruction* receiver = new(zone()) HAllocateObject(context, constructor); 5895 HInstruction* receiver = new(zone()) HAllocateObject(context, constructor);
5895 // Index of the receiver from the top of the expression stack. 5896 // Index of the receiver from the top of the expression stack.
5896 const int receiver_index = argument_count - 1; 5897 const int receiver_index = argument_count - 1;
5897 AddInstruction(receiver); 5898 AddInstruction(receiver);
5898 ASSERT(environment()->ExpressionStackAt(receiver_index) == function); 5899 ASSERT(environment()->ExpressionStackAt(receiver_index) == function);
5899 environment()->SetExpressionStackAt(receiver_index, receiver); 5900 environment()->SetExpressionStackAt(receiver_index, receiver);
5900 5901
5901 if (TryInlineConstruct(expr, receiver)) return; 5902 if (TryInlineConstruct(expr, receiver)) return;
5902 5903
5903 // TODO(mstarzinger): For now we remove the previous HAllocateObject and 5904 // TODO(mstarzinger): For now we remove the previous HAllocateObject and
5904 // add HPushArgument for the arguments in case inlining failed. What we 5905 // add HPushArgument for the arguments in case inlining failed. What we
5905 // actually should do is emit HInvokeFunction on the constructor instead 5906 // actually should do is emit HInvokeFunction on the constructor instead
5906 // of using HCallNew as a fallback. 5907 // of using HCallNew as a fallback.
5907 receiver->DeleteAndReplaceWith(NULL); 5908 receiver->DeleteAndReplaceWith(NULL);
5909 check->DeleteAndReplaceWith(NULL);
5908 environment()->SetExpressionStackAt(receiver_index, function); 5910 environment()->SetExpressionStackAt(receiver_index, function);
5909 HInstruction* call = PreProcessCall( 5911 HInstruction* call = PreProcessCall(
5910 new(zone()) HCallNew(context, function, argument_count)); 5912 new(zone()) HCallNew(context, function, argument_count));
5911 call->set_position(expr->position()); 5913 call->set_position(expr->position());
5912 return ast_context()->ReturnInstruction(call, expr->id()); 5914 return ast_context()->ReturnInstruction(call, expr->id());
5913 } else { 5915 } else {
5914 // The constructor function is both an operand to the instruction and an 5916 // The constructor function is both an operand to the instruction and an
5915 // argument to the construct call. 5917 // argument to the construct call.
5916 HValue* constructor = NULL; 5918 HValue* constructor = NULL;
5917 CHECK_ALIVE(constructor = VisitArgument(expr->expression())); 5919 CHECK_ALIVE(constructor = VisitArgument(expr->expression()));
(...skipping 2101 matching lines...) Expand 10 before | Expand all | Expand 10 after
8019 } 8021 }
8020 } 8022 }
8021 8023
8022 #ifdef DEBUG 8024 #ifdef DEBUG
8023 if (graph_ != NULL) graph_->Verify(false); // No full verify. 8025 if (graph_ != NULL) graph_->Verify(false); // No full verify.
8024 if (allocator_ != NULL) allocator_->Verify(); 8026 if (allocator_ != NULL) allocator_->Verify();
8025 #endif 8027 #endif
8026 } 8028 }
8027 8029
8028 } } // namespace v8::internal 8030 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698