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

Side by Side Diff: bleeding_edge/src/runtime.cc

Issue 506037: Improve performance of allocating closures for nested... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years 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
« bleeding_edge/src/objects.h ('K') | « bleeding_edge/src/objects-inl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 } 713 }
714 // The property already exists without conflicting: Go to 714 // The property already exists without conflicting: Go to
715 // the next declaration. 715 // the next declaration.
716 continue; 716 continue;
717 } 717 }
718 } 718 }
719 } else { 719 } else {
720 // Copy the function and update its context. Use it as value. 720 // Copy the function and update its context. Use it as value.
721 Handle<JSFunction> boilerplate = Handle<JSFunction>::cast(value); 721 Handle<JSFunction> boilerplate = Handle<JSFunction>::cast(value);
722 Handle<JSFunction> function = 722 Handle<JSFunction> function =
723 Factory::NewFunctionFromBoilerplate(boilerplate, context); 723 Factory::NewFunctionFromBoilerplate(boilerplate, context, TENURED);
724 value = function; 724 value = function;
725 } 725 }
726 726
727 LookupResult lookup; 727 LookupResult lookup;
728 global->LocalLookup(*name, &lookup); 728 global->LocalLookup(*name, &lookup);
729 729
730 PropertyAttributes attributes = is_const_property 730 PropertyAttributes attributes = is_const_property
731 ? static_cast<PropertyAttributes>(base | READ_ONLY) 731 ? static_cast<PropertyAttributes>(base | READ_ONLY)
732 : base; 732 : base;
733 733
(...skipping 3761 matching lines...) Expand 10 before | Expand all | Expand 10 after
4495 return result; 4495 return result;
4496 } 4496 }
4497 4497
4498 4498
4499 static Object* Runtime_NewClosure(Arguments args) { 4499 static Object* Runtime_NewClosure(Arguments args) {
4500 HandleScope scope; 4500 HandleScope scope;
4501 ASSERT(args.length() == 2); 4501 ASSERT(args.length() == 2);
4502 CONVERT_ARG_CHECKED(Context, context, 0); 4502 CONVERT_ARG_CHECKED(Context, context, 0);
4503 CONVERT_ARG_CHECKED(JSFunction, boilerplate, 1); 4503 CONVERT_ARG_CHECKED(JSFunction, boilerplate, 1);
4504 4504
4505 PretenureFlag pretenure = (context->global_context() == *context)
4506 ? TENURED // Allocate global closures in old space.
4507 : NOT_TENURED; // Allocate local closures in new space.
4505 Handle<JSFunction> result = 4508 Handle<JSFunction> result =
4506 Factory::NewFunctionFromBoilerplate(boilerplate, context); 4509 Factory::NewFunctionFromBoilerplate(boilerplate, context, pretenure);
4507 return *result; 4510 return *result;
4508 } 4511 }
4509 4512
4510 4513
4511 static Code* ComputeConstructStub(Handle<SharedFunctionInfo> shared) { 4514 static Code* ComputeConstructStub(Handle<SharedFunctionInfo> shared) {
4512 // TODO(385): Change this to create a construct stub specialized for 4515 // TODO(385): Change this to create a construct stub specialized for
4513 // the given map to make allocation of simple objects - and maybe 4516 // the given map to make allocation of simple objects - and maybe
4514 // arrays - much faster. 4517 // arrays - much faster.
4515 if (FLAG_inline_new 4518 if (FLAG_inline_new
4516 && shared->has_only_simple_this_property_assignments()) { 4519 && shared->has_only_simple_this_property_assignments()) {
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
5212 // Compile source string in the global context. 5215 // Compile source string in the global context.
5213 Handle<Context> context(Top::context()->global_context()); 5216 Handle<Context> context(Top::context()->global_context());
5214 Compiler::ValidationState validate = (is_json->IsTrue()) 5217 Compiler::ValidationState validate = (is_json->IsTrue())
5215 ? Compiler::VALIDATE_JSON : Compiler::DONT_VALIDATE_JSON; 5218 ? Compiler::VALIDATE_JSON : Compiler::DONT_VALIDATE_JSON;
5216 Handle<JSFunction> boilerplate = Compiler::CompileEval(source, 5219 Handle<JSFunction> boilerplate = Compiler::CompileEval(source,
5217 context, 5220 context,
5218 true, 5221 true,
5219 validate); 5222 validate);
5220 if (boilerplate.is_null()) return Failure::Exception(); 5223 if (boilerplate.is_null()) return Failure::Exception();
5221 Handle<JSFunction> fun = 5224 Handle<JSFunction> fun =
5222 Factory::NewFunctionFromBoilerplate(boilerplate, context); 5225 Factory::NewFunctionFromBoilerplate(boilerplate, context, NOT_TENURED);
5223 return *fun; 5226 return *fun;
5224 } 5227 }
5225 5228
5226 5229
5227 static Handle<JSFunction> GetBuiltinFunction(String* name) { 5230 static Handle<JSFunction> GetBuiltinFunction(String* name) {
5228 LookupResult result; 5231 LookupResult result;
5229 Top::global_context()->builtins()->LocalLookup(name, &result); 5232 Top::global_context()->builtins()->LocalLookup(name, &result);
5230 return Handle<JSFunction>(JSFunction::cast(result.GetValue())); 5233 return Handle<JSFunction>(JSFunction::cast(result.GetValue()));
5231 } 5234 }
5232 5235
5233 5236
5234 static Object* CompileDirectEval(Handle<String> source) { 5237 static Object* CompileDirectEval(Handle<String> source) {
5235 // Compute the eval context. 5238 // Compute the eval context.
5236 HandleScope scope; 5239 HandleScope scope;
5237 StackFrameLocator locator; 5240 StackFrameLocator locator;
5238 JavaScriptFrame* frame = locator.FindJavaScriptFrame(0); 5241 JavaScriptFrame* frame = locator.FindJavaScriptFrame(0);
5239 Handle<Context> context(Context::cast(frame->context())); 5242 Handle<Context> context(Context::cast(frame->context()));
5240 bool is_global = context->IsGlobalContext(); 5243 bool is_global = context->IsGlobalContext();
5241 5244
5242 // Compile source string in the current context. 5245 // Compile source string in the current context.
5243 Handle<JSFunction> boilerplate = Compiler::CompileEval( 5246 Handle<JSFunction> boilerplate = Compiler::CompileEval(
5244 source, 5247 source,
5245 context, 5248 context,
5246 is_global, 5249 is_global,
5247 Compiler::DONT_VALIDATE_JSON); 5250 Compiler::DONT_VALIDATE_JSON);
5248 if (boilerplate.is_null()) return Failure::Exception(); 5251 if (boilerplate.is_null()) return Failure::Exception();
5249 Handle<JSFunction> fun = 5252 Handle<JSFunction> fun =
5250 Factory::NewFunctionFromBoilerplate(boilerplate, context); 5253 Factory::NewFunctionFromBoilerplate(boilerplate, context, NOT_TENURED);
5251 return *fun; 5254 return *fun;
5252 } 5255 }
5253 5256
5254 5257
5255 static Object* Runtime_ResolvePossiblyDirectEval(Arguments args) { 5258 static Object* Runtime_ResolvePossiblyDirectEval(Arguments args) {
5256 ASSERT(args.length() == 2); 5259 ASSERT(args.length() == 2);
5257 5260
5258 HandleScope scope; 5261 HandleScope scope;
5259 5262
5260 CONVERT_ARG_CHECKED(JSFunction, callee, 0); 5263 CONVERT_ARG_CHECKED(JSFunction, callee, 0);
(...skipping 2778 matching lines...) Expand 10 before | Expand all | Expand 10 after
8039 } else { 8042 } else {
8040 // Handle last resort GC and make sure to allow future allocations 8043 // Handle last resort GC and make sure to allow future allocations
8041 // to grow the heap without causing GCs (if possible). 8044 // to grow the heap without causing GCs (if possible).
8042 Counters::gc_last_resort_from_js.Increment(); 8045 Counters::gc_last_resort_from_js.Increment();
8043 Heap::CollectAllGarbage(false); 8046 Heap::CollectAllGarbage(false);
8044 } 8047 }
8045 } 8048 }
8046 8049
8047 8050
8048 } } // namespace v8::internal 8051 } } // namespace v8::internal
OLDNEW
« bleeding_edge/src/objects.h ('K') | « bleeding_edge/src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698