| 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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 HValue* key = builder.BeginBody(start, argc, Token::LT); | 369 HValue* key = builder.BeginBody(start, argc, Token::LT); |
| 370 { | 370 { |
| 371 HValue* argument = Add<HAccessArgumentsAt>(argument_elements, argc, key); | 371 HValue* argument = Add<HAccessArgumentsAt>(argument_elements, argc, key); |
| 372 HValue* index = AddUncasted<HAdd>(key, length); | 372 HValue* index = AddUncasted<HAdd>(key, length); |
| 373 AddElementAccess(elements, index, argument, object, nullptr, kind, STORE); | 373 AddElementAccess(elements, index, argument, object, nullptr, kind, STORE); |
| 374 } | 374 } |
| 375 builder.EndBody(); | 375 builder.EndBody(); |
| 376 return new_length; | 376 return new_length; |
| 377 } | 377 } |
| 378 | 378 |
| 379 template <> | |
| 380 HValue* CodeStubGraphBuilder<LoadFastElementStub>::BuildCodeStub() { | |
| 381 LoadKeyedHoleMode hole_mode = casted_stub()->convert_hole_to_undefined() | |
| 382 ? CONVERT_HOLE_TO_UNDEFINED | |
| 383 : NEVER_RETURN_HOLE; | |
| 384 | |
| 385 HInstruction* load = BuildUncheckedMonomorphicElementAccess( | |
| 386 GetParameter(Descriptor::kReceiver), GetParameter(Descriptor::kName), | |
| 387 NULL, casted_stub()->is_js_array(), casted_stub()->elements_kind(), LOAD, | |
| 388 hole_mode, STANDARD_STORE); | |
| 389 return load; | |
| 390 } | |
| 391 | |
| 392 | |
| 393 Handle<Code> LoadFastElementStub::GenerateCode() { | |
| 394 return DoGenerateCode(this); | |
| 395 } | |
| 396 | |
| 397 | |
| 398 HLoadNamedField* CodeStubGraphBuilderBase::BuildLoadNamedField( | 379 HLoadNamedField* CodeStubGraphBuilderBase::BuildLoadNamedField( |
| 399 HValue* object, FieldIndex index) { | 380 HValue* object, FieldIndex index) { |
| 400 Representation representation = index.is_double() | 381 Representation representation = index.is_double() |
| 401 ? Representation::Double() | 382 ? Representation::Double() |
| 402 : Representation::Tagged(); | 383 : Representation::Tagged(); |
| 403 int offset = index.offset(); | 384 int offset = index.offset(); |
| 404 HObjectAccess access = index.is_inobject() | 385 HObjectAccess access = index.is_inobject() |
| 405 ? HObjectAccess::ForObservableJSObjectOffset(offset, representation) | 386 ? HObjectAccess::ForObservableJSObjectOffset(offset, representation) |
| 406 : HObjectAccess::ForBackingStoreOffset(offset, representation); | 387 : HObjectAccess::ForBackingStoreOffset(offset, representation); |
| 407 if (index.is_double() && | 388 if (index.is_double() && |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 if_true.If<HBranch>(GetParameter(Descriptor::kArgument), stub->hints()); | 773 if_true.If<HBranch>(GetParameter(Descriptor::kArgument), stub->hints()); |
| 793 if_true.Then(); | 774 if_true.Then(); |
| 794 if_true.Return(graph()->GetConstantTrue()); | 775 if_true.Return(graph()->GetConstantTrue()); |
| 795 if_true.Else(); | 776 if_true.Else(); |
| 796 if_true.End(); | 777 if_true.End(); |
| 797 return graph()->GetConstantFalse(); | 778 return graph()->GetConstantFalse(); |
| 798 } | 779 } |
| 799 | 780 |
| 800 Handle<Code> ToBooleanICStub::GenerateCode() { return DoGenerateCode(this); } | 781 Handle<Code> ToBooleanICStub::GenerateCode() { return DoGenerateCode(this); } |
| 801 | 782 |
| 802 template <> | |
| 803 HValue* CodeStubGraphBuilder<LoadDictionaryElementStub>::BuildCodeStub() { | |
| 804 HValue* receiver = GetParameter(Descriptor::kReceiver); | |
| 805 HValue* key = GetParameter(Descriptor::kName); | |
| 806 | |
| 807 Add<HCheckSmi>(key); | |
| 808 | |
| 809 HValue* elements = AddLoadElements(receiver); | |
| 810 | |
| 811 HValue* hash = BuildElementIndexHash(key); | |
| 812 | |
| 813 return BuildUncheckedDictionaryElementLoad(receiver, elements, key, hash); | |
| 814 } | |
| 815 | |
| 816 | |
| 817 Handle<Code> LoadDictionaryElementStub::GenerateCode() { | |
| 818 return DoGenerateCode(this); | |
| 819 } | |
| 820 | |
| 821 } // namespace internal | 783 } // namespace internal |
| 822 } // namespace v8 | 784 } // namespace v8 |
| OLD | NEW |