OLD | NEW |
---|---|
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/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/field-index.h" | 8 #include "src/field-index.h" |
9 #include "src/hydrogen.h" | 9 #include "src/hydrogen.h" |
10 #include "src/lithium.h" | 10 #include "src/lithium.h" |
(...skipping 21 matching lines...) Expand all Loading... | |
32 | 32 |
33 | 33 |
34 class CodeStubGraphBuilderBase : public HGraphBuilder { | 34 class CodeStubGraphBuilderBase : public HGraphBuilder { |
35 public: | 35 public: |
36 CodeStubGraphBuilderBase(Isolate* isolate, HydrogenCodeStub* stub) | 36 CodeStubGraphBuilderBase(Isolate* isolate, HydrogenCodeStub* stub) |
37 : HGraphBuilder(&info_), | 37 : HGraphBuilder(&info_), |
38 arguments_length_(NULL), | 38 arguments_length_(NULL), |
39 info_(stub, isolate), | 39 info_(stub, isolate), |
40 context_(NULL) { | 40 context_(NULL) { |
41 descriptor_ = stub->GetInterfaceDescriptor(); | 41 descriptor_ = stub->GetInterfaceDescriptor(); |
42 parameters_.Reset(new HParameter*[descriptor_->register_param_count()]); | 42 int parameter_count = descriptor_->register_param_count() - 1; |
danno
2014/07/16 13:19:59
GetEnvironmentParameterCount
mvstanton
2014/07/17 09:04:04
Done.
| |
43 parameters_.Reset(new HParameter*[parameter_count]); | |
43 } | 44 } |
44 virtual bool BuildGraph(); | 45 virtual bool BuildGraph(); |
45 | 46 |
46 protected: | 47 protected: |
47 virtual HValue* BuildCodeStub() = 0; | 48 virtual HValue* BuildCodeStub() = 0; |
48 HParameter* GetParameter(int parameter) { | 49 HParameter* GetParameter(int parameter) { |
49 ASSERT(parameter < descriptor_->register_param_count()); | 50 ASSERT(parameter < descriptor_->register_param_count()); |
50 return parameters_[parameter]; | 51 return parameters_[parameter]; |
51 } | 52 } |
52 HValue* GetArgumentsLength() { | 53 HValue* GetArgumentsLength() { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 // Update the static counter each time a new code stub is generated. | 110 // Update the static counter each time a new code stub is generated. |
110 isolate()->counters()->code_stubs()->Increment(); | 111 isolate()->counters()->code_stubs()->Increment(); |
111 | 112 |
112 if (FLAG_trace_hydrogen_stubs) { | 113 if (FLAG_trace_hydrogen_stubs) { |
113 const char* name = CodeStub::MajorName(stub()->MajorKey(), false); | 114 const char* name = CodeStub::MajorName(stub()->MajorKey(), false); |
114 PrintF("-----------------------------------------------------------\n"); | 115 PrintF("-----------------------------------------------------------\n"); |
115 PrintF("Compiling stub %s using hydrogen\n", name); | 116 PrintF("Compiling stub %s using hydrogen\n", name); |
116 isolate()->GetHTracer()->TraceCompilation(&info_); | 117 isolate()->GetHTracer()->TraceCompilation(&info_); |
117 } | 118 } |
118 | 119 |
119 int param_count = descriptor_->register_param_count(); | 120 // Every descriptor has a context register parameter, which we don't need |
121 // to include here. | |
122 int param_count = descriptor_->register_param_count() - 1; | |
danno
2014/07/16 13:19:59
Use GetEnvironmentLength(), then comment is unnece
mvstanton
2014/07/17 09:04:04
Done. (but I used GetEnvironmentParameterCount() a
| |
120 HEnvironment* start_environment = graph()->start_environment(); | 123 HEnvironment* start_environment = graph()->start_environment(); |
121 HBasicBlock* next_block = CreateBasicBlock(start_environment); | 124 HBasicBlock* next_block = CreateBasicBlock(start_environment); |
122 Goto(next_block); | 125 Goto(next_block); |
123 next_block->SetJoinId(BailoutId::StubEntry()); | 126 next_block->SetJoinId(BailoutId::StubEntry()); |
124 set_current_block(next_block); | 127 set_current_block(next_block); |
125 | 128 |
126 bool runtime_stack_params = descriptor_->stack_parameter_count().is_valid(); | 129 bool runtime_stack_params = descriptor_->stack_parameter_count().is_valid(); |
127 HInstruction* stack_parameter_count = NULL; | 130 HInstruction* stack_parameter_count = NULL; |
128 for (int i = 0; i < param_count; ++i) { | 131 for (int i = 0; i < param_count; ++i) { |
129 Representation r = descriptor_->GetRegisterParameterRepresentation(i); | 132 int parameter_index = i+1; |
danno
2014/07/16 13:19:59
nit: make sure to clang format your patch. Comment
mvstanton
2014/07/17 09:04:04
I got rid of this whole notion of "convert a param
| |
130 HParameter* param = Add<HParameter>(i, HParameter::REGISTER_PARAMETER, r); | 133 Representation r = descriptor_->GetParameterRepresentation(parameter_index); |
134 HParameter* param = Add<HParameter>(parameter_index, | |
135 HParameter::REGISTER_PARAMETER, r); | |
131 start_environment->Bind(i, param); | 136 start_environment->Bind(i, param); |
132 parameters_[i] = param; | 137 parameters_[i] = param; |
133 if (descriptor_->IsParameterCountRegister(i)) { | 138 if (descriptor_->IsParameterCountRegister(parameter_index)) { |
134 param->set_type(HType::Smi()); | 139 param->set_type(HType::Smi()); |
135 stack_parameter_count = param; | 140 stack_parameter_count = param; |
136 arguments_length_ = stack_parameter_count; | 141 arguments_length_ = stack_parameter_count; |
137 } | 142 } |
138 } | 143 } |
139 | 144 |
140 ASSERT(!runtime_stack_params || arguments_length_ != NULL); | 145 ASSERT(!runtime_stack_params || arguments_length_ != NULL); |
141 if (!runtime_stack_params) { | 146 if (!runtime_stack_params) { |
142 stack_parameter_count = graph()->GetConstantMinus1(); | 147 stack_parameter_count = graph()->GetConstantMinus1(); |
143 arguments_length_ = graph()->GetConstant0(); | 148 arguments_length_ = graph()->GetConstant0(); |
(...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1725 return Pop(); | 1730 return Pop(); |
1726 } | 1731 } |
1727 | 1732 |
1728 | 1733 |
1729 Handle<Code> KeyedLoadGenericElementStub::GenerateCode() { | 1734 Handle<Code> KeyedLoadGenericElementStub::GenerateCode() { |
1730 return DoGenerateCode(this); | 1735 return DoGenerateCode(this); |
1731 } | 1736 } |
1732 | 1737 |
1733 | 1738 |
1734 } } // namespace v8::internal | 1739 } } // namespace v8::internal |
OLD | NEW |