OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/builtins/builtins-constructor.h" | 5 #include "src/builtins/builtins-constructor.h" |
6 #include "src/ast/ast.h" | 6 #include "src/ast/ast.h" |
7 #include "src/builtins/builtins-utils.h" | 7 #include "src/builtins/builtins-utils.h" |
8 #include "src/builtins/builtins.h" | 8 #include "src/builtins/builtins.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stub-assembler.h" | 10 #include "src/code-stub-assembler.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 StoreMapNoWriteBarrier(result, map_slot_value); | 119 StoreMapNoWriteBarrier(result, map_slot_value); |
120 | 120 |
121 // Initialize the rest of the function. | 121 // Initialize the rest of the function. |
122 Node* empty_fixed_array = HeapConstant(factory->empty_fixed_array()); | 122 Node* empty_fixed_array = HeapConstant(factory->empty_fixed_array()); |
123 StoreObjectFieldNoWriteBarrier(result, JSObject::kPropertiesOffset, | 123 StoreObjectFieldNoWriteBarrier(result, JSObject::kPropertiesOffset, |
124 empty_fixed_array); | 124 empty_fixed_array); |
125 StoreObjectFieldNoWriteBarrier(result, JSObject::kElementsOffset, | 125 StoreObjectFieldNoWriteBarrier(result, JSObject::kElementsOffset, |
126 empty_fixed_array); | 126 empty_fixed_array); |
127 Node* literals_cell = LoadFixedArrayElement( | 127 Node* literals_cell = LoadFixedArrayElement( |
128 feedback_vector, slot, 0, CodeStubAssembler::SMI_PARAMETERS); | 128 feedback_vector, slot, 0, CodeStubAssembler::SMI_PARAMETERS); |
| 129 { |
| 130 // Bump the closure counter encoded in the cell's map. |
| 131 Node* cell_map = LoadMap(literals_cell); |
| 132 Label no_closures(this), one_closure(this), cell_done(this); |
| 133 |
| 134 GotoIf(IsNoClosuresCellMap(cell_map), &no_closures); |
| 135 GotoIf(IsOneClosureCellMap(cell_map), &one_closure); |
| 136 CSA_ASSERT(this, IsManyClosuresCellMap(cell_map)); |
| 137 Goto(&cell_done); |
| 138 |
| 139 Bind(&no_closures); |
| 140 StoreMapNoWriteBarrier(literals_cell, Heap::kOneClosureCellMapRootIndex); |
| 141 Goto(&cell_done); |
| 142 |
| 143 Bind(&one_closure); |
| 144 StoreMapNoWriteBarrier(literals_cell, Heap::kManyClosuresCellMapRootIndex); |
| 145 Goto(&cell_done); |
| 146 |
| 147 Bind(&cell_done); |
| 148 } |
129 StoreObjectFieldNoWriteBarrier(result, JSFunction::kFeedbackVectorOffset, | 149 StoreObjectFieldNoWriteBarrier(result, JSFunction::kFeedbackVectorOffset, |
130 literals_cell); | 150 literals_cell); |
131 StoreObjectFieldNoWriteBarrier( | 151 StoreObjectFieldNoWriteBarrier( |
132 result, JSFunction::kPrototypeOrInitialMapOffset, TheHoleConstant()); | 152 result, JSFunction::kPrototypeOrInitialMapOffset, TheHoleConstant()); |
133 StoreObjectFieldNoWriteBarrier(result, JSFunction::kSharedFunctionInfoOffset, | 153 StoreObjectFieldNoWriteBarrier(result, JSFunction::kSharedFunctionInfoOffset, |
134 shared_info); | 154 shared_info); |
135 StoreObjectFieldNoWriteBarrier(result, JSFunction::kContextOffset, context); | 155 StoreObjectFieldNoWriteBarrier(result, JSFunction::kContextOffset, context); |
136 Handle<Code> lazy_builtin_handle( | 156 Handle<Code> lazy_builtin_handle( |
137 isolate->builtins()->builtin(Builtins::kCompileLazy)); | 157 isolate->builtins()->builtin(Builtins::kCompileLazy)); |
138 Node* lazy_builtin = HeapConstant(lazy_builtin_handle); | 158 Node* lazy_builtin = HeapConstant(lazy_builtin_handle); |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 case 6: | 779 case 6: |
760 return FastCloneShallowObject6(); | 780 return FastCloneShallowObject6(); |
761 default: | 781 default: |
762 UNREACHABLE(); | 782 UNREACHABLE(); |
763 } | 783 } |
764 return Handle<Code>::null(); | 784 return Handle<Code>::null(); |
765 } | 785 } |
766 | 786 |
767 } // namespace internal | 787 } // namespace internal |
768 } // namespace v8 | 788 } // namespace v8 |
OLD | NEW |