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 2164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2175 CONVERT_ARG_HANDLE_CHECKED(JSFunction, target, 0); | 2175 CONVERT_ARG_HANDLE_CHECKED(JSFunction, target, 0); |
2176 Handle<Object> code = args.at<Object>(1); | 2176 Handle<Object> code = args.at<Object>(1); |
2177 | 2177 |
2178 Handle<Context> context(target->context()); | 2178 Handle<Context> context(target->context()); |
2179 | 2179 |
2180 if (!code->IsNull()) { | 2180 if (!code->IsNull()) { |
2181 RUNTIME_ASSERT(code->IsJSFunction()); | 2181 RUNTIME_ASSERT(code->IsJSFunction()); |
2182 Handle<JSFunction> fun = Handle<JSFunction>::cast(code); | 2182 Handle<JSFunction> fun = Handle<JSFunction>::cast(code); |
2183 Handle<SharedFunctionInfo> shared(fun->shared()); | 2183 Handle<SharedFunctionInfo> shared(fun->shared()); |
2184 | 2184 |
2185 if (!JSFunction::CompileLazy(fun, KEEP_EXCEPTION)) { | 2185 if (!SharedFunctionInfo::EnsureCompiled(shared, KEEP_EXCEPTION)) { |
2186 return Failure::Exception(); | 2186 return Failure::Exception(); |
2187 } | 2187 } |
2188 // Since we don't store the source for this we should never | 2188 // Since we don't store the source for this we should never |
2189 // optimize this. | 2189 // optimize this. |
2190 shared->code()->set_optimizable(false); | 2190 shared->code()->set_optimizable(false); |
2191 // Set the code, scope info, formal parameter count, | 2191 // Set the code, scope info, formal parameter count, |
2192 // and the length of the target function. | 2192 // and the length of the target function. |
2193 target->shared()->set_code(shared->code()); | 2193 target->shared()->set_code(shared->code()); |
2194 target->ReplaceCode(shared->code()); | 2194 target->ReplaceCode(shared->code()); |
2195 target->shared()->set_scope_info(shared->scope_info()); | 2195 target->shared()->set_scope_info(shared->scope_info()); |
(...skipping 11359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13555 // Handle last resort GC and make sure to allow future allocations | 13555 // Handle last resort GC and make sure to allow future allocations |
13556 // to grow the heap without causing GCs (if possible). | 13556 // to grow the heap without causing GCs (if possible). |
13557 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13557 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13558 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13558 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13559 "Runtime::PerformGC"); | 13559 "Runtime::PerformGC"); |
13560 } | 13560 } |
13561 } | 13561 } |
13562 | 13562 |
13563 | 13563 |
13564 } } // namespace v8::internal | 13564 } } // namespace v8::internal |
OLD | NEW |