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

Side by Side Diff: src/hydrogen.cc

Issue 19493005: Avoid adding HWrapReceiver during graph building. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | 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 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 return header; 1036 return header;
1037 } 1037 }
1038 1038
1039 1039
1040 HValue* HGraphBuilder::BuildCheckHeapObject(HValue* obj) { 1040 HValue* HGraphBuilder::BuildCheckHeapObject(HValue* obj) {
1041 if (obj->type().IsHeapObject()) return obj; 1041 if (obj->type().IsHeapObject()) return obj;
1042 return Add<HCheckHeapObject>(obj); 1042 return Add<HCheckHeapObject>(obj);
1043 } 1043 }
1044 1044
1045 1045
1046 HValue* HGraphBuilder::BuildCheckMap(HValue* obj, 1046 HValue* HGraphBuilder::BuildCheckMap(HValue* obj, Handle<Map> map) {
1047 Handle<Map> map) {
1048 HCheckMaps* check = HCheckMaps::New(obj, map, zone()); 1047 HCheckMaps* check = HCheckMaps::New(obj, map, zone());
1049 AddInstruction(check); 1048 AddInstruction(check);
1050 return check; 1049 return check;
1051 } 1050 }
1052 1051
1053 1052
1053 HValue* HGraphBuilder::BuildWrapReceiver(HValue* object, HValue* function) {
1054 if (object->type().IsJSObject()) return object;
1055 return Add<HWrapReceiver>(object, function);
1056 }
1057
1058
1054 HValue* HGraphBuilder::BuildCheckForCapacityGrow(HValue* object, 1059 HValue* HGraphBuilder::BuildCheckForCapacityGrow(HValue* object,
1055 HValue* elements, 1060 HValue* elements,
1056 ElementsKind kind, 1061 ElementsKind kind,
1057 HValue* length, 1062 HValue* length,
1058 HValue* key, 1063 HValue* key,
1059 bool is_js_array) { 1064 bool is_js_array) {
1060 Zone* zone = this->zone(); 1065 Zone* zone = this->zone();
1061 IfBuilder length_checker(this); 1066 IfBuilder length_checker(this);
1062 1067
1063 Token::Value token = IsHoleyElementsKind(kind) ? Token::GTE : Token::EQ; 1068 Token::Value token = IsHoleyElementsKind(kind) ? Token::GTE : Token::EQ;
(...skipping 5810 matching lines...) Expand 10 before | Expand all | Expand 10 after
6874 AddCheckConstantFunction(expr->holder(), function, function_map); 6879 AddCheckConstantFunction(expr->holder(), function, function_map);
6875 Drop(1); 6880 Drop(1);
6876 6881
6877 VisitForValue(args->at(0)); 6882 VisitForValue(args->at(0));
6878 if (HasStackOverflow() || current_block() == NULL) return true; 6883 if (HasStackOverflow() || current_block() == NULL) return true;
6879 HValue* receiver = Pop(); 6884 HValue* receiver = Pop();
6880 6885
6881 if (function_state()->outer() == NULL) { 6886 if (function_state()->outer() == NULL) {
6882 HInstruction* elements = Add<HArgumentsElements>(false); 6887 HInstruction* elements = Add<HArgumentsElements>(false);
6883 HInstruction* length = Add<HArgumentsLength>(elements); 6888 HInstruction* length = Add<HArgumentsLength>(elements);
6884 HValue* wrapped_receiver = Add<HWrapReceiver>(receiver, function); 6889 HValue* wrapped_receiver = BuildWrapReceiver(receiver, function);
6885 HInstruction* result = 6890 HInstruction* result =
6886 new(zone()) HApplyArguments(function, 6891 new(zone()) HApplyArguments(function,
6887 wrapped_receiver, 6892 wrapped_receiver,
6888 length, 6893 length,
6889 elements); 6894 elements);
6890 result->set_position(expr->position()); 6895 result->set_position(expr->position());
6891 ast_context()->ReturnInstruction(result, expr->id()); 6896 ast_context()->ReturnInstruction(result, expr->id());
6892 return true; 6897 return true;
6893 } else { 6898 } else {
6894 // We are inside inlined function and we know exactly what is inside 6899 // We are inside inlined function and we know exactly what is inside
6895 // arguments object. But we need to be able to materialize at deopt. 6900 // arguments object. But we need to be able to materialize at deopt.
6896 ASSERT_EQ(environment()->arguments_environment()->parameter_count(), 6901 ASSERT_EQ(environment()->arguments_environment()->parameter_count(),
6897 function_state()->entry()->arguments_object()->arguments_count()); 6902 function_state()->entry()->arguments_object()->arguments_count());
6898 HArgumentsObject* args = function_state()->entry()->arguments_object(); 6903 HArgumentsObject* args = function_state()->entry()->arguments_object();
6899 const ZoneList<HValue*>* arguments_values = args->arguments_values(); 6904 const ZoneList<HValue*>* arguments_values = args->arguments_values();
6900 int arguments_count = arguments_values->length(); 6905 int arguments_count = arguments_values->length();
6901 PushAndAdd(new(zone()) HWrapReceiver(receiver, function)); 6906 Push(BuildWrapReceiver(receiver, function));
6902 for (int i = 1; i < arguments_count; i++) { 6907 for (int i = 1; i < arguments_count; i++) {
6903 Push(arguments_values->at(i)); 6908 Push(arguments_values->at(i));
6904 } 6909 }
6905 6910
6906 Handle<JSFunction> known_function; 6911 Handle<JSFunction> known_function;
6907 if (function->IsConstant()) { 6912 if (function->IsConstant()) {
6908 HConstant* constant_function = HConstant::cast(function); 6913 HConstant* constant_function = HConstant::cast(function);
6909 known_function = Handle<JSFunction>::cast(constant_function->handle()); 6914 known_function = Handle<JSFunction>::cast(constant_function->handle());
6910 int args_count = arguments_count - 1; // Excluding receiver. 6915 int args_count = arguments_count - 1; // Excluding receiver.
6911 if (TryInlineApply(known_function, expr, args_count)) return true; 6916 if (TryInlineApply(known_function, expr, args_count)) return true;
(...skipping 2992 matching lines...) Expand 10 before | Expand all | Expand 10 after
9904 if (ShouldProduceTraceOutput()) { 9909 if (ShouldProduceTraceOutput()) {
9905 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 9910 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
9906 } 9911 }
9907 9912
9908 #ifdef DEBUG 9913 #ifdef DEBUG
9909 graph_->Verify(false); // No full verify. 9914 graph_->Verify(false); // No full verify.
9910 #endif 9915 #endif
9911 } 9916 }
9912 9917
9913 } } // namespace v8::internal 9918 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698