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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/heap/heap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/extensions/externalize-string-extension.h" 10 #include "src/extensions/externalize-string-extension.h"
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 factory->NewScriptContextTable(); 1074 factory->NewScriptContextTable();
1075 native_context()->set_script_context_table(*script_context_table); 1075 native_context()->set_script_context_table(*script_context_table);
1076 InstallGlobalThisBinding(); 1076 InstallGlobalThisBinding();
1077 1077
1078 Handle<String> object_name = factory->Object_string(); 1078 Handle<String> object_name = factory->Object_string();
1079 JSObject::AddProperty( 1079 JSObject::AddProperty(
1080 global_object, object_name, isolate->object_function(), DONT_ENUM); 1080 global_object, object_name, isolate->object_function(), DONT_ENUM);
1081 1081
1082 Handle<JSObject> global(native_context()->global_object()); 1082 Handle<JSObject> global(native_context()->global_object());
1083 1083
1084 1084 { // --- F u n c t i o n ---
1085 { // Install global Function object
1086 Handle<JSFunction> function_function = 1085 Handle<JSFunction> function_function =
1087 InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize, 1086 InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize,
1088 empty_function, Builtins::kIllegal); 1087 empty_function, Builtins::kIllegal);
1089 function_function->initial_map()->set_is_callable(); 1088 function_function->set_prototype_or_initial_map(
1090 function_function->initial_map()->set_is_constructor(true); 1089 *sloppy_function_map_writable_prototype_);
1091 function_function->shared()->set_construct_stub( 1090 function_function->shared()->set_construct_stub(
1092 *isolate->builtins()->JSBuiltinsConstructStub()); 1091 *isolate->builtins()->JSBuiltinsConstructStub());
1093 InstallWithIntrinsicDefaultProto(isolate, function_function, 1092 InstallWithIntrinsicDefaultProto(isolate, function_function,
1094 Context::FUNCTION_FUNCTION_INDEX); 1093 Context::FUNCTION_FUNCTION_INDEX);
1094
1095 sloppy_function_map_writable_prototype_->SetConstructor(*function_function);
1096 strict_function_map_writable_prototype_->SetConstructor(*function_function);
1097 native_context()->strong_function_map()->SetConstructor(*function_function);
1095 } 1098 }
1096 1099
1097 { // --- A r r a y --- 1100 { // --- A r r a y ---
1098 Handle<JSFunction> array_function = 1101 Handle<JSFunction> array_function =
1099 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize, 1102 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize,
1100 isolate->initial_object_prototype(), 1103 isolate->initial_object_prototype(),
1101 Builtins::kArrayCode); 1104 Builtins::kArrayCode);
1102 array_function->shared()->DontAdaptArguments(); 1105 array_function->shared()->DontAdaptArguments();
1103 array_function->shared()->set_function_data(Smi::FromInt(kArrayCode)); 1106 array_function->shared()->set_function_data(Smi::FromInt(kArrayCode));
1104 1107
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
1865 1868
1866 JSObject::AddProperty( 1869 JSObject::AddProperty(
1867 container, factory->InternalizeUtf8String("GeneratorFunctionPrototype"), 1870 container, factory->InternalizeUtf8String("GeneratorFunctionPrototype"),
1868 generator_function_prototype, NONE); 1871 generator_function_prototype, NONE);
1869 1872
1870 static const bool kUseStrictFunctionMap = true; 1873 static const bool kUseStrictFunctionMap = true;
1871 Handle<JSFunction> generator_function_function = 1874 Handle<JSFunction> generator_function_function =
1872 InstallFunction(container, "GeneratorFunction", JS_FUNCTION_TYPE, 1875 InstallFunction(container, "GeneratorFunction", JS_FUNCTION_TYPE,
1873 JSFunction::kSize, generator_function_prototype, 1876 JSFunction::kSize, generator_function_prototype,
1874 Builtins::kIllegal, kUseStrictFunctionMap); 1877 Builtins::kIllegal, kUseStrictFunctionMap);
1875 generator_function_function->initial_map()->set_is_callable(); 1878 generator_function_function->set_prototype_or_initial_map(
1876 generator_function_function->initial_map()->set_is_constructor(true); 1879 native_context->sloppy_generator_function_map());
1877 generator_function_function->shared()->set_construct_stub( 1880 generator_function_function->shared()->set_construct_stub(
1878 *isolate->builtins()->JSBuiltinsConstructStub()); 1881 *isolate->builtins()->JSBuiltinsConstructStub());
1879 InstallWithIntrinsicDefaultProto( 1882 InstallWithIntrinsicDefaultProto(
1880 isolate, generator_function_function, 1883 isolate, generator_function_function,
1881 Context::GENERATOR_FUNCTION_FUNCTION_INDEX); 1884 Context::GENERATOR_FUNCTION_FUNCTION_INDEX);
1885
1886 native_context->sloppy_generator_function_map()->SetConstructor(
1887 *generator_function_function);
1888 native_context->strict_generator_function_map()->SetConstructor(
1889 *generator_function_function);
1890 native_context->strong_generator_function_map()->SetConstructor(
1891 *generator_function_function);
1882 } 1892 }
1883 1893
1884 { // -- S e t I t e r a t o r 1894 { // -- S e t I t e r a t o r
1885 Handle<JSObject> set_iterator_prototype = 1895 Handle<JSObject> set_iterator_prototype =
1886 isolate->factory()->NewJSObject(isolate->object_function(), TENURED); 1896 isolate->factory()->NewJSObject(isolate->object_function(), TENURED);
1887 SetObjectPrototype(set_iterator_prototype, iterator_prototype); 1897 SetObjectPrototype(set_iterator_prototype, iterator_prototype);
1888 Handle<JSFunction> set_iterator_function = InstallFunction( 1898 Handle<JSFunction> set_iterator_function = InstallFunction(
1889 container, "SetIterator", JS_SET_ITERATOR_TYPE, JSSetIterator::kSize, 1899 container, "SetIterator", JS_SET_ITERATOR_TYPE, JSSetIterator::kSize,
1890 set_iterator_prototype, Builtins::kIllegal); 1900 set_iterator_prototype, Builtins::kIllegal);
1891 native_context->set_set_iterator_map(set_iterator_function->initial_map()); 1901 native_context->set_set_iterator_map(set_iterator_function->initial_map());
(...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after
3294 } 3304 }
3295 3305
3296 3306
3297 // Called when the top-level V8 mutex is destroyed. 3307 // Called when the top-level V8 mutex is destroyed.
3298 void Bootstrapper::FreeThreadResources() { 3308 void Bootstrapper::FreeThreadResources() {
3299 DCHECK(!IsActive()); 3309 DCHECK(!IsActive());
3300 } 3310 }
3301 3311
3302 } // namespace internal 3312 } // namespace internal
3303 } // namespace v8 3313 } // namespace v8
OLDNEW
« 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