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

Side by Side Diff: src/bootstrapper.cc

Issue 2125163004: Correctly format builtin constructors in stack traces (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@20160704-string-number-builtins
Patch Set: Rebase Created 4 years, 5 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/compiler.cc » ('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 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 Handle<JSObject> global(native_context()->global_object()); 1219 Handle<JSObject> global(native_context()->global_object());
1220 1220
1221 { // --- F u n c t i o n --- 1221 { // --- F u n c t i o n ---
1222 Handle<JSFunction> prototype = empty_function; 1222 Handle<JSFunction> prototype = empty_function;
1223 Handle<JSFunction> function_fun = 1223 Handle<JSFunction> function_fun =
1224 InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize, 1224 InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize,
1225 prototype, Builtins::kFunctionConstructor); 1225 prototype, Builtins::kFunctionConstructor);
1226 function_fun->set_prototype_or_initial_map( 1226 function_fun->set_prototype_or_initial_map(
1227 *sloppy_function_map_writable_prototype_); 1227 *sloppy_function_map_writable_prototype_);
1228 function_fun->shared()->DontAdaptArguments(); 1228 function_fun->shared()->DontAdaptArguments();
1229 function_fun->shared()->set_construct_stub( 1229 function_fun->shared()->SetConstructStub(
1230 *isolate->builtins()->FunctionConstructor()); 1230 *isolate->builtins()->FunctionConstructor());
1231 function_fun->shared()->set_length(1); 1231 function_fun->shared()->set_length(1);
1232 InstallWithIntrinsicDefaultProto(isolate, function_fun, 1232 InstallWithIntrinsicDefaultProto(isolate, function_fun,
1233 Context::FUNCTION_FUNCTION_INDEX); 1233 Context::FUNCTION_FUNCTION_INDEX);
1234 1234
1235 // Setup the methods on the %FunctionPrototype%. 1235 // Setup the methods on the %FunctionPrototype%.
1236 SimpleInstallFunction(prototype, factory->apply_string(), 1236 SimpleInstallFunction(prototype, factory->apply_string(),
1237 Builtins::kFunctionPrototypeApply, 2, false); 1237 Builtins::kFunctionPrototypeApply, 2, false);
1238 1238
1239 FastFunctionBindStub bind_stub(isolate); 1239 FastFunctionBindStub bind_stub(isolate);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 initial_map->AppendDescriptor(&d); 1301 initial_map->AppendDescriptor(&d);
1302 } 1302 }
1303 1303
1304 InstallWithIntrinsicDefaultProto(isolate, array_function, 1304 InstallWithIntrinsicDefaultProto(isolate, array_function,
1305 Context::ARRAY_FUNCTION_INDEX); 1305 Context::ARRAY_FUNCTION_INDEX);
1306 1306
1307 // Cache the array maps, needed by ArrayConstructorStub 1307 // Cache the array maps, needed by ArrayConstructorStub
1308 CacheInitialJSArrayMaps(native_context(), initial_map); 1308 CacheInitialJSArrayMaps(native_context(), initial_map);
1309 ArrayConstructorStub array_constructor_stub(isolate); 1309 ArrayConstructorStub array_constructor_stub(isolate);
1310 Handle<Code> code = array_constructor_stub.GetCode(); 1310 Handle<Code> code = array_constructor_stub.GetCode();
1311 array_function->shared()->set_construct_stub(*code); 1311 array_function->shared()->SetConstructStub(*code);
1312 1312
1313 Handle<JSFunction> is_arraylike = SimpleInstallFunction( 1313 Handle<JSFunction> is_arraylike = SimpleInstallFunction(
1314 array_function, isolate->factory()->InternalizeUtf8String("isArray"), 1314 array_function, isolate->factory()->InternalizeUtf8String("isArray"),
1315 Builtins::kArrayIsArray, 1, true); 1315 Builtins::kArrayIsArray, 1, true);
1316 native_context()->set_is_arraylike(*is_arraylike); 1316 native_context()->set_is_arraylike(*is_arraylike);
1317 } 1317 }
1318 1318
1319 { // --- N u m b e r --- 1319 { // --- N u m b e r ---
1320 Handle<JSFunction> number_fun = InstallFunction( 1320 Handle<JSFunction> number_fun = InstallFunction(
1321 global, "Number", JS_VALUE_TYPE, JSValue::kSize, 1321 global, "Number", JS_VALUE_TYPE, JSValue::kSize,
1322 isolate->initial_object_prototype(), Builtins::kNumberConstructor); 1322 isolate->initial_object_prototype(), Builtins::kNumberConstructor);
1323 number_fun->shared()->DontAdaptArguments(); 1323 number_fun->shared()->DontAdaptArguments();
1324 number_fun->shared()->set_construct_stub( 1324 number_fun->shared()->SetConstructStub(
1325 *isolate->builtins()->NumberConstructor_ConstructStub()); 1325 *isolate->builtins()->NumberConstructor_ConstructStub());
1326 number_fun->shared()->set_length(1); 1326 number_fun->shared()->set_length(1);
1327 InstallWithIntrinsicDefaultProto(isolate, number_fun, 1327 InstallWithIntrinsicDefaultProto(isolate, number_fun,
1328 Context::NUMBER_FUNCTION_INDEX); 1328 Context::NUMBER_FUNCTION_INDEX);
1329 1329
1330 // Create the %NumberPrototype% 1330 // Create the %NumberPrototype%
1331 Handle<JSValue> prototype = 1331 Handle<JSValue> prototype =
1332 Handle<JSValue>::cast(factory->NewJSObject(number_fun, TENURED)); 1332 Handle<JSValue>::cast(factory->NewJSObject(number_fun, TENURED));
1333 prototype->set_value(Smi::FromInt(0)); 1333 prototype->set_value(Smi::FromInt(0));
1334 Accessors::FunctionSetPrototype(number_fun, prototype).Assert(); 1334 Accessors::FunctionSetPrototype(number_fun, prototype).Assert();
(...skipping 18 matching lines...) Expand all
1353 SimpleInstallFunction(prototype, "toLocaleString", 1353 SimpleInstallFunction(prototype, "toLocaleString",
1354 Builtins::kNumberPrototypeToLocaleString, 0, false); 1354 Builtins::kNumberPrototypeToLocaleString, 0, false);
1355 } 1355 }
1356 1356
1357 { // --- B o o l e a n --- 1357 { // --- B o o l e a n ---
1358 Handle<JSFunction> boolean_fun = 1358 Handle<JSFunction> boolean_fun =
1359 InstallFunction(global, "Boolean", JS_VALUE_TYPE, JSValue::kSize, 1359 InstallFunction(global, "Boolean", JS_VALUE_TYPE, JSValue::kSize,
1360 isolate->initial_object_prototype(), 1360 isolate->initial_object_prototype(),
1361 Builtins::kBooleanConstructor); 1361 Builtins::kBooleanConstructor);
1362 boolean_fun->shared()->DontAdaptArguments(); 1362 boolean_fun->shared()->DontAdaptArguments();
1363 boolean_fun->shared()->set_construct_stub( 1363 boolean_fun->shared()->SetConstructStub(
1364 *isolate->builtins()->BooleanConstructor_ConstructStub()); 1364 *isolate->builtins()->BooleanConstructor_ConstructStub());
1365 boolean_fun->shared()->set_length(1); 1365 boolean_fun->shared()->set_length(1);
1366 InstallWithIntrinsicDefaultProto(isolate, boolean_fun, 1366 InstallWithIntrinsicDefaultProto(isolate, boolean_fun,
1367 Context::BOOLEAN_FUNCTION_INDEX); 1367 Context::BOOLEAN_FUNCTION_INDEX);
1368 1368
1369 // Create the %BooleanPrototype% 1369 // Create the %BooleanPrototype%
1370 Handle<JSValue> prototype = 1370 Handle<JSValue> prototype =
1371 Handle<JSValue>::cast(factory->NewJSObject(boolean_fun, TENURED)); 1371 Handle<JSValue>::cast(factory->NewJSObject(boolean_fun, TENURED));
1372 prototype->set_value(isolate->heap()->false_value()); 1372 prototype->set_value(isolate->heap()->false_value());
1373 Accessors::FunctionSetPrototype(boolean_fun, prototype).Assert(); 1373 Accessors::FunctionSetPrototype(boolean_fun, prototype).Assert();
1374 1374
1375 // Install the "constructor" property on the {prototype}. 1375 // Install the "constructor" property on the {prototype}.
1376 JSObject::AddProperty(prototype, factory->constructor_string(), boolean_fun, 1376 JSObject::AddProperty(prototype, factory->constructor_string(), boolean_fun,
1377 DONT_ENUM); 1377 DONT_ENUM);
1378 1378
1379 // Install the Boolean.prototype methods. 1379 // Install the Boolean.prototype methods.
1380 SimpleInstallFunction(prototype, "toString", 1380 SimpleInstallFunction(prototype, "toString",
1381 Builtins::kBooleanPrototypeToString, 0, true); 1381 Builtins::kBooleanPrototypeToString, 0, true);
1382 SimpleInstallFunction(prototype, "valueOf", 1382 SimpleInstallFunction(prototype, "valueOf",
1383 Builtins::kBooleanPrototypeValueOf, 0, true); 1383 Builtins::kBooleanPrototypeValueOf, 0, true);
1384 } 1384 }
1385 1385
1386 { // --- S t r i n g --- 1386 { // --- S t r i n g ---
1387 Handle<JSFunction> string_fun = InstallFunction( 1387 Handle<JSFunction> string_fun = InstallFunction(
1388 global, "String", JS_VALUE_TYPE, JSValue::kSize, 1388 global, "String", JS_VALUE_TYPE, JSValue::kSize,
1389 isolate->initial_object_prototype(), Builtins::kStringConstructor); 1389 isolate->initial_object_prototype(), Builtins::kStringConstructor);
1390 string_fun->shared()->set_construct_stub( 1390 string_fun->shared()->SetConstructStub(
1391 *isolate->builtins()->StringConstructor_ConstructStub()); 1391 *isolate->builtins()->StringConstructor_ConstructStub());
1392 string_fun->shared()->DontAdaptArguments(); 1392 string_fun->shared()->DontAdaptArguments();
1393 string_fun->shared()->set_length(1); 1393 string_fun->shared()->set_length(1);
1394 InstallWithIntrinsicDefaultProto(isolate, string_fun, 1394 InstallWithIntrinsicDefaultProto(isolate, string_fun,
1395 Context::STRING_FUNCTION_INDEX); 1395 Context::STRING_FUNCTION_INDEX);
1396 1396
1397 Handle<Map> string_map = 1397 Handle<Map> string_map =
1398 Handle<Map>(native_context()->string_function()->initial_map()); 1398 Handle<Map>(native_context()->string_function()->initial_map());
1399 string_map->set_elements_kind(FAST_STRING_WRAPPER_ELEMENTS); 1399 string_map->set_elements_kind(FAST_STRING_WRAPPER_ELEMENTS);
1400 Map::EnsureDescriptorSlack(string_map, 1); 1400 Map::EnsureDescriptorSlack(string_map, 1);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 Builtins::kStringPrototypeValueOf, 0, true); 1445 Builtins::kStringPrototypeValueOf, 0, true);
1446 } 1446 }
1447 1447
1448 { 1448 {
1449 // --- S y m b o l --- 1449 // --- S y m b o l ---
1450 Handle<JSObject> prototype = 1450 Handle<JSObject> prototype =
1451 factory->NewJSObject(isolate->object_function(), TENURED); 1451 factory->NewJSObject(isolate->object_function(), TENURED);
1452 Handle<JSFunction> symbol_fun = 1452 Handle<JSFunction> symbol_fun =
1453 InstallFunction(global, "Symbol", JS_VALUE_TYPE, JSValue::kSize, 1453 InstallFunction(global, "Symbol", JS_VALUE_TYPE, JSValue::kSize,
1454 prototype, Builtins::kSymbolConstructor); 1454 prototype, Builtins::kSymbolConstructor);
1455 symbol_fun->shared()->set_construct_stub( 1455 symbol_fun->shared()->SetConstructStub(
1456 *isolate->builtins()->SymbolConstructor_ConstructStub()); 1456 *isolate->builtins()->SymbolConstructor_ConstructStub());
1457 symbol_fun->shared()->set_length(0); 1457 symbol_fun->shared()->set_length(0);
1458 symbol_fun->shared()->DontAdaptArguments(); 1458 symbol_fun->shared()->DontAdaptArguments();
1459 native_context()->set_symbol_function(*symbol_fun); 1459 native_context()->set_symbol_function(*symbol_fun);
1460 1460
1461 // Install the @@toStringTag property on the {prototype}. 1461 // Install the @@toStringTag property on the {prototype}.
1462 JSObject::AddProperty( 1462 JSObject::AddProperty(
1463 prototype, factory->to_string_tag_symbol(), 1463 prototype, factory->to_string_tag_symbol(),
1464 factory->NewStringFromAsciiChecked("Symbol"), 1464 factory->NewStringFromAsciiChecked("Symbol"),
1465 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); 1465 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
(...skipping 24 matching lines...) Expand all
1490 1490
1491 { // --- D a t e --- 1491 { // --- D a t e ---
1492 // Builtin functions for Date.prototype. 1492 // Builtin functions for Date.prototype.
1493 Handle<JSObject> prototype = 1493 Handle<JSObject> prototype =
1494 factory->NewJSObject(isolate->object_function(), TENURED); 1494 factory->NewJSObject(isolate->object_function(), TENURED);
1495 Handle<JSFunction> date_fun = 1495 Handle<JSFunction> date_fun =
1496 InstallFunction(global, "Date", JS_DATE_TYPE, JSDate::kSize, prototype, 1496 InstallFunction(global, "Date", JS_DATE_TYPE, JSDate::kSize, prototype,
1497 Builtins::kDateConstructor); 1497 Builtins::kDateConstructor);
1498 InstallWithIntrinsicDefaultProto(isolate, date_fun, 1498 InstallWithIntrinsicDefaultProto(isolate, date_fun,
1499 Context::DATE_FUNCTION_INDEX); 1499 Context::DATE_FUNCTION_INDEX);
1500 date_fun->shared()->set_construct_stub( 1500 date_fun->shared()->SetConstructStub(
1501 *isolate->builtins()->DateConstructor_ConstructStub()); 1501 *isolate->builtins()->DateConstructor_ConstructStub());
1502 date_fun->shared()->set_length(7); 1502 date_fun->shared()->set_length(7);
1503 date_fun->shared()->DontAdaptArguments(); 1503 date_fun->shared()->DontAdaptArguments();
1504 1504
1505 // Install the Date.now, Date.parse and Date.UTC functions. 1505 // Install the Date.now, Date.parse and Date.UTC functions.
1506 SimpleInstallFunction(date_fun, "now", Builtins::kDateNow, 0, false); 1506 SimpleInstallFunction(date_fun, "now", Builtins::kDateNow, 0, false);
1507 SimpleInstallFunction(date_fun, "parse", Builtins::kDateParse, 1, false); 1507 SimpleInstallFunction(date_fun, "parse", Builtins::kDateParse, 1, false);
1508 SimpleInstallFunction(date_fun, "UTC", Builtins::kDateUTC, 7, false); 1508 SimpleInstallFunction(date_fun, "UTC", Builtins::kDateUTC, 7, false);
1509 1509
1510 // Install the "constructor" property on the {prototype}. 1510 // Install the "constructor" property on the {prototype}.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 } 1623 }
1624 1624
1625 { // -- R e g E x p 1625 { // -- R e g E x p
1626 // Builtin functions for RegExp.prototype. 1626 // Builtin functions for RegExp.prototype.
1627 Handle<JSFunction> regexp_fun = 1627 Handle<JSFunction> regexp_fun =
1628 InstallFunction(global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize, 1628 InstallFunction(global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize,
1629 isolate->initial_object_prototype(), 1629 isolate->initial_object_prototype(),
1630 Builtins::kIllegal); 1630 Builtins::kIllegal);
1631 InstallWithIntrinsicDefaultProto(isolate, regexp_fun, 1631 InstallWithIntrinsicDefaultProto(isolate, regexp_fun,
1632 Context::REGEXP_FUNCTION_INDEX); 1632 Context::REGEXP_FUNCTION_INDEX);
1633 regexp_fun->shared()->set_construct_stub( 1633 regexp_fun->shared()->SetConstructStub(
1634 *isolate->builtins()->JSBuiltinsConstructStub()); 1634 *isolate->builtins()->JSBuiltinsConstructStub());
1635 1635
1636 DCHECK(regexp_fun->has_initial_map()); 1636 DCHECK(regexp_fun->has_initial_map());
1637 Handle<Map> initial_map(regexp_fun->initial_map()); 1637 Handle<Map> initial_map(regexp_fun->initial_map());
1638 1638
1639 DCHECK_EQ(0, initial_map->GetInObjectProperties()); 1639 DCHECK_EQ(0, initial_map->GetInObjectProperties());
1640 1640
1641 Map::EnsureDescriptorSlack(initial_map, 1); 1641 Map::EnsureDescriptorSlack(initial_map, 1);
1642 1642
1643 // ECMA-262, section 15.10.7.5. 1643 // ECMA-262, section 15.10.7.5.
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1867 1867
1868 { // -- D a t a V i e w 1868 { // -- D a t a V i e w
1869 Handle<JSObject> prototype = 1869 Handle<JSObject> prototype =
1870 factory->NewJSObject(isolate->object_function(), TENURED); 1870 factory->NewJSObject(isolate->object_function(), TENURED);
1871 Handle<JSFunction> data_view_fun = 1871 Handle<JSFunction> data_view_fun =
1872 InstallFunction(global, "DataView", JS_DATA_VIEW_TYPE, 1872 InstallFunction(global, "DataView", JS_DATA_VIEW_TYPE,
1873 JSDataView::kSizeWithInternalFields, prototype, 1873 JSDataView::kSizeWithInternalFields, prototype,
1874 Builtins::kDataViewConstructor); 1874 Builtins::kDataViewConstructor);
1875 InstallWithIntrinsicDefaultProto(isolate, data_view_fun, 1875 InstallWithIntrinsicDefaultProto(isolate, data_view_fun,
1876 Context::DATA_VIEW_FUN_INDEX); 1876 Context::DATA_VIEW_FUN_INDEX);
1877 data_view_fun->shared()->set_construct_stub( 1877 data_view_fun->shared()->SetConstructStub(
1878 *isolate->builtins()->DataViewConstructor_ConstructStub()); 1878 *isolate->builtins()->DataViewConstructor_ConstructStub());
1879 data_view_fun->shared()->set_length(3); 1879 data_view_fun->shared()->set_length(3);
1880 data_view_fun->shared()->DontAdaptArguments(); 1880 data_view_fun->shared()->DontAdaptArguments();
1881 1881
1882 // Install the @@toStringTag property on the {prototype}. 1882 // Install the @@toStringTag property on the {prototype}.
1883 JSObject::AddProperty( 1883 JSObject::AddProperty(
1884 prototype, factory->to_string_tag_symbol(), 1884 prototype, factory->to_string_tag_symbol(),
1885 factory->NewStringFromAsciiChecked("DataView"), 1885 factory->NewStringFromAsciiChecked("DataView"),
1886 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); 1886 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
1887 1887
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1964 Handle<Code> code(isolate->builtins()->ProxyConstructor()); 1964 Handle<Code> code(isolate->builtins()->ProxyConstructor());
1965 1965
1966 Handle<JSFunction> proxy_function = 1966 Handle<JSFunction> proxy_function =
1967 factory->NewFunction(isolate->proxy_function_map(), 1967 factory->NewFunction(isolate->proxy_function_map(),
1968 factory->Proxy_string(), MaybeHandle<Code>(code)); 1968 factory->Proxy_string(), MaybeHandle<Code>(code));
1969 1969
1970 JSFunction::SetInitialMap( 1970 JSFunction::SetInitialMap(
1971 proxy_function, Handle<Map>(native_context()->proxy_map(), isolate), 1971 proxy_function, Handle<Map>(native_context()->proxy_map(), isolate),
1972 factory->null_value()); 1972 factory->null_value());
1973 1973
1974 proxy_function->shared()->set_construct_stub( 1974 proxy_function->shared()->SetConstructStub(
1975 *isolate->builtins()->ProxyConstructor_ConstructStub()); 1975 *isolate->builtins()->ProxyConstructor_ConstructStub());
1976 proxy_function->shared()->set_internal_formal_parameter_count(2); 1976 proxy_function->shared()->set_internal_formal_parameter_count(2);
1977 proxy_function->shared()->set_length(2); 1977 proxy_function->shared()->set_length(2);
1978 1978
1979 native_context()->set_proxy_function(*proxy_function); 1979 native_context()->set_proxy_function(*proxy_function);
1980 InstallFunction(global, name, proxy_function, factory->Object_string()); 1980 InstallFunction(global, name, proxy_function, factory->Object_string());
1981 } 1981 }
1982 1982
1983 { // -- R e f l e c t 1983 { // -- R e f l e c t
1984 Handle<String> reflect_string = factory->InternalizeUtf8String("Reflect"); 1984 Handle<String> reflect_string = factory->InternalizeUtf8String("Reflect");
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
2505 generator_function_prototype, NONE); 2505 generator_function_prototype, NONE);
2506 2506
2507 static const bool kUseStrictFunctionMap = true; 2507 static const bool kUseStrictFunctionMap = true;
2508 Handle<JSFunction> generator_function_function = InstallFunction( 2508 Handle<JSFunction> generator_function_function = InstallFunction(
2509 container, "GeneratorFunction", JS_FUNCTION_TYPE, JSFunction::kSize, 2509 container, "GeneratorFunction", JS_FUNCTION_TYPE, JSFunction::kSize,
2510 generator_function_prototype, Builtins::kGeneratorFunctionConstructor, 2510 generator_function_prototype, Builtins::kGeneratorFunctionConstructor,
2511 kUseStrictFunctionMap); 2511 kUseStrictFunctionMap);
2512 generator_function_function->set_prototype_or_initial_map( 2512 generator_function_function->set_prototype_or_initial_map(
2513 native_context->sloppy_generator_function_map()); 2513 native_context->sloppy_generator_function_map());
2514 generator_function_function->shared()->DontAdaptArguments(); 2514 generator_function_function->shared()->DontAdaptArguments();
2515 generator_function_function->shared()->set_construct_stub( 2515 generator_function_function->shared()->SetConstructStub(
2516 *isolate->builtins()->GeneratorFunctionConstructor()); 2516 *isolate->builtins()->GeneratorFunctionConstructor());
2517 generator_function_function->shared()->set_length(1); 2517 generator_function_function->shared()->set_length(1);
2518 InstallWithIntrinsicDefaultProto( 2518 InstallWithIntrinsicDefaultProto(
2519 isolate, generator_function_function, 2519 isolate, generator_function_function,
2520 Context::GENERATOR_FUNCTION_FUNCTION_INDEX); 2520 Context::GENERATOR_FUNCTION_FUNCTION_INDEX);
2521 2521
2522 SetObjectPrototype(generator_function_function, 2522 SetObjectPrototype(generator_function_function,
2523 isolate->function_function()); 2523 isolate->function_function());
2524 JSObject::AddProperty( 2524 JSObject::AddProperty(
2525 generator_function_prototype, factory->constructor_string(), 2525 generator_function_prototype, factory->constructor_string(),
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
2702 { 2702 {
2703 PrototypeIterator iter(native_context->sloppy_async_function_map()); 2703 PrototypeIterator iter(native_context->sloppy_async_function_map());
2704 Handle<JSObject> async_function_prototype(iter.GetCurrent<JSObject>()); 2704 Handle<JSObject> async_function_prototype(iter.GetCurrent<JSObject>());
2705 2705
2706 static const bool kUseStrictFunctionMap = true; 2706 static const bool kUseStrictFunctionMap = true;
2707 Handle<JSFunction> async_function_constructor = InstallFunction( 2707 Handle<JSFunction> async_function_constructor = InstallFunction(
2708 container, "AsyncFunction", JS_FUNCTION_TYPE, JSFunction::kSize, 2708 container, "AsyncFunction", JS_FUNCTION_TYPE, JSFunction::kSize,
2709 async_function_prototype, Builtins::kAsyncFunctionConstructor, 2709 async_function_prototype, Builtins::kAsyncFunctionConstructor,
2710 kUseStrictFunctionMap); 2710 kUseStrictFunctionMap);
2711 async_function_constructor->shared()->DontAdaptArguments(); 2711 async_function_constructor->shared()->DontAdaptArguments();
2712 async_function_constructor->shared()->set_construct_stub( 2712 async_function_constructor->shared()->SetConstructStub(
2713 *isolate->builtins()->AsyncFunctionConstructor()); 2713 *isolate->builtins()->AsyncFunctionConstructor());
2714 async_function_constructor->shared()->set_length(1); 2714 async_function_constructor->shared()->set_length(1);
2715 InstallWithIntrinsicDefaultProto(isolate, async_function_constructor, 2715 InstallWithIntrinsicDefaultProto(isolate, async_function_constructor,
2716 Context::ASYNC_FUNCTION_FUNCTION_INDEX); 2716 Context::ASYNC_FUNCTION_FUNCTION_INDEX);
2717 SetObjectPrototype(async_function_constructor, 2717 SetObjectPrototype(async_function_constructor,
2718 isolate->function_function()); 2718 isolate->function_function());
2719 2719
2720 JSObject::AddProperty( 2720 JSObject::AddProperty(
2721 async_function_prototype, factory->constructor_string(), 2721 async_function_prototype, factory->constructor_string(),
2722 async_function_constructor, 2722 async_function_constructor,
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
2913 factory()->NewJSObject(isolate()->object_function(), TENURED); 2913 factory()->NewJSObject(isolate()->object_function(), TENURED);
2914 JSObject::AddProperty(prototype, factory()->to_string_tag_symbol(), 2914 JSObject::AddProperty(prototype, factory()->to_string_tag_symbol(),
2915 factory()->NewStringFromAsciiChecked(name), 2915 factory()->NewStringFromAsciiChecked(name),
2916 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); 2916 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
2917 2917
2918 // Allocate the constructor with the given {prototype}. 2918 // Allocate the constructor with the given {prototype}.
2919 Handle<JSFunction> array_buffer_fun = 2919 Handle<JSFunction> array_buffer_fun =
2920 InstallFunction(target, name, JS_ARRAY_BUFFER_TYPE, 2920 InstallFunction(target, name, JS_ARRAY_BUFFER_TYPE,
2921 JSArrayBuffer::kSizeWithInternalFields, prototype, 2921 JSArrayBuffer::kSizeWithInternalFields, prototype,
2922 Builtins::kArrayBufferConstructor); 2922 Builtins::kArrayBufferConstructor);
2923 array_buffer_fun->shared()->set_construct_stub( 2923 array_buffer_fun->shared()->SetConstructStub(
2924 *isolate()->builtins()->ArrayBufferConstructor_ConstructStub()); 2924 *isolate()->builtins()->ArrayBufferConstructor_ConstructStub());
2925 array_buffer_fun->shared()->DontAdaptArguments(); 2925 array_buffer_fun->shared()->DontAdaptArguments();
2926 array_buffer_fun->shared()->set_length(1); 2926 array_buffer_fun->shared()->set_length(1);
2927 2927
2928 // Install the "constructor" property on the {prototype}. 2928 // Install the "constructor" property on the {prototype}.
2929 JSObject::AddProperty(prototype, factory()->constructor_string(), 2929 JSObject::AddProperty(prototype, factory()->constructor_string(),
2930 array_buffer_fun, DONT_ENUM); 2930 array_buffer_fun, DONT_ENUM);
2931 2931
2932 SimpleInstallFunction(array_buffer_fun, factory()->isView_string(), 2932 SimpleInstallFunction(array_buffer_fun, factory()->isView_string(),
2933 Builtins::kArrayBufferIsView, 1, true); 2933 Builtins::kArrayBufferIsView, 1, true);
(...skipping 16 matching lines...) Expand all
2950 // To be used only for internal work by builtins. Instances 2950 // To be used only for internal work by builtins. Instances
2951 // must not be leaked to user code. 2951 // must not be leaked to user code.
2952 Handle<JSObject> prototype = 2952 Handle<JSObject> prototype =
2953 factory()->NewJSObject(isolate()->object_function(), TENURED); 2953 factory()->NewJSObject(isolate()->object_function(), TENURED);
2954 Handle<JSFunction> array_function = 2954 Handle<JSFunction> array_function =
2955 InstallFunction(target, name, JS_ARRAY_TYPE, JSArray::kSize, prototype, 2955 InstallFunction(target, name, JS_ARRAY_TYPE, JSArray::kSize, prototype,
2956 Builtins::kInternalArrayCode); 2956 Builtins::kInternalArrayCode);
2957 2957
2958 InternalArrayConstructorStub internal_array_constructor_stub(isolate()); 2958 InternalArrayConstructorStub internal_array_constructor_stub(isolate());
2959 Handle<Code> code = internal_array_constructor_stub.GetCode(); 2959 Handle<Code> code = internal_array_constructor_stub.GetCode();
2960 array_function->shared()->set_construct_stub(*code); 2960 array_function->shared()->SetConstructStub(*code);
2961 array_function->shared()->DontAdaptArguments(); 2961 array_function->shared()->DontAdaptArguments();
2962 2962
2963 Handle<Map> original_map(array_function->initial_map()); 2963 Handle<Map> original_map(array_function->initial_map());
2964 Handle<Map> initial_map = Map::Copy(original_map, "InternalArray"); 2964 Handle<Map> initial_map = Map::Copy(original_map, "InternalArray");
2965 initial_map->set_elements_kind(elements_kind); 2965 initial_map->set_elements_kind(elements_kind);
2966 JSFunction::SetInitialMap(array_function, initial_map, prototype); 2966 JSFunction::SetInitialMap(array_function, initial_map, prototype);
2967 2967
2968 // Make "length" magic on instances. 2968 // Make "length" magic on instances.
2969 Map::EnsureDescriptorSlack(initial_map, 1); 2969 Map::EnsureDescriptorSlack(initial_map, 1);
2970 2970
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
3140 concat->shared()->set_length(1); 3140 concat->shared()->set_length(1);
3141 } 3141 }
3142 3142
3143 // Set up the Promise constructor. 3143 // Set up the Promise constructor.
3144 { 3144 {
3145 Handle<String> key = factory()->Promise_string(); 3145 Handle<String> key = factory()->Promise_string();
3146 Handle<JSFunction> function = Handle<JSFunction>::cast( 3146 Handle<JSFunction> function = Handle<JSFunction>::cast(
3147 JSReceiver::GetProperty(global_object, key).ToHandleChecked()); 3147 JSReceiver::GetProperty(global_object, key).ToHandleChecked());
3148 JSFunction::EnsureHasInitialMap(function); 3148 JSFunction::EnsureHasInitialMap(function);
3149 function->initial_map()->set_instance_type(JS_PROMISE_TYPE); 3149 function->initial_map()->set_instance_type(JS_PROMISE_TYPE);
3150 function->shared()->set_construct_stub( 3150 function->shared()->SetConstructStub(
3151 *isolate()->builtins()->JSBuiltinsConstructStub()); 3151 *isolate()->builtins()->JSBuiltinsConstructStub());
3152 InstallWithIntrinsicDefaultProto(isolate(), function, 3152 InstallWithIntrinsicDefaultProto(isolate(), function,
3153 Context::PROMISE_FUNCTION_INDEX); 3153 Context::PROMISE_FUNCTION_INDEX);
3154 } 3154 }
3155 3155
3156 InstallBuiltinFunctionIds(); 3156 InstallBuiltinFunctionIds();
3157 3157
3158 // Create a map for accessor property descriptors (a variant of JSObject 3158 // Create a map for accessor property descriptors (a variant of JSObject
3159 // that predefines four properties get, set, configurable and enumerable). 3159 // that predefines four properties get, set, configurable and enumerable).
3160 { 3160 {
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
4098 } 4098 }
4099 4099
4100 4100
4101 // Called when the top-level V8 mutex is destroyed. 4101 // Called when the top-level V8 mutex is destroyed.
4102 void Bootstrapper::FreeThreadResources() { 4102 void Bootstrapper::FreeThreadResources() {
4103 DCHECK(!IsActive()); 4103 DCHECK(!IsActive());
4104 } 4104 }
4105 4105
4106 } // namespace internal 4106 } // namespace internal
4107 } // namespace v8 4107 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698