Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Side by Side Diff: src/runtime.cc

Issue 5220007: Force pretenuring of closures that are immediately assigned to... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 6323 matching lines...) Expand 10 before | Expand all | Expand 10 after
6334 array->set(i, *--parameters, mode); 6334 array->set(i, *--parameters, mode);
6335 } 6335 }
6336 JSObject::cast(result)->set_elements(FixedArray::cast(obj)); 6336 JSObject::cast(result)->set_elements(FixedArray::cast(obj));
6337 } 6337 }
6338 return result; 6338 return result;
6339 } 6339 }
6340 6340
6341 6341
6342 static MaybeObject* Runtime_NewClosure(Arguments args) { 6342 static MaybeObject* Runtime_NewClosure(Arguments args) {
6343 HandleScope scope; 6343 HandleScope scope;
6344 ASSERT(args.length() == 2); 6344 ASSERT(args.length() == 3);
6345 CONVERT_ARG_CHECKED(Context, context, 0); 6345 CONVERT_ARG_CHECKED(Context, context, 0);
6346 CONVERT_ARG_CHECKED(SharedFunctionInfo, shared, 1); 6346 CONVERT_ARG_CHECKED(SharedFunctionInfo, shared, 1);
6347 CONVERT_BOOLEAN_CHECKED(pretenure, args[2]);
6347 6348
6348 PretenureFlag pretenure = (context->global_context() == *context) 6349 // Allocate global closures in old space and allocate local closures
6349 ? TENURED // Allocate global closures in old space. 6350 // in new space. Additionally pretenure closures that are assigned
6350 : NOT_TENURED; // Allocate local closures in new space. 6351 // directly to properties.
6352 pretenure = pretenure || (context->global_context() == *context);
6353 PretenureFlag pretenure_flag = pretenure ? TENURED : NOT_TENURED;
6351 Handle<JSFunction> result = 6354 Handle<JSFunction> result =
6352 Factory::NewFunctionFromSharedFunctionInfo(shared, context, pretenure); 6355 Factory::NewFunctionFromSharedFunctionInfo(shared,
6356 context,
6357 pretenure_flag);
6353 return *result; 6358 return *result;
6354 } 6359 }
6355 6360
6356 static MaybeObject* Runtime_NewObjectFromBound(Arguments args) { 6361 static MaybeObject* Runtime_NewObjectFromBound(Arguments args) {
6357 HandleScope scope; 6362 HandleScope scope;
6358 ASSERT(args.length() == 2); 6363 ASSERT(args.length() == 2);
6359 CONVERT_ARG_CHECKED(JSFunction, function, 0); 6364 CONVERT_ARG_CHECKED(JSFunction, function, 0);
6360 CONVERT_ARG_CHECKED(JSArray, params, 1); 6365 CONVERT_ARG_CHECKED(JSArray, params, 1);
6361 6366
6362 RUNTIME_ASSERT(params->HasFastElements()); 6367 RUNTIME_ASSERT(params->HasFastElements());
(...skipping 3958 matching lines...) Expand 10 before | Expand all | Expand 10 after
10321 } else { 10326 } else {
10322 // Handle last resort GC and make sure to allow future allocations 10327 // Handle last resort GC and make sure to allow future allocations
10323 // to grow the heap without causing GCs (if possible). 10328 // to grow the heap without causing GCs (if possible).
10324 Counters::gc_last_resort_from_js.Increment(); 10329 Counters::gc_last_resort_from_js.Increment();
10325 Heap::CollectAllGarbage(false); 10330 Heap::CollectAllGarbage(false);
10326 } 10331 }
10327 } 10332 }
10328 10333
10329 10334
10330 } } // namespace v8::internal 10335 } } // namespace v8::internal
OLDNEW
« src/arm/codegen-arm.cc ('K') | « src/runtime.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698