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

Unified Diff: src/bootstrapper.cc

Issue 1510753005: Fix Function subclassing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressing comments Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/heap/heap.h » ('j') | src/objects.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index 26857502da6705d59e88a1d81fb8b7e74e3f8686..7297a74d70a3411e6ed9da559fd5d5b8f0382281 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1058,14 +1058,22 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Handle<JSObject> global(native_context()->global_object());
- // Install global Function object
- Handle<JSFunction> function_function =
- InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize,
- empty_function, Builtins::kIllegal);
- function_function->initial_map()->set_is_callable();
- function_function->initial_map()->set_is_constructor(true);
- function_function->shared()->set_construct_stub(
- *isolate->builtins()->JSBuiltinsConstructStub());
+ { // --- F u n c t i o n ---
+ Handle<JSFunction> function_function =
+ InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize,
+ empty_function, Builtins::kIllegal);
+ function_function->set_prototype_or_initial_map(
+ *sloppy_function_map_writable_prototype_);
+ function_function->shared()->set_construct_stub(
+ *isolate->builtins()->JSBuiltinsConstructStub());
+
+ sloppy_function_map_writable_prototype_->set_constructor_or_backpointer(
Toon Verwaest 2015/12/09 21:40:03 SetConstructor?
Igor Sheludko 2015/12/10 10:50:41 Done.
+ *function_function);
+ strict_function_map_writable_prototype_->set_constructor_or_backpointer(
+ *function_function);
+ native_context()->strong_function_map()->set_constructor_or_backpointer(
+ *function_function);
+ }
{ // --- A r r a y ---
Handle<JSFunction> array_function =
@@ -1772,10 +1780,17 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
InstallFunction(container, "GeneratorFunction", JS_FUNCTION_TYPE,
JSFunction::kSize, generator_function_prototype,
Builtins::kIllegal, kUseStrictFunctionMap);
- generator_function_function->initial_map()->set_is_callable();
- generator_function_function->initial_map()->set_is_constructor(true);
+ generator_function_function->set_prototype_or_initial_map(
+ native_context->sloppy_generator_function_map());
generator_function_function->shared()->set_construct_stub(
*isolate->builtins()->JSBuiltinsConstructStub());
+
+ native_context->sloppy_generator_function_map()
+ ->set_constructor_or_backpointer(*generator_function_function);
+ native_context->strict_generator_function_map()
+ ->set_constructor_or_backpointer(*generator_function_function);
+ native_context->strong_generator_function_map()
+ ->set_constructor_or_backpointer(*generator_function_function);
}
{ // -- S e t I t e r a t o r
« no previous file with comments | « no previous file | src/heap/heap.h » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698