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/allocation-site-scopes.h" | 7 #include "src/allocation-site-scopes.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/conversions.h" | 9 #include "src/conversions.h" |
10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
(...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1295 Handle<JSFunction> Factory::NewFunction(Handle<String> name, | 1295 Handle<JSFunction> Factory::NewFunction(Handle<String> name, |
1296 Handle<Code> code, | 1296 Handle<Code> code, |
1297 Handle<Object> prototype, | 1297 Handle<Object> prototype, |
1298 InstanceType type, | 1298 InstanceType type, |
1299 int instance_size, | 1299 int instance_size, |
1300 bool read_only_prototype) { | 1300 bool read_only_prototype) { |
1301 // Allocate the function | 1301 // Allocate the function |
1302 Handle<JSFunction> function = NewFunction( | 1302 Handle<JSFunction> function = NewFunction( |
1303 name, code, prototype, read_only_prototype); | 1303 name, code, prototype, read_only_prototype); |
1304 | 1304 |
1305 Handle<Map> initial_map = NewMap( | 1305 ElementsKind elements_kind = |
1306 type, instance_size, GetInitialFastElementsKind()); | 1306 type == JS_ARRAY_TYPE ? FAST_SMI_ELEMENTS : FAST_HOLEY_SMI_ELEMENTS; |
| 1307 Handle<Map> initial_map = NewMap(type, instance_size, elements_kind); |
1307 if (prototype->IsTheHole() && !function->shared()->is_generator()) { | 1308 if (prototype->IsTheHole() && !function->shared()->is_generator()) { |
1308 prototype = NewFunctionPrototype(function); | 1309 prototype = NewFunctionPrototype(function); |
1309 } | 1310 } |
1310 | 1311 |
1311 JSFunction::SetInitialMap(function, initial_map, | 1312 JSFunction::SetInitialMap(function, initial_map, |
1312 Handle<JSReceiver>::cast(prototype)); | 1313 Handle<JSReceiver>::cast(prototype)); |
1313 | 1314 |
1314 return function; | 1315 return function; |
1315 } | 1316 } |
1316 | 1317 |
(...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2397 return Handle<Object>::null(); | 2398 return Handle<Object>::null(); |
2398 } | 2399 } |
2399 | 2400 |
2400 | 2401 |
2401 Handle<Object> Factory::ToBoolean(bool value) { | 2402 Handle<Object> Factory::ToBoolean(bool value) { |
2402 return value ? true_value() : false_value(); | 2403 return value ? true_value() : false_value(); |
2403 } | 2404 } |
2404 | 2405 |
2405 | 2406 |
2406 } } // namespace v8::internal | 2407 } } // namespace v8::internal |
OLD | NEW |