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<SharedFunctionInfo> shared) { | 4852 static Code* ComputeConstructStub(Handle<SharedFunctionInfo> shared) { |
4853 // TODO(385): Change this to create a construct stub specialized for | |
4854 // the given map to make allocation of simple objects - and maybe | |
4855 // arrays - much faster. | |
4856 if (FLAG_inline_new | 4853 if (FLAG_inline_new |
4857 && shared->has_only_simple_this_property_assignments()) { | 4854 && shared->has_only_simple_this_property_assignments()) { |
4858 ConstructStubCompiler compiler; | 4855 ConstructStubCompiler compiler; |
4859 Object* code = compiler.CompileConstructStub(*shared); | 4856 Object* code = compiler.CompileConstructStub(*shared); |
4860 if (code->IsFailure()) { | 4857 if (code->IsFailure()) { |
4861 return Builtins::builtin(Builtins::JSConstructStubGeneric); | 4858 return Builtins::builtin(Builtins::JSConstructStubGeneric); |
4862 } | 4859 } |
4863 return Code::cast(code); | 4860 return Code::cast(code); |
4864 } | 4861 } |
4865 | 4862 |
(...skipping 3375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8241 } else { | 8238 } else { |
8242 // Handle last resort GC and make sure to allow future allocations | 8239 // Handle last resort GC and make sure to allow future allocations |
8243 // to grow the heap without causing GCs (if possible). | 8240 // to grow the heap without causing GCs (if possible). |
8244 Counters::gc_last_resort_from_js.Increment(); | 8241 Counters::gc_last_resort_from_js.Increment(); |
8245 Heap::CollectAllGarbage(false); | 8242 Heap::CollectAllGarbage(false); |
8246 } | 8243 } |
8247 } | 8244 } |
8248 | 8245 |
8249 | 8246 |
8250 } } // namespace v8::internal | 8247 } } // namespace v8::internal |
OLD | NEW |