OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 2639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2650 memento_create_count->ClearFlag(HValue::kCanOverflow); | 2650 memento_create_count->ClearFlag(HValue::kCanOverflow); |
2651 HStoreNamedField* store = Add<HStoreNamedField>( | 2651 HStoreNamedField* store = Add<HStoreNamedField>( |
2652 allocation_site, HObjectAccess::ForAllocationSiteOffset( | 2652 allocation_site, HObjectAccess::ForAllocationSiteOffset( |
2653 AllocationSite::kMementoCreateCountOffset), memento_create_count); | 2653 AllocationSite::kMementoCreateCountOffset), memento_create_count); |
2654 // No write barrier needed to store a smi. | 2654 // No write barrier needed to store a smi. |
2655 store->SkipWriteBarrier(); | 2655 store->SkipWriteBarrier(); |
2656 } | 2656 } |
2657 } | 2657 } |
2658 | 2658 |
2659 | 2659 |
| 2660 HInstruction* HGraphBuilder::BuildGetNativeContext(HValue* closure) { |
| 2661 // Get the global context, then the native context |
| 2662 HInstruction* context = |
| 2663 Add<HLoadNamedField>(closure, HObjectAccess::ForFunctionContextPointer()); |
| 2664 HInstruction* global_object = Add<HLoadNamedField>(context, |
| 2665 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); |
| 2666 HObjectAccess access = HObjectAccess::ForJSObjectOffset( |
| 2667 GlobalObject::kNativeContextOffset); |
| 2668 return Add<HLoadNamedField>(global_object, access); |
| 2669 } |
| 2670 |
| 2671 |
2660 HInstruction* HGraphBuilder::BuildGetNativeContext() { | 2672 HInstruction* HGraphBuilder::BuildGetNativeContext() { |
2661 // Get the global context, then the native context | 2673 // Get the global context, then the native context |
2662 HInstruction* global_object = Add<HGlobalObject>(); | 2674 HInstruction* global_object = Add<HGlobalObject>(); |
2663 HObjectAccess access = HObjectAccess::ForJSObjectOffset( | 2675 HObjectAccess access = HObjectAccess::ForJSObjectOffset( |
2664 GlobalObject::kNativeContextOffset); | 2676 GlobalObject::kNativeContextOffset); |
2665 return Add<HLoadNamedField>(global_object, access); | 2677 return Add<HLoadNamedField>(global_object, access); |
2666 } | 2678 } |
2667 | 2679 |
2668 | 2680 |
2669 HInstruction* HGraphBuilder::BuildGetArrayFunction() { | 2681 HInstruction* HGraphBuilder::BuildGetArrayFunction() { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2709 return builder()->Add<HConstant>(map); | 2721 return builder()->Add<HConstant>(map); |
2710 } | 2722 } |
2711 | 2723 |
2712 if (constructor_function_ != NULL && kind_ == GetInitialFastElementsKind()) { | 2724 if (constructor_function_ != NULL && kind_ == GetInitialFastElementsKind()) { |
2713 // No need for a context lookup if the kind_ matches the initial | 2725 // No need for a context lookup if the kind_ matches the initial |
2714 // map, because we can just load the map in that case. | 2726 // map, because we can just load the map in that case. |
2715 HObjectAccess access = HObjectAccess::ForPrototypeOrInitialMap(); | 2727 HObjectAccess access = HObjectAccess::ForPrototypeOrInitialMap(); |
2716 return builder()->AddLoadNamedField(constructor_function_, access); | 2728 return builder()->AddLoadNamedField(constructor_function_, access); |
2717 } | 2729 } |
2718 | 2730 |
2719 HInstruction* native_context = builder()->BuildGetNativeContext(); | 2731 // TODO(mvstanton): we should always have a constructor function if we |
| 2732 // are creating a stub. |
| 2733 HInstruction* native_context = constructor_function_ != NULL |
| 2734 ? builder()->BuildGetNativeContext(constructor_function_) |
| 2735 : builder()->BuildGetNativeContext(); |
| 2736 |
2720 HInstruction* index = builder()->Add<HConstant>( | 2737 HInstruction* index = builder()->Add<HConstant>( |
2721 static_cast<int32_t>(Context::JS_ARRAY_MAPS_INDEX)); | 2738 static_cast<int32_t>(Context::JS_ARRAY_MAPS_INDEX)); |
2722 | 2739 |
2723 HInstruction* map_array = builder()->Add<HLoadKeyed>( | 2740 HInstruction* map_array = builder()->Add<HLoadKeyed>( |
2724 native_context, index, static_cast<HValue*>(NULL), FAST_ELEMENTS); | 2741 native_context, index, static_cast<HValue*>(NULL), FAST_ELEMENTS); |
2725 | 2742 |
2726 HInstruction* kind_index = builder()->Add<HConstant>(kind_); | 2743 HInstruction* kind_index = builder()->Add<HConstant>(kind_); |
2727 | 2744 |
2728 return builder()->Add<HLoadKeyed>( | 2745 return builder()->Add<HLoadKeyed>( |
2729 map_array, kind_index, static_cast<HValue*>(NULL), FAST_ELEMENTS); | 2746 map_array, kind_index, static_cast<HValue*>(NULL), FAST_ELEMENTS); |
(...skipping 8214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10944 if (ShouldProduceTraceOutput()) { | 10961 if (ShouldProduceTraceOutput()) { |
10945 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 10962 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
10946 } | 10963 } |
10947 | 10964 |
10948 #ifdef DEBUG | 10965 #ifdef DEBUG |
10949 graph_->Verify(false); // No full verify. | 10966 graph_->Verify(false); // No full verify. |
10950 #endif | 10967 #endif |
10951 } | 10968 } |
10952 | 10969 |
10953 } } // namespace v8::internal | 10970 } } // namespace v8::internal |
OLD | NEW |