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

Side by Side Diff: src/code-stubs-hydrogen.cc

Issue 16925008: Generate StoreGlobal stubs with Hydrogen (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address feedback 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
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 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 } 802 }
803 803
804 804
805 template <> 805 template <>
806 HValue* CodeStubGraphBuilder<ToBooleanStub>::BuildCodeInitializedStub() { 806 HValue* CodeStubGraphBuilder<ToBooleanStub>::BuildCodeInitializedStub() {
807 ToBooleanStub* stub = casted_stub(); 807 ToBooleanStub* stub = casted_stub();
808 808
809 IfBuilder if_true(this); 809 IfBuilder if_true(this);
810 if_true.If<HBranch>(GetParameter(0), stub->GetTypes()); 810 if_true.If<HBranch>(GetParameter(0), stub->GetTypes());
811 if_true.Then(); 811 if_true.Then();
812 if_true.Return(graph()->GetConstant1()); 812 if_true.Return(graph()->GetConstant1());
813 if_true.Else(); 813 if_true.Else();
814 if_true.End(); 814 if_true.End();
815 return graph()->GetConstant0(); 815 return graph()->GetConstant0();
816 } 816 }
817 817
818 818
819 Handle<Code> ToBooleanStub::GenerateCode() { 819 Handle<Code> ToBooleanStub::GenerateCode() {
820 return DoGenerateCode(this); 820 return DoGenerateCode(this);
821 } 821 }
822 822
823 823
824 template <>
825 HValue* CodeStubGraphBuilder<StoreGlobalStub>::BuildCodeInitializedStub() {
826 StoreGlobalStub* stub = casted_stub();
827 Handle<Object> hole(isolate()->heap()->the_hole_value(), isolate());
828 Handle<Object> placeholer_value(Smi::FromInt(0), isolate());
829 Handle<PropertyCell> placeholder_cell =
830 isolate()->factory()->NewPropertyCell(placeholer_value);
831
832 HParameter* receiver = GetParameter(0);
833 HParameter* value = GetParameter(2);
834
835 if (stub->is_constant()) {
836 // Assume every store to a constant value changes it.
837 current_block()->FinishExitWithDeoptimization(HDeoptimize::kUseAll);
838 set_current_block(NULL);
839 } else {
840 HValue* cell = Add<HConstant>(placeholder_cell, Representation::Tagged());
841 // Check that the map of the global has not changed.
842 AddInstruction(HCheckMaps::New(receiver,
843 Handle<Map>(isolate()->heap()->meta_map()),
844 zone()));
845
846 // Load the payload of the global parameter cell. A hole indicates that the
847 // property has been deleted and that the store must be handled by the
848 // runtime.
849 HObjectAccess access(HObjectAccess::ForCellPayload(isolate()));
850 HValue* cell_contents = Add<HLoadNamedField>(cell, access);
851 IfBuilder builder(this);
852 HValue* hole_value = Add<HConstant>(hole, Representation::Tagged());
853 builder.If<HCompareObjectEqAndBranch>(cell_contents, hole_value);
854 builder.Then();
855 builder.Deopt();
856 builder.Else();
857 Add<HStoreNamedField>(cell, access, value);
858 builder.End();
859 }
860 return value;
861 }
862
863
864 Handle<Code> StoreGlobalStub::GenerateCode() {
865 return DoGenerateCode(this);
866 }
867
868
824 } } // namespace v8::internal 869 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/heap.h » ('j') | src/x64/lithium-gap-resolver-x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698