OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 7470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7481 } | 7481 } |
7482 | 7482 |
7483 | 7483 |
7484 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewClosure) { | 7484 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewClosure) { |
7485 HandleScope scope(isolate); | 7485 HandleScope scope(isolate); |
7486 ASSERT(args.length() == 3); | 7486 ASSERT(args.length() == 3); |
7487 CONVERT_ARG_CHECKED(Context, context, 0); | 7487 CONVERT_ARG_CHECKED(Context, context, 0); |
7488 CONVERT_ARG_CHECKED(SharedFunctionInfo, shared, 1); | 7488 CONVERT_ARG_CHECKED(SharedFunctionInfo, shared, 1); |
7489 CONVERT_BOOLEAN_CHECKED(pretenure, args[2]); | 7489 CONVERT_BOOLEAN_CHECKED(pretenure, args[2]); |
7490 | 7490 |
7491 // Allocate global closures in old space and allocate local closures | 7491 // The caller ensures that we pretenure closures that are assigned |
7492 // in new space. Additionally pretenure closures that are assigned | |
7493 // directly to properties. | 7492 // directly to properties. |
7494 pretenure = pretenure || (context->global_context() == *context); | |
7495 PretenureFlag pretenure_flag = pretenure ? TENURED : NOT_TENURED; | 7493 PretenureFlag pretenure_flag = pretenure ? TENURED : NOT_TENURED; |
7496 Handle<JSFunction> result = | 7494 Handle<JSFunction> result = |
7497 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, | 7495 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, |
7498 context, | 7496 context, |
7499 pretenure_flag); | 7497 pretenure_flag); |
7500 return *result; | 7498 return *result; |
7501 } | 7499 } |
7502 | 7500 |
7503 | 7501 |
7504 static SmartPointer<Object**> GetNonBoundArguments(int bound_argc, | 7502 static SmartPointer<Object**> GetNonBoundArguments(int bound_argc, |
(...skipping 4955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12460 } else { | 12458 } else { |
12461 // Handle last resort GC and make sure to allow future allocations | 12459 // Handle last resort GC and make sure to allow future allocations |
12462 // to grow the heap without causing GCs (if possible). | 12460 // to grow the heap without causing GCs (if possible). |
12463 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12461 isolate->counters()->gc_last_resort_from_js()->Increment(); |
12464 isolate->heap()->CollectAllGarbage(false); | 12462 isolate->heap()->CollectAllGarbage(false); |
12465 } | 12463 } |
12466 } | 12464 } |
12467 | 12465 |
12468 | 12466 |
12469 } } // namespace v8::internal | 12467 } } // namespace v8::internal |
OLD | NEW |