Commit f61bec13 authored by rossberg@chromium.org's avatar rossberg@chromium.org

Reduce register pressure in some runtime functions

Hoped to cure the spurious 3% regression we saw on beloved chromium-rel-win7-dual/sunspider after http://code.google.com/p/v8/source/detail?r=14236

R=mstarzinger@chromium.org
BUG=chromium:233441

Review URL: https://codereview.chromium.org/15297004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14722 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 19e120ad
...@@ -4048,13 +4048,11 @@ MaybeObject* Heap::AllocateFunctionPrototype(JSFunction* function) { ...@@ -4048,13 +4048,11 @@ MaybeObject* Heap::AllocateFunctionPrototype(JSFunction* function) {
// Make sure to use globals from the function's context, since the function // Make sure to use globals from the function's context, since the function
// can be from a different context. // can be from a different context.
Context* native_context = function->context()->native_context(); Context* native_context = function->context()->native_context();
bool needs_constructor_property;
Map* new_map; Map* new_map;
if (function->shared()->is_generator()) { if (function->shared()->is_generator()) {
// Generator prototypes can share maps since they don't have "constructor" // Generator prototypes can share maps since they don't have "constructor"
// properties. // properties.
new_map = native_context->generator_object_prototype_map(); new_map = native_context->generator_object_prototype_map();
needs_constructor_property = false;
} else { } else {
// Each function prototype gets a fresh map to avoid unwanted sharing of // Each function prototype gets a fresh map to avoid unwanted sharing of
// maps between prototypes of different constructors. // maps between prototypes of different constructors.
...@@ -4062,14 +4060,13 @@ MaybeObject* Heap::AllocateFunctionPrototype(JSFunction* function) { ...@@ -4062,14 +4060,13 @@ MaybeObject* Heap::AllocateFunctionPrototype(JSFunction* function) {
ASSERT(object_function->has_initial_map()); ASSERT(object_function->has_initial_map());
MaybeObject* maybe_map = object_function->initial_map()->Copy(); MaybeObject* maybe_map = object_function->initial_map()->Copy();
if (!maybe_map->To(&new_map)) return maybe_map; if (!maybe_map->To(&new_map)) return maybe_map;
needs_constructor_property = true;
} }
Object* prototype; Object* prototype;
MaybeObject* maybe_prototype = AllocateJSObjectFromMap(new_map); MaybeObject* maybe_prototype = AllocateJSObjectFromMap(new_map);
if (!maybe_prototype->ToObject(&prototype)) return maybe_prototype; if (!maybe_prototype->ToObject(&prototype)) return maybe_prototype;
if (needs_constructor_property) { if (!function->shared()->is_generator()) {
MaybeObject* maybe_failure = MaybeObject* maybe_failure =
JSObject::cast(prototype)->SetLocalPropertyIgnoreAttributes( JSObject::cast(prototype)->SetLocalPropertyIgnoreAttributes(
constructor_string(), function, DONT_ENUM); constructor_string(), function, DONT_ENUM);
...@@ -4209,7 +4206,7 @@ MaybeObject* Heap::AllocateInitialMap(JSFunction* fun) { ...@@ -4209,7 +4206,7 @@ MaybeObject* Heap::AllocateInitialMap(JSFunction* fun) {
// the inline_new flag so we only change the map if we generate a // the inline_new flag so we only change the map if we generate a
// specialized construct stub. // specialized construct stub.
ASSERT(in_object_properties <= Map::kMaxPreAllocatedPropertyFields); ASSERT(in_object_properties <= Map::kMaxPreAllocatedPropertyFields);
if (instance_type == JS_OBJECT_TYPE && if (!fun->shared()->is_generator() &&
fun->shared()->CanGenerateInlineConstructor(prototype)) { fun->shared()->CanGenerateInlineConstructor(prototype)) {
int count = fun->shared()->this_property_assignments_count(); int count = fun->shared()->this_property_assignments_count();
if (count > in_object_properties) { if (count > in_object_properties) {
...@@ -4245,7 +4242,7 @@ MaybeObject* Heap::AllocateInitialMap(JSFunction* fun) { ...@@ -4245,7 +4242,7 @@ MaybeObject* Heap::AllocateInitialMap(JSFunction* fun) {
} }
} }
if (instance_type == JS_OBJECT_TYPE) { if (!fun->shared()->is_generator()) {
fun->shared()->StartInobjectSlackTracking(map); fun->shared()->StartInobjectSlackTracking(map);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment