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 2142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2153 } | 2153 } |
2154 return args[0]; // return TOS | 2154 return args[0]; // return TOS |
2155 } | 2155 } |
2156 | 2156 |
2157 | 2157 |
2158 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetReadOnlyPrototype) { | 2158 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetReadOnlyPrototype) { |
2159 NoHandleAllocation ha; | 2159 NoHandleAllocation ha; |
2160 RUNTIME_ASSERT(args.length() == 1); | 2160 RUNTIME_ASSERT(args.length() == 1); |
2161 CONVERT_ARG_CHECKED(JSFunction, function, 0); | 2161 CONVERT_ARG_CHECKED(JSFunction, function, 0); |
2162 | 2162 |
2163 MaybeObject* maybe_name = | 2163 String* name = isolate->heap()->prototype_symbol(); |
2164 isolate->heap()->AllocateStringFromAscii(CStrVector("prototype")); | |
2165 String* name; | |
2166 if (!maybe_name->To(&name)) return maybe_name; | |
2167 | 2164 |
2168 if (function->HasFastProperties()) { | 2165 if (function->HasFastProperties()) { |
2169 // Construct a new field descriptor with updated attributes. | 2166 // Construct a new field descriptor with updated attributes. |
2170 DescriptorArray* instance_desc = function->map()->instance_descriptors(); | 2167 DescriptorArray* instance_desc = function->map()->instance_descriptors(); |
2171 | 2168 |
2172 int index = instance_desc->Search(name); | 2169 int index = instance_desc->Search(name); |
2173 ASSERT(index != DescriptorArray::kNotFound); | 2170 ASSERT(index != DescriptorArray::kNotFound); |
2174 PropertyDetails details = instance_desc->GetDetails(index); | 2171 PropertyDetails details = instance_desc->GetDetails(index); |
2175 | 2172 |
2176 CallbacksDescriptor new_desc(name, | 2173 CallbacksDescriptor new_desc(name, |
(...skipping 11541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13718 // Handle last resort GC and make sure to allow future allocations | 13715 // Handle last resort GC and make sure to allow future allocations |
13719 // to grow the heap without causing GCs (if possible). | 13716 // to grow the heap without causing GCs (if possible). |
13720 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13717 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13721 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13718 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13722 "Runtime::PerformGC"); | 13719 "Runtime::PerformGC"); |
13723 } | 13720 } |
13724 } | 13721 } |
13725 | 13722 |
13726 | 13723 |
13727 } } // namespace v8::internal | 13724 } } // namespace v8::internal |
OLD | NEW |