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 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 NoHandleAllocation ha; | 912 NoHandleAllocation ha; |
913 ASSERT(args.length() == 2); | 913 ASSERT(args.length() == 2); |
914 | 914 |
915 CONVERT_CHECKED(JSFunction, fun, args[0]); | 915 CONVERT_CHECKED(JSFunction, fun, args[0]); |
916 Object* obj = Accessors::FunctionSetPrototype(fun, args[1], NULL); | 916 Object* obj = Accessors::FunctionSetPrototype(fun, args[1], NULL); |
917 if (obj->IsFailure()) return obj; | 917 if (obj->IsFailure()) return obj; |
918 return args[0]; // return TOS | 918 return args[0]; // return TOS |
919 } | 919 } |
920 | 920 |
921 | 921 |
| 922 static Object* Runtime_FunctionIsAPIFunction(Arguments args) { |
| 923 NoHandleAllocation ha; |
| 924 ASSERT(args.length() == 1); |
| 925 |
| 926 CONVERT_CHECKED(JSFunction, f, args[0]); |
| 927 // The function_data field of the shared function info is used exclusively by |
| 928 // the API. |
| 929 return !f->shared()->function_data()->IsUndefined() ? Heap::true_value() |
| 930 : Heap::false_value(); |
| 931 } |
| 932 |
| 933 |
922 static Object* Runtime_SetCode(Arguments args) { | 934 static Object* Runtime_SetCode(Arguments args) { |
923 HandleScope scope; | 935 HandleScope scope; |
924 ASSERT(args.length() == 2); | 936 ASSERT(args.length() == 2); |
925 | 937 |
926 CONVERT_CHECKED(JSFunction, raw_target, args[0]); | 938 CONVERT_CHECKED(JSFunction, raw_target, args[0]); |
927 Handle<JSFunction> target(raw_target); | 939 Handle<JSFunction> target(raw_target); |
928 Handle<Object> code = args.at<Object>(1); | 940 Handle<Object> code = args.at<Object>(1); |
929 | 941 |
930 Handle<Context> context(target->context()); | 942 Handle<Context> context(target->context()); |
931 | 943 |
(...skipping 4988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5920 } else { | 5932 } else { |
5921 // Handle last resort GC and make sure to allow future allocations | 5933 // Handle last resort GC and make sure to allow future allocations |
5922 // to grow the heap without causing GCs (if possible). | 5934 // to grow the heap without causing GCs (if possible). |
5923 Counters::gc_last_resort_from_js.Increment(); | 5935 Counters::gc_last_resort_from_js.Increment(); |
5924 Heap::CollectAllGarbage(); | 5936 Heap::CollectAllGarbage(); |
5925 } | 5937 } |
5926 } | 5938 } |
5927 | 5939 |
5928 | 5940 |
5929 } } // namespace v8::internal | 5941 } } // namespace v8::internal |
OLD | NEW |