OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/hydrogen.h" | 5 #include "src/hydrogen.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 12709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12720 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | 12720 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
12721 HValue* receiver = Pop(); | 12721 HValue* receiver = Pop(); |
12722 | 12722 |
12723 NoObservableSideEffectsScope no_effects(this); | 12723 NoObservableSideEffectsScope no_effects(this); |
12724 HValue* table = BuildAllocateOrderedHashTable<OrderedHashMap>(); | 12724 HValue* table = BuildAllocateOrderedHashTable<OrderedHashMap>(); |
12725 Add<HStoreNamedField>(receiver, HObjectAccess::ForJSCollectionTable(), table); | 12725 Add<HStoreNamedField>(receiver, HObjectAccess::ForJSCollectionTable(), table); |
12726 return ast_context()->ReturnValue(receiver); | 12726 return ast_context()->ReturnValue(receiver); |
12727 } | 12727 } |
12728 | 12728 |
12729 | 12729 |
| 12730 template <typename CollectionType> |
| 12731 void HOptimizedGraphBuilder::BuildOrderedHashTableClear(HValue* receiver) { |
| 12732 HValue* old_table = |
| 12733 Add<HLoadNamedField>(receiver, static_cast<HValue*>(NULL), |
| 12734 HObjectAccess::ForJSCollectionTable()); |
| 12735 HValue* new_table = BuildAllocateOrderedHashTable<CollectionType>(); |
| 12736 Add<HStoreNamedField>( |
| 12737 old_table, HObjectAccess::ForOrderedHashTableNextTable<CollectionType>(), |
| 12738 new_table); |
| 12739 Add<HStoreNamedField>( |
| 12740 old_table, HObjectAccess::ForOrderedHashTableNumberOfDeletedElements< |
| 12741 CollectionType>(), |
| 12742 Add<HConstant>(CollectionType::kClearedTableSentinel)); |
| 12743 Add<HStoreNamedField>(receiver, HObjectAccess::ForJSCollectionTable(), |
| 12744 new_table); |
| 12745 } |
| 12746 |
| 12747 |
| 12748 void HOptimizedGraphBuilder::GenerateSetClear(CallRuntime* call) { |
| 12749 DCHECK(call->arguments()->length() == 1); |
| 12750 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
| 12751 HValue* receiver = Pop(); |
| 12752 |
| 12753 NoObservableSideEffectsScope no_effects(this); |
| 12754 BuildOrderedHashTableClear<OrderedHashSet>(receiver); |
| 12755 return ast_context()->ReturnValue(graph()->GetConstantUndefined()); |
| 12756 } |
| 12757 |
| 12758 |
| 12759 void HOptimizedGraphBuilder::GenerateMapClear(CallRuntime* call) { |
| 12760 DCHECK(call->arguments()->length() == 1); |
| 12761 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
| 12762 HValue* receiver = Pop(); |
| 12763 |
| 12764 NoObservableSideEffectsScope no_effects(this); |
| 12765 BuildOrderedHashTableClear<OrderedHashMap>(receiver); |
| 12766 return ast_context()->ReturnValue(graph()->GetConstantUndefined()); |
| 12767 } |
| 12768 |
| 12769 |
12730 void HOptimizedGraphBuilder::GenerateGetCachedArrayIndex(CallRuntime* call) { | 12770 void HOptimizedGraphBuilder::GenerateGetCachedArrayIndex(CallRuntime* call) { |
12731 DCHECK(call->arguments()->length() == 1); | 12771 DCHECK(call->arguments()->length() == 1); |
12732 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | 12772 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
12733 HValue* value = Pop(); | 12773 HValue* value = Pop(); |
12734 HGetCachedArrayIndex* result = New<HGetCachedArrayIndex>(value); | 12774 HGetCachedArrayIndex* result = New<HGetCachedArrayIndex>(value); |
12735 return ast_context()->ReturnInstruction(result, call->id()); | 12775 return ast_context()->ReturnInstruction(result, call->id()); |
12736 } | 12776 } |
12737 | 12777 |
12738 | 12778 |
12739 void HOptimizedGraphBuilder::GenerateFastOneByteArrayJoin(CallRuntime* call) { | 12779 void HOptimizedGraphBuilder::GenerateFastOneByteArrayJoin(CallRuntime* call) { |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13447 if (ShouldProduceTraceOutput()) { | 13487 if (ShouldProduceTraceOutput()) { |
13448 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13488 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13449 } | 13489 } |
13450 | 13490 |
13451 #ifdef DEBUG | 13491 #ifdef DEBUG |
13452 graph_->Verify(false); // No full verify. | 13492 graph_->Verify(false); // No full verify. |
13453 #endif | 13493 #endif |
13454 } | 13494 } |
13455 | 13495 |
13456 } } // namespace v8::internal | 13496 } } // namespace v8::internal |
OLD | NEW |