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

Side by Side Diff: src/bootstrapper.cc

Issue 1415683007: Reland "[es6] Fix Function and GeneratorFunction built-ins subclassing." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@fix-subclass
Patch Set: Improved test Created 5 years, 1 month 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/factory.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 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 JSObject::AddProperty( 1094 JSObject::AddProperty(
1095 global_object, object_name, isolate->object_function(), DONT_ENUM); 1095 global_object, object_name, isolate->object_function(), DONT_ENUM);
1096 1096
1097 Handle<JSObject> global(native_context()->global_object()); 1097 Handle<JSObject> global(native_context()->global_object());
1098 1098
1099 // Install global Function object 1099 // Install global Function object
1100 Handle<JSFunction> function_function = 1100 Handle<JSFunction> function_function =
1101 InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize, 1101 InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize,
1102 empty_function, Builtins::kIllegal); 1102 empty_function, Builtins::kIllegal);
1103 function_function->initial_map()->set_is_callable(); 1103 function_function->initial_map()->set_is_callable();
1104 function_function->initial_map()->set_is_constructor(true);
1104 1105
1105 { // --- A r r a y --- 1106 { // --- A r r a y ---
1106 Handle<JSFunction> array_function = 1107 Handle<JSFunction> array_function =
1107 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize, 1108 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize,
1108 isolate->initial_object_prototype(), 1109 isolate->initial_object_prototype(),
1109 Builtins::kArrayCode); 1110 Builtins::kArrayCode);
1110 array_function->shared()->DontAdaptArguments(); 1111 array_function->shared()->DontAdaptArguments();
1111 array_function->shared()->set_function_data(Smi::FromInt(kArrayCode)); 1112 array_function->shared()->set_function_data(Smi::FromInt(kArrayCode));
1112 1113
1113 // This seems a bit hackish, but we need to make sure Array.length 1114 // This seems a bit hackish, but we need to make sure Array.length
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
1906 JSObject::AddProperty( 1907 JSObject::AddProperty(
1907 container, factory->InternalizeUtf8String("GeneratorFunctionPrototype"), 1908 container, factory->InternalizeUtf8String("GeneratorFunctionPrototype"),
1908 generator_function_prototype, NONE); 1909 generator_function_prototype, NONE);
1909 1910
1910 static const bool kUseStrictFunctionMap = true; 1911 static const bool kUseStrictFunctionMap = true;
1911 Handle<JSFunction> generator_function_function = 1912 Handle<JSFunction> generator_function_function =
1912 InstallFunction(container, "GeneratorFunction", JS_FUNCTION_TYPE, 1913 InstallFunction(container, "GeneratorFunction", JS_FUNCTION_TYPE,
1913 JSFunction::kSize, generator_function_prototype, 1914 JSFunction::kSize, generator_function_prototype,
1914 Builtins::kIllegal, kUseStrictFunctionMap); 1915 Builtins::kIllegal, kUseStrictFunctionMap);
1915 generator_function_function->initial_map()->set_is_callable(); 1916 generator_function_function->initial_map()->set_is_callable();
1917 generator_function_function->initial_map()->set_is_constructor(true);
1916 } 1918 }
1917 1919
1918 { // -- S e t I t e r a t o r 1920 { // -- S e t I t e r a t o r
1919 Handle<JSObject> set_iterator_prototype = 1921 Handle<JSObject> set_iterator_prototype =
1920 isolate->factory()->NewJSObject(isolate->object_function(), TENURED); 1922 isolate->factory()->NewJSObject(isolate->object_function(), TENURED);
1921 SetObjectPrototype(set_iterator_prototype, iterator_prototype); 1923 SetObjectPrototype(set_iterator_prototype, iterator_prototype);
1922 Handle<JSFunction> set_iterator_function = InstallFunction( 1924 Handle<JSFunction> set_iterator_function = InstallFunction(
1923 container, "SetIterator", JS_SET_ITERATOR_TYPE, JSSetIterator::kSize, 1925 container, "SetIterator", JS_SET_ITERATOR_TYPE, JSSetIterator::kSize,
1924 set_iterator_prototype, Builtins::kIllegal); 1926 set_iterator_prototype, Builtins::kIllegal);
1925 native_context->set_set_iterator_map(set_iterator_function->initial_map()); 1927 native_context->set_set_iterator_map(set_iterator_function->initial_map());
(...skipping 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after
3306 } 3308 }
3307 3309
3308 3310
3309 // Called when the top-level V8 mutex is destroyed. 3311 // Called when the top-level V8 mutex is destroyed.
3310 void Bootstrapper::FreeThreadResources() { 3312 void Bootstrapper::FreeThreadResources() {
3311 DCHECK(!IsActive()); 3313 DCHECK(!IsActive());
3312 } 3314 }
3313 3315
3314 } // namespace internal 3316 } // namespace internal
3315 } // namespace v8 3317 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698