OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 | 458 |
459 | 459 |
460 Handle<JSObject> Factory::NewFunctionPrototype(Handle<JSFunction> function) { | 460 Handle<JSObject> Factory::NewFunctionPrototype(Handle<JSFunction> function) { |
461 CALL_HEAP_FUNCTION( | 461 CALL_HEAP_FUNCTION( |
462 isolate(), | 462 isolate(), |
463 isolate()->heap()->AllocateFunctionPrototype(*function), | 463 isolate()->heap()->AllocateFunctionPrototype(*function), |
464 JSObject); | 464 JSObject); |
465 } | 465 } |
466 | 466 |
467 | 467 |
468 Handle<Map> Factory::CopyMapDropDescriptors(Handle<Map> src) { | 468 Handle<Map> Factory::CopyWithPreallocatedFieldDescriptors(Handle<Map> src) { |
469 CALL_HEAP_FUNCTION(isolate(), src->CopyDropDescriptors(), Map); | 469 CALL_HEAP_FUNCTION( |
| 470 isolate(), src->CopyWithPreallocatedFieldDescriptors(), Map); |
470 } | 471 } |
471 | 472 |
472 | 473 |
473 Handle<Map> Factory::CopyMap(Handle<Map> src, | 474 Handle<Map> Factory::CopyMap(Handle<Map> src, |
474 int extra_inobject_properties) { | 475 int extra_inobject_properties) { |
475 Handle<Map> copy = CopyMapDropDescriptors(src); | 476 Handle<Map> copy = CopyWithPreallocatedFieldDescriptors(src); |
476 // Check that we do not overflow the instance size when adding the | 477 // Check that we do not overflow the instance size when adding the |
477 // extra inobject properties. | 478 // extra inobject properties. |
478 int instance_size_delta = extra_inobject_properties * kPointerSize; | 479 int instance_size_delta = extra_inobject_properties * kPointerSize; |
479 int max_instance_size_delta = | 480 int max_instance_size_delta = |
480 JSObject::kMaxInstanceSize - copy->instance_size(); | 481 JSObject::kMaxInstanceSize - copy->instance_size(); |
481 if (instance_size_delta > max_instance_size_delta) { | 482 if (instance_size_delta > max_instance_size_delta) { |
482 // If the instance size overflows, we allocate as many properties | 483 // If the instance size overflows, we allocate as many properties |
483 // as we can as inobject properties. | 484 // as we can as inobject properties. |
484 instance_size_delta = max_instance_size_delta; | 485 instance_size_delta = max_instance_size_delta; |
485 extra_inobject_properties = max_instance_size_delta >> kPointerSizeLog2; | 486 extra_inobject_properties = max_instance_size_delta >> kPointerSizeLog2; |
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1491 | 1492 |
1492 | 1493 |
1493 Handle<Object> Factory::ToBoolean(bool value) { | 1494 Handle<Object> Factory::ToBoolean(bool value) { |
1494 return Handle<Object>(value | 1495 return Handle<Object>(value |
1495 ? isolate()->heap()->true_value() | 1496 ? isolate()->heap()->true_value() |
1496 : isolate()->heap()->false_value()); | 1497 : isolate()->heap()->false_value()); |
1497 } | 1498 } |
1498 | 1499 |
1499 | 1500 |
1500 } } // namespace v8::internal | 1501 } } // namespace v8::internal |
OLD | NEW |