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

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

Issue 1026513004: Remove dangerous constructor from CompilationInfoWithZone. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comment. Created 5 years, 9 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
« no previous file with comments | « no previous file | src/compiler.h » ('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/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 17 matching lines...) Expand all
28 LChunk* chunk = LChunk::NewChunk(graph); 28 LChunk* chunk = LChunk::NewChunk(graph);
29 if (chunk == NULL) { 29 if (chunk == NULL) {
30 FATAL(GetBailoutReason(graph->info()->bailout_reason())); 30 FATAL(GetBailoutReason(graph->info()->bailout_reason()));
31 } 31 }
32 return chunk; 32 return chunk;
33 } 33 }
34 34
35 35
36 class CodeStubGraphBuilderBase : public HGraphBuilder { 36 class CodeStubGraphBuilderBase : public HGraphBuilder {
37 public: 37 public:
38 explicit CodeStubGraphBuilderBase(CompilationInfoWithZone* 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 = descriptor_.GetEnvironmentParameterCount();
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
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 HValue* shared_info, 100 HValue* shared_info,
101 HValue* native_context); 101 HValue* native_context);
102 102
103 private: 103 private:
104 HValue* BuildArraySingleArgumentConstructor(JSArrayBuilder* builder); 104 HValue* BuildArraySingleArgumentConstructor(JSArrayBuilder* builder);
105 HValue* BuildArrayNArgumentsConstructor(JSArrayBuilder* builder, 105 HValue* BuildArrayNArgumentsConstructor(JSArrayBuilder* builder,
106 ElementsKind kind); 106 ElementsKind kind);
107 107
108 SmartArrayPointer<HParameter*> parameters_; 108 SmartArrayPointer<HParameter*> parameters_;
109 HValue* arguments_length_; 109 HValue* arguments_length_;
110 CompilationInfoWithZone* info_; 110 CompilationInfo* info_;
111 CodeStubDescriptor descriptor_; 111 CodeStubDescriptor descriptor_;
112 HContext* context_; 112 HContext* context_;
113 }; 113 };
114 114
115 115
116 bool CodeStubGraphBuilderBase::BuildGraph() { 116 bool CodeStubGraphBuilderBase::BuildGraph() {
117 // Update the static counter each time a new code stub is generated. 117 // Update the static counter each time a new code stub is generated.
118 isolate()->counters()->code_stubs()->Increment(); 118 isolate()->counters()->code_stubs()->Increment();
119 119
120 if (FLAG_trace_hydrogen_stubs) { 120 if (FLAG_trace_hydrogen_stubs) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 stack_pop_count); 183 stack_pop_count);
184 FinishCurrentBlock(hreturn_instruction); 184 FinishCurrentBlock(hreturn_instruction);
185 } 185 }
186 return true; 186 return true;
187 } 187 }
188 188
189 189
190 template <class Stub> 190 template <class Stub>
191 class CodeStubGraphBuilder: public CodeStubGraphBuilderBase { 191 class CodeStubGraphBuilder: public CodeStubGraphBuilderBase {
192 public: 192 public:
193 explicit CodeStubGraphBuilder(CompilationInfoWithZone* info) 193 explicit CodeStubGraphBuilder(CompilationInfo* info)
194 : CodeStubGraphBuilderBase(info) {} 194 : CodeStubGraphBuilderBase(info) {}
195 195
196 protected: 196 protected:
197 virtual HValue* BuildCodeStub() { 197 virtual HValue* BuildCodeStub() {
198 if (casted_stub()->IsUninitialized()) { 198 if (casted_stub()->IsUninitialized()) {
199 return BuildCodeUninitializedStub(); 199 return BuildCodeUninitializedStub();
200 } else { 200 } else {
201 return BuildCodeInitializedStub(); 201 return BuildCodeInitializedStub();
202 } 202 }
203 } 203 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 // the runtime that is significantly faster than using the standard 265 // the runtime that is significantly faster than using the standard
266 // stub-failure deopt mechanism. 266 // stub-failure deopt mechanism.
267 if (stub->IsUninitialized() && descriptor.has_miss_handler()) { 267 if (stub->IsUninitialized() && descriptor.has_miss_handler()) {
268 DCHECK(!descriptor.stack_parameter_count().is_valid()); 268 DCHECK(!descriptor.stack_parameter_count().is_valid());
269 return stub->GenerateLightweightMissCode(descriptor.miss_handler()); 269 return stub->GenerateLightweightMissCode(descriptor.miss_handler());
270 } 270 }
271 base::ElapsedTimer timer; 271 base::ElapsedTimer timer;
272 if (FLAG_profile_hydrogen_code_stub_compilation) { 272 if (FLAG_profile_hydrogen_code_stub_compilation) {
273 timer.Start(); 273 timer.Start();
274 } 274 }
275 CompilationInfoWithZone info(stub, isolate); 275 Zone zone;
276 CompilationInfo info(stub, isolate, &zone);
276 CodeStubGraphBuilder<Stub> builder(&info); 277 CodeStubGraphBuilder<Stub> builder(&info);
277 LChunk* chunk = OptimizeGraph(builder.CreateGraph()); 278 LChunk* chunk = OptimizeGraph(builder.CreateGraph());
278 Handle<Code> code = chunk->Codegen(); 279 Handle<Code> code = chunk->Codegen();
279 if (FLAG_profile_hydrogen_code_stub_compilation) { 280 if (FLAG_profile_hydrogen_code_stub_compilation) {
280 OFStream os(stdout); 281 OFStream os(stdout);
281 os << "[Lazy compilation of " << stub << " took " 282 os << "[Lazy compilation of " << stub << " took "
282 << timer.Elapsed().InMillisecondsF() << " ms]" << std::endl; 283 << timer.Elapsed().InMillisecondsF() << " ms]" << std::endl;
283 } 284 }
284 return code; 285 return code;
285 } 286 }
(...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 1705
1705 Handle<Code> RegExpConstructResultStub::GenerateCode() { 1706 Handle<Code> RegExpConstructResultStub::GenerateCode() {
1706 return DoGenerateCode(this); 1707 return DoGenerateCode(this);
1707 } 1708 }
1708 1709
1709 1710
1710 template <> 1711 template <>
1711 class CodeStubGraphBuilder<KeyedLoadGenericStub> 1712 class CodeStubGraphBuilder<KeyedLoadGenericStub>
1712 : public CodeStubGraphBuilderBase { 1713 : public CodeStubGraphBuilderBase {
1713 public: 1714 public:
1714 explicit CodeStubGraphBuilder(CompilationInfoWithZone* info) 1715 explicit CodeStubGraphBuilder(CompilationInfo* info)
1715 : CodeStubGraphBuilderBase(info) {} 1716 : CodeStubGraphBuilderBase(info) {}
1716 1717
1717 protected: 1718 protected:
1718 virtual HValue* BuildCodeStub(); 1719 virtual HValue* BuildCodeStub();
1719 1720
1720 void BuildElementsKindLimitCheck(HGraphBuilder::IfBuilder* if_builder, 1721 void BuildElementsKindLimitCheck(HGraphBuilder::IfBuilder* if_builder,
1721 HValue* bit_field2, 1722 HValue* bit_field2,
1722 ElementsKind kind); 1723 ElementsKind kind);
1723 1724
1724 void BuildFastElementLoad(HGraphBuilder::IfBuilder* if_builder, 1725 void BuildFastElementLoad(HGraphBuilder::IfBuilder* if_builder,
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
2028 // megamorphic case is handled as part of the default stub. 2029 // megamorphic case is handled as part of the default stub.
2029 DCHECK(!FLAG_vector_ics); 2030 DCHECK(!FLAG_vector_ics);
2030 2031
2031 // Probe the stub cache. 2032 // Probe the stub cache.
2032 Add<HTailCallThroughMegamorphicCache>(receiver, name); 2033 Add<HTailCallThroughMegamorphicCache>(receiver, name);
2033 2034
2034 // We never continue. 2035 // We never continue.
2035 return graph()->GetConstant0(); 2036 return graph()->GetConstant0();
2036 } 2037 }
2037 } } // namespace v8::internal 2038 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698