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

Side by Side Diff: src/bootstrapper.cc

Issue 1548623002: [runtime] Also migrate the Function and GeneratorFunction constructors to C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix message tests. Created 4 years, 12 months 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/builtins.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 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 global_object, object_name, isolate->object_function(), DONT_ENUM); 1110 global_object, object_name, isolate->object_function(), DONT_ENUM);
1111 SimpleInstallFunction(isolate->object_function(), 1111 SimpleInstallFunction(isolate->object_function(),
1112 isolate->factory()->InternalizeUtf8String("assign"), 1112 isolate->factory()->InternalizeUtf8String("assign"),
1113 Builtins::kObjectAssign, 2, false); 1113 Builtins::kObjectAssign, 2, false);
1114 1114
1115 Handle<JSObject> global(native_context()->global_object()); 1115 Handle<JSObject> global(native_context()->global_object());
1116 1116
1117 { // --- F u n c t i o n --- 1117 { // --- F u n c t i o n ---
1118 Handle<JSFunction> function_function = 1118 Handle<JSFunction> function_function =
1119 InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize, 1119 InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize,
1120 empty_function, Builtins::kIllegal); 1120 empty_function, Builtins::kFunctionConstructor);
1121 function_function->set_prototype_or_initial_map( 1121 function_function->set_prototype_or_initial_map(
1122 *sloppy_function_map_writable_prototype_); 1122 *sloppy_function_map_writable_prototype_);
1123 function_function->shared()->DontAdaptArguments();
1123 function_function->shared()->set_construct_stub( 1124 function_function->shared()->set_construct_stub(
1124 *isolate->builtins()->JSBuiltinsConstructStub()); 1125 *isolate->builtins()->FunctionConstructor());
1126 function_function->shared()->set_length(1);
1125 InstallWithIntrinsicDefaultProto(isolate, function_function, 1127 InstallWithIntrinsicDefaultProto(isolate, function_function,
1126 Context::FUNCTION_FUNCTION_INDEX); 1128 Context::FUNCTION_FUNCTION_INDEX);
1127 1129
1128 sloppy_function_map_writable_prototype_->SetConstructor(*function_function); 1130 sloppy_function_map_writable_prototype_->SetConstructor(*function_function);
1129 strict_function_map_writable_prototype_->SetConstructor(*function_function); 1131 strict_function_map_writable_prototype_->SetConstructor(*function_function);
1130 native_context()->strong_function_map()->SetConstructor(*function_function); 1132 native_context()->strong_function_map()->SetConstructor(*function_function);
1131 } 1133 }
1132 1134
1133 { // --- A r r a y --- 1135 { // --- A r r a y ---
1134 Handle<JSFunction> array_function = 1136 Handle<JSFunction> array_function =
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
1902 1904
1903 { 1905 {
1904 PrototypeIterator iter(native_context->sloppy_generator_function_map()); 1906 PrototypeIterator iter(native_context->sloppy_generator_function_map());
1905 Handle<JSObject> generator_function_prototype(iter.GetCurrent<JSObject>()); 1907 Handle<JSObject> generator_function_prototype(iter.GetCurrent<JSObject>());
1906 1908
1907 JSObject::AddProperty( 1909 JSObject::AddProperty(
1908 container, factory->InternalizeUtf8String("GeneratorFunctionPrototype"), 1910 container, factory->InternalizeUtf8String("GeneratorFunctionPrototype"),
1909 generator_function_prototype, NONE); 1911 generator_function_prototype, NONE);
1910 1912
1911 static const bool kUseStrictFunctionMap = true; 1913 static const bool kUseStrictFunctionMap = true;
1912 Handle<JSFunction> generator_function_function = 1914 Handle<JSFunction> generator_function_function = InstallFunction(
1913 InstallFunction(container, "GeneratorFunction", JS_FUNCTION_TYPE, 1915 container, "GeneratorFunction", JS_FUNCTION_TYPE, JSFunction::kSize,
1914 JSFunction::kSize, generator_function_prototype, 1916 generator_function_prototype, Builtins::kGeneratorFunctionConstructor,
1915 Builtins::kIllegal, kUseStrictFunctionMap); 1917 kUseStrictFunctionMap);
1916 generator_function_function->set_prototype_or_initial_map( 1918 generator_function_function->set_prototype_or_initial_map(
1917 native_context->sloppy_generator_function_map()); 1919 native_context->sloppy_generator_function_map());
1920 generator_function_function->shared()->DontAdaptArguments();
1918 generator_function_function->shared()->set_construct_stub( 1921 generator_function_function->shared()->set_construct_stub(
1919 *isolate->builtins()->JSBuiltinsConstructStub()); 1922 *isolate->builtins()->GeneratorFunctionConstructor());
1923 generator_function_function->shared()->set_length(1);
1920 InstallWithIntrinsicDefaultProto( 1924 InstallWithIntrinsicDefaultProto(
1921 isolate, generator_function_function, 1925 isolate, generator_function_function,
1922 Context::GENERATOR_FUNCTION_FUNCTION_INDEX); 1926 Context::GENERATOR_FUNCTION_FUNCTION_INDEX);
1923 1927
1924 native_context->sloppy_generator_function_map()->SetConstructor( 1928 native_context->sloppy_generator_function_map()->SetConstructor(
1925 *generator_function_function); 1929 *generator_function_function);
1926 native_context->strict_generator_function_map()->SetConstructor( 1930 native_context->strict_generator_function_map()->SetConstructor(
1927 *generator_function_function); 1931 *generator_function_function);
1928 native_context->strong_generator_function_map()->SetConstructor( 1932 native_context->strong_generator_function_map()->SetConstructor(
1929 *generator_function_function); 1933 *generator_function_function);
(...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after
3349 } 3353 }
3350 3354
3351 3355
3352 // Called when the top-level V8 mutex is destroyed. 3356 // Called when the top-level V8 mutex is destroyed.
3353 void Bootstrapper::FreeThreadResources() { 3357 void Bootstrapper::FreeThreadResources() {
3354 DCHECK(!IsActive()); 3358 DCHECK(!IsActive());
3355 } 3359 }
3356 3360
3357 } // namespace internal 3361 } // namespace internal
3358 } // namespace v8 3362 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698