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

Unified Diff: src/bootstrapper.cc

Issue 1510753005: Fix Function subclassing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Adressing 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') | no next file with comments »
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 17a593dadf8e45b239be44c48bac08161fa7bb0d..a5a1da3bc388c93da101a88aca261caccebdddff 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1081,17 +1081,20 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Handle<JSObject> global(native_context()->global_object());
-
- { // Install global Function object
+ { // --- 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->initial_map()->set_is_callable();
- function_function->initial_map()->set_is_constructor(true);
+ function_function->set_prototype_or_initial_map(
+ *sloppy_function_map_writable_prototype_);
function_function->shared()->set_construct_stub(
*isolate->builtins()->JSBuiltinsConstructStub());
InstallWithIntrinsicDefaultProto(isolate, function_function,
Context::FUNCTION_FUNCTION_INDEX);
+
+ sloppy_function_map_writable_prototype_->SetConstructor(*function_function);
+ strict_function_map_writable_prototype_->SetConstructor(*function_function);
+ native_context()->strong_function_map()->SetConstructor(*function_function);
}
{ // --- A r r a y ---
@@ -1872,13 +1875,20 @@ 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());
InstallWithIntrinsicDefaultProto(
isolate, generator_function_function,
Context::GENERATOR_FUNCTION_FUNCTION_INDEX);
+
+ native_context->sloppy_generator_function_map()->SetConstructor(
+ *generator_function_function);
+ native_context->strict_generator_function_map()->SetConstructor(
+ *generator_function_function);
+ native_context->strong_generator_function_map()->SetConstructor(
+ *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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698