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 2942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2953 source_shared, Handle<Code>(source_shared->code())); | 2953 source_shared, Handle<Code>(source_shared->code())); |
2954 } | 2954 } |
2955 | 2955 |
2956 return *target; | 2956 return *target; |
2957 } | 2957 } |
2958 | 2958 |
2959 | 2959 |
2960 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetExpectedNumberOfProperties) { | 2960 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetExpectedNumberOfProperties) { |
2961 HandleScope scope(isolate); | 2961 HandleScope scope(isolate); |
2962 ASSERT(args.length() == 2); | 2962 ASSERT(args.length() == 2); |
2963 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 2963 CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0); |
2964 CONVERT_SMI_ARG_CHECKED(num, 1); | 2964 CONVERT_SMI_ARG_CHECKED(num, 1); |
2965 RUNTIME_ASSERT(num >= 0); | 2965 RUNTIME_ASSERT(num >= 0); |
2966 SetExpectedNofProperties(function, num); | 2966 // If objects constructed from this function exist then changing |
2967 // 'estimated_nof_properties' is dangerous since the previous value might | |
2968 // have been compiled into the fast construct stub. More over, the inobject | |
rossberg
2013/10/16 09:50:22
Nit: Moreover
| |
2969 // slack tracking logic might have adjusted the previous value, so even | |
2970 // passing the same value is risky. | |
2971 if (!func->shared()->live_objects_may_exist()) { | |
2972 func->shared()->set_expected_nof_properties(num); | |
2973 if (func->has_initial_map()) { | |
2974 Handle<Map> new_initial_map = | |
2975 func->GetIsolate()->factory()->CopyMap( | |
2976 Handle<Map>(func->initial_map())); | |
2977 new_initial_map->set_unused_property_fields(num); | |
2978 func->set_initial_map(*new_initial_map); | |
2979 } | |
2980 } | |
2967 return isolate->heap()->undefined_value(); | 2981 return isolate->heap()->undefined_value(); |
2968 } | 2982 } |
2969 | 2983 |
2970 | 2984 |
2971 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateJSGeneratorObject) { | 2985 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateJSGeneratorObject) { |
2972 SealHandleScope shs(isolate); | 2986 SealHandleScope shs(isolate); |
2973 ASSERT(args.length() == 0); | 2987 ASSERT(args.length() == 0); |
2974 | 2988 |
2975 JavaScriptFrameIterator it(isolate); | 2989 JavaScriptFrameIterator it(isolate); |
2976 JavaScriptFrame* frame = it.frame(); | 2990 JavaScriptFrame* frame = it.frame(); |
(...skipping 11857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
14834 // Handle last resort GC and make sure to allow future allocations | 14848 // Handle last resort GC and make sure to allow future allocations |
14835 // to grow the heap without causing GCs (if possible). | 14849 // to grow the heap without causing GCs (if possible). |
14836 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14850 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14837 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14851 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14838 "Runtime::PerformGC"); | 14852 "Runtime::PerformGC"); |
14839 } | 14853 } |
14840 } | 14854 } |
14841 | 14855 |
14842 | 14856 |
14843 } } // namespace v8::internal | 14857 } } // namespace v8::internal |
OLD | NEW |