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

Side by Side Diff: src/hydrogen.cc

Issue 95583002: Follow-up fix for r18135 in TryCallApply. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 7542 matching lines...) Expand 10 before | Expand all | Expand 10 after
7553 if (args->length() != 2) return false; 7553 if (args->length() != 2) return false;
7554 7554
7555 VariableProxy* arg_two = args->at(1)->AsVariableProxy(); 7555 VariableProxy* arg_two = args->at(1)->AsVariableProxy();
7556 if (arg_two == NULL || !arg_two->var()->IsStackAllocated()) return false; 7556 if (arg_two == NULL || !arg_two->var()->IsStackAllocated()) return false;
7557 HValue* arg_two_value = LookupAndMakeLive(arg_two->var()); 7557 HValue* arg_two_value = LookupAndMakeLive(arg_two->var());
7558 if (!arg_two_value->CheckFlag(HValue::kIsArguments)) return false; 7558 if (!arg_two_value->CheckFlag(HValue::kIsArguments)) return false;
7559 7559
7560 // Found pattern f.apply(receiver, arguments). 7560 // Found pattern f.apply(receiver, arguments).
7561 CHECK_ALIVE_OR_RETURN(VisitForValue(prop->obj()), true); 7561 CHECK_ALIVE_OR_RETURN(VisitForValue(prop->obj()), true);
7562 HValue* function = Top(); 7562 HValue* function = Top();
7563 // The function get here may be an undefined constant if lookup fails.
7564 if (function->IsConstant() &&
7565 !HConstant::cast(function)->handle(isolate())->IsJSFunction()) {
7566 Drop(1);
7567 return false;
7568 }
7569 7563
7570 AddCheckConstantFunction(expr->holder(), function, function_map); 7564 AddCheckConstantFunction(expr->holder(), function, function_map);
7571 Drop(1); 7565 Drop(1);
7572 7566
7573 CHECK_ALIVE_OR_RETURN(VisitForValue(args->at(0)), true); 7567 CHECK_ALIVE_OR_RETURN(VisitForValue(args->at(0)), true);
7574 HValue* receiver = Pop(); 7568 HValue* receiver = Pop();
7575 7569
7576 if (function_state()->outer() == NULL) { 7570 if (function_state()->outer() == NULL) {
7577 HInstruction* elements = Add<HArgumentsElements>(false); 7571 HInstruction* elements = Add<HArgumentsElements>(false);
7578 HInstruction* length = Add<HArgumentsLength>(elements); 7572 HInstruction* length = Add<HArgumentsLength>(elements);
(...skipping 11 matching lines...) Expand all
7590 function_state()->entry()->arguments_object()->arguments_count()); 7584 function_state()->entry()->arguments_object()->arguments_count());
7591 HArgumentsObject* args = function_state()->entry()->arguments_object(); 7585 HArgumentsObject* args = function_state()->entry()->arguments_object();
7592 const ZoneList<HValue*>* arguments_values = args->arguments_values(); 7586 const ZoneList<HValue*>* arguments_values = args->arguments_values();
7593 int arguments_count = arguments_values->length(); 7587 int arguments_count = arguments_values->length();
7594 Push(BuildWrapReceiver(receiver, function)); 7588 Push(BuildWrapReceiver(receiver, function));
7595 for (int i = 1; i < arguments_count; i++) { 7589 for (int i = 1; i < arguments_count; i++) {
7596 Push(arguments_values->at(i)); 7590 Push(arguments_values->at(i));
7597 } 7591 }
7598 7592
7599 Handle<JSFunction> known_function; 7593 Handle<JSFunction> known_function;
7600 if (function->IsConstant()) { 7594 if (function->IsConstant() &&
7601 HConstant* constant_function = HConstant::cast(function); 7595 HConstant::cast(function)->handle(isolate())->IsJSFunction()) {
7602 known_function = Handle<JSFunction>::cast( 7596 known_function = Handle<JSFunction>::cast(
7603 constant_function->handle(isolate())); 7597 HConstant::cast(function)->handle(isolate()));
7604 int args_count = arguments_count - 1; // Excluding receiver. 7598 int args_count = arguments_count - 1; // Excluding receiver.
7605 if (TryInlineApply(known_function, expr, args_count)) return true; 7599 if (TryInlineApply(known_function, expr, args_count)) return true;
7606 } 7600 }
7607 7601
7608 Drop(arguments_count - 1); 7602 Drop(arguments_count - 1);
7609 Push(Add<HPushArgument>(Pop())); 7603 Push(Add<HPushArgument>(Pop()));
7610 for (int i = 1; i < arguments_count; i++) { 7604 for (int i = 1; i < arguments_count; i++) {
7611 Push(Add<HPushArgument>(arguments_values->at(i))); 7605 Push(Add<HPushArgument>(arguments_values->at(i)));
7612 } 7606 }
7613 7607
(...skipping 3207 matching lines...) Expand 10 before | Expand all | Expand 10 after
10821 if (ShouldProduceTraceOutput()) { 10815 if (ShouldProduceTraceOutput()) {
10822 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 10816 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
10823 } 10817 }
10824 10818
10825 #ifdef DEBUG 10819 #ifdef DEBUG
10826 graph_->Verify(false); // No full verify. 10820 graph_->Verify(false); // No full verify.
10827 #endif 10821 #endif
10828 } 10822 }
10829 10823
10830 } } // namespace v8::internal 10824 } } // 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