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

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

Issue 11550005: Elide unnecessary context reload in generated stubs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 7 years, 12 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/arm/lithium-codegen-arm.cc ('k') | src/hydrogen.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 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 LChunk* chunk = LChunk::NewChunk(graph); 44 LChunk* chunk = LChunk::NewChunk(graph);
45 ASSERT(chunk != NULL); 45 ASSERT(chunk != NULL);
46 Handle<Code> stub = chunk->Codegen(Code::COMPILED_STUB); 46 Handle<Code> stub = chunk->Codegen(Code::COMPILED_STUB);
47 return stub; 47 return stub;
48 } 48 }
49 49
50 50
51 class CodeStubGraphBuilderBase : public HGraphBuilder { 51 class CodeStubGraphBuilderBase : public HGraphBuilder {
52 public: 52 public:
53 CodeStubGraphBuilderBase(Isolate* isolate, HydrogenCodeStub* stub) 53 CodeStubGraphBuilderBase(Isolate* isolate, HydrogenCodeStub* stub)
54 : HGraphBuilder(&info_), info_(stub, isolate) {} 54 : HGraphBuilder(&info_), info_(stub, isolate), context_(NULL) {}
55 virtual bool BuildGraph(); 55 virtual bool BuildGraph();
56 56
57 protected: 57 protected:
58 virtual void BuildCodeStub() = 0; 58 virtual void BuildCodeStub() = 0;
59 HParameter* GetParameter(int parameter) { return parameters_[parameter]; } 59 HParameter* GetParameter(int parameter) { return parameters_[parameter]; }
60 HydrogenCodeStub* stub() { return info_.code_stub(); } 60 HydrogenCodeStub* stub() { return info_.code_stub(); }
61 HContext* context() { return context_; }
61 62
62 private: 63 private:
63 SmartArrayPointer<HParameter*> parameters_; 64 SmartArrayPointer<HParameter*> parameters_;
64 CompilationInfoWithZone info_; 65 CompilationInfoWithZone info_;
66 HContext* context_;
65 }; 67 };
66 68
67 69
68 bool CodeStubGraphBuilderBase::BuildGraph() { 70 bool CodeStubGraphBuilderBase::BuildGraph() {
69 if (FLAG_trace_hydrogen) { 71 if (FLAG_trace_hydrogen) {
70 PrintF("-----------------------------------------------------------\n"); 72 PrintF("-----------------------------------------------------------\n");
71 PrintF("Compiling stub using hydrogen\n"); 73 PrintF("Compiling stub using hydrogen\n");
72 HTracer::Instance()->TraceCompilation(&info_); 74 HTracer::Instance()->TraceCompilation(&info_);
73 } 75 }
74 HBasicBlock* next_block = graph()->CreateBasicBlock(); 76 HBasicBlock* next_block = graph()->CreateBasicBlock();
75 next_block->SetInitialEnvironment(graph()->start_environment()); 77 next_block->SetInitialEnvironment(graph()->start_environment());
76 HGoto* jump = new(zone()) HGoto(next_block); 78 HGoto* jump = new(zone()) HGoto(next_block);
77 graph()->entry_block()->Finish(jump); 79 graph()->entry_block()->Finish(jump);
78 set_current_block(next_block); 80 set_current_block(next_block);
79 81
82 context_ = new(zone()) HContext();
83 AddInstruction(context_);
84
80 int major_key = stub()->MajorKey(); 85 int major_key = stub()->MajorKey();
81 CodeStubInterfaceDescriptor* descriptor = 86 CodeStubInterfaceDescriptor* descriptor =
82 info_.isolate()->code_stub_interface_descriptor(major_key); 87 info_.isolate()->code_stub_interface_descriptor(major_key);
83 if (descriptor->register_param_count_ < 0) { 88 if (descriptor->register_param_count_ < 0) {
84 stub()->InitializeInterfaceDescriptor(info_.isolate(), descriptor); 89 stub()->InitializeInterfaceDescriptor(info_.isolate(), descriptor);
85 } 90 }
86 parameters_.Reset(new HParameter*[descriptor->register_param_count_]); 91 parameters_.Reset(new HParameter*[descriptor->register_param_count_]);
87 92
88 HGraph* graph = this->graph(); 93 HGraph* graph = this->graph();
89 Zone* zone = this->zone(); 94 Zone* zone = this->zone();
(...skipping 24 matching lines...) Expand all
114 119
115 template <> 120 template <>
116 void CodeStubGraphBuilder<KeyedLoadFastElementStub>::BuildCodeStub() { 121 void CodeStubGraphBuilder<KeyedLoadFastElementStub>::BuildCodeStub() {
117 Zone* zone = this->zone(); 122 Zone* zone = this->zone();
118 123
119 HInstruction* load = BuildUncheckedMonomorphicElementAccess( 124 HInstruction* load = BuildUncheckedMonomorphicElementAccess(
120 GetParameter(0), GetParameter(1), NULL, NULL, 125 GetParameter(0), GetParameter(1), NULL, NULL,
121 casted_stub()->is_js_array(), casted_stub()->elements_kind(), false); 126 casted_stub()->is_js_array(), casted_stub()->elements_kind(), false);
122 AddInstruction(load); 127 AddInstruction(load);
123 128
124 HReturn* ret = new(zone) HReturn(load); 129 HReturn* ret = new(zone) HReturn(load, context());
125 current_block()->Finish(ret); 130 current_block()->Finish(ret);
126 } 131 }
127 132
128 133
129 Handle<Code> KeyedLoadFastElementStub::GenerateCode() { 134 Handle<Code> KeyedLoadFastElementStub::GenerateCode() {
130 CodeStubGraphBuilder<KeyedLoadFastElementStub> builder(this); 135 CodeStubGraphBuilder<KeyedLoadFastElementStub> builder(this);
131 return CodeFromGraph(builder.CreateGraph()); 136 return CodeFromGraph(builder.CreateGraph());
132 } 137 }
133 138
134 139
135 } } // namespace v8::internal 140 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698