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

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

Issue 384403002: StubCallInterfaceDescriptor takes a context register. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Code comments and ports. Created 6 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/deoptimizer.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 // 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
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_->GetEnvironmentParameterCount();
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_->GetEnvironmentParameterCount());
50 return parameters_[parameter]; 51 return parameters_[parameter];
51 } 52 }
52 HValue* GetArgumentsLength() { 53 HValue* GetArgumentsLength() {
53 // This is initialized in BuildGraph() 54 // This is initialized in BuildGraph()
54 ASSERT(arguments_length_ != NULL); 55 ASSERT(arguments_length_ != NULL);
55 return arguments_length_; 56 return arguments_length_;
56 } 57 }
57 CompilationInfo* info() { return &info_; } 58 CompilationInfo* info() { return &info_; }
58 HydrogenCodeStub* stub() { return info_.code_stub(); } 59 HydrogenCodeStub* stub() { return info_.code_stub(); }
59 HContext* context() { return context_; } 60 HContext* context() { return context_; }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 int param_count = descriptor_->GetEnvironmentParameterCount();
120 HEnvironment* start_environment = graph()->start_environment(); 121 HEnvironment* start_environment = graph()->start_environment();
121 HBasicBlock* next_block = CreateBasicBlock(start_environment); 122 HBasicBlock* next_block = CreateBasicBlock(start_environment);
122 Goto(next_block); 123 Goto(next_block);
123 next_block->SetJoinId(BailoutId::StubEntry()); 124 next_block->SetJoinId(BailoutId::StubEntry());
124 set_current_block(next_block); 125 set_current_block(next_block);
125 126
126 bool runtime_stack_params = descriptor_->stack_parameter_count().is_valid(); 127 bool runtime_stack_params = descriptor_->stack_parameter_count().is_valid();
127 HInstruction* stack_parameter_count = NULL; 128 HInstruction* stack_parameter_count = NULL;
128 for (int i = 0; i < param_count; ++i) { 129 for (int i = 0; i < param_count; ++i) {
129 Representation r = descriptor_->GetRegisterParameterRepresentation(i); 130 Representation r = descriptor_->GetEnvironmentParameterRepresentation(i);
130 HParameter* param = Add<HParameter>(i, HParameter::REGISTER_PARAMETER, r); 131 HParameter* param = Add<HParameter>(i,
132 HParameter::REGISTER_PARAMETER, r);
131 start_environment->Bind(i, param); 133 start_environment->Bind(i, param);
132 parameters_[i] = param; 134 parameters_[i] = param;
133 if (descriptor_->IsParameterCountRegister(i)) { 135 if (descriptor_->IsEnvironmentParameterCountRegister(i)) {
134 param->set_type(HType::Smi()); 136 param->set_type(HType::Smi());
135 stack_parameter_count = param; 137 stack_parameter_count = param;
136 arguments_length_ = stack_parameter_count; 138 arguments_length_ = stack_parameter_count;
137 } 139 }
138 } 140 }
139 141
140 ASSERT(!runtime_stack_params || arguments_length_ != NULL); 142 ASSERT(!runtime_stack_params || arguments_length_ != NULL);
141 if (!runtime_stack_params) { 143 if (!runtime_stack_params) {
142 stack_parameter_count = graph()->GetConstantMinus1(); 144 stack_parameter_count = graph()->GetConstantMinus1();
143 arguments_length_ = graph()->GetConstant0(); 145 arguments_length_ = graph()->GetConstant0();
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 } 246 }
245 247
246 248
247 template <class Stub> 249 template <class Stub>
248 static Handle<Code> DoGenerateCode(Stub* stub) { 250 static Handle<Code> DoGenerateCode(Stub* stub) {
249 Isolate* isolate = stub->isolate(); 251 Isolate* isolate = stub->isolate();
250 CodeStub::Major major_key = 252 CodeStub::Major major_key =
251 static_cast<HydrogenCodeStub*>(stub)->MajorKey(); 253 static_cast<HydrogenCodeStub*>(stub)->MajorKey();
252 CodeStubInterfaceDescriptor* descriptor = 254 CodeStubInterfaceDescriptor* descriptor =
253 isolate->code_stub_interface_descriptor(major_key); 255 isolate->code_stub_interface_descriptor(major_key);
254 if (!descriptor->initialized()) { 256 if (!descriptor->IsInitialized()) {
255 stub->InitializeInterfaceDescriptor(descriptor); 257 stub->InitializeInterfaceDescriptor(descriptor);
256 } 258 }
257 259
258 // If we are uninitialized we can use a light-weight stub to enter 260 // If we are uninitialized we can use a light-weight stub to enter
259 // the runtime that is significantly faster than using the standard 261 // the runtime that is significantly faster than using the standard
260 // stub-failure deopt mechanism. 262 // stub-failure deopt mechanism.
261 if (stub->IsUninitialized() && descriptor->has_miss_handler()) { 263 if (stub->IsUninitialized() && descriptor->has_miss_handler()) {
262 ASSERT(!descriptor->stack_parameter_count().is_valid()); 264 ASSERT(!descriptor->stack_parameter_count().is_valid());
263 return stub->GenerateLightweightMissCode(); 265 return stub->GenerateLightweightMissCode();
264 } 266 }
(...skipping 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after
1725 return Pop(); 1727 return Pop();
1726 } 1728 }
1727 1729
1728 1730
1729 Handle<Code> KeyedLoadGenericElementStub::GenerateCode() { 1731 Handle<Code> KeyedLoadGenericElementStub::GenerateCode() {
1730 return DoGenerateCode(this); 1732 return DoGenerateCode(this);
1731 } 1733 }
1732 1734
1733 1735
1734 } } // namespace v8::internal 1736 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/deoptimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698