| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 | 534 |
| 535 HValue* js_array = GetParameter(0); | 535 HValue* js_array = GetParameter(0); |
| 536 HValue* map = GetParameter(1); | 536 HValue* map = GetParameter(1); |
| 537 | 537 |
| 538 info()->MarkAsSavesCallerDoubles(); | 538 info()->MarkAsSavesCallerDoubles(); |
| 539 | 539 |
| 540 if (AllocationSite::GetMode(from_kind, to_kind) == TRACK_ALLOCATION_SITE) { | 540 if (AllocationSite::GetMode(from_kind, to_kind) == TRACK_ALLOCATION_SITE) { |
| 541 Add<HTrapAllocationMemento>(js_array); | 541 Add<HTrapAllocationMemento>(js_array); |
| 542 } | 542 } |
| 543 | 543 |
| 544 HInstruction* array_length = | 544 HInstruction* elements = AddLoadElements(js_array); |
| 545 AddLoad(js_array, HObjectAccess::ForArrayLength()); | 545 |
| 546 array_length->set_type(HType::Smi()); | 546 HInstruction* empty_fixed_array = Add<HConstant>( |
| 547 isolate()->factory()->empty_fixed_array(), Representation::Tagged()); |
| 547 | 548 |
| 548 IfBuilder if_builder(this); | 549 IfBuilder if_builder(this); |
| 549 | 550 |
| 550 if_builder.IfNot<HCompareNumericAndBranch>(array_length, | 551 if_builder.IfNot<HCompareObjectEqAndBranch>(elements, empty_fixed_array); |
| 551 graph()->GetConstant0(), | 552 |
| 552 Token::EQ); | |
| 553 if_builder.Then(); | 553 if_builder.Then(); |
| 554 | 554 |
| 555 HInstruction* elements = AddLoadElements(js_array); | 555 HInstruction* elements_length = AddLoadFixedArrayLength(elements); |
| 556 | 556 |
| 557 HInstruction* elements_length = AddLoadFixedArrayLength(elements); | 557 HInstruction* array_length = AddLoad( |
| 558 js_array, HObjectAccess::ForArrayLength(), NULL, Representation::Smi()); |
| 559 array_length->set_type(HType::Smi()); |
| 558 | 560 |
| 559 BuildGrowElementsCapacity(js_array, elements, from_kind, to_kind, | 561 BuildGrowElementsCapacity(js_array, elements, from_kind, to_kind, |
| 560 array_length, elements_length); | 562 array_length, elements_length); |
| 561 | 563 |
| 562 if_builder.End(); | 564 if_builder.End(); |
| 563 | 565 |
| 564 AddStore(js_array, HObjectAccess::ForMap(), map); | 566 AddStore(js_array, HObjectAccess::ForMap(), map); |
| 565 | 567 |
| 566 return js_array; | 568 return js_array; |
| 567 } | 569 } |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 return DoGenerateCode(this); | 779 return DoGenerateCode(this); |
| 778 } | 780 } |
| 779 | 781 |
| 780 | 782 |
| 781 template <> | 783 template <> |
| 782 HValue* CodeStubGraphBuilder<CompareNilICStub>::BuildCodeInitializedStub() { | 784 HValue* CodeStubGraphBuilder<CompareNilICStub>::BuildCodeInitializedStub() { |
| 783 Isolate* isolate = graph()->isolate(); | 785 Isolate* isolate = graph()->isolate(); |
| 784 CompareNilICStub* stub = casted_stub(); | 786 CompareNilICStub* stub = casted_stub(); |
| 785 HIfContinuation continuation; | 787 HIfContinuation continuation; |
| 786 Handle<Map> sentinel_map(isolate->heap()->meta_map()); | 788 Handle<Map> sentinel_map(isolate->heap()->meta_map()); |
| 787 Handle<Type> type = | 789 Handle<Type> type = stub->GetType(isolate, sentinel_map); |
| 788 CompareNilICStub::StateToType(isolate, stub->GetState(), sentinel_map); | |
| 789 BuildCompareNil(GetParameter(0), type, RelocInfo::kNoPosition, &continuation); | 790 BuildCompareNil(GetParameter(0), type, RelocInfo::kNoPosition, &continuation); |
| 790 IfBuilder if_nil(this, &continuation); | 791 IfBuilder if_nil(this, &continuation); |
| 791 if_nil.Then(); | 792 if_nil.Then(); |
| 792 if (continuation.IsFalseReachable()) { | 793 if (continuation.IsFalseReachable()) { |
| 793 if_nil.Else(); | 794 if_nil.Else(); |
| 794 if_nil.Return(graph()->GetConstant0()); | 795 if_nil.Return(graph()->GetConstant0()); |
| 795 } | 796 } |
| 796 if_nil.End(); | 797 if_nil.End(); |
| 797 return continuation.IsTrueReachable() | 798 return continuation.IsTrueReachable() |
| 798 ? graph()->GetConstant1() | 799 ? graph()->GetConstant1() |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 return value; | 904 return value; |
| 904 } | 905 } |
| 905 | 906 |
| 906 | 907 |
| 907 Handle<Code> StoreGlobalStub::GenerateCode() { | 908 Handle<Code> StoreGlobalStub::GenerateCode() { |
| 908 return DoGenerateCode(this); | 909 return DoGenerateCode(this); |
| 909 } | 910 } |
| 910 | 911 |
| 911 | 912 |
| 912 } } // namespace v8::internal | 913 } } // namespace v8::internal |
| OLD | NEW |