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

Side by Side Diff: src/bootstrapper.cc

Issue 10818005: Fix bootstrapping without snapshot and low GC interval. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed long line. Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/regress-2249.js » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 } 380 }
381 function->shared()->set_native(true); 381 function->shared()->set_native(true);
382 return function; 382 return function;
383 } 383 }
384 384
385 385
386 void Genesis::SetFunctionInstanceDescriptor( 386 void Genesis::SetFunctionInstanceDescriptor(
387 Handle<Map> map, PrototypePropertyMode prototypeMode) { 387 Handle<Map> map, PrototypePropertyMode prototypeMode) {
388 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5; 388 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5;
389 Handle<DescriptorArray> descriptors(factory()->NewDescriptorArray(size)); 389 Handle<DescriptorArray> descriptors(factory()->NewDescriptorArray(size));
390 DescriptorArray::WhitenessWitness witness(*descriptors);
391
392 Handle<Foreign> length(factory()->NewForeign(&Accessors::FunctionLength));
393 Handle<Foreign> name(factory()->NewForeign(&Accessors::FunctionName));
394 Handle<Foreign> args(factory()->NewForeign(&Accessors::FunctionArguments));
395 Handle<Foreign> caller(factory()->NewForeign(&Accessors::FunctionCaller));
396 Handle<Foreign> prototype;
397 if (prototypeMode != DONT_ADD_PROTOTYPE) {
398 prototype = factory()->NewForeign(&Accessors::FunctionPrototype);
399 }
390 PropertyAttributes attribs = static_cast<PropertyAttributes>( 400 PropertyAttributes attribs = static_cast<PropertyAttributes>(
391 DONT_ENUM | DONT_DELETE | READ_ONLY); 401 DONT_ENUM | DONT_DELETE | READ_ONLY);
392
393 DescriptorArray::WhitenessWitness witness(*descriptors);
394 map->set_instance_descriptors(*descriptors); 402 map->set_instance_descriptors(*descriptors);
395 403
396 { // Add length. 404 { // Add length.
397 Handle<Foreign> f(factory()->NewForeign(&Accessors::FunctionLength)); 405 CallbacksDescriptor d(*factory()->length_symbol(), *length, attribs);
398 CallbacksDescriptor d(*factory()->length_symbol(), *f, attribs);
399 map->AppendDescriptor(&d, witness); 406 map->AppendDescriptor(&d, witness);
400 } 407 }
401 { // Add name. 408 { // Add name.
402 Handle<Foreign> f(factory()->NewForeign(&Accessors::FunctionName)); 409 CallbacksDescriptor d(*factory()->name_symbol(), *name, attribs);
403 CallbacksDescriptor d(*factory()->name_symbol(), *f, attribs);
404 map->AppendDescriptor(&d, witness); 410 map->AppendDescriptor(&d, witness);
405 } 411 }
406 { // Add arguments. 412 { // Add arguments.
407 Handle<Foreign> f(factory()->NewForeign(&Accessors::FunctionArguments)); 413 CallbacksDescriptor d(*factory()->arguments_symbol(), *args, attribs);
408 CallbacksDescriptor d(*factory()->arguments_symbol(), *f, attribs);
409 map->AppendDescriptor(&d, witness); 414 map->AppendDescriptor(&d, witness);
410 } 415 }
411 { // Add caller. 416 { // Add caller.
412 Handle<Foreign> f(factory()->NewForeign(&Accessors::FunctionCaller)); 417 CallbacksDescriptor d(*factory()->caller_symbol(), *caller, attribs);
413 CallbacksDescriptor d(*factory()->caller_symbol(), *f, attribs);
414 map->AppendDescriptor(&d, witness); 418 map->AppendDescriptor(&d, witness);
415 } 419 }
416 if (prototypeMode != DONT_ADD_PROTOTYPE) { 420 if (prototypeMode != DONT_ADD_PROTOTYPE) {
417 // Add prototype. 421 // Add prototype.
418 if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) { 422 if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) {
419 attribs = static_cast<PropertyAttributes>(attribs & ~READ_ONLY); 423 attribs = static_cast<PropertyAttributes>(attribs & ~READ_ONLY);
420 } 424 }
421 Handle<Foreign> f(factory()->NewForeign(&Accessors::FunctionPrototype)); 425 CallbacksDescriptor d(*factory()->prototype_symbol(), *prototype, attribs);
422 CallbacksDescriptor d(*factory()->prototype_symbol(), *f, attribs);
423 map->AppendDescriptor(&d, witness); 426 map->AppendDescriptor(&d, witness);
424 } 427 }
425 } 428 }
426 429
427 430
428 Handle<Map> Genesis::CreateFunctionMap(PrototypePropertyMode prototype_mode) { 431 Handle<Map> Genesis::CreateFunctionMap(PrototypePropertyMode prototype_mode) {
429 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); 432 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize);
430 SetFunctionInstanceDescriptor(map, prototype_mode); 433 SetFunctionInstanceDescriptor(map, prototype_mode);
431 map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE); 434 map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE);
432 return map; 435 return map;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 global_context()->object_function()->prototype()); 521 global_context()->object_function()->prototype());
519 empty_function->set_map(*empty_function_map); 522 empty_function->set_map(*empty_function_map);
520 return empty_function; 523 return empty_function;
521 } 524 }
522 525
523 526
524 void Genesis::SetStrictFunctionInstanceDescriptor( 527 void Genesis::SetStrictFunctionInstanceDescriptor(
525 Handle<Map> map, PrototypePropertyMode prototypeMode) { 528 Handle<Map> map, PrototypePropertyMode prototypeMode) {
526 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5; 529 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5;
527 Handle<DescriptorArray> descriptors(factory()->NewDescriptorArray(size)); 530 Handle<DescriptorArray> descriptors(factory()->NewDescriptorArray(size));
531 DescriptorArray::WhitenessWitness witness(*descriptors);
532
533 Handle<Foreign> length(factory()->NewForeign(&Accessors::FunctionLength));
534 Handle<Foreign> name(factory()->NewForeign(&Accessors::FunctionName));
535 Handle<AccessorPair> arguments(factory()->NewAccessorPair());
536 Handle<AccessorPair> caller(factory()->NewAccessorPair());
537 Handle<Foreign> prototype;
538 if (prototypeMode != DONT_ADD_PROTOTYPE) {
539 prototype = factory()->NewForeign(&Accessors::FunctionPrototype);
540 }
528 PropertyAttributes attribs = static_cast<PropertyAttributes>( 541 PropertyAttributes attribs = static_cast<PropertyAttributes>(
529 DONT_ENUM | DONT_DELETE); 542 DONT_ENUM | DONT_DELETE);
530
531 DescriptorArray::WhitenessWitness witness(*descriptors);
532 map->set_instance_descriptors(*descriptors); 543 map->set_instance_descriptors(*descriptors);
533 544
534 { // Add length. 545 { // Add length.
535 Handle<Foreign> f(factory()->NewForeign(&Accessors::FunctionLength)); 546 CallbacksDescriptor d(*factory()->length_symbol(), *length, attribs);
536 CallbacksDescriptor d(*factory()->length_symbol(), *f, attribs);
537 map->AppendDescriptor(&d, witness); 547 map->AppendDescriptor(&d, witness);
538 } 548 }
539 { // Add name. 549 { // Add name.
540 Handle<Foreign> f(factory()->NewForeign(&Accessors::FunctionName)); 550 CallbacksDescriptor d(*factory()->name_symbol(), *name, attribs);
541 CallbacksDescriptor d(*factory()->name_symbol(), *f, attribs);
542 map->AppendDescriptor(&d, witness); 551 map->AppendDescriptor(&d, witness);
543 } 552 }
544 { // Add arguments. 553 { // Add arguments.
545 Handle<AccessorPair> arguments(factory()->NewAccessorPair());
546 CallbacksDescriptor d(*factory()->arguments_symbol(), *arguments, attribs); 554 CallbacksDescriptor d(*factory()->arguments_symbol(), *arguments, attribs);
547 map->AppendDescriptor(&d, witness); 555 map->AppendDescriptor(&d, witness);
548 } 556 }
549 { // Add caller. 557 { // Add caller.
550 Handle<AccessorPair> caller(factory()->NewAccessorPair());
551 CallbacksDescriptor d(*factory()->caller_symbol(), *caller, attribs); 558 CallbacksDescriptor d(*factory()->caller_symbol(), *caller, attribs);
552 map->AppendDescriptor(&d, witness); 559 map->AppendDescriptor(&d, witness);
553 } 560 }
554
555 if (prototypeMode != DONT_ADD_PROTOTYPE) { 561 if (prototypeMode != DONT_ADD_PROTOTYPE) {
556 // Add prototype. 562 // Add prototype.
557 if (prototypeMode != ADD_WRITEABLE_PROTOTYPE) { 563 if (prototypeMode != ADD_WRITEABLE_PROTOTYPE) {
558 attribs = static_cast<PropertyAttributes>(attribs | READ_ONLY); 564 attribs = static_cast<PropertyAttributes>(attribs | READ_ONLY);
559 } 565 }
560 Handle<Foreign> f(factory()->NewForeign(&Accessors::FunctionPrototype)); 566 CallbacksDescriptor d(*factory()->prototype_symbol(), *prototype, attribs);
561 CallbacksDescriptor d(*factory()->prototype_symbol(), *f, attribs);
562 map->AppendDescriptor(&d, witness); 567 map->AppendDescriptor(&d, witness);
563 } 568 }
564 } 569 }
565 570
566 571
567 // ECMAScript 5th Edition, 13.2.3 572 // ECMAScript 5th Edition, 13.2.3
568 Handle<JSFunction> Genesis::GetThrowTypeErrorFunction() { 573 Handle<JSFunction> Genesis::GetThrowTypeErrorFunction() {
569 if (throw_type_error_function.is_null()) { 574 if (throw_type_error_function.is_null()) {
570 Handle<String> name = factory()->LookupAsciiSymbol("ThrowTypeError"); 575 Handle<String> name = factory()->LookupAsciiSymbol("ThrowTypeError");
571 throw_type_error_function = 576 throw_type_error_function =
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 856
852 { // --- A r r a y --- 857 { // --- A r r a y ---
853 Handle<JSFunction> array_function = 858 Handle<JSFunction> array_function =
854 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize, 859 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize,
855 isolate->initial_object_prototype(), 860 isolate->initial_object_prototype(),
856 Builtins::kArrayCode, true); 861 Builtins::kArrayCode, true);
857 array_function->shared()->set_construct_stub( 862 array_function->shared()->set_construct_stub(
858 isolate->builtins()->builtin(Builtins::kArrayConstructCode)); 863 isolate->builtins()->builtin(Builtins::kArrayConstructCode));
859 array_function->shared()->DontAdaptArguments(); 864 array_function->shared()->DontAdaptArguments();
860 865
861
862 // This seems a bit hackish, but we need to make sure Array.length 866 // This seems a bit hackish, but we need to make sure Array.length
863 // is 1. 867 // is 1.
864 array_function->shared()->set_length(1); 868 array_function->shared()->set_length(1);
865 869
866 Handle<DescriptorArray> array_descriptors(factory->NewDescriptorArray(1)); 870 Handle<DescriptorArray> array_descriptors(factory->NewDescriptorArray(1));
871 DescriptorArray::WhitenessWitness witness(*array_descriptors);
872
873 Handle<Foreign> array_length(factory->NewForeign(&Accessors::ArrayLength));
867 PropertyAttributes attribs = static_cast<PropertyAttributes>( 874 PropertyAttributes attribs = static_cast<PropertyAttributes>(
868 DONT_ENUM | DONT_DELETE); 875 DONT_ENUM | DONT_DELETE);
869
870 DescriptorArray::WhitenessWitness witness(*array_descriptors);
871 array_function->initial_map()->set_instance_descriptors(*array_descriptors); 876 array_function->initial_map()->set_instance_descriptors(*array_descriptors);
872 877
873 { // Add length. 878 { // Add length.
874 Handle<Foreign> f(factory->NewForeign(&Accessors::ArrayLength)); 879 CallbacksDescriptor d(*factory->length_symbol(), *array_length, attribs);
875 CallbacksDescriptor d(*factory->length_symbol(), *f, attribs);
876 array_function->initial_map()->AppendDescriptor(&d, witness); 880 array_function->initial_map()->AppendDescriptor(&d, witness);
877 } 881 }
878 882
879 // array_function is used internally. JS code creating array object should 883 // array_function is used internally. JS code creating array object should
880 // search for the 'Array' property on the global object and use that one 884 // search for the 'Array' property on the global object and use that one
881 // as the constructor. 'Array' property on a global object can be 885 // as the constructor. 'Array' property on a global object can be
882 // overwritten by JS code. 886 // overwritten by JS code.
883 global_context()->set_array_function(*array_function); 887 global_context()->set_array_function(*array_function);
884 } 888 }
885 889
(...skipping 18 matching lines...) Expand all
904 InstallFunction(global, "String", JS_VALUE_TYPE, JSValue::kSize, 908 InstallFunction(global, "String", JS_VALUE_TYPE, JSValue::kSize,
905 isolate->initial_object_prototype(), 909 isolate->initial_object_prototype(),
906 Builtins::kIllegal, true); 910 Builtins::kIllegal, true);
907 string_fun->shared()->set_construct_stub( 911 string_fun->shared()->set_construct_stub(
908 isolate->builtins()->builtin(Builtins::kStringConstructCode)); 912 isolate->builtins()->builtin(Builtins::kStringConstructCode));
909 global_context()->set_string_function(*string_fun); 913 global_context()->set_string_function(*string_fun);
910 914
911 Handle<Map> string_map = 915 Handle<Map> string_map =
912 Handle<Map>(global_context()->string_function()->initial_map()); 916 Handle<Map>(global_context()->string_function()->initial_map());
913 Handle<DescriptorArray> string_descriptors(factory->NewDescriptorArray(1)); 917 Handle<DescriptorArray> string_descriptors(factory->NewDescriptorArray(1));
918 DescriptorArray::WhitenessWitness witness(*string_descriptors);
919
920 Handle<Foreign> string_length(
921 factory->NewForeign(&Accessors::StringLength));
914 PropertyAttributes attribs = static_cast<PropertyAttributes>( 922 PropertyAttributes attribs = static_cast<PropertyAttributes>(
915 DONT_ENUM | DONT_DELETE | READ_ONLY); 923 DONT_ENUM | DONT_DELETE | READ_ONLY);
916
917 DescriptorArray::WhitenessWitness witness(*string_descriptors);
918 string_map->set_instance_descriptors(*string_descriptors); 924 string_map->set_instance_descriptors(*string_descriptors);
919 925
920 { // Add length. 926 { // Add length.
921 Handle<Foreign> f(factory->NewForeign(&Accessors::StringLength)); 927 CallbacksDescriptor d(*factory->length_symbol(), *string_length, attribs);
922 CallbacksDescriptor d(*factory->length_symbol(), *f, attribs);
923 string_map->AppendDescriptor(&d, witness); 928 string_map->AppendDescriptor(&d, witness);
924 } 929 }
925 } 930 }
926 931
927 { // --- D a t e --- 932 { // --- D a t e ---
928 // Builtin functions for Date.prototype. 933 // Builtin functions for Date.prototype.
929 Handle<JSFunction> date_fun = 934 Handle<JSFunction> date_fun =
930 InstallFunction(global, "Date", JS_DATE_TYPE, JSDate::kSize, 935 InstallFunction(global, "Date", JS_DATE_TYPE, JSDate::kSize,
931 isolate->initial_object_prototype(), 936 isolate->initial_object_prototype(),
932 Builtins::kIllegal, true); 937 Builtins::kIllegal, true);
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 // Builtin functions for Script. 1471 // Builtin functions for Script.
1467 Handle<JSFunction> script_fun = 1472 Handle<JSFunction> script_fun =
1468 InstallFunction(builtins, "Script", JS_VALUE_TYPE, JSValue::kSize, 1473 InstallFunction(builtins, "Script", JS_VALUE_TYPE, JSValue::kSize,
1469 isolate()->initial_object_prototype(), 1474 isolate()->initial_object_prototype(),
1470 Builtins::kIllegal, false); 1475 Builtins::kIllegal, false);
1471 Handle<JSObject> prototype = 1476 Handle<JSObject> prototype =
1472 factory()->NewJSObject(isolate()->object_function(), TENURED); 1477 factory()->NewJSObject(isolate()->object_function(), TENURED);
1473 SetPrototype(script_fun, prototype); 1478 SetPrototype(script_fun, prototype);
1474 global_context()->set_script_function(*script_fun); 1479 global_context()->set_script_function(*script_fun);
1475 1480
1476 PropertyAttributes attribs =
1477 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
1478
1479 Handle<Map> script_map = Handle<Map>(script_fun->initial_map()); 1481 Handle<Map> script_map = Handle<Map>(script_fun->initial_map());
1480 1482
1481 Handle<DescriptorArray> script_descriptors( 1483 Handle<DescriptorArray> script_descriptors(
1482 factory()->NewDescriptorArray(13)); 1484 factory()->NewDescriptorArray(13));
1485 DescriptorArray::WhitenessWitness witness(*script_descriptors);
1483 1486
1484 DescriptorArray::WhitenessWitness witness(*script_descriptors); 1487 Handle<Foreign> script_source(
1488 factory()->NewForeign(&Accessors::ScriptSource));
1489 Handle<Foreign> script_name(factory()->NewForeign(&Accessors::ScriptName));
1490 Handle<String> id_symbol(factory()->LookupAsciiSymbol("id"));
1491 Handle<Foreign> script_id(factory()->NewForeign(&Accessors::ScriptId));
1492 Handle<String> line_offset_symbol(
1493 factory()->LookupAsciiSymbol("line_offset"));
1494 Handle<Foreign> script_line_offset(
1495 factory()->NewForeign(&Accessors::ScriptLineOffset));
1496 Handle<String> column_offset_symbol(
1497 factory()->LookupAsciiSymbol("column_offset"));
1498 Handle<Foreign> script_column_offset(
1499 factory()->NewForeign(&Accessors::ScriptColumnOffset));
1500 Handle<String> data_symbol(factory()->LookupAsciiSymbol("data"));
1501 Handle<Foreign> script_data(factory()->NewForeign(&Accessors::ScriptData));
1502 Handle<String> type_symbol(factory()->LookupAsciiSymbol("type"));
1503 Handle<Foreign> script_type(factory()->NewForeign(&Accessors::ScriptType));
1504 Handle<String> compilation_type_symbol(
1505 factory()->LookupAsciiSymbol("compilation_type"));
1506 Handle<Foreign> script_compilation_type(
1507 factory()->NewForeign(&Accessors::ScriptCompilationType));
1508 Handle<String> line_ends_symbol(factory()->LookupAsciiSymbol("line_ends"));
1509 Handle<Foreign> script_line_ends(
1510 factory()->NewForeign(&Accessors::ScriptLineEnds));
1511 Handle<String> context_data_symbol(
1512 factory()->LookupAsciiSymbol("context_data"));
1513 Handle<Foreign> script_context_data(
1514 factory()->NewForeign(&Accessors::ScriptContextData));
1515 Handle<String> eval_from_script_symbol(
1516 factory()->LookupAsciiSymbol("eval_from_script"));
1517 Handle<Foreign> script_eval_from_script(
1518 factory()->NewForeign(&Accessors::ScriptEvalFromScript));
1519 Handle<String> eval_from_script_position_symbol(
1520 factory()->LookupAsciiSymbol("eval_from_script_position"));
1521 Handle<Foreign> script_eval_from_script_position(
1522 factory()->NewForeign(&Accessors::ScriptEvalFromScriptPosition));
1523 Handle<String> eval_from_function_name_symbol(
1524 factory()->LookupAsciiSymbol("eval_from_function_name"));
1525 Handle<Foreign> script_eval_from_function_name(
1526 factory()->NewForeign(&Accessors::ScriptEvalFromFunctionName));
1527 PropertyAttributes attribs =
1528 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
1485 script_map->set_instance_descriptors(*script_descriptors); 1529 script_map->set_instance_descriptors(*script_descriptors);
1486 1530
1487 { 1531 {
1488 Handle<Foreign> f(factory()->NewForeign(&Accessors::ScriptSource));
1489 CallbacksDescriptor d( 1532 CallbacksDescriptor d(
1490 *factory()->LookupAsciiSymbol("source"), *f, attribs); 1533 *factory()->source_symbol(), *script_source, attribs);
1491 script_map->AppendDescriptor(&d, witness); 1534 script_map->AppendDescriptor(&d, witness);
1492 } 1535 }
1493 1536
1494 { 1537 {
1495 Handle<Foreign> f(factory()->NewForeign(&Accessors::ScriptName)); 1538 CallbacksDescriptor d(*factory()->name_symbol(), *script_name, attribs);
1496 CallbacksDescriptor d(
1497 *factory()->LookupAsciiSymbol("name"), *f, attribs);
1498 script_map->AppendDescriptor(&d, witness); 1539 script_map->AppendDescriptor(&d, witness);
1499 } 1540 }
1500 1541
1501 { 1542 {
1502 Handle<Foreign> f(factory()->NewForeign(&Accessors::ScriptId)); 1543 CallbacksDescriptor d(*id_symbol, *script_id, attribs);
1503 CallbacksDescriptor d(
1504 *factory()->LookupAsciiSymbol("id"), *f, attribs);
1505 script_map->AppendDescriptor(&d, witness); 1544 script_map->AppendDescriptor(&d, witness);
1506 } 1545 }
1507 1546
1508 { 1547 {
1509 Handle<Foreign> f(factory()->NewForeign(&Accessors::ScriptLineOffset)); 1548 CallbacksDescriptor d(*line_offset_symbol, *script_line_offset, attribs);
1510 CallbacksDescriptor d(
1511 *factory()->LookupAsciiSymbol("line_offset"), *f, attribs);
1512 script_map->AppendDescriptor(&d, witness); 1549 script_map->AppendDescriptor(&d, witness);
1513 } 1550 }
1514 1551
1515 { 1552 {
1516 Handle<Foreign> f(factory()->NewForeign(&Accessors::ScriptColumnOffset));
1517 CallbacksDescriptor d( 1553 CallbacksDescriptor d(
1518 *factory()->LookupAsciiSymbol("column_offset"), *f, attribs); 1554 *column_offset_symbol, *script_column_offset, attribs);
1519 script_map->AppendDescriptor(&d, witness); 1555 script_map->AppendDescriptor(&d, witness);
1520 } 1556 }
1521 1557
1522 { 1558 {
1523 Handle<Foreign> f(factory()->NewForeign(&Accessors::ScriptData)); 1559 CallbacksDescriptor d(*data_symbol, *script_data, attribs);
1524 CallbacksDescriptor d(
1525 *factory()->LookupAsciiSymbol("data"), *f, attribs);
1526 script_map->AppendDescriptor(&d, witness); 1560 script_map->AppendDescriptor(&d, witness);
1527 } 1561 }
1528 1562
1529 { 1563 {
1530 Handle<Foreign> f(factory()->NewForeign(&Accessors::ScriptType)); 1564 CallbacksDescriptor d(*type_symbol, *script_type, attribs);
1531 CallbacksDescriptor d(
1532 *factory()->LookupAsciiSymbol("type"), *f, attribs);
1533 script_map->AppendDescriptor(&d, witness); 1565 script_map->AppendDescriptor(&d, witness);
1534 } 1566 }
1535 1567
1536 { 1568 {
1537 Handle<Foreign> f(factory()->NewForeign(
1538 &Accessors::ScriptCompilationType));
1539 CallbacksDescriptor d( 1569 CallbacksDescriptor d(
1540 *factory()->LookupAsciiSymbol("compilation_type"), *f, attribs); 1570 *compilation_type_symbol, *script_compilation_type, attribs);
1541 script_map->AppendDescriptor(&d, witness); 1571 script_map->AppendDescriptor(&d, witness);
1542 } 1572 }
1543 1573
1544 { 1574 {
1545 Handle<Foreign> f(factory()->NewForeign(&Accessors::ScriptLineEnds)); 1575 CallbacksDescriptor d(*line_ends_symbol, *script_line_ends, attribs);
1546 CallbacksDescriptor d(
1547 *factory()->LookupAsciiSymbol("line_ends"), *f, attribs);
1548 script_map->AppendDescriptor(&d, witness); 1576 script_map->AppendDescriptor(&d, witness);
1549 } 1577 }
1550 1578
1551 { 1579 {
1552 Handle<Foreign> f(factory()->NewForeign(&Accessors::ScriptContextData));
1553 CallbacksDescriptor d( 1580 CallbacksDescriptor d(
1554 *factory()->LookupAsciiSymbol("context_data"), *f, attribs); 1581 *context_data_symbol, *script_context_data, attribs);
1555 script_map->AppendDescriptor(&d, witness); 1582 script_map->AppendDescriptor(&d, witness);
1556 } 1583 }
1557 1584
1558 { 1585 {
1559 Handle<Foreign> f(factory()->NewForeign(
1560 &Accessors::ScriptEvalFromScript));
1561 CallbacksDescriptor d( 1586 CallbacksDescriptor d(
1562 *factory()->LookupAsciiSymbol("eval_from_script"), *f, attribs); 1587 *eval_from_script_symbol, *script_eval_from_script, attribs);
1563 script_map->AppendDescriptor(&d, witness); 1588 script_map->AppendDescriptor(&d, witness);
1564 } 1589 }
1565 1590
1566 { 1591 {
1567 Handle<Foreign> f(factory()->NewForeign(
1568 &Accessors::ScriptEvalFromScriptPosition));
1569 CallbacksDescriptor d( 1592 CallbacksDescriptor d(
1570 *factory()->LookupAsciiSymbol("eval_from_script_position"), 1593 *eval_from_script_position_symbol,
1571 *f, 1594 *script_eval_from_script_position,
1572 attribs); 1595 attribs);
1573 script_map->AppendDescriptor(&d, witness); 1596 script_map->AppendDescriptor(&d, witness);
1574 } 1597 }
1575 1598
1576 { 1599 {
1577 Handle<Foreign> f(factory()->NewForeign(
1578 &Accessors::ScriptEvalFromFunctionName));
1579 CallbacksDescriptor d( 1600 CallbacksDescriptor d(
1580 *factory()->LookupAsciiSymbol("eval_from_function_name"), 1601 *eval_from_function_name_symbol,
1581 *f, 1602 *script_eval_from_function_name,
1582 attribs); 1603 attribs);
1583 script_map->AppendDescriptor(&d, witness); 1604 script_map->AppendDescriptor(&d, witness);
1584 } 1605 }
1585 1606
1586 // Allocate the empty script. 1607 // Allocate the empty script.
1587 Handle<Script> script = factory()->NewScript(factory()->empty_string()); 1608 Handle<Script> script = factory()->NewScript(factory()->empty_string());
1588 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); 1609 script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
1589 heap()->public_set_empty_script(*script); 1610 heap()->public_set_empty_script(*script);
1590 } 1611 }
1591 { 1612 {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 // transition easy to trap. Moreover, they rarely are smi-only. 1653 // transition easy to trap. Moreover, they rarely are smi-only.
1633 MaybeObject* maybe_map = 1654 MaybeObject* maybe_map =
1634 array_function->initial_map()->Copy(DescriptorArray::MAY_BE_SHARED); 1655 array_function->initial_map()->Copy(DescriptorArray::MAY_BE_SHARED);
1635 Map* new_map; 1656 Map* new_map;
1636 if (!maybe_map->To(&new_map)) return false; 1657 if (!maybe_map->To(&new_map)) return false;
1637 new_map->set_elements_kind(FAST_HOLEY_ELEMENTS); 1658 new_map->set_elements_kind(FAST_HOLEY_ELEMENTS);
1638 array_function->set_initial_map(new_map); 1659 array_function->set_initial_map(new_map);
1639 1660
1640 // Make "length" magic on instances. 1661 // Make "length" magic on instances.
1641 Handle<DescriptorArray> array_descriptors(factory()->NewDescriptorArray(1)); 1662 Handle<DescriptorArray> array_descriptors(factory()->NewDescriptorArray(1));
1663 DescriptorArray::WhitenessWitness witness(*array_descriptors);
1664
1665 Handle<Foreign> array_length(factory()->NewForeign(
1666 &Accessors::ArrayLength));
1642 PropertyAttributes attribs = static_cast<PropertyAttributes>( 1667 PropertyAttributes attribs = static_cast<PropertyAttributes>(
1643 DONT_ENUM | DONT_DELETE); 1668 DONT_ENUM | DONT_DELETE);
1644
1645 DescriptorArray::WhitenessWitness witness(*array_descriptors);
1646 array_function->initial_map()->set_instance_descriptors(*array_descriptors); 1669 array_function->initial_map()->set_instance_descriptors(*array_descriptors);
1647 1670
1648 { // Add length. 1671 { // Add length.
1649 Handle<Foreign> f(factory()->NewForeign(&Accessors::ArrayLength)); 1672 CallbacksDescriptor d(
1650 CallbacksDescriptor d(*factory()->length_symbol(), *f, attribs); 1673 *factory()->length_symbol(), *array_length, attribs);
1651 array_function->initial_map()->AppendDescriptor(&d, witness); 1674 array_function->initial_map()->AppendDescriptor(&d, witness);
1652 } 1675 }
1653 1676
1654 global_context()->set_internal_array_function(*array_function); 1677 global_context()->set_internal_array_function(*array_function);
1655 } 1678 }
1656 1679
1657 if (FLAG_disable_native_files) { 1680 if (FLAG_disable_native_files) {
1658 PrintF("Warning: Running without installed natives!\n"); 1681 PrintF("Warning: Running without installed natives!\n");
1659 return true; 1682 return true;
1660 } 1683 }
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
2363 return from + sizeof(NestingCounterType); 2386 return from + sizeof(NestingCounterType);
2364 } 2387 }
2365 2388
2366 2389
2367 // Called when the top-level V8 mutex is destroyed. 2390 // Called when the top-level V8 mutex is destroyed.
2368 void Bootstrapper::FreeThreadResources() { 2391 void Bootstrapper::FreeThreadResources() {
2369 ASSERT(!IsActive()); 2392 ASSERT(!IsActive());
2370 } 2393 }
2371 2394
2372 } } // namespace v8::internal 2395 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress-2249.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698