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

Side by Side Diff: src/hydrogen.cc

Issue 155913002: inline api setters in crankshaft (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase Created 6 years, 10 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') | test/cctest/test-api.cc » ('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 5567 matching lines...) Expand 10 before | Expand all | Expand 10 after
5578 Push(value); 5578 Push(value);
5579 } 5579 }
5580 5580
5581 if (NeedsWrappingFor(info->type(), info->accessor())) { 5581 if (NeedsWrappingFor(info->type(), info->accessor())) {
5582 HValue* function = Add<HConstant>(info->accessor()); 5582 HValue* function = Add<HConstant>(info->accessor());
5583 PushArgumentsFromEnvironment(argument_count); 5583 PushArgumentsFromEnvironment(argument_count);
5584 return New<HCallFunction>(function, argument_count, WRAP_AND_CALL); 5584 return New<HCallFunction>(function, argument_count, WRAP_AND_CALL);
5585 } else if (FLAG_inline_accessors && can_inline_accessor) { 5585 } else if (FLAG_inline_accessors && can_inline_accessor) {
5586 bool success = info->IsLoad() 5586 bool success = info->IsLoad()
5587 ? TryInlineGetter(info->accessor(), info->map(), ast_id, return_id) 5587 ? TryInlineGetter(info->accessor(), info->map(), ast_id, return_id)
5588 : TryInlineSetter(info->accessor(), ast_id, return_id, value); 5588 : TryInlineSetter(
5589 info->accessor(), info->map(), ast_id, return_id, value);
5589 if (success) return NULL; 5590 if (success) return NULL;
5590 } 5591 }
5591 5592
5592 PushArgumentsFromEnvironment(argument_count); 5593 PushArgumentsFromEnvironment(argument_count);
5593 return BuildCallConstantFunction(info->accessor(), argument_count); 5594 return BuildCallConstantFunction(info->accessor(), argument_count);
5594 } 5595 }
5595 5596
5596 ASSERT(info->lookup()->IsConstant()); 5597 ASSERT(info->lookup()->IsConstant());
5597 if (info->IsLoad()) { 5598 if (info->IsLoad()) {
5598 return New<HConstant>(info->constant()); 5599 return New<HConstant>(info->constant());
(...skipping 1814 matching lines...) Expand 10 before | Expand all | Expand 10 after
7413 return TryInline(getter, 7414 return TryInline(getter,
7414 0, 7415 0,
7415 NULL, 7416 NULL,
7416 ast_id, 7417 ast_id,
7417 return_id, 7418 return_id,
7418 GETTER_CALL_RETURN); 7419 GETTER_CALL_RETURN);
7419 } 7420 }
7420 7421
7421 7422
7422 bool HOptimizedGraphBuilder::TryInlineSetter(Handle<JSFunction> setter, 7423 bool HOptimizedGraphBuilder::TryInlineSetter(Handle<JSFunction> setter,
7424 Handle<Map> receiver_map,
7423 BailoutId id, 7425 BailoutId id,
7424 BailoutId assignment_id, 7426 BailoutId assignment_id,
7425 HValue* implicit_return_value) { 7427 HValue* implicit_return_value) {
7428 if (TryInlineApiSetter(setter, receiver_map, id)) return true;
7426 return TryInline(setter, 7429 return TryInline(setter,
7427 1, 7430 1,
7428 implicit_return_value, 7431 implicit_return_value,
7429 id, assignment_id, 7432 id, assignment_id,
7430 SETTER_CALL_RETURN); 7433 SETTER_CALL_RETURN);
7431 } 7434 }
7432 7435
7433 7436
7434 bool HOptimizedGraphBuilder::TryInlineApply(Handle<JSFunction> function, 7437 bool HOptimizedGraphBuilder::TryInlineApply(Handle<JSFunction> function,
7435 Call* expr, 7438 Call* expr,
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
7726 receiver_maps.Add(receiver_map, zone()); 7729 receiver_maps.Add(receiver_map, zone());
7727 return TryInlineApiCall(function, 7730 return TryInlineApiCall(function,
7728 NULL, // Receiver is on expression stack. 7731 NULL, // Receiver is on expression stack.
7729 &receiver_maps, 7732 &receiver_maps,
7730 0, 7733 0,
7731 ast_id, 7734 ast_id,
7732 kCallApiGetter); 7735 kCallApiGetter);
7733 } 7736 }
7734 7737
7735 7738
7739 bool HOptimizedGraphBuilder::TryInlineApiSetter(Handle<JSFunction> function,
7740 Handle<Map> receiver_map,
7741 BailoutId ast_id) {
7742 SmallMapList receiver_maps(1, zone());
7743 receiver_maps.Add(receiver_map, zone());
7744 return TryInlineApiCall(function,
7745 NULL, // Receiver is on expression stack.
7746 &receiver_maps,
7747 1,
7748 ast_id,
7749 kCallApiSetter);
7750 }
7751
7752
7736 bool HOptimizedGraphBuilder::TryInlineApiCall(Handle<JSFunction> function, 7753 bool HOptimizedGraphBuilder::TryInlineApiCall(Handle<JSFunction> function,
7737 HValue* receiver, 7754 HValue* receiver,
7738 SmallMapList* receiver_maps, 7755 SmallMapList* receiver_maps,
7739 int argc, 7756 int argc,
7740 BailoutId ast_id, 7757 BailoutId ast_id,
7741 ApiCallType call_type) { 7758 ApiCallType call_type) {
7742 CallOptimization optimization(function); 7759 CallOptimization optimization(function);
7743 if (!optimization.is_simple_api_call()) return false; 7760 if (!optimization.is_simple_api_call()) return false;
7744 Handle<Map> holder_map; 7761 Handle<Map> holder_map;
7745 if (call_type == kCallApiFunction) { 7762 if (call_type == kCallApiFunction) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
7781 drop_extra = true; 7798 drop_extra = true;
7782 break; 7799 break;
7783 case kCallApiGetter: 7800 case kCallApiGetter:
7784 // Receiver and prototype chain cannot have changed. 7801 // Receiver and prototype chain cannot have changed.
7785 ASSERT_EQ(0, argc); 7802 ASSERT_EQ(0, argc);
7786 ASSERT_EQ(NULL, receiver); 7803 ASSERT_EQ(NULL, receiver);
7787 // Receiver is on expression stack. 7804 // Receiver is on expression stack.
7788 receiver = Pop(); 7805 receiver = Pop();
7789 Add<HPushArgument>(receiver); 7806 Add<HPushArgument>(receiver);
7790 break; 7807 break;
7808 case kCallApiSetter:
7809 {
7810 // Receiver and prototype chain cannot have changed.
7811 ASSERT_EQ(1, argc);
7812 ASSERT_EQ(NULL, receiver);
7813 // Receiver and value are on expression stack.
7814 HValue* value = Pop();
7815 receiver = Pop();
7816 Add<HPushArgument>(receiver);
7817 Add<HPushArgument>(value);
7818 break;
7819 }
7791 } 7820 }
7792 7821
7793 HValue* holder = NULL; 7822 HValue* holder = NULL;
7794 switch (holder_lookup) { 7823 switch (holder_lookup) {
7795 case CallOptimization::kHolderFound: 7824 case CallOptimization::kHolderFound:
7796 holder = Add<HConstant>(api_holder); 7825 holder = Add<HConstant>(api_holder);
7797 break; 7826 break;
7798 case CallOptimization::kHolderIsReceiver: 7827 case CallOptimization::kHolderIsReceiver:
7799 holder = receiver; 7828 holder = receiver;
7800 break; 7829 break;
(...skipping 3403 matching lines...) Expand 10 before | Expand all | Expand 10 after
11204 if (ShouldProduceTraceOutput()) { 11233 if (ShouldProduceTraceOutput()) {
11205 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11234 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11206 } 11235 }
11207 11236
11208 #ifdef DEBUG 11237 #ifdef DEBUG
11209 graph_->Verify(false); // No full verify. 11238 graph_->Verify(false); // No full verify.
11210 #endif 11239 #endif
11211 } 11240 }
11212 11241
11213 } } // namespace v8::internal 11242 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698