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

Side by Side Diff: src/bootstrapper.cc

Issue 1428823002: [es6] Fix Function and GeneratorFunction built-ins subclassing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@subclass
Patch Set: Addressing comments 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/base/utils/random-number-generator.h" 9 #include "src/base/utils/random-number-generator.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 JSObject::AddProperty( 1109 JSObject::AddProperty(
1110 global_object, object_name, isolate->object_function(), DONT_ENUM); 1110 global_object, object_name, isolate->object_function(), DONT_ENUM);
1111 1111
1112 Handle<JSObject> global(native_context()->global_object()); 1112 Handle<JSObject> global(native_context()->global_object());
1113 1113
1114 // Install global Function object 1114 // Install global Function object
1115 Handle<JSFunction> function_function = 1115 Handle<JSFunction> function_function =
1116 InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize, 1116 InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize,
1117 empty_function, Builtins::kIllegal); 1117 empty_function, Builtins::kIllegal);
1118 function_function->initial_map()->set_is_callable(); 1118 function_function->initial_map()->set_is_callable();
1119 function_function->initial_map()->set_is_constructor(true);
1119 1120
1120 { // --- A r r a y --- 1121 { // --- A r r a y ---
1121 Handle<JSFunction> array_function = 1122 Handle<JSFunction> array_function =
1122 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize, 1123 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize,
1123 isolate->initial_object_prototype(), 1124 isolate->initial_object_prototype(),
1124 Builtins::kArrayCode); 1125 Builtins::kArrayCode);
1125 array_function->shared()->DontAdaptArguments(); 1126 array_function->shared()->DontAdaptArguments();
1126 array_function->shared()->set_function_data(Smi::FromInt(kArrayCode)); 1127 array_function->shared()->set_function_data(Smi::FromInt(kArrayCode));
1127 1128
1128 // This seems a bit hackish, but we need to make sure Array.length 1129 // This seems a bit hackish, but we need to make sure Array.length
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
1944 JSObject::AddProperty( 1945 JSObject::AddProperty(
1945 container, factory->InternalizeUtf8String("GeneratorFunctionPrototype"), 1946 container, factory->InternalizeUtf8String("GeneratorFunctionPrototype"),
1946 generator_function_prototype, NONE); 1947 generator_function_prototype, NONE);
1947 1948
1948 static const bool kUseStrictFunctionMap = true; 1949 static const bool kUseStrictFunctionMap = true;
1949 Handle<JSFunction> generator_function_function = 1950 Handle<JSFunction> generator_function_function =
1950 InstallFunction(container, "GeneratorFunction", JS_FUNCTION_TYPE, 1951 InstallFunction(container, "GeneratorFunction", JS_FUNCTION_TYPE,
1951 JSFunction::kSize, generator_function_prototype, 1952 JSFunction::kSize, generator_function_prototype,
1952 Builtins::kIllegal, kUseStrictFunctionMap); 1953 Builtins::kIllegal, kUseStrictFunctionMap);
1953 generator_function_function->initial_map()->set_is_callable(); 1954 generator_function_function->initial_map()->set_is_callable();
1955 generator_function_function->initial_map()->set_is_constructor(true);
1954 } 1956 }
1955 1957
1956 { // -- S e t I t e r a t o r 1958 { // -- S e t I t e r a t o r
1957 Handle<JSObject> set_iterator_prototype = 1959 Handle<JSObject> set_iterator_prototype =
1958 isolate->factory()->NewJSObject(isolate->object_function(), TENURED); 1960 isolate->factory()->NewJSObject(isolate->object_function(), TENURED);
1959 SetObjectPrototype(set_iterator_prototype, iterator_prototype); 1961 SetObjectPrototype(set_iterator_prototype, iterator_prototype);
1960 Handle<JSFunction> set_iterator_function = InstallFunction( 1962 Handle<JSFunction> set_iterator_function = InstallFunction(
1961 container, "SetIterator", JS_SET_ITERATOR_TYPE, JSSetIterator::kSize, 1963 container, "SetIterator", JS_SET_ITERATOR_TYPE, JSSetIterator::kSize,
1962 set_iterator_prototype, Builtins::kIllegal); 1964 set_iterator_prototype, Builtins::kIllegal);
1963 native_context->set_set_iterator_map(set_iterator_function->initial_map()); 1965 native_context->set_set_iterator_map(set_iterator_function->initial_map());
(...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after
3327 } 3329 }
3328 3330
3329 3331
3330 // Called when the top-level V8 mutex is destroyed. 3332 // Called when the top-level V8 mutex is destroyed.
3331 void Bootstrapper::FreeThreadResources() { 3333 void Bootstrapper::FreeThreadResources() {
3332 DCHECK(!IsActive()); 3334 DCHECK(!IsActive());
3333 } 3335 }
3334 3336
3335 } // namespace internal 3337 } // namespace internal
3336 } // namespace v8 3338 } // 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