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 2762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2773 ASSERT(args.length() == 2); | 2773 ASSERT(args.length() == 2); |
2774 | 2774 |
2775 CONVERT_ARG_CHECKED(JSFunction, fun, 0); | 2775 CONVERT_ARG_CHECKED(JSFunction, fun, 0); |
2776 CONVERT_SMI_ARG_CHECKED(length, 1); | 2776 CONVERT_SMI_ARG_CHECKED(length, 1); |
2777 fun->shared()->set_length(length); | 2777 fun->shared()->set_length(length); |
2778 return isolate->heap()->undefined_value(); | 2778 return isolate->heap()->undefined_value(); |
2779 } | 2779 } |
2780 | 2780 |
2781 | 2781 |
2782 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetPrototype) { | 2782 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetPrototype) { |
2783 SealHandleScope shs(isolate); | 2783 HandleScope scope(isolate); |
2784 ASSERT(args.length() == 2); | 2784 ASSERT(args.length() == 2); |
2785 | 2785 |
2786 CONVERT_ARG_CHECKED(JSFunction, fun, 0); | 2786 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); |
| 2787 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
2787 ASSERT(fun->should_have_prototype()); | 2788 ASSERT(fun->should_have_prototype()); |
2788 Object* obj; | 2789 Accessors::FunctionSetPrototype(fun, value); |
2789 { MaybeObject* maybe_obj = | |
2790 Accessors::FunctionSetPrototype(fun, args[1], NULL); | |
2791 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | |
2792 } | |
2793 return args[0]; // return TOS | 2790 return args[0]; // return TOS |
2794 } | 2791 } |
2795 | 2792 |
2796 | 2793 |
2797 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetReadOnlyPrototype) { | 2794 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetReadOnlyPrototype) { |
2798 SealHandleScope shs(isolate); | 2795 SealHandleScope shs(isolate); |
2799 RUNTIME_ASSERT(args.length() == 1); | 2796 RUNTIME_ASSERT(args.length() == 1); |
2800 CONVERT_ARG_CHECKED(JSFunction, function, 0); | 2797 CONVERT_ARG_CHECKED(JSFunction, function, 0); |
2801 | 2798 |
2802 String* name = isolate->heap()->prototype_string(); | 2799 String* name = isolate->heap()->prototype_string(); |
(...skipping 11678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14481 // Handle last resort GC and make sure to allow future allocations | 14478 // Handle last resort GC and make sure to allow future allocations |
14482 // to grow the heap without causing GCs (if possible). | 14479 // to grow the heap without causing GCs (if possible). |
14483 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14480 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14484 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14481 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14485 "Runtime::PerformGC"); | 14482 "Runtime::PerformGC"); |
14486 } | 14483 } |
14487 } | 14484 } |
14488 | 14485 |
14489 | 14486 |
14490 } } // namespace v8::internal | 14487 } } // namespace v8::internal |
OLD | NEW |