| 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 19 matching lines...) Expand all Loading... |
| 30 return chunk; | 30 return chunk; |
| 31 } | 31 } |
| 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 descriptor_(stub), |
| 40 context_(NULL) { | 41 context_(NULL) { |
| 41 stub->InitializeInterfaceDescriptor(&descriptor_); | |
| 42 int parameter_count = descriptor_.GetEnvironmentParameterCount(); | 42 int parameter_count = descriptor_.GetEnvironmentParameterCount(); |
| 43 parameters_.Reset(new HParameter*[parameter_count]); | 43 parameters_.Reset(new HParameter*[parameter_count]); |
| 44 } | 44 } |
| 45 virtual bool BuildGraph(); | 45 virtual bool BuildGraph(); |
| 46 | 46 |
| 47 protected: | 47 protected: |
| 48 virtual HValue* BuildCodeStub() = 0; | 48 virtual HValue* BuildCodeStub() = 0; |
| 49 HParameter* GetParameter(int parameter) { | 49 HParameter* GetParameter(int parameter) { |
| 50 DCHECK(parameter < descriptor_.GetEnvironmentParameterCount()); | 50 DCHECK(parameter < descriptor_.GetEnvironmentParameterCount()); |
| 51 return parameters_[parameter]; | 51 return parameters_[parameter]; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 GetStubType()); | 244 GetStubType()); |
| 245 Handle<Code> new_object = factory->NewCode( | 245 Handle<Code> new_object = factory->NewCode( |
| 246 desc, flags, masm.CodeObject(), NeedsImmovableCode()); | 246 desc, flags, masm.CodeObject(), NeedsImmovableCode()); |
| 247 return new_object; | 247 return new_object; |
| 248 } | 248 } |
| 249 | 249 |
| 250 | 250 |
| 251 template <class Stub> | 251 template <class Stub> |
| 252 static Handle<Code> DoGenerateCode(Stub* stub) { | 252 static Handle<Code> DoGenerateCode(Stub* stub) { |
| 253 Isolate* isolate = stub->isolate(); | 253 Isolate* isolate = stub->isolate(); |
| 254 CodeStubInterfaceDescriptor descriptor; | 254 CodeStubInterfaceDescriptor descriptor(stub); |
| 255 stub->InitializeInterfaceDescriptor(&descriptor); | |
| 256 | 255 |
| 257 // If we are uninitialized we can use a light-weight stub to enter | 256 // If we are uninitialized we can use a light-weight stub to enter |
| 258 // the runtime that is significantly faster than using the standard | 257 // the runtime that is significantly faster than using the standard |
| 259 // stub-failure deopt mechanism. | 258 // stub-failure deopt mechanism. |
| 260 if (stub->IsUninitialized() && descriptor.has_miss_handler()) { | 259 if (stub->IsUninitialized() && descriptor.has_miss_handler()) { |
| 261 DCHECK(!descriptor.stack_parameter_count().is_valid()); | 260 DCHECK(!descriptor.stack_parameter_count().is_valid()); |
| 262 return stub->GenerateLightweightMissCode(); | 261 return stub->GenerateLightweightMissCode(); |
| 263 } | 262 } |
| 264 base::ElapsedTimer timer; | 263 base::ElapsedTimer timer; |
| 265 if (FLAG_profile_hydrogen_code_stub_compilation) { | 264 if (FLAG_profile_hydrogen_code_stub_compilation) { |
| (...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1802 HValue* receiver = GetParameter(VectorLoadICDescriptor::kReceiverIndex); | 1801 HValue* receiver = GetParameter(VectorLoadICDescriptor::kReceiverIndex); |
| 1803 Add<HDeoptimize>("Always deopt", Deoptimizer::EAGER); | 1802 Add<HDeoptimize>("Always deopt", Deoptimizer::EAGER); |
| 1804 return receiver; | 1803 return receiver; |
| 1805 } | 1804 } |
| 1806 | 1805 |
| 1807 | 1806 |
| 1808 Handle<Code> VectorKeyedLoadStub::GenerateCode() { | 1807 Handle<Code> VectorKeyedLoadStub::GenerateCode() { |
| 1809 return DoGenerateCode(this); | 1808 return DoGenerateCode(this); |
| 1810 } | 1809 } |
| 1811 } } // namespace v8::internal | 1810 } } // namespace v8::internal |
| OLD | NEW |