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

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

Powered by Google App Engine
This is Rietveld 408576698