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

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

Issue 1211333003: Make context register implicit for CallInterfaceDescriptors (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Platform ports Created 5 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/bailout-reason.h" 7 #include "src/bailout-reason.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/field-index.h" 9 #include "src/field-index.h"
10 #include "src/hydrogen.h" 10 #include "src/hydrogen.h"
(...skipping 23 matching lines...) Expand all
34 34
35 35
36 class CodeStubGraphBuilderBase : public HGraphBuilder { 36 class CodeStubGraphBuilderBase : public HGraphBuilder {
37 public: 37 public:
38 explicit CodeStubGraphBuilderBase(CompilationInfo* info) 38 explicit CodeStubGraphBuilderBase(CompilationInfo* info)
39 : HGraphBuilder(info), 39 : HGraphBuilder(info),
40 arguments_length_(NULL), 40 arguments_length_(NULL),
41 info_(info), 41 info_(info),
42 descriptor_(info->code_stub()), 42 descriptor_(info->code_stub()),
43 context_(NULL) { 43 context_(NULL) {
44 int parameter_count = descriptor_.GetEnvironmentParameterCount(); 44 int parameter_count = GetParameterCount();
45 parameters_.Reset(new HParameter*[parameter_count]); 45 parameters_.Reset(new HParameter*[parameter_count]);
46 } 46 }
47 virtual bool BuildGraph(); 47 virtual bool BuildGraph();
48 48
49 protected: 49 protected:
50 virtual HValue* BuildCodeStub() = 0; 50 virtual HValue* BuildCodeStub() = 0;
51 int GetParameterCount() const {
52 return descriptor_.GetRegisterParameterCount();
53 }
51 HParameter* GetParameter(int parameter) { 54 HParameter* GetParameter(int parameter) {
52 DCHECK(parameter < descriptor_.GetEnvironmentParameterCount()); 55 DCHECK(parameter < GetParameterCount());
53 return parameters_[parameter]; 56 return parameters_[parameter];
54 } 57 }
58 Representation GetParameterRepresentation(int parameter) {
59 return RepresentationFromType(descriptor_.GetParameterType(parameter));
60 }
61 bool IsParameterCountRegister(int index) const {
62 return descriptor_.GetRegisterParameter(index)
63 .is(descriptor_.stack_parameter_count());
64 }
55 HValue* GetArgumentsLength() { 65 HValue* GetArgumentsLength() {
56 // This is initialized in BuildGraph() 66 // This is initialized in BuildGraph()
57 DCHECK(arguments_length_ != NULL); 67 DCHECK(arguments_length_ != NULL);
58 return arguments_length_; 68 return arguments_length_;
59 } 69 }
60 CompilationInfo* info() { return info_; } 70 CompilationInfo* info() { return info_; }
61 CodeStub* stub() { return info_->code_stub(); } 71 CodeStub* stub() { return info_->code_stub(); }
62 HContext* context() { return context_; } 72 HContext* context() { return context_; }
63 Isolate* isolate() { return info_->isolate(); } 73 Isolate* isolate() { return info_->isolate(); }
64 74
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 // Update the static counter each time a new code stub is generated. 131 // Update the static counter each time a new code stub is generated.
122 isolate()->counters()->code_stubs()->Increment(); 132 isolate()->counters()->code_stubs()->Increment();
123 133
124 if (FLAG_trace_hydrogen_stubs) { 134 if (FLAG_trace_hydrogen_stubs) {
125 const char* name = CodeStub::MajorName(stub()->MajorKey(), false); 135 const char* name = CodeStub::MajorName(stub()->MajorKey(), false);
126 PrintF("-----------------------------------------------------------\n"); 136 PrintF("-----------------------------------------------------------\n");
127 PrintF("Compiling stub %s using hydrogen\n", name); 137 PrintF("Compiling stub %s using hydrogen\n", name);
128 isolate()->GetHTracer()->TraceCompilation(info()); 138 isolate()->GetHTracer()->TraceCompilation(info());
129 } 139 }
130 140
131 int param_count = descriptor_.GetEnvironmentParameterCount(); 141 int param_count = GetParameterCount();
132 HEnvironment* start_environment = graph()->start_environment(); 142 HEnvironment* start_environment = graph()->start_environment();
133 HBasicBlock* next_block = CreateBasicBlock(start_environment); 143 HBasicBlock* next_block = CreateBasicBlock(start_environment);
134 Goto(next_block); 144 Goto(next_block);
135 next_block->SetJoinId(BailoutId::StubEntry()); 145 next_block->SetJoinId(BailoutId::StubEntry());
136 set_current_block(next_block); 146 set_current_block(next_block);
137 147
138 bool runtime_stack_params = descriptor_.stack_parameter_count().is_valid(); 148 bool runtime_stack_params = descriptor_.stack_parameter_count().is_valid();
139 HInstruction* stack_parameter_count = NULL; 149 HInstruction* stack_parameter_count = NULL;
140 for (int i = 0; i < param_count; ++i) { 150 for (int i = 0; i < param_count; ++i) {
141 Representation r = 151 Representation r = GetParameterRepresentation(i);
142 RepresentationFromType(descriptor_.GetEnvironmentParameterType(i));
143 HParameter* param = Add<HParameter>(i, 152 HParameter* param = Add<HParameter>(i,
144 HParameter::REGISTER_PARAMETER, r); 153 HParameter::REGISTER_PARAMETER, r);
145 start_environment->Bind(i, param); 154 start_environment->Bind(i, param);
146 parameters_[i] = param; 155 parameters_[i] = param;
147 if (descriptor_.IsEnvironmentParameterCountRegister(i)) { 156 if (IsParameterCountRegister(i)) {
148 param->set_type(HType::Smi()); 157 param->set_type(HType::Smi());
149 stack_parameter_count = param; 158 stack_parameter_count = param;
150 arguments_length_ = stack_parameter_count; 159 arguments_length_ = stack_parameter_count;
151 } 160 }
152 } 161 }
153 162
154 DCHECK(!runtime_stack_params || arguments_length_ != NULL); 163 DCHECK(!runtime_stack_params || arguments_length_ != NULL);
155 if (!runtime_stack_params) { 164 if (!runtime_stack_params) {
156 stack_parameter_count = graph()->GetConstantMinus1(); 165 stack_parameter_count = graph()->GetConstantMinus1();
157 arguments_length_ = graph()->GetConstant0(); 166 arguments_length_ = graph()->GetConstant0();
(...skipping 2095 matching lines...) Expand 10 before | Expand all | Expand 10 after
2253 return Pop(); 2262 return Pop();
2254 } 2263 }
2255 2264
2256 2265
2257 Handle<Code> KeyedLoadGenericStub::GenerateCode() { 2266 Handle<Code> KeyedLoadGenericStub::GenerateCode() {
2258 return DoGenerateCode(this); 2267 return DoGenerateCode(this);
2259 } 2268 }
2260 2269
2261 } // namespace internal 2270 } // namespace internal
2262 } // namespace v8 2271 } // namespace v8
OLDNEW
« src/code-stubs.h ('K') | « src/code-stubs.cc ('k') | src/compiler/linkage-impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698