OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 | 691 |
692 | 692 |
693 Handle<JSFunction> Factory::NewFunction(Handle<String> name, | 693 Handle<JSFunction> Factory::NewFunction(Handle<String> name, |
694 InstanceType type, | 694 InstanceType type, |
695 int instance_size, | 695 int instance_size, |
696 Handle<Code> code, | 696 Handle<Code> code, |
697 bool force_initial_map) { | 697 bool force_initial_map) { |
698 // Allocate the function | 698 // Allocate the function |
699 Handle<JSFunction> function = NewFunction(name, the_hole_value()); | 699 Handle<JSFunction> function = NewFunction(name, the_hole_value()); |
700 | 700 |
701 // Setup the code pointer in both the shared function info and in | 701 // Set up the code pointer in both the shared function info and in |
702 // the function itself. | 702 // the function itself. |
703 function->shared()->set_code(*code); | 703 function->shared()->set_code(*code); |
704 function->set_code(*code); | 704 function->set_code(*code); |
705 | 705 |
706 if (force_initial_map || | 706 if (force_initial_map || |
707 type != JS_OBJECT_TYPE || | 707 type != JS_OBJECT_TYPE || |
708 instance_size != JSObject::kHeaderSize) { | 708 instance_size != JSObject::kHeaderSize) { |
709 Handle<Map> initial_map = NewMap(type, instance_size); | 709 Handle<Map> initial_map = NewMap(type, instance_size); |
710 Handle<JSObject> prototype = NewFunctionPrototype(function); | 710 Handle<JSObject> prototype = NewFunctionPrototype(function); |
711 initial_map->set_prototype(*prototype); | 711 initial_map->set_prototype(*prototype); |
(...skipping 10 matching lines...) Expand all Loading... |
722 | 722 |
723 Handle<JSFunction> Factory::NewFunctionWithPrototype(Handle<String> name, | 723 Handle<JSFunction> Factory::NewFunctionWithPrototype(Handle<String> name, |
724 InstanceType type, | 724 InstanceType type, |
725 int instance_size, | 725 int instance_size, |
726 Handle<JSObject> prototype, | 726 Handle<JSObject> prototype, |
727 Handle<Code> code, | 727 Handle<Code> code, |
728 bool force_initial_map) { | 728 bool force_initial_map) { |
729 // Allocate the function. | 729 // Allocate the function. |
730 Handle<JSFunction> function = NewFunction(name, prototype); | 730 Handle<JSFunction> function = NewFunction(name, prototype); |
731 | 731 |
732 // Setup the code pointer in both the shared function info and in | 732 // Set up the code pointer in both the shared function info and in |
733 // the function itself. | 733 // the function itself. |
734 function->shared()->set_code(*code); | 734 function->shared()->set_code(*code); |
735 function->set_code(*code); | 735 function->set_code(*code); |
736 | 736 |
737 if (force_initial_map || | 737 if (force_initial_map || |
738 type != JS_OBJECT_TYPE || | 738 type != JS_OBJECT_TYPE || |
739 instance_size != JSObject::kHeaderSize) { | 739 instance_size != JSObject::kHeaderSize) { |
740 ElementsKind default_elements_kind = FLAG_smi_only_arrays | 740 ElementsKind default_elements_kind = FLAG_smi_only_arrays |
741 ? FAST_SMI_ONLY_ELEMENTS | 741 ? FAST_SMI_ONLY_ELEMENTS |
742 : FAST_ELEMENTS; | 742 : FAST_ELEMENTS; |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1384 | 1384 |
1385 | 1385 |
1386 Handle<Object> Factory::ToBoolean(bool value) { | 1386 Handle<Object> Factory::ToBoolean(bool value) { |
1387 return Handle<Object>(value | 1387 return Handle<Object>(value |
1388 ? isolate()->heap()->true_value() | 1388 ? isolate()->heap()->true_value() |
1389 : isolate()->heap()->false_value()); | 1389 : isolate()->heap()->false_value()); |
1390 } | 1390 } |
1391 | 1391 |
1392 | 1392 |
1393 } } // namespace v8::internal | 1393 } } // namespace v8::internal |
OLD | NEW |