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

Side by Side Diff: src/bootstrapper.cc

Issue 2770753003: Migrate Object constructor to C++
Patch Set: Ack comments 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') | 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/ieee754.h" 9 #include "src/base/ieee754.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 Isolate* isolate = global_object->GetIsolate(); 1271 Isolate* isolate = global_object->GetIsolate();
1272 Factory* factory = isolate->factory(); 1272 Factory* factory = isolate->factory();
1273 1273
1274 native_context()->set_osr_code_table(*factory->empty_fixed_array()); 1274 native_context()->set_osr_code_table(*factory->empty_fixed_array());
1275 1275
1276 Handle<ScriptContextTable> script_context_table = 1276 Handle<ScriptContextTable> script_context_table =
1277 factory->NewScriptContextTable(); 1277 factory->NewScriptContextTable();
1278 native_context()->set_script_context_table(*script_context_table); 1278 native_context()->set_script_context_table(*script_context_table);
1279 InstallGlobalThisBinding(); 1279 InstallGlobalThisBinding();
1280 1280
1281 Handle<JSObject> global(native_context()->global_object());
1282
1281 { // --- O b j e c t --- 1283 { // --- O b j e c t ---
1282 Handle<String> object_name = factory->Object_string(); 1284 Handle<JSFunction> object_function =
1283 Handle<JSFunction> object_function = isolate->object_function(); 1285 InstallFunction(global, factory->Object_string(), JS_OBJECT_TYPE,
1284 JSObject::AddProperty(global_object, object_name, object_function, 1286 JSObject::kHeaderSize,
1285 DONT_ENUM); 1287 isolate->initial_object_prototype(),
1288 Builtins::kObjectConstructor, DONT_ENUM);
1289 object_function->shared()->DontAdaptArguments();
1290 object_function->shared()->SetConstructStub(
1291 *isolate->builtins()->ObjectConstructor_ConstructStub());
1292 object_function->shared()->set_length(1);
1293 InstallWithIntrinsicDefaultProto(isolate, object_function,
1294 Context::OBJECT_FUNCTION_INDEX);
1286 1295
1287 SimpleInstallFunction(object_function, factory->assign_string(), 1296 SimpleInstallFunction(object_function, factory->assign_string(),
1288 Builtins::kObjectAssign, 2, false); 1297 Builtins::kObjectAssign, 2, false);
1289 SimpleInstallFunction(object_function, "getOwnPropertyDescriptor", 1298 SimpleInstallFunction(object_function, "getOwnPropertyDescriptor",
1290 Builtins::kObjectGetOwnPropertyDescriptor, 2, false); 1299 Builtins::kObjectGetOwnPropertyDescriptor, 2, false);
1291 SimpleInstallFunction(object_function, 1300 SimpleInstallFunction(object_function,
1292 factory->getOwnPropertyDescriptors_string(), 1301 factory->getOwnPropertyDescriptors_string(),
1293 Builtins::kObjectGetOwnPropertyDescriptors, 1, false); 1302 Builtins::kObjectGetOwnPropertyDescriptors, 1, false);
1294 SimpleInstallFunction(object_function, "getOwnPropertyNames", 1303 SimpleInstallFunction(object_function, "getOwnPropertyNames",
1295 Builtins::kObjectGetOwnPropertyNames, 1, false); 1304 Builtins::kObjectGetOwnPropertyNames, 1, false);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 "__defineSetter__", Builtins::kObjectDefineSetter, 2, 1365 "__defineSetter__", Builtins::kObjectDefineSetter, 2,
1357 true); 1366 true);
1358 SimpleInstallFunction(isolate->initial_object_prototype(), "hasOwnProperty", 1367 SimpleInstallFunction(isolate->initial_object_prototype(), "hasOwnProperty",
1359 Builtins::kObjectHasOwnProperty, 1, true); 1368 Builtins::kObjectHasOwnProperty, 1, true);
1360 SimpleInstallFunction(isolate->initial_object_prototype(), 1369 SimpleInstallFunction(isolate->initial_object_prototype(),
1361 "__lookupGetter__", Builtins::kObjectLookupGetter, 1, 1370 "__lookupGetter__", Builtins::kObjectLookupGetter, 1,
1362 true); 1371 true);
1363 SimpleInstallFunction(isolate->initial_object_prototype(), 1372 SimpleInstallFunction(isolate->initial_object_prototype(),
1364 "__lookupSetter__", Builtins::kObjectLookupSetter, 1, 1373 "__lookupSetter__", Builtins::kObjectLookupSetter, 1,
1365 true); 1374 true);
1375 JSObject::AddProperty(isolate->initial_object_prototype(),
1376 factory->constructor_string(), object_function,
1377 DONT_ENUM);
1366 SimpleInstallFunction( 1378 SimpleInstallFunction(
1367 isolate->initial_object_prototype(), "propertyIsEnumerable", 1379 isolate->initial_object_prototype(), "propertyIsEnumerable",
1368 Builtins::kObjectPrototypePropertyIsEnumerable, 1, false); 1380 Builtins::kObjectPrototypePropertyIsEnumerable, 1, false);
1369 Handle<JSFunction> object_value_of = SimpleInstallFunction( 1381 Handle<JSFunction> object_value_of = SimpleInstallFunction(
1370 isolate->initial_object_prototype(), "valueOf", 1382 isolate->initial_object_prototype(), "valueOf",
1371 Builtins::kObjectPrototypeValueOf, 0, true); 1383 Builtins::kObjectPrototypeValueOf, 0, true);
1372 native_context()->set_object_value_of(*object_value_of); 1384 native_context()->set_object_value_of(*object_value_of);
1373 1385
1374 SimpleInstallGetterSetter(isolate->initial_object_prototype(), 1386 SimpleInstallGetterSetter(isolate->initial_object_prototype(),
1375 factory->proto_string(), 1387 factory->proto_string(),
1376 Builtins::kObjectPrototypeGetProto, 1388 Builtins::kObjectPrototypeGetProto,
1377 Builtins::kObjectPrototypeSetProto, DONT_ENUM); 1389 Builtins::kObjectPrototypeSetProto, DONT_ENUM);
1378 } 1390 }
1379 1391
1380 Handle<JSObject> global(native_context()->global_object());
1381
1382 { // --- F u n c t i o n --- 1392 { // --- F u n c t i o n ---
1383 Handle<JSFunction> prototype = empty_function; 1393 Handle<JSFunction> prototype = empty_function;
1384 Handle<JSFunction> function_fun = 1394 Handle<JSFunction> function_fun =
1385 InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize, 1395 InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize,
1386 prototype, Builtins::kFunctionConstructor); 1396 prototype, Builtins::kFunctionConstructor);
1387 function_fun->set_prototype_or_initial_map( 1397 function_fun->set_prototype_or_initial_map(
1388 *sloppy_function_map_writable_prototype_); 1398 *sloppy_function_map_writable_prototype_);
1389 function_fun->shared()->DontAdaptArguments(); 1399 function_fun->shared()->DontAdaptArguments();
1390 function_fun->shared()->SetConstructStub( 1400 function_fun->shared()->SetConstructStub(
1391 *isolate->builtins()->FunctionConstructor()); 1401 *isolate->builtins()->FunctionConstructor());
(...skipping 3849 matching lines...) Expand 10 before | Expand all | Expand 10 after
5241 } 5251 }
5242 5252
5243 5253
5244 // Called when the top-level V8 mutex is destroyed. 5254 // Called when the top-level V8 mutex is destroyed.
5245 void Bootstrapper::FreeThreadResources() { 5255 void Bootstrapper::FreeThreadResources() {
5246 DCHECK(!IsActive()); 5256 DCHECK(!IsActive());
5247 } 5257 }
5248 5258
5249 } // namespace internal 5259 } // namespace internal
5250 } // namespace v8 5260 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/builtins/builtins-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698