| 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/conversions.h" | 8 #include "src/conversions.h" |
| 9 #include "src/isolate-inl.h" | 9 #include "src/isolate-inl.h" |
| 10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
| (...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1282 // Allocate the function | 1282 // Allocate the function |
| 1283 Handle<JSFunction> function = NewFunction( | 1283 Handle<JSFunction> function = NewFunction( |
| 1284 name, code, prototype, read_only_prototype); | 1284 name, code, prototype, read_only_prototype); |
| 1285 | 1285 |
| 1286 Handle<Map> initial_map = NewMap( | 1286 Handle<Map> initial_map = NewMap( |
| 1287 type, instance_size, GetInitialFastElementsKind()); | 1287 type, instance_size, GetInitialFastElementsKind()); |
| 1288 if (prototype->IsTheHole() && !function->shared()->is_generator()) { | 1288 if (prototype->IsTheHole() && !function->shared()->is_generator()) { |
| 1289 prototype = NewFunctionPrototype(function); | 1289 prototype = NewFunctionPrototype(function); |
| 1290 } | 1290 } |
| 1291 | 1291 |
| 1292 initial_map->set_prototype(*prototype); | 1292 JSFunction::SetInitialMap(function, initial_map, |
| 1293 JSFunction::SetInitialMap(function, initial_map); | 1293 Handle<JSReceiver>::cast(prototype)); |
| 1294 | 1294 |
| 1295 return function; | 1295 return function; |
| 1296 } | 1296 } |
| 1297 | 1297 |
| 1298 | 1298 |
| 1299 Handle<JSFunction> Factory::NewFunction(Handle<String> name, | 1299 Handle<JSFunction> Factory::NewFunction(Handle<String> name, |
| 1300 Handle<Code> code, | 1300 Handle<Code> code, |
| 1301 InstanceType type, | 1301 InstanceType type, |
| 1302 int instance_size) { | 1302 int instance_size) { |
| 1303 return NewFunction(name, code, the_hole_value(), type, instance_size); | 1303 return NewFunction(name, code, the_hole_value(), type, instance_size); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1314 // properties. | 1314 // properties. |
| 1315 new_map = handle(native_context->generator_object_prototype_map()); | 1315 new_map = handle(native_context->generator_object_prototype_map()); |
| 1316 } else { | 1316 } else { |
| 1317 // Each function prototype gets a fresh map to avoid unwanted sharing of | 1317 // Each function prototype gets a fresh map to avoid unwanted sharing of |
| 1318 // maps between prototypes of different constructors. | 1318 // maps between prototypes of different constructors. |
| 1319 Handle<JSFunction> object_function(native_context->object_function()); | 1319 Handle<JSFunction> object_function(native_context->object_function()); |
| 1320 DCHECK(object_function->has_initial_map()); | 1320 DCHECK(object_function->has_initial_map()); |
| 1321 new_map = handle(object_function->initial_map()); | 1321 new_map = handle(object_function->initial_map()); |
| 1322 } | 1322 } |
| 1323 | 1323 |
| 1324 DCHECK(!new_map->is_prototype_map()); |
| 1324 Handle<JSObject> prototype = NewJSObjectFromMap(new_map); | 1325 Handle<JSObject> prototype = NewJSObjectFromMap(new_map); |
| 1325 | 1326 |
| 1326 if (!function->shared()->is_generator()) { | 1327 if (!function->shared()->is_generator()) { |
| 1327 JSObject::AddProperty(prototype, constructor_string(), function, DONT_ENUM); | 1328 JSObject::AddProperty(prototype, constructor_string(), function, DONT_ENUM); |
| 1328 } | 1329 } |
| 1329 | 1330 |
| 1330 return prototype; | 1331 return prototype; |
| 1331 } | 1332 } |
| 1332 | 1333 |
| 1333 | 1334 |
| (...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2365 return Handle<Object>::null(); | 2366 return Handle<Object>::null(); |
| 2366 } | 2367 } |
| 2367 | 2368 |
| 2368 | 2369 |
| 2369 Handle<Object> Factory::ToBoolean(bool value) { | 2370 Handle<Object> Factory::ToBoolean(bool value) { |
| 2370 return value ? true_value() : false_value(); | 2371 return value ? true_value() : false_value(); |
| 2371 } | 2372 } |
| 2372 | 2373 |
| 2373 | 2374 |
| 2374 } } // namespace v8::internal | 2375 } } // namespace v8::internal |
| OLD | NEW |