OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/factory.h" | 5 #include "src/factory.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 PretenureFlag pretenure) { | 152 PretenureFlag pretenure) { |
153 DCHECK(0 <= size); | 153 DCHECK(0 <= size); |
154 CALL_HEAP_FUNCTION( | 154 CALL_HEAP_FUNCTION( |
155 isolate(), | 155 isolate(), |
156 isolate()->heap()->AllocateFixedArrayWithFiller(size, | 156 isolate()->heap()->AllocateFixedArrayWithFiller(size, |
157 pretenure, | 157 pretenure, |
158 *the_hole_value()), | 158 *the_hole_value()), |
159 FixedArray); | 159 FixedArray); |
160 } | 160 } |
161 | 161 |
| 162 Handle<FixedArray> Factory::NewFixedArrayWithSmis(int size, int value, |
| 163 PretenureFlag pretenure) { |
| 164 DCHECK_LT(0, size); |
| 165 CALL_HEAP_FUNCTION(isolate(), isolate()->heap()->AllocateFixedArrayWithFiller( |
| 166 size, pretenure, Smi::FromInt(value)), |
| 167 FixedArray); |
| 168 } |
162 | 169 |
163 Handle<FixedArray> Factory::NewUninitializedFixedArray(int size) { | 170 Handle<FixedArray> Factory::NewUninitializedFixedArray(int size) { |
164 CALL_HEAP_FUNCTION( | 171 CALL_HEAP_FUNCTION( |
165 isolate(), | 172 isolate(), |
166 isolate()->heap()->AllocateUninitializedFixedArray(size), | 173 isolate()->heap()->AllocateUninitializedFixedArray(size), |
167 FixedArray); | 174 FixedArray); |
168 } | 175 } |
169 | 176 |
170 | 177 |
171 Handle<FixedArrayBase> Factory::NewFixedDoubleArray(int size, | 178 Handle<FixedArrayBase> Factory::NewFixedDoubleArray(int size, |
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 script->set_name(heap->undefined_value()); | 1050 script->set_name(heap->undefined_value()); |
1044 script->set_id(isolate()->heap()->NextScriptId()); | 1051 script->set_id(isolate()->heap()->NextScriptId()); |
1045 script->set_line_offset(0); | 1052 script->set_line_offset(0); |
1046 script->set_column_offset(0); | 1053 script->set_column_offset(0); |
1047 script->set_context_data(heap->undefined_value()); | 1054 script->set_context_data(heap->undefined_value()); |
1048 script->set_type(Script::TYPE_NORMAL); | 1055 script->set_type(Script::TYPE_NORMAL); |
1049 script->set_wrapper(heap->undefined_value()); | 1056 script->set_wrapper(heap->undefined_value()); |
1050 script->set_line_ends(heap->undefined_value()); | 1057 script->set_line_ends(heap->undefined_value()); |
1051 script->set_eval_from_shared(heap->undefined_value()); | 1058 script->set_eval_from_shared(heap->undefined_value()); |
1052 script->set_eval_from_position(0); | 1059 script->set_eval_from_position(0); |
1053 script->set_shared_function_infos(Smi::kZero); | 1060 script->set_shared_function_infos(*empty_fixed_array(), SKIP_WRITE_BARRIER); |
1054 script->set_flags(0); | 1061 script->set_flags(0); |
1055 | 1062 |
1056 heap->set_script_list(*WeakFixedArray::Add(script_list(), script)); | 1063 heap->set_script_list(*WeakFixedArray::Add(script_list(), script)); |
1057 return script; | 1064 return script; |
1058 } | 1065 } |
1059 | 1066 |
1060 | 1067 |
1061 Handle<Foreign> Factory::NewForeign(Address addr, PretenureFlag pretenure) { | 1068 Handle<Foreign> Factory::NewForeign(Address addr, PretenureFlag pretenure) { |
1062 CALL_HEAP_FUNCTION(isolate(), | 1069 CALL_HEAP_FUNCTION(isolate(), |
1063 isolate()->heap()->AllocateForeign(addr, pretenure), | 1070 isolate()->heap()->AllocateForeign(addr, pretenure), |
(...skipping 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2735 Handle<JSFixedArrayIterator>::cast(NewJSObjectFromMap(map)); | 2742 Handle<JSFixedArrayIterator>::cast(NewJSObjectFromMap(map)); |
2736 iterator->set_initial_next(*next); | 2743 iterator->set_initial_next(*next); |
2737 iterator->set_array(*array); | 2744 iterator->set_array(*array); |
2738 iterator->set_index(0); | 2745 iterator->set_index(0); |
2739 iterator->InObjectPropertyAtPut(JSFixedArrayIterator::kNextIndex, *next); | 2746 iterator->InObjectPropertyAtPut(JSFixedArrayIterator::kNextIndex, *next); |
2740 return iterator; | 2747 return iterator; |
2741 } | 2748 } |
2742 | 2749 |
2743 } // namespace internal | 2750 } // namespace internal |
2744 } // namespace v8 | 2751 } // namespace v8 |
OLD | NEW |