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

Side by Side Diff: src/bootstrapper.cc

Issue 1553043002: [builtins] Migrate a bunch of Object builtins to C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 Handle<String> name, 1037 Handle<String> name,
1038 Builtins::Name call, int len, 1038 Builtins::Name call, int len,
1039 bool adapt) { 1039 bool adapt) {
1040 Handle<JSFunction> fun = 1040 Handle<JSFunction> fun =
1041 SimpleCreateFunction(base->GetIsolate(), name, call, len, adapt); 1041 SimpleCreateFunction(base->GetIsolate(), name, call, len, adapt);
1042 InstallFunction(base, fun, name, DONT_ENUM); 1042 InstallFunction(base, fun, name, DONT_ENUM);
1043 return fun; 1043 return fun;
1044 } 1044 }
1045 1045
1046 1046
1047 static Handle<JSFunction> SimpleInstallFunction(Handle<JSObject> base,
1048 const char* name,
1049 Builtins::Name call, int len,
1050 bool adapt) {
1051 Factory* const factory = base->GetIsolate()->factory();
1052 return SimpleInstallFunction(base, factory->InternalizeUtf8String(name), call,
1053 len, adapt);
1054 }
1055
1056
1047 static void InstallWithIntrinsicDefaultProto(Isolate* isolate, 1057 static void InstallWithIntrinsicDefaultProto(Isolate* isolate,
1048 Handle<JSFunction> function, 1058 Handle<JSFunction> function,
1049 int context_index) { 1059 int context_index) {
1050 Handle<Smi> index(Smi::FromInt(context_index), isolate); 1060 Handle<Smi> index(Smi::FromInt(context_index), isolate);
1051 JSObject::AddProperty( 1061 JSObject::AddProperty(
1052 function, isolate->factory()->native_context_index_symbol(), index, NONE); 1062 function, isolate->factory()->native_context_index_symbol(), index, NONE);
1053 isolate->native_context()->set(context_index, *function); 1063 isolate->native_context()->set(context_index, *function);
1054 } 1064 }
1055 1065
1056 1066
(...skipping 14 matching lines...) Expand all
1071 native_context()->set_security_token(*global_object); 1081 native_context()->set_security_token(*global_object);
1072 1082
1073 Isolate* isolate = global_object->GetIsolate(); 1083 Isolate* isolate = global_object->GetIsolate();
1074 Factory* factory = isolate->factory(); 1084 Factory* factory = isolate->factory();
1075 1085
1076 Handle<ScriptContextTable> script_context_table = 1086 Handle<ScriptContextTable> script_context_table =
1077 factory->NewScriptContextTable(); 1087 factory->NewScriptContextTable();
1078 native_context()->set_script_context_table(*script_context_table); 1088 native_context()->set_script_context_table(*script_context_table);
1079 InstallGlobalThisBinding(); 1089 InstallGlobalThisBinding();
1080 1090
1081 Handle<String> object_name = factory->Object_string(); 1091 { // --- O b j e c t ---
1082 JSObject::AddProperty( 1092 Handle<String> object_name = factory->Object_string();
1083 global_object, object_name, isolate->object_function(), DONT_ENUM); 1093 Handle<JSFunction> object_function = isolate->object_function();
1084 SimpleInstallFunction(isolate->object_function(), factory->assign_string(), 1094 JSObject::AddProperty(global_object, object_name, object_function,
1085 Builtins::kObjectAssign, 2, false); 1095 DONT_ENUM);
1086 SimpleInstallFunction(isolate->object_function(), factory->create_string(), 1096 SimpleInstallFunction(object_function, factory->assign_string(),
1087 Builtins::kObjectCreate, 2, false); 1097 Builtins::kObjectAssign, 2, false);
1098 SimpleInstallFunction(object_function, factory->create_string(),
1099 Builtins::kObjectCreate, 2, false);
1100 Handle<JSFunction> object_freeze = SimpleInstallFunction(
1101 object_function, "freeze", Builtins::kObjectFreeze, 1, false);
1102 native_context()->set_object_freeze(*object_freeze);
1103 Handle<JSFunction> object_is_extensible =
1104 SimpleInstallFunction(object_function, "isExtensible",
1105 Builtins::kObjectIsExtensible, 1, false);
1106 native_context()->set_object_is_extensible(*object_is_extensible);
1107 Handle<JSFunction> object_is_frozen = SimpleInstallFunction(
1108 object_function, "isFrozen", Builtins::kObjectIsFrozen, 1, false);
1109 native_context()->set_object_is_frozen(*object_is_frozen);
1110 Handle<JSFunction> object_is_sealed = SimpleInstallFunction(
1111 object_function, "isSealed", Builtins::kObjectIsSealed, 1, false);
1112 native_context()->set_object_is_sealed(*object_is_sealed);
1113 SimpleInstallFunction(object_function, "preventExtensions",
1114 Builtins::kObjectPreventExtensions, 1, false);
1115 SimpleInstallFunction(object_function, "seal", Builtins::kObjectSeal, 1,
1116 false);
1117 }
1088 1118
1089 Handle<JSObject> global(native_context()->global_object()); 1119 Handle<JSObject> global(native_context()->global_object());
1090 1120
1091 { // --- F u n c t i o n --- 1121 { // --- F u n c t i o n ---
1092 Handle<JSFunction> function_function = 1122 Handle<JSFunction> function_function =
1093 InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize, 1123 InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize,
1094 empty_function, Builtins::kFunctionConstructor); 1124 empty_function, Builtins::kFunctionConstructor);
1095 function_function->set_prototype_or_initial_map( 1125 function_function->set_prototype_or_initial_map(
1096 *sloppy_function_map_writable_prototype_); 1126 *sloppy_function_map_writable_prototype_);
1097 function_function->shared()->DontAdaptArguments(); 1127 function_function->shared()->DontAdaptArguments();
(...skipping 2284 matching lines...) Expand 10 before | Expand all | Expand 10 after
3382 } 3412 }
3383 3413
3384 3414
3385 // Called when the top-level V8 mutex is destroyed. 3415 // Called when the top-level V8 mutex is destroyed.
3386 void Bootstrapper::FreeThreadResources() { 3416 void Bootstrapper::FreeThreadResources() {
3387 DCHECK(!IsActive()); 3417 DCHECK(!IsActive());
3388 } 3418 }
3389 3419
3390 } // namespace internal 3420 } // namespace internal
3391 } // namespace v8 3421 } // 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