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

Side by Side Diff: src/bootstrapper.cc

Issue 2770753003: Migrate Object constructor to C++
Patch Set: Manually set ElementsKind Created 3 years, 8 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/builtins-definitions.h » ('j') | src/builtins/builtins-object.cc » ('J')
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/ieee754.h" 9 #include "src/base/ieee754.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 Isolate* isolate = global_object->GetIsolate(); 1210 Isolate* isolate = global_object->GetIsolate();
1211 Factory* factory = isolate->factory(); 1211 Factory* factory = isolate->factory();
1212 1212
1213 native_context()->set_osr_code_table(*factory->empty_fixed_array()); 1213 native_context()->set_osr_code_table(*factory->empty_fixed_array());
1214 1214
1215 Handle<ScriptContextTable> script_context_table = 1215 Handle<ScriptContextTable> script_context_table =
1216 factory->NewScriptContextTable(); 1216 factory->NewScriptContextTable();
1217 native_context()->set_script_context_table(*script_context_table); 1217 native_context()->set_script_context_table(*script_context_table);
1218 InstallGlobalThisBinding(); 1218 InstallGlobalThisBinding();
1219 1219
1220 Handle<JSObject> global(native_context()->global_object());
1221
1220 { // --- O b j e c t --- 1222 { // --- O b j e c t ---
1221 Handle<String> object_name = factory->Object_string(); 1223 Handle<JSFunction> object_function =
1222 Handle<JSFunction> object_function = isolate->object_function(); 1224 InstallFunction(global, factory->Object_string(), JS_OBJECT_TYPE,
1223 JSObject::AddProperty(global_object, object_name, object_function, 1225 JSObject::kHeaderSize,
1224 DONT_ENUM); 1226 isolate->initial_object_prototype(),
1227 Builtins::kObjectConstructor, DONT_ENUM);
1228 object_function->shared()->DontAdaptArguments();
1229 object_function->shared()->SetConstructStub(
1230 *isolate->builtins()->ObjectConstructor_ConstructStub());
1231 object_function->shared()->set_length(1);
1232 InstallWithIntrinsicDefaultProto(isolate, object_function,
1233 Context::OBJECT_FUNCTION_INDEX);
1225 1234
1226 SimpleInstallFunction(object_function, factory->assign_string(), 1235 SimpleInstallFunction(object_function, factory->assign_string(),
1227 Builtins::kObjectAssign, 2, false); 1236 Builtins::kObjectAssign, 2, false);
1228 SimpleInstallFunction(object_function, "getOwnPropertyDescriptor", 1237 SimpleInstallFunction(object_function, "getOwnPropertyDescriptor",
1229 Builtins::kObjectGetOwnPropertyDescriptor, 2, false); 1238 Builtins::kObjectGetOwnPropertyDescriptor, 2, false);
1230 SimpleInstallFunction(object_function, 1239 SimpleInstallFunction(object_function,
1231 factory->getOwnPropertyDescriptors_string(), 1240 factory->getOwnPropertyDescriptors_string(),
1232 Builtins::kObjectGetOwnPropertyDescriptors, 1, false); 1241 Builtins::kObjectGetOwnPropertyDescriptors, 1, false);
1233 SimpleInstallFunction(object_function, "getOwnPropertyNames", 1242 SimpleInstallFunction(object_function, "getOwnPropertyNames",
1234 Builtins::kObjectGetOwnPropertyNames, 1, false); 1243 Builtins::kObjectGetOwnPropertyNames, 1, false);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 "__defineSetter__", Builtins::kObjectDefineSetter, 2, 1304 "__defineSetter__", Builtins::kObjectDefineSetter, 2,
1296 true); 1305 true);
1297 SimpleInstallFunction(isolate->initial_object_prototype(), "hasOwnProperty", 1306 SimpleInstallFunction(isolate->initial_object_prototype(), "hasOwnProperty",
1298 Builtins::kObjectHasOwnProperty, 1, true); 1307 Builtins::kObjectHasOwnProperty, 1, true);
1299 SimpleInstallFunction(isolate->initial_object_prototype(), 1308 SimpleInstallFunction(isolate->initial_object_prototype(),
1300 "__lookupGetter__", Builtins::kObjectLookupGetter, 1, 1309 "__lookupGetter__", Builtins::kObjectLookupGetter, 1,
1301 true); 1310 true);
1302 SimpleInstallFunction(isolate->initial_object_prototype(), 1311 SimpleInstallFunction(isolate->initial_object_prototype(),
1303 "__lookupSetter__", Builtins::kObjectLookupSetter, 1, 1312 "__lookupSetter__", Builtins::kObjectLookupSetter, 1,
1304 true); 1313 true);
1314 JSObject::AddProperty(isolate->initial_object_prototype(),
1315 factory->constructor_string(), object_function,
1316 DONT_ENUM);
1305 SimpleInstallFunction( 1317 SimpleInstallFunction(
1306 isolate->initial_object_prototype(), "propertyIsEnumerable", 1318 isolate->initial_object_prototype(), "propertyIsEnumerable",
1307 Builtins::kObjectPrototypePropertyIsEnumerable, 1, false); 1319 Builtins::kObjectPrototypePropertyIsEnumerable, 1, false);
1308 Handle<JSFunction> object_value_of = SimpleInstallFunction( 1320 Handle<JSFunction> object_value_of = SimpleInstallFunction(
1309 isolate->initial_object_prototype(), "valueOf", 1321 isolate->initial_object_prototype(), "valueOf",
1310 Builtins::kObjectPrototypeValueOf, 0, true); 1322 Builtins::kObjectPrototypeValueOf, 0, true);
1311 native_context()->set_object_value_of(*object_value_of); 1323 native_context()->set_object_value_of(*object_value_of);
1312 1324
1313 SimpleInstallGetterSetter(isolate->initial_object_prototype(), 1325 SimpleInstallGetterSetter(isolate->initial_object_prototype(),
1314 factory->proto_string(), 1326 factory->proto_string(),
1315 Builtins::kObjectPrototypeGetProto, 1327 Builtins::kObjectPrototypeGetProto,
1316 Builtins::kObjectPrototypeSetProto, DONT_ENUM); 1328 Builtins::kObjectPrototypeSetProto, DONT_ENUM);
1317 } 1329 }
1318 1330
1319 Handle<JSObject> global(native_context()->global_object());
1320
1321 { // --- F u n c t i o n --- 1331 { // --- F u n c t i o n ---
1322 Handle<JSFunction> prototype = empty_function; 1332 Handle<JSFunction> prototype = empty_function;
1323 Handle<JSFunction> function_fun = 1333 Handle<JSFunction> function_fun =
1324 InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize, 1334 InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize,
1325 prototype, Builtins::kFunctionConstructor); 1335 prototype, Builtins::kFunctionConstructor);
1326 function_fun->set_prototype_or_initial_map( 1336 function_fun->set_prototype_or_initial_map(
1327 *sloppy_function_map_writable_prototype_); 1337 *sloppy_function_map_writable_prototype_);
1328 function_fun->shared()->DontAdaptArguments(); 1338 function_fun->shared()->DontAdaptArguments();
1329 function_fun->shared()->SetConstructStub( 1339 function_fun->shared()->SetConstructStub(
1330 *isolate->builtins()->FunctionConstructor()); 1340 *isolate->builtins()->FunctionConstructor());
(...skipping 3775 matching lines...) Expand 10 before | Expand all | Expand 10 after
5106 } 5116 }
5107 5117
5108 5118
5109 // Called when the top-level V8 mutex is destroyed. 5119 // Called when the top-level V8 mutex is destroyed.
5110 void Bootstrapper::FreeThreadResources() { 5120 void Bootstrapper::FreeThreadResources() {
5111 DCHECK(!IsActive()); 5121 DCHECK(!IsActive());
5112 } 5122 }
5113 5123
5114 } // namespace internal 5124 } // namespace internal
5115 } // namespace v8 5125 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/builtins/builtins-definitions.h » ('j') | src/builtins/builtins-object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698