OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 SetExpectedNofProperties(target, fun->shared()->expected_nof_properties()); | 884 SetExpectedNofProperties(target, fun->shared()->expected_nof_properties()); |
885 if (!fun->is_compiled() && !CompileLazy(fun, KEEP_EXCEPTION)) { | 885 if (!fun->is_compiled() && !CompileLazy(fun, KEEP_EXCEPTION)) { |
886 return Failure::Exception(); | 886 return Failure::Exception(); |
887 } | 887 } |
888 // Set the code, formal parameter count, and the length of the target | 888 // Set the code, formal parameter count, and the length of the target |
889 // function. | 889 // function. |
890 target->set_code(fun->code()); | 890 target->set_code(fun->code()); |
891 target->shared()->set_length(fun->shared()->length()); | 891 target->shared()->set_length(fun->shared()->length()); |
892 target->shared()->set_formal_parameter_count( | 892 target->shared()->set_formal_parameter_count( |
893 fun->shared()->formal_parameter_count()); | 893 fun->shared()->formal_parameter_count()); |
894 // Set the source code of the target function. | 894 // Set the source code of the target function to undefined. |
895 target->shared()->set_script(fun->shared()->script()); | 895 // SetCode is only used for built-in constructors like String, |
896 target->shared()->set_start_position(fun->shared()->start_position()); | 896 // Array, and Object, and some web code |
897 target->shared()->set_end_position(fun->shared()->end_position()); | 897 // doesn't like seeing source code for constructors. |
| 898 target->shared()->set_script(Heap::undefined_value()); |
898 context = Handle<Context>(fun->context()); | 899 context = Handle<Context>(fun->context()); |
899 | 900 |
900 // Make sure we get a fresh copy of the literal vector to avoid | 901 // Make sure we get a fresh copy of the literal vector to avoid |
901 // cross context contamination. | 902 // cross context contamination. |
902 int number_of_literals = fun->NumberOfLiterals(); | 903 int number_of_literals = fun->NumberOfLiterals(); |
903 Handle<FixedArray> literals = | 904 Handle<FixedArray> literals = |
904 Factory::NewFixedArray(number_of_literals, TENURED); | 905 Factory::NewFixedArray(number_of_literals, TENURED); |
905 if (number_of_literals > 0) { | 906 if (number_of_literals > 0) { |
906 // Insert the object, regexp and array functions in the literals | 907 // Insert the object, regexp and array functions in the literals |
907 // array prefix. These are the functions that will be used when | 908 // array prefix. These are the functions that will be used when |
(...skipping 4422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5330 | 5331 |
5331 void Runtime::PerformGC(Object* result) { | 5332 void Runtime::PerformGC(Object* result) { |
5332 Failure* failure = Failure::cast(result); | 5333 Failure* failure = Failure::cast(result); |
5333 // Try to do a garbage collection; ignore it if it fails. The C | 5334 // Try to do a garbage collection; ignore it if it fails. The C |
5334 // entry stub will throw an out-of-memory exception in that case. | 5335 // entry stub will throw an out-of-memory exception in that case. |
5335 Heap::CollectGarbage(failure->requested(), failure->allocation_space()); | 5336 Heap::CollectGarbage(failure->requested(), failure->allocation_space()); |
5336 } | 5337 } |
5337 | 5338 |
5338 | 5339 |
5339 } } // namespace v8::internal | 5340 } } // namespace v8::internal |
OLD | NEW |