| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 } | 179 } |
| 180 | 180 |
| 181 Handle<FixedArray> Factory::NewUninitializedFixedArray(int size) { | 181 Handle<FixedArray> Factory::NewUninitializedFixedArray(int size) { |
| 182 CALL_HEAP_FUNCTION( | 182 CALL_HEAP_FUNCTION( |
| 183 isolate(), | 183 isolate(), |
| 184 isolate()->heap()->AllocateUninitializedFixedArray(size), | 184 isolate()->heap()->AllocateUninitializedFixedArray(size), |
| 185 FixedArray); | 185 FixedArray); |
| 186 } | 186 } |
| 187 | 187 |
| 188 Handle<BoilerplateDescription> Factory::NewBoilerplateDescription( | 188 Handle<BoilerplateDescription> Factory::NewBoilerplateDescription( |
| 189 int boilerplate, int all_properties, bool has_seen_proto) { | 189 int boilerplate, int all_properties, int index_keys, bool has_seen_proto) { |
| 190 DCHECK_GE(all_properties, 0); | 190 DCHECK_GE(boilerplate, 0); |
| 191 DCHECK_GE(all_properties, index_keys); |
| 192 DCHECK_GE(index_keys, 0); |
| 191 | 193 |
| 192 int backing_store_size = all_properties - (has_seen_proto ? 1 : 0); | 194 int backing_store_size = |
| 195 all_properties - index_keys - (has_seen_proto ? 1 : 0); |
| 193 DCHECK_GE(backing_store_size, 0); | 196 DCHECK_GE(backing_store_size, 0); |
| 194 bool has_different_size_backing_store = boilerplate != backing_store_size; | 197 bool has_different_size_backing_store = boilerplate != backing_store_size; |
| 195 | 198 |
| 196 // Space for name and value for every boilerplate property. | 199 // Space for name and value for every boilerplate property. |
| 197 int size = 2 * boilerplate; | 200 int size = 2 * boilerplate; |
| 198 | 201 |
| 199 if (has_different_size_backing_store) { | 202 if (has_different_size_backing_store) { |
| 200 // An extra entry for the backing store size. | 203 // An extra entry for the backing store size. |
| 201 size++; | 204 size++; |
| 202 } | 205 } |
| 203 | 206 |
| 204 Handle<BoilerplateDescription> description = | 207 Handle<BoilerplateDescription> description = |
| 205 Handle<BoilerplateDescription>::cast(NewFixedArray(size, TENURED)); | 208 Handle<BoilerplateDescription>::cast(NewFixedArray(size, TENURED)); |
| 206 | 209 |
| 207 if (has_different_size_backing_store) { | 210 if (has_different_size_backing_store) { |
| 208 DCHECK((boilerplate != all_properties) || has_seen_proto); | 211 DCHECK((boilerplate != (all_properties - index_keys)) || has_seen_proto); |
| 209 description->set_backing_store_size(isolate(), backing_store_size); | 212 description->set_backing_store_size(isolate(), backing_store_size); |
| 210 } | 213 } |
| 211 return description; | 214 return description; |
| 212 } | 215 } |
| 213 | 216 |
| 214 Handle<FixedArrayBase> Factory::NewFixedDoubleArray(int size, | 217 Handle<FixedArrayBase> Factory::NewFixedDoubleArray(int size, |
| 215 PretenureFlag pretenure) { | 218 PretenureFlag pretenure) { |
| 216 DCHECK(0 <= size); | 219 DCHECK(0 <= size); |
| 217 CALL_HEAP_FUNCTION( | 220 CALL_HEAP_FUNCTION( |
| 218 isolate(), | 221 isolate(), |
| (...skipping 2625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2844 Handle<AccessorInfo> prototype = | 2847 Handle<AccessorInfo> prototype = |
| 2845 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); | 2848 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); |
| 2846 Descriptor d = Descriptor::AccessorConstant( | 2849 Descriptor d = Descriptor::AccessorConstant( |
| 2847 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs); | 2850 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs); |
| 2848 map->AppendDescriptor(&d); | 2851 map->AppendDescriptor(&d); |
| 2849 } | 2852 } |
| 2850 } | 2853 } |
| 2851 | 2854 |
| 2852 } // namespace internal | 2855 } // namespace internal |
| 2853 } // namespace v8 | 2856 } // namespace v8 |
| OLD | NEW |