| 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 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 if (force_initial_map || | 867 if (force_initial_map || |
| 868 type != JS_OBJECT_TYPE || | 868 type != JS_OBJECT_TYPE || |
| 869 instance_size != JSObject::kHeaderSize) { | 869 instance_size != JSObject::kHeaderSize) { |
| 870 Handle<Map> initial_map = NewMap(type, | 870 Handle<Map> initial_map = NewMap(type, |
| 871 instance_size, | 871 instance_size, |
| 872 GetInitialFastElementsKind()); | 872 GetInitialFastElementsKind()); |
| 873 function->set_initial_map(*initial_map); | 873 function->set_initial_map(*initial_map); |
| 874 initial_map->set_constructor(*function); | 874 initial_map->set_constructor(*function); |
| 875 } | 875 } |
| 876 | 876 |
| 877 // Set function.prototype and give the prototype a constructor | |
| 878 // property that refers to the function. | |
| 879 SetPrototypeProperty(function, prototype); | 877 SetPrototypeProperty(function, prototype); |
| 880 // Currently safe because it is only invoked from Genesis. | |
| 881 CHECK_NOT_EMPTY_HANDLE(isolate(), | |
| 882 JSObject::SetLocalPropertyIgnoreAttributes( | |
| 883 prototype, constructor_string(), | |
| 884 function, DONT_ENUM)); | |
| 885 return function; | 878 return function; |
| 886 } | 879 } |
| 887 | 880 |
| 888 | 881 |
| 889 Handle<JSFunction> Factory::NewFunctionWithoutPrototype(Handle<String> name, | 882 Handle<JSFunction> Factory::NewFunctionWithoutPrototype(Handle<String> name, |
| 890 Handle<Code> code) { | 883 Handle<Code> code) { |
| 891 Handle<JSFunction> function = NewFunctionWithoutPrototype(name, | 884 Handle<JSFunction> function = NewFunctionWithoutPrototype(name, |
| 892 CLASSIC_MODE); | 885 CLASSIC_MODE); |
| 893 function->shared()->set_code(*code); | 886 function->shared()->set_code(*code); |
| 894 function->set_code(*code); | 887 function->set_code(*code); |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1479 return Handle<Object>::null(); | 1472 return Handle<Object>::null(); |
| 1480 } | 1473 } |
| 1481 | 1474 |
| 1482 | 1475 |
| 1483 Handle<Object> Factory::ToBoolean(bool value) { | 1476 Handle<Object> Factory::ToBoolean(bool value) { |
| 1484 return value ? true_value() : false_value(); | 1477 return value ? true_value() : false_value(); |
| 1485 } | 1478 } |
| 1486 | 1479 |
| 1487 | 1480 |
| 1488 } } // namespace v8::internal | 1481 } } // namespace v8::internal |
| OLD | NEW |