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

Unified Diff: src/runtime.cc

Issue 606062: Fix construction of simple objects with setters on prototype... (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/setter-on-constructor-prototype.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
===================================================================
--- src/runtime.cc (revision 3877)
+++ src/runtime.cc (working copy)
@@ -4849,18 +4849,20 @@
}
-static Code* ComputeConstructStub(Handle<SharedFunctionInfo> shared) {
+static Code* ComputeConstructStub(Handle<JSFunction> function) {
if (FLAG_inline_new
- && shared->has_only_simple_this_property_assignments()) {
+ && function->shared()->has_only_simple_this_property_assignments()
+ && (!function->has_instance_prototype()
+ || !JSObject::cast(function->instance_prototype())->HasSetter())) {
ConstructStubCompiler compiler;
- Object* code = compiler.CompileConstructStub(*shared);
+ Object* code = compiler.CompileConstructStub(function->shared());
if (code->IsFailure()) {
return Builtins::builtin(Builtins::JSConstructStubGeneric);
}
return Code::cast(code);
}
- return shared->construct_stub();
+ return function->shared()->construct_stub();
}
@@ -4910,10 +4912,9 @@
bool first_allocation = !function->has_initial_map();
Handle<JSObject> result = Factory::NewJSObject(function);
if (first_allocation) {
- Handle<Map> map = Handle<Map>(function->initial_map());
Handle<Code> stub = Handle<Code>(
- ComputeConstructStub(Handle<SharedFunctionInfo>(function->shared())));
- function->shared()->set_construct_stub(*stub);
+ ComputeConstructStub(Handle<JSFunction>(function)));
+ shared->set_construct_stub(*stub);
}
Counters::constructed_objects.Increment();
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/setter-on-constructor-prototype.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698