| 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/code-stubs.h" | 5 #include "src/code-stubs.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 HValue* CodeStubGraphBuilder<LoadFieldStub>::BuildCodeStub() { | 401 HValue* CodeStubGraphBuilder<LoadFieldStub>::BuildCodeStub() { |
| 402 return BuildLoadNamedField(GetParameter(Descriptor::kReceiver), | 402 return BuildLoadNamedField(GetParameter(Descriptor::kReceiver), |
| 403 casted_stub()->index()); | 403 casted_stub()->index()); |
| 404 } | 404 } |
| 405 | 405 |
| 406 | 406 |
| 407 Handle<Code> LoadFieldStub::GenerateCode() { | 407 Handle<Code> LoadFieldStub::GenerateCode() { |
| 408 return DoGenerateCode(this); | 408 return DoGenerateCode(this); |
| 409 } | 409 } |
| 410 | 410 |
| 411 | |
| 412 template <> | |
| 413 HValue* CodeStubGraphBuilder<LoadConstantStub>::BuildCodeStub() { | |
| 414 HValue* map = AddLoadMap(GetParameter(Descriptor::kReceiver), NULL); | |
| 415 HObjectAccess descriptors_access = HObjectAccess::ForObservableJSObjectOffset( | |
| 416 Map::kDescriptorsOffset, Representation::Tagged()); | |
| 417 HValue* descriptors = Add<HLoadNamedField>(map, nullptr, descriptors_access); | |
| 418 HObjectAccess value_access = HObjectAccess::ForObservableJSObjectOffset( | |
| 419 DescriptorArray::GetValueOffset(casted_stub()->constant_index())); | |
| 420 return Add<HLoadNamedField>(descriptors, nullptr, value_access); | |
| 421 } | |
| 422 | |
| 423 | |
| 424 Handle<Code> LoadConstantStub::GenerateCode() { return DoGenerateCode(this); } | |
| 425 | |
| 426 | |
| 427 void CodeStubGraphBuilderBase::BuildStoreNamedField( | 411 void CodeStubGraphBuilderBase::BuildStoreNamedField( |
| 428 HValue* object, HValue* value, FieldIndex index, | 412 HValue* object, HValue* value, FieldIndex index, |
| 429 Representation representation, bool transition_to_field) { | 413 Representation representation, bool transition_to_field) { |
| 430 DCHECK(!index.is_double() || representation.IsDouble()); | 414 DCHECK(!index.is_double() || representation.IsDouble()); |
| 431 int offset = index.offset(); | 415 int offset = index.offset(); |
| 432 HObjectAccess access = | 416 HObjectAccess access = |
| 433 index.is_inobject() | 417 index.is_inobject() |
| 434 ? HObjectAccess::ForObservableJSObjectOffset(offset, representation) | 418 ? HObjectAccess::ForObservableJSObjectOffset(offset, representation) |
| 435 : HObjectAccess::ForBackingStoreOffset(offset, representation); | 419 : HObjectAccess::ForBackingStoreOffset(offset, representation); |
| 436 | 420 |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 if_true.Return(graph()->GetConstantTrue()); | 759 if_true.Return(graph()->GetConstantTrue()); |
| 776 if_true.Else(); | 760 if_true.Else(); |
| 777 if_true.End(); | 761 if_true.End(); |
| 778 return graph()->GetConstantFalse(); | 762 return graph()->GetConstantFalse(); |
| 779 } | 763 } |
| 780 | 764 |
| 781 Handle<Code> ToBooleanICStub::GenerateCode() { return DoGenerateCode(this); } | 765 Handle<Code> ToBooleanICStub::GenerateCode() { return DoGenerateCode(this); } |
| 782 | 766 |
| 783 } // namespace internal | 767 } // namespace internal |
| 784 } // namespace v8 | 768 } // namespace v8 |
| OLD | NEW |