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

Unified Diff: src/factory.cc

Issue 274463003: Directly create API functions with readonly prototypes rather than converting. Remove FunctionSetRe… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove test Created 6 years, 7 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/factory.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index cfcb2f1011562d584f617c3c4d6921c99a88fe01..f4d356b49c67a0b3e6b976406923eed3f4a9f609 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -1210,7 +1210,9 @@ Handle<JSFunction> Factory::NewFunction(Handle<Map> map,
ASSERT((info->strict_mode() == SLOPPY) &&
(map.is_identical_to(isolate()->sloppy_function_map()) ||
map.is_identical_to(
- isolate()->sloppy_function_without_prototype_map())));
+ isolate()->sloppy_function_without_prototype_map()) ||
+ map.is_identical_to(
+ isolate()->sloppy_function_with_readonly_prototype_map())));
return NewFunction(map, info, context);
}
@@ -1230,9 +1232,12 @@ Handle<JSFunction> Factory::NewFunctionWithoutPrototype(Handle<String> name,
Handle<JSFunction> Factory::NewFunction(Handle<String> name,
Handle<Code> code,
- Handle<Object> prototype) {
- Handle<JSFunction> result = NewFunction(
- isolate()->sloppy_function_map(), name, code);
+ Handle<Object> prototype,
+ bool read_only_prototype) {
+ Handle<Map> map = read_only_prototype
+ ? isolate()->sloppy_function_with_readonly_prototype_map()
+ : isolate()->sloppy_function_map();
+ Handle<JSFunction> result = NewFunction(map, name, code);
result->set_prototype_or_initial_map(*prototype);
return result;
}
@@ -1242,9 +1247,11 @@ Handle<JSFunction> Factory::NewFunction(Handle<String> name,
Handle<Code> code,
Handle<Object> prototype,
InstanceType type,
- int instance_size) {
+ int instance_size,
+ bool read_only_prototype) {
// Allocate the function
- Handle<JSFunction> function = NewFunction(name, code, prototype);
+ Handle<JSFunction> function = NewFunction(
+ name, code, prototype, read_only_prototype);
Handle<Map> initial_map = NewMap(
type, instance_size, GetInitialFastElementsKind());
@@ -2101,7 +2108,8 @@ Handle<JSFunction> Factory::CreateApiFunction(
break;
}
- result = NewFunction(empty_string(), code, prototype, type, instance_size);
+ result = NewFunction(empty_string(), code, prototype, type,
+ instance_size, obj->read_only_prototype());
}
result->shared()->set_length(obj->length());
« no previous file with comments | « src/factory.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698