OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 4832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4843 PretenureFlag pretenure = (context->global_context() == *context) | 4843 PretenureFlag pretenure = (context->global_context() == *context) |
4844 ? TENURED // Allocate global closures in old space. | 4844 ? TENURED // Allocate global closures in old space. |
4845 : NOT_TENURED; // Allocate local closures in new space. | 4845 : NOT_TENURED; // Allocate local closures in new space. |
4846 Handle<JSFunction> result = | 4846 Handle<JSFunction> result = |
4847 Factory::NewFunctionFromBoilerplate(boilerplate, context, pretenure); | 4847 Factory::NewFunctionFromBoilerplate(boilerplate, context, pretenure); |
4848 return *result; | 4848 return *result; |
4849 } | 4849 } |
4850 | 4850 |
4851 | 4851 |
4852 static Code* ComputeConstructStub(Handle<JSFunction> function) { | 4852 static Code* ComputeConstructStub(Handle<JSFunction> function) { |
4853 if (FLAG_inline_new | 4853 Handle<Object> prototype = Factory::null_value(); |
4854 && function->shared()->has_only_simple_this_property_assignments() | 4854 if (function->has_instance_prototype()) { |
4855 && (!function->has_instance_prototype() | 4855 prototype = Handle<Object>(function->instance_prototype()); |
4856 || !JSObject::cast(function->instance_prototype())->HasSetter())) { | 4856 } |
| 4857 if (function->shared()->CanGenerateInlineConstructor(*prototype)) { |
4857 ConstructStubCompiler compiler; | 4858 ConstructStubCompiler compiler; |
4858 Object* code = compiler.CompileConstructStub(function->shared()); | 4859 Object* code = compiler.CompileConstructStub(function->shared()); |
4859 if (code->IsFailure()) { | 4860 if (code->IsFailure()) { |
4860 return Builtins::builtin(Builtins::JSConstructStubGeneric); | 4861 return Builtins::builtin(Builtins::JSConstructStubGeneric); |
4861 } | 4862 } |
4862 return Code::cast(code); | 4863 return Code::cast(code); |
4863 } | 4864 } |
4864 | 4865 |
4865 return function->shared()->construct_stub(); | 4866 return function->shared()->construct_stub(); |
4866 } | 4867 } |
(...skipping 3372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8239 } else { | 8240 } else { |
8240 // Handle last resort GC and make sure to allow future allocations | 8241 // Handle last resort GC and make sure to allow future allocations |
8241 // to grow the heap without causing GCs (if possible). | 8242 // to grow the heap without causing GCs (if possible). |
8242 Counters::gc_last_resort_from_js.Increment(); | 8243 Counters::gc_last_resort_from_js.Increment(); |
8243 Heap::CollectAllGarbage(false); | 8244 Heap::CollectAllGarbage(false); |
8244 } | 8245 } |
8245 } | 8246 } |
8246 | 8247 |
8247 | 8248 |
8248 } } // namespace v8::internal | 8249 } } // namespace v8::internal |
OLD | NEW |