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

Side by Side Diff: src/bootstrapper.cc

Issue 11028027: Revert trunk to bleeding_edge at r12484 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 8 years, 2 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 | « src/atomicops.h ('k') | src/builtins.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 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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 function->shared()->set_instance_class_name(*symbol); 377 function->shared()->set_instance_class_name(*symbol);
378 } 378 }
379 function->shared()->set_native(true); 379 function->shared()->set_native(true);
380 return function; 380 return function;
381 } 381 }
382 382
383 383
384 void Genesis::SetFunctionInstanceDescriptor( 384 void Genesis::SetFunctionInstanceDescriptor(
385 Handle<Map> map, PrototypePropertyMode prototypeMode) { 385 Handle<Map> map, PrototypePropertyMode prototypeMode) {
386 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5; 386 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5;
387 Handle<DescriptorArray> descriptors(factory()->NewDescriptorArray(0, size)); 387 Handle<DescriptorArray> descriptors(factory()->NewDescriptorArray(size));
388 DescriptorArray::WhitenessWitness witness(*descriptors); 388 DescriptorArray::WhitenessWitness witness(*descriptors);
389 389
390 Handle<Foreign> length(factory()->NewForeign(&Accessors::FunctionLength)); 390 Handle<Foreign> length(factory()->NewForeign(&Accessors::FunctionLength));
391 Handle<Foreign> name(factory()->NewForeign(&Accessors::FunctionName)); 391 Handle<Foreign> name(factory()->NewForeign(&Accessors::FunctionName));
392 Handle<Foreign> args(factory()->NewForeign(&Accessors::FunctionArguments)); 392 Handle<Foreign> args(factory()->NewForeign(&Accessors::FunctionArguments));
393 Handle<Foreign> caller(factory()->NewForeign(&Accessors::FunctionCaller)); 393 Handle<Foreign> caller(factory()->NewForeign(&Accessors::FunctionCaller));
394 Handle<Foreign> prototype; 394 Handle<Foreign> prototype;
395 if (prototypeMode != DONT_ADD_PROTOTYPE) { 395 if (prototypeMode != DONT_ADD_PROTOTYPE) {
396 prototype = factory()->NewForeign(&Accessors::FunctionPrototype); 396 prototype = factory()->NewForeign(&Accessors::FunctionPrototype);
397 } 397 }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 empty_function_map->set_prototype( 518 empty_function_map->set_prototype(
519 native_context()->object_function()->prototype()); 519 native_context()->object_function()->prototype());
520 empty_function->set_map(*empty_function_map); 520 empty_function->set_map(*empty_function_map);
521 return empty_function; 521 return empty_function;
522 } 522 }
523 523
524 524
525 void Genesis::SetStrictFunctionInstanceDescriptor( 525 void Genesis::SetStrictFunctionInstanceDescriptor(
526 Handle<Map> map, PrototypePropertyMode prototypeMode) { 526 Handle<Map> map, PrototypePropertyMode prototypeMode) {
527 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5; 527 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5;
528 Handle<DescriptorArray> descriptors(factory()->NewDescriptorArray(0, size)); 528 Handle<DescriptorArray> descriptors(factory()->NewDescriptorArray(size));
529 DescriptorArray::WhitenessWitness witness(*descriptors); 529 DescriptorArray::WhitenessWitness witness(*descriptors);
530 530
531 Handle<Foreign> length(factory()->NewForeign(&Accessors::FunctionLength)); 531 Handle<Foreign> length(factory()->NewForeign(&Accessors::FunctionLength));
532 Handle<Foreign> name(factory()->NewForeign(&Accessors::FunctionName)); 532 Handle<Foreign> name(factory()->NewForeign(&Accessors::FunctionName));
533 Handle<AccessorPair> arguments(factory()->NewAccessorPair()); 533 Handle<AccessorPair> arguments(factory()->NewAccessorPair());
534 Handle<AccessorPair> caller(factory()->NewAccessorPair()); 534 Handle<AccessorPair> caller(factory()->NewAccessorPair());
535 Handle<Foreign> prototype; 535 Handle<Foreign> prototype;
536 if (prototypeMode != DONT_ADD_PROTOTYPE) { 536 if (prototypeMode != DONT_ADD_PROTOTYPE) {
537 prototype = factory()->NewForeign(&Accessors::FunctionPrototype); 537 prototype = factory()->NewForeign(&Accessors::FunctionPrototype);
538 } 538 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 PoisonArgumentsAndCaller(strict_mode_function_map); 630 PoisonArgumentsAndCaller(strict_mode_function_map);
631 PoisonArgumentsAndCaller( 631 PoisonArgumentsAndCaller(
632 strict_mode_function_instance_map_writable_prototype_); 632 strict_mode_function_instance_map_writable_prototype_);
633 } 633 }
634 634
635 635
636 static void SetAccessors(Handle<Map> map, 636 static void SetAccessors(Handle<Map> map,
637 Handle<String> name, 637 Handle<String> name,
638 Handle<JSFunction> func) { 638 Handle<JSFunction> func) {
639 DescriptorArray* descs = map->instance_descriptors(); 639 DescriptorArray* descs = map->instance_descriptors();
640 int number = descs->SearchWithCache(*name, *map); 640 int number = descs->Search(*name);
641 AccessorPair* accessors = AccessorPair::cast(descs->GetValue(number)); 641 AccessorPair* accessors = AccessorPair::cast(descs->GetValue(number));
642 accessors->set_getter(*func); 642 accessors->set_getter(*func);
643 accessors->set_setter(*func); 643 accessors->set_setter(*func);
644 } 644 }
645 645
646 646
647 void Genesis::PoisonArgumentsAndCaller(Handle<Map> map) { 647 void Genesis::PoisonArgumentsAndCaller(Handle<Map> map) {
648 SetAccessors(map, factory()->arguments_symbol(), GetThrowTypeErrorFunction()); 648 SetAccessors(map, factory()->arguments_symbol(), GetThrowTypeErrorFunction());
649 SetAccessors(map, factory()->caller_symbol(), GetThrowTypeErrorFunction()); 649 SetAccessors(map, factory()->caller_symbol(), GetThrowTypeErrorFunction());
650 } 650 }
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 Builtins::kArrayCode, true); 861 Builtins::kArrayCode, true);
862 array_function->shared()->set_construct_stub( 862 array_function->shared()->set_construct_stub(
863 isolate->builtins()->builtin(Builtins::kArrayConstructCode)); 863 isolate->builtins()->builtin(Builtins::kArrayConstructCode));
864 array_function->shared()->DontAdaptArguments(); 864 array_function->shared()->DontAdaptArguments();
865 865
866 // 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
867 // is 1. 867 // is 1.
868 array_function->shared()->set_length(1); 868 array_function->shared()->set_length(1);
869 869
870 Handle<Map> initial_map(array_function->initial_map()); 870 Handle<Map> initial_map(array_function->initial_map());
871 Handle<DescriptorArray> array_descriptors( 871 Handle<DescriptorArray> array_descriptors(factory->NewDescriptorArray(1));
872 factory->NewDescriptorArray(0, 1));
873 DescriptorArray::WhitenessWitness witness(*array_descriptors); 872 DescriptorArray::WhitenessWitness witness(*array_descriptors);
874 873
875 Handle<Foreign> array_length(factory->NewForeign(&Accessors::ArrayLength)); 874 Handle<Foreign> array_length(factory->NewForeign(&Accessors::ArrayLength));
876 PropertyAttributes attribs = static_cast<PropertyAttributes>( 875 PropertyAttributes attribs = static_cast<PropertyAttributes>(
877 DONT_ENUM | DONT_DELETE); 876 DONT_ENUM | DONT_DELETE);
878 Map::SetDescriptors(initial_map, array_descriptors); 877 Map::SetDescriptors(initial_map, array_descriptors);
879 878
880 { // Add length. 879 { // Add length.
881 CallbacksDescriptor d(*factory->length_symbol(), *array_length, attribs); 880 CallbacksDescriptor d(*factory->length_symbol(), *array_length, attribs);
882 array_function->initial_map()->AppendDescriptor(&d, witness); 881 array_function->initial_map()->AppendDescriptor(&d, witness);
(...skipping 26 matching lines...) Expand all
909 Handle<JSFunction> string_fun = 908 Handle<JSFunction> string_fun =
910 InstallFunction(global, "String", JS_VALUE_TYPE, JSValue::kSize, 909 InstallFunction(global, "String", JS_VALUE_TYPE, JSValue::kSize,
911 isolate->initial_object_prototype(), 910 isolate->initial_object_prototype(),
912 Builtins::kIllegal, true); 911 Builtins::kIllegal, true);
913 string_fun->shared()->set_construct_stub( 912 string_fun->shared()->set_construct_stub(
914 isolate->builtins()->builtin(Builtins::kStringConstructCode)); 913 isolate->builtins()->builtin(Builtins::kStringConstructCode));
915 native_context()->set_string_function(*string_fun); 914 native_context()->set_string_function(*string_fun);
916 915
917 Handle<Map> string_map = 916 Handle<Map> string_map =
918 Handle<Map>(native_context()->string_function()->initial_map()); 917 Handle<Map>(native_context()->string_function()->initial_map());
919 Handle<DescriptorArray> string_descriptors( 918 Handle<DescriptorArray> string_descriptors(factory->NewDescriptorArray(1));
920 factory->NewDescriptorArray(0, 1));
921 DescriptorArray::WhitenessWitness witness(*string_descriptors); 919 DescriptorArray::WhitenessWitness witness(*string_descriptors);
922 920
923 Handle<Foreign> string_length( 921 Handle<Foreign> string_length(
924 factory->NewForeign(&Accessors::StringLength)); 922 factory->NewForeign(&Accessors::StringLength));
925 PropertyAttributes attribs = static_cast<PropertyAttributes>( 923 PropertyAttributes attribs = static_cast<PropertyAttributes>(
926 DONT_ENUM | DONT_DELETE | READ_ONLY); 924 DONT_ENUM | DONT_DELETE | READ_ONLY);
927 Map::SetDescriptors(string_map, string_descriptors); 925 Map::SetDescriptors(string_map, string_descriptors);
928 926
929 { // Add length. 927 { // Add length.
930 CallbacksDescriptor d(*factory->length_symbol(), *string_length, attribs); 928 CallbacksDescriptor d(*factory->length_symbol(), *string_length, attribs);
(...skipping 20 matching lines...) Expand all
951 Builtins::kIllegal, true); 949 Builtins::kIllegal, true);
952 native_context()->set_regexp_function(*regexp_fun); 950 native_context()->set_regexp_function(*regexp_fun);
953 951
954 ASSERT(regexp_fun->has_initial_map()); 952 ASSERT(regexp_fun->has_initial_map());
955 Handle<Map> initial_map(regexp_fun->initial_map()); 953 Handle<Map> initial_map(regexp_fun->initial_map());
956 954
957 ASSERT_EQ(0, initial_map->inobject_properties()); 955 ASSERT_EQ(0, initial_map->inobject_properties());
958 956
959 PropertyAttributes final = 957 PropertyAttributes final =
960 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); 958 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
961 Handle<DescriptorArray> descriptors = factory->NewDescriptorArray(0, 5); 959 Handle<DescriptorArray> descriptors = factory->NewDescriptorArray(5);
962 DescriptorArray::WhitenessWitness witness(*descriptors); 960 DescriptorArray::WhitenessWitness witness(*descriptors);
963 Map::SetDescriptors(initial_map, descriptors); 961 Map::SetDescriptors(initial_map, descriptors);
964 962
965 { 963 {
966 // ECMA-262, section 15.10.7.1. 964 // ECMA-262, section 15.10.7.1.
967 FieldDescriptor field(heap->source_symbol(), 965 FieldDescriptor field(heap->source_symbol(),
968 JSRegExp::kSourceFieldIndex, 966 JSRegExp::kSourceFieldIndex,
969 final); 967 final);
970 initial_map->AppendDescriptor(&field, witness); 968 initial_map->AppendDescriptor(&field, witness);
971 } 969 }
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 // Install the ThrowTypeError functions. 1133 // Install the ThrowTypeError functions.
1136 callee->set_getter(*throw_function); 1134 callee->set_getter(*throw_function);
1137 callee->set_setter(*throw_function); 1135 callee->set_setter(*throw_function);
1138 caller->set_getter(*throw_function); 1136 caller->set_getter(*throw_function);
1139 caller->set_setter(*throw_function); 1137 caller->set_setter(*throw_function);
1140 1138
1141 // Create the map. Allocate one in-object field for length. 1139 // Create the map. Allocate one in-object field for length.
1142 Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE, 1140 Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE,
1143 Heap::kArgumentsObjectSizeStrict); 1141 Heap::kArgumentsObjectSizeStrict);
1144 // Create the descriptor array for the arguments object. 1142 // Create the descriptor array for the arguments object.
1145 Handle<DescriptorArray> descriptors = factory->NewDescriptorArray(0, 3); 1143 Handle<DescriptorArray> descriptors = factory->NewDescriptorArray(3);
1146 DescriptorArray::WhitenessWitness witness(*descriptors); 1144 DescriptorArray::WhitenessWitness witness(*descriptors);
1147 Map::SetDescriptors(map, descriptors); 1145 Map::SetDescriptors(map, descriptors);
1148 1146
1149 { // length 1147 { // length
1150 FieldDescriptor d(*factory->length_symbol(), 0, DONT_ENUM); 1148 FieldDescriptor d(*factory->length_symbol(), 0, DONT_ENUM);
1151 map->AppendDescriptor(&d, witness); 1149 map->AppendDescriptor(&d, witness);
1152 } 1150 }
1153 { // callee 1151 { // callee
1154 CallbacksDescriptor d(*factory->callee_symbol(), 1152 CallbacksDescriptor d(*factory->callee_symbol(),
1155 *callee, 1153 *callee,
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1482 isolate()->initial_object_prototype(), 1480 isolate()->initial_object_prototype(),
1483 Builtins::kIllegal, false); 1481 Builtins::kIllegal, false);
1484 Handle<JSObject> prototype = 1482 Handle<JSObject> prototype =
1485 factory()->NewJSObject(isolate()->object_function(), TENURED); 1483 factory()->NewJSObject(isolate()->object_function(), TENURED);
1486 SetPrototype(script_fun, prototype); 1484 SetPrototype(script_fun, prototype);
1487 native_context()->set_script_function(*script_fun); 1485 native_context()->set_script_function(*script_fun);
1488 1486
1489 Handle<Map> script_map = Handle<Map>(script_fun->initial_map()); 1487 Handle<Map> script_map = Handle<Map>(script_fun->initial_map());
1490 1488
1491 Handle<DescriptorArray> script_descriptors( 1489 Handle<DescriptorArray> script_descriptors(
1492 factory()->NewDescriptorArray(0, 13)); 1490 factory()->NewDescriptorArray(13));
1493 DescriptorArray::WhitenessWitness witness(*script_descriptors); 1491 DescriptorArray::WhitenessWitness witness(*script_descriptors);
1494 1492
1495 Handle<Foreign> script_source( 1493 Handle<Foreign> script_source(
1496 factory()->NewForeign(&Accessors::ScriptSource)); 1494 factory()->NewForeign(&Accessors::ScriptSource));
1497 Handle<Foreign> script_name(factory()->NewForeign(&Accessors::ScriptName)); 1495 Handle<Foreign> script_name(factory()->NewForeign(&Accessors::ScriptName));
1498 Handle<String> id_symbol(factory()->LookupAsciiSymbol("id")); 1496 Handle<String> id_symbol(factory()->LookupAsciiSymbol("id"));
1499 Handle<Foreign> script_id(factory()->NewForeign(&Accessors::ScriptId)); 1497 Handle<Foreign> script_id(factory()->NewForeign(&Accessors::ScriptId));
1500 Handle<String> line_offset_symbol( 1498 Handle<String> line_offset_symbol(
1501 factory()->LookupAsciiSymbol("line_offset")); 1499 factory()->LookupAsciiSymbol("line_offset"));
1502 Handle<Foreign> script_line_offset( 1500 Handle<Foreign> script_line_offset(
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1660 // through a common bottleneck that would make the SMI_ONLY -> FAST_ELEMENT 1658 // through a common bottleneck that would make the SMI_ONLY -> FAST_ELEMENT
1661 // transition easy to trap. Moreover, they rarely are smi-only. 1659 // transition easy to trap. Moreover, they rarely are smi-only.
1662 MaybeObject* maybe_map = array_function->initial_map()->Copy(); 1660 MaybeObject* maybe_map = array_function->initial_map()->Copy();
1663 Map* new_map; 1661 Map* new_map;
1664 if (!maybe_map->To(&new_map)) return false; 1662 if (!maybe_map->To(&new_map)) return false;
1665 new_map->set_elements_kind(FAST_HOLEY_ELEMENTS); 1663 new_map->set_elements_kind(FAST_HOLEY_ELEMENTS);
1666 array_function->set_initial_map(new_map); 1664 array_function->set_initial_map(new_map);
1667 1665
1668 // Make "length" magic on instances. 1666 // Make "length" magic on instances.
1669 Handle<Map> initial_map(array_function->initial_map()); 1667 Handle<Map> initial_map(array_function->initial_map());
1670 Handle<DescriptorArray> array_descriptors( 1668 Handle<DescriptorArray> array_descriptors(factory()->NewDescriptorArray(1));
1671 factory()->NewDescriptorArray(0, 1));
1672 DescriptorArray::WhitenessWitness witness(*array_descriptors); 1669 DescriptorArray::WhitenessWitness witness(*array_descriptors);
1673 1670
1674 Handle<Foreign> array_length(factory()->NewForeign( 1671 Handle<Foreign> array_length(factory()->NewForeign(
1675 &Accessors::ArrayLength)); 1672 &Accessors::ArrayLength));
1676 PropertyAttributes attribs = static_cast<PropertyAttributes>( 1673 PropertyAttributes attribs = static_cast<PropertyAttributes>(
1677 DONT_ENUM | DONT_DELETE); 1674 DONT_ENUM | DONT_DELETE);
1678 Map::SetDescriptors(initial_map, array_descriptors); 1675 Map::SetDescriptors(initial_map, array_descriptors);
1679 1676
1680 { // Add length. 1677 { // Add length.
1681 CallbacksDescriptor d( 1678 CallbacksDescriptor d(
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1761 Handle<Map> initial_map = 1758 Handle<Map> initial_map =
1762 factory()->NewMap(JS_ARRAY_TYPE, JSRegExpResult::kSize); 1759 factory()->NewMap(JS_ARRAY_TYPE, JSRegExpResult::kSize);
1763 initial_map->set_constructor(*array_constructor); 1760 initial_map->set_constructor(*array_constructor);
1764 1761
1765 // Set prototype on map. 1762 // Set prototype on map.
1766 initial_map->set_non_instance_prototype(false); 1763 initial_map->set_non_instance_prototype(false);
1767 initial_map->set_prototype(*array_prototype); 1764 initial_map->set_prototype(*array_prototype);
1768 1765
1769 // Update map with length accessor from Array and add "index" and "input". 1766 // Update map with length accessor from Array and add "index" and "input".
1770 Handle<DescriptorArray> reresult_descriptors = 1767 Handle<DescriptorArray> reresult_descriptors =
1771 factory()->NewDescriptorArray(0, 3); 1768 factory()->NewDescriptorArray(3);
1772 DescriptorArray::WhitenessWitness witness(*reresult_descriptors); 1769 DescriptorArray::WhitenessWitness witness(*reresult_descriptors);
1773 Map::SetDescriptors(initial_map, reresult_descriptors); 1770 Map::SetDescriptors(initial_map, reresult_descriptors);
1774 1771
1775 { 1772 {
1776 JSFunction* array_function = native_context()->array_function(); 1773 JSFunction* array_function = native_context()->array_function();
1777 Handle<DescriptorArray> array_descriptors( 1774 Handle<DescriptorArray> array_descriptors(
1778 array_function->initial_map()->instance_descriptors()); 1775 array_function->initial_map()->instance_descriptors());
1779 String* length = heap()->length_symbol(); 1776 String* length = heap()->length_symbol();
1780 int old = array_descriptors->SearchWithCache( 1777 int old = array_descriptors->SearchWithCache(length);
1781 length, array_function->initial_map());
1782 ASSERT(old != DescriptorArray::kNotFound); 1778 ASSERT(old != DescriptorArray::kNotFound);
1783 CallbacksDescriptor desc(length, 1779 CallbacksDescriptor desc(length,
1784 array_descriptors->GetValue(old), 1780 array_descriptors->GetValue(old),
1785 array_descriptors->GetDetails(old).attributes()); 1781 array_descriptors->GetDetails(old).attributes());
1786 initial_map->AppendDescriptor(&desc, witness); 1782 initial_map->AppendDescriptor(&desc, witness);
1787 } 1783 }
1788 { 1784 {
1789 FieldDescriptor index_field(heap()->index_symbol(), 1785 FieldDescriptor index_field(heap()->index_symbol(),
1790 JSRegExpResult::kIndexIndex, 1786 JSRegExpResult::kIndexIndex,
1791 NONE); 1787 NONE);
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
2399 return from + sizeof(NestingCounterType); 2395 return from + sizeof(NestingCounterType);
2400 } 2396 }
2401 2397
2402 2398
2403 // Called when the top-level V8 mutex is destroyed. 2399 // Called when the top-level V8 mutex is destroyed.
2404 void Bootstrapper::FreeThreadResources() { 2400 void Bootstrapper::FreeThreadResources() {
2405 ASSERT(!IsActive()); 2401 ASSERT(!IsActive());
2406 } 2402 }
2407 2403
2408 } } // namespace v8::internal 2404 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/atomicops.h ('k') | src/builtins.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698