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

Side by Side Diff: src/runtime.cc

Issue 619006: Refactor the check for generating inline constructors... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 10 months 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 4832 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698