| OLD | NEW |
| 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/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/extensions/externalize-string-extension.h" | 9 #include "src/extensions/externalize-string-extension.h" |
| 10 #include "src/extensions/free-buffer-extension.h" | 10 #include "src/extensions/free-buffer-extension.h" |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 return Handle<Context>(); | 355 return Handle<Context>(); |
| 356 } | 356 } |
| 357 return scope.CloseAndEscape(env); | 357 return scope.CloseAndEscape(env); |
| 358 } | 358 } |
| 359 | 359 |
| 360 | 360 |
| 361 static void SetObjectPrototype(Handle<JSObject> object, Handle<Object> proto) { | 361 static void SetObjectPrototype(Handle<JSObject> object, Handle<Object> proto) { |
| 362 // object.__proto__ = proto; | 362 // object.__proto__ = proto; |
| 363 Handle<Map> old_map = Handle<Map>(object->map()); | 363 Handle<Map> old_map = Handle<Map>(object->map()); |
| 364 Handle<Map> new_map = Map::Copy(old_map, "SetObjectPrototype"); | 364 Handle<Map> new_map = Map::Copy(old_map, "SetObjectPrototype"); |
| 365 new_map->set_prototype(*proto); | 365 new_map->SetPrototype(proto, FAST_PROTOTYPE); |
| 366 JSObject::MigrateToMap(object, new_map); | 366 JSObject::MigrateToMap(object, new_map); |
| 367 } | 367 } |
| 368 | 368 |
| 369 | 369 |
| 370 void Bootstrapper::DetachGlobal(Handle<Context> env) { | 370 void Bootstrapper::DetachGlobal(Handle<Context> env) { |
| 371 Factory* factory = env->GetIsolate()->factory(); | 371 Factory* factory = env->GetIsolate()->factory(); |
| 372 Handle<JSGlobalProxy> global_proxy(JSGlobalProxy::cast(env->global_proxy())); | 372 Handle<JSGlobalProxy> global_proxy(JSGlobalProxy::cast(env->global_proxy())); |
| 373 global_proxy->set_native_context(*factory->null_value()); | 373 global_proxy->set_native_context(*factory->null_value()); |
| 374 SetObjectPrototype(global_proxy, factory->null_value()); | 374 SetObjectPrototype(global_proxy, factory->null_value()); |
| 375 global_proxy->map()->set_constructor(*factory->null_value()); | 375 global_proxy->map()->set_constructor(*factory->null_value()); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 | 486 |
| 487 // The final map for functions. Writeable prototype. | 487 // The final map for functions. Writeable prototype. |
| 488 // This map is installed in MakeFunctionInstancePrototypeWritable. | 488 // This map is installed in MakeFunctionInstancePrototypeWritable. |
| 489 sloppy_function_map_writable_prototype_ = | 489 sloppy_function_map_writable_prototype_ = |
| 490 CreateFunctionMap(FUNCTION_WITH_WRITEABLE_PROTOTYPE); | 490 CreateFunctionMap(FUNCTION_WITH_WRITEABLE_PROTOTYPE); |
| 491 | 491 |
| 492 Factory* factory = isolate->factory(); | 492 Factory* factory = isolate->factory(); |
| 493 | 493 |
| 494 Handle<String> object_name = factory->Object_string(); | 494 Handle<String> object_name = factory->Object_string(); |
| 495 | 495 |
| 496 Handle<JSObject> object_function_prototype; |
| 497 |
| 496 { // --- O b j e c t --- | 498 { // --- O b j e c t --- |
| 497 Handle<JSFunction> object_fun = factory->NewFunction(object_name); | 499 Handle<JSFunction> object_fun = factory->NewFunction(object_name); |
| 498 int unused = JSObject::kInitialGlobalObjectUnusedPropertiesCount; | 500 int unused = JSObject::kInitialGlobalObjectUnusedPropertiesCount; |
| 499 int instance_size = JSObject::kHeaderSize + kPointerSize * unused; | 501 int instance_size = JSObject::kHeaderSize + kPointerSize * unused; |
| 500 Handle<Map> object_function_map = | 502 Handle<Map> object_function_map = |
| 501 factory->NewMap(JS_OBJECT_TYPE, instance_size); | 503 factory->NewMap(JS_OBJECT_TYPE, instance_size); |
| 502 object_function_map->set_inobject_properties(unused); | 504 object_function_map->set_inobject_properties(unused); |
| 503 JSFunction::SetInitialMap(object_fun, object_function_map, | 505 JSFunction::SetInitialMap(object_fun, object_function_map, |
| 504 isolate->factory()->null_value()); | 506 isolate->factory()->null_value()); |
| 505 object_function_map->set_unused_property_fields(unused); | 507 object_function_map->set_unused_property_fields(unused); |
| 506 | 508 |
| 507 native_context()->set_object_function(*object_fun); | 509 native_context()->set_object_function(*object_fun); |
| 508 | 510 |
| 509 // Allocate a new prototype for the object function. | 511 // Allocate a new prototype for the object function. |
| 510 Handle<JSObject> prototype = factory->NewJSObject( | 512 object_function_prototype = |
| 511 isolate->object_function(), | 513 factory->NewJSObject(isolate->object_function(), TENURED); |
| 512 TENURED); | 514 Handle<Map> map = Map::Copy(handle(object_function_prototype->map()), |
| 513 Handle<Map> map = | 515 "EmptyObjectPrototype"); |
| 514 Map::Copy(handle(prototype->map()), "EmptyObjectPrototype"); | |
| 515 map->set_is_prototype_map(true); | 516 map->set_is_prototype_map(true); |
| 516 prototype->set_map(*map); | 517 object_function_prototype->set_map(*map); |
| 517 | 518 |
| 518 native_context()->set_initial_object_prototype(*prototype); | 519 native_context()->set_initial_object_prototype(*object_function_prototype); |
| 519 // For bootstrapping set the array prototype to be the same as the object | 520 // For bootstrapping set the array prototype to be the same as the object |
| 520 // prototype, otherwise the missing initial_array_prototype will cause | 521 // prototype, otherwise the missing initial_array_prototype will cause |
| 521 // assertions during startup. | 522 // assertions during startup. |
| 522 native_context()->set_initial_array_prototype(*prototype); | 523 native_context()->set_initial_array_prototype(*object_function_prototype); |
| 523 Accessors::FunctionSetPrototype(object_fun, prototype).Assert(); | 524 Accessors::FunctionSetPrototype(object_fun, object_function_prototype) |
| 525 .Assert(); |
| 524 } | 526 } |
| 525 | 527 |
| 526 // Allocate the empty function as the prototype for function ECMAScript | 528 // Allocate the empty function as the prototype for function ECMAScript |
| 527 // 262 15.3.4. | 529 // 262 15.3.4. |
| 528 Handle<String> empty_string = | 530 Handle<String> empty_string = |
| 529 factory->InternalizeOneByteString(STATIC_CHAR_VECTOR("Empty")); | 531 factory->InternalizeOneByteString(STATIC_CHAR_VECTOR("Empty")); |
| 530 Handle<Code> code(isolate->builtins()->builtin(Builtins::kEmptyFunction)); | 532 Handle<Code> code(isolate->builtins()->builtin(Builtins::kEmptyFunction)); |
| 531 Handle<JSFunction> empty_function = factory->NewFunctionWithoutPrototype( | 533 Handle<JSFunction> empty_function = factory->NewFunctionWithoutPrototype( |
| 532 empty_string, code); | 534 empty_string, code); |
| 533 | 535 |
| 534 // Allocate the function map first and then patch the prototype later | 536 // Allocate the function map first and then patch the prototype later |
| 535 Handle<Map> empty_function_map = | 537 Handle<Map> empty_function_map = |
| 536 CreateFunctionMap(FUNCTION_WITHOUT_PROTOTYPE); | 538 CreateFunctionMap(FUNCTION_WITHOUT_PROTOTYPE); |
| 537 DCHECK(!empty_function_map->is_dictionary_map()); | 539 DCHECK(!empty_function_map->is_dictionary_map()); |
| 538 empty_function_map->set_prototype( | 540 empty_function_map->SetPrototype(object_function_prototype); |
| 539 native_context()->object_function()->prototype()); | |
| 540 empty_function_map->set_is_prototype_map(true); | 541 empty_function_map->set_is_prototype_map(true); |
| 541 empty_function->set_map(*empty_function_map); | 542 empty_function->set_map(*empty_function_map); |
| 542 | 543 |
| 543 // --- E m p t y --- | 544 // --- E m p t y --- |
| 544 Handle<String> source = factory->NewStringFromStaticChars("() {}"); | 545 Handle<String> source = factory->NewStringFromStaticChars("() {}"); |
| 545 Handle<Script> script = factory->NewScript(source); | 546 Handle<Script> script = factory->NewScript(source); |
| 546 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); | 547 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); |
| 547 empty_function->shared()->set_script(*script); | 548 empty_function->shared()->set_script(*script); |
| 548 empty_function->shared()->set_start_position(0); | 549 empty_function->shared()->set_start_position(0); |
| 549 empty_function->shared()->set_end_position(source->length()); | 550 empty_function->shared()->set_end_position(source->length()); |
| 550 empty_function->shared()->DontAdaptArguments(); | 551 empty_function->shared()->DontAdaptArguments(); |
| 551 | 552 |
| 552 // Set prototypes for the function maps. | 553 // Set prototypes for the function maps. |
| 553 native_context()->sloppy_function_map()->set_prototype(*empty_function); | 554 native_context()->sloppy_function_map()->SetPrototype(empty_function); |
| 554 native_context()->sloppy_function_without_prototype_map()-> | 555 native_context()->sloppy_function_without_prototype_map()->SetPrototype( |
| 555 set_prototype(*empty_function); | 556 empty_function); |
| 556 sloppy_function_map_writable_prototype_->set_prototype(*empty_function); | 557 sloppy_function_map_writable_prototype_->SetPrototype(empty_function); |
| 557 return empty_function; | 558 return empty_function; |
| 558 } | 559 } |
| 559 | 560 |
| 560 | 561 |
| 561 void Genesis::SetStrictFunctionInstanceDescriptor( | 562 void Genesis::SetStrictFunctionInstanceDescriptor( |
| 562 Handle<Map> map, FunctionMode function_mode) { | 563 Handle<Map> map, FunctionMode function_mode) { |
| 563 int size = IsFunctionModeWithPrototype(function_mode) ? 5 : 4; | 564 int size = IsFunctionModeWithPrototype(function_mode) ? 5 : 4; |
| 564 Map::EnsureDescriptorSlack(map, size); | 565 Map::EnsureDescriptorSlack(map, size); |
| 565 | 566 |
| 566 Handle<AccessorPair> arguments(factory()->NewAccessorPair()); | 567 Handle<AccessorPair> arguments(factory()->NewAccessorPair()); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 return generator_poison_function; | 649 return generator_poison_function; |
| 649 } | 650 } |
| 650 | 651 |
| 651 | 652 |
| 652 Handle<Map> Genesis::CreateStrictFunctionMap( | 653 Handle<Map> Genesis::CreateStrictFunctionMap( |
| 653 FunctionMode function_mode, | 654 FunctionMode function_mode, |
| 654 Handle<JSFunction> empty_function) { | 655 Handle<JSFunction> empty_function) { |
| 655 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); | 656 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); |
| 656 SetStrictFunctionInstanceDescriptor(map, function_mode); | 657 SetStrictFunctionInstanceDescriptor(map, function_mode); |
| 657 map->set_function_with_prototype(IsFunctionModeWithPrototype(function_mode)); | 658 map->set_function_with_prototype(IsFunctionModeWithPrototype(function_mode)); |
| 658 map->set_prototype(*empty_function); | 659 map->SetPrototype(empty_function); |
| 659 return map; | 660 return map; |
| 660 } | 661 } |
| 661 | 662 |
| 662 | 663 |
| 663 void Genesis::CreateStrictModeFunctionMaps(Handle<JSFunction> empty) { | 664 void Genesis::CreateStrictModeFunctionMaps(Handle<JSFunction> empty) { |
| 664 // Allocate map for the prototype-less strict mode instances. | 665 // Allocate map for the prototype-less strict mode instances. |
| 665 Handle<Map> strict_function_without_prototype_map = | 666 Handle<Map> strict_function_without_prototype_map = |
| 666 CreateStrictFunctionMap(FUNCTION_WITHOUT_PROTOTYPE, empty); | 667 CreateStrictFunctionMap(FUNCTION_WITHOUT_PROTOTYPE, empty); |
| 667 native_context()->set_strict_function_without_prototype_map( | 668 native_context()->set_strict_function_without_prototype_map( |
| 668 *strict_function_without_prototype_map); | 669 *strict_function_without_prototype_map); |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1086 | 1087 |
| 1087 static const int num_fields = JSRegExp::kInObjectFieldCount; | 1088 static const int num_fields = JSRegExp::kInObjectFieldCount; |
| 1088 initial_map->set_inobject_properties(num_fields); | 1089 initial_map->set_inobject_properties(num_fields); |
| 1089 initial_map->set_pre_allocated_property_fields(num_fields); | 1090 initial_map->set_pre_allocated_property_fields(num_fields); |
| 1090 initial_map->set_unused_property_fields(0); | 1091 initial_map->set_unused_property_fields(0); |
| 1091 initial_map->set_instance_size(initial_map->instance_size() + | 1092 initial_map->set_instance_size(initial_map->instance_size() + |
| 1092 num_fields * kPointerSize); | 1093 num_fields * kPointerSize); |
| 1093 | 1094 |
| 1094 // RegExp prototype object is itself a RegExp. | 1095 // RegExp prototype object is itself a RegExp. |
| 1095 Handle<Map> proto_map = Map::Copy(initial_map, "RegExpPrototype"); | 1096 Handle<Map> proto_map = Map::Copy(initial_map, "RegExpPrototype"); |
| 1096 proto_map->set_prototype(native_context()->initial_object_prototype()); | 1097 DCHECK(proto_map->prototype() == *isolate->initial_object_prototype()); |
| 1097 Handle<JSObject> proto = factory->NewJSObjectFromMap(proto_map); | 1098 Handle<JSObject> proto = factory->NewJSObjectFromMap(proto_map); |
| 1098 proto->InObjectPropertyAtPut(JSRegExp::kGlobalFieldIndex, | 1099 proto->InObjectPropertyAtPut(JSRegExp::kGlobalFieldIndex, |
| 1099 heap->false_value()); | 1100 heap->false_value()); |
| 1100 proto->InObjectPropertyAtPut(JSRegExp::kIgnoreCaseFieldIndex, | 1101 proto->InObjectPropertyAtPut(JSRegExp::kIgnoreCaseFieldIndex, |
| 1101 heap->false_value()); | 1102 heap->false_value()); |
| 1102 proto->InObjectPropertyAtPut(JSRegExp::kMultilineFieldIndex, | 1103 proto->InObjectPropertyAtPut(JSRegExp::kMultilineFieldIndex, |
| 1103 heap->false_value()); | 1104 heap->false_value()); |
| 1104 proto->InObjectPropertyAtPut(JSRegExp::kLastIndexFieldIndex, | 1105 proto->InObjectPropertyAtPut(JSRegExp::kLastIndexFieldIndex, |
| 1105 Smi::FromInt(0), | 1106 Smi::FromInt(0), |
| 1106 SKIP_WRITE_BARRIER); // It's a Smi. | 1107 SKIP_WRITE_BARRIER); // It's a Smi. |
| 1107 proto_map->set_is_prototype_map(true); | 1108 proto_map->set_is_prototype_map(true); |
| 1108 initial_map->set_prototype(*proto); | 1109 initial_map->SetPrototype(proto); |
| 1109 factory->SetRegExpIrregexpData(Handle<JSRegExp>::cast(proto), | 1110 factory->SetRegExpIrregexpData(Handle<JSRegExp>::cast(proto), |
| 1110 JSRegExp::IRREGEXP, factory->empty_string(), | 1111 JSRegExp::IRREGEXP, factory->empty_string(), |
| 1111 JSRegExp::Flags(0), 0); | 1112 JSRegExp::Flags(0), 0); |
| 1112 } | 1113 } |
| 1113 | 1114 |
| 1114 { // -- J S O N | 1115 { // -- J S O N |
| 1115 Handle<String> name = factory->InternalizeUtf8String("JSON"); | 1116 Handle<String> name = factory->InternalizeUtf8String("JSON"); |
| 1116 Handle<JSFunction> cons = factory->NewFunction(name); | 1117 Handle<JSFunction> cons = factory->NewFunction(name); |
| 1117 JSFunction::SetInstancePrototype(cons, | 1118 JSFunction::SetInstancePrototype(cons, |
| 1118 Handle<Object>(native_context()->initial_object_prototype(), isolate)); | 1119 Handle<Object>(native_context()->initial_object_prototype(), isolate)); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1283 CallbacksDescriptor d(factory->callee_string(), callee, attributes); | 1284 CallbacksDescriptor d(factory->callee_string(), callee, attributes); |
| 1284 map->AppendDescriptor(&d); | 1285 map->AppendDescriptor(&d); |
| 1285 } | 1286 } |
| 1286 { // caller | 1287 { // caller |
| 1287 CallbacksDescriptor d(factory->caller_string(), caller, attributes); | 1288 CallbacksDescriptor d(factory->caller_string(), caller, attributes); |
| 1288 map->AppendDescriptor(&d); | 1289 map->AppendDescriptor(&d); |
| 1289 } | 1290 } |
| 1290 // @@iterator method is added later. | 1291 // @@iterator method is added later. |
| 1291 | 1292 |
| 1292 map->set_function_with_prototype(true); | 1293 map->set_function_with_prototype(true); |
| 1293 map->set_prototype(native_context()->object_function()->prototype()); | 1294 DCHECK_EQ(native_context()->object_function()->prototype(), |
| 1295 *isolate->initial_object_prototype()); |
| 1296 map->SetPrototype(isolate->initial_object_prototype()); |
| 1294 map->set_pre_allocated_property_fields(1); | 1297 map->set_pre_allocated_property_fields(1); |
| 1295 map->set_inobject_properties(1); | 1298 map->set_inobject_properties(1); |
| 1296 | 1299 |
| 1297 // Copy constructor from the sloppy arguments boilerplate. | 1300 // Copy constructor from the sloppy arguments boilerplate. |
| 1298 map->set_constructor( | 1301 map->set_constructor( |
| 1299 native_context()->sloppy_arguments_map()->constructor()); | 1302 native_context()->sloppy_arguments_map()->constructor()); |
| 1300 | 1303 |
| 1301 native_context()->set_strict_arguments_map(*map); | 1304 native_context()->set_strict_arguments_map(*map); |
| 1302 | 1305 |
| 1303 DCHECK(map->inobject_properties() > Heap::kArgumentsLengthIndex); | 1306 DCHECK(map->inobject_properties() > Heap::kArgumentsLengthIndex); |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1930 JS_FUNCTION_TYPE, JSFunction::kHeaderSize, | 1933 JS_FUNCTION_TYPE, JSFunction::kHeaderSize, |
| 1931 generator_object_prototype, Builtins::kIllegal); | 1934 generator_object_prototype, Builtins::kIllegal); |
| 1932 InstallFunction(builtins, "GeneratorFunction", JS_FUNCTION_TYPE, | 1935 InstallFunction(builtins, "GeneratorFunction", JS_FUNCTION_TYPE, |
| 1933 JSFunction::kSize, generator_function_prototype, | 1936 JSFunction::kSize, generator_function_prototype, |
| 1934 Builtins::kIllegal); | 1937 Builtins::kIllegal); |
| 1935 | 1938 |
| 1936 // Create maps for generator functions and their prototypes. Store those | 1939 // Create maps for generator functions and their prototypes. Store those |
| 1937 // maps in the native context. | 1940 // maps in the native context. |
| 1938 Handle<Map> generator_function_map = | 1941 Handle<Map> generator_function_map = |
| 1939 Map::Copy(sloppy_function_map_writable_prototype_, "GeneratorFunction"); | 1942 Map::Copy(sloppy_function_map_writable_prototype_, "GeneratorFunction"); |
| 1940 generator_function_map->set_prototype(*generator_function_prototype); | 1943 generator_function_map->SetPrototype(generator_function_prototype); |
| 1941 native_context()->set_sloppy_generator_function_map( | 1944 native_context()->set_sloppy_generator_function_map( |
| 1942 *generator_function_map); | 1945 *generator_function_map); |
| 1943 | 1946 |
| 1944 // The "arguments" and "caller" instance properties aren't specified, so | 1947 // The "arguments" and "caller" instance properties aren't specified, so |
| 1945 // technically we could leave them out. They make even less sense for | 1948 // technically we could leave them out. They make even less sense for |
| 1946 // generators than for functions. Still, the same argument that it makes | 1949 // generators than for functions. Still, the same argument that it makes |
| 1947 // sense to keep them around but poisoned in strict mode applies to | 1950 // sense to keep them around but poisoned in strict mode applies to |
| 1948 // generators as well. With poisoned accessors, naive callers can still | 1951 // generators as well. With poisoned accessors, naive callers can still |
| 1949 // iterate over the properties without accessing them. | 1952 // iterate over the properties without accessing them. |
| 1950 // | 1953 // |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1963 poison_pair->set_setter(*poison_function); | 1966 poison_pair->set_setter(*poison_function); |
| 1964 ReplaceAccessors(generator_function_map, factory()->arguments_string(), | 1967 ReplaceAccessors(generator_function_map, factory()->arguments_string(), |
| 1965 rw_attribs, poison_pair); | 1968 rw_attribs, poison_pair); |
| 1966 ReplaceAccessors(generator_function_map, factory()->caller_string(), | 1969 ReplaceAccessors(generator_function_map, factory()->caller_string(), |
| 1967 rw_attribs, poison_pair); | 1970 rw_attribs, poison_pair); |
| 1968 | 1971 |
| 1969 Handle<Map> strict_function_map(native_context()->strict_function_map()); | 1972 Handle<Map> strict_function_map(native_context()->strict_function_map()); |
| 1970 Handle<Map> strict_generator_function_map = | 1973 Handle<Map> strict_generator_function_map = |
| 1971 Map::Copy(strict_function_map, "StrictGeneratorFunction"); | 1974 Map::Copy(strict_function_map, "StrictGeneratorFunction"); |
| 1972 // "arguments" and "caller" already poisoned. | 1975 // "arguments" and "caller" already poisoned. |
| 1973 strict_generator_function_map->set_prototype(*generator_function_prototype); | 1976 strict_generator_function_map->SetPrototype(generator_function_prototype); |
| 1974 native_context()->set_strict_generator_function_map( | 1977 native_context()->set_strict_generator_function_map( |
| 1975 *strict_generator_function_map); | 1978 *strict_generator_function_map); |
| 1976 | 1979 |
| 1977 Handle<JSFunction> object_function(native_context()->object_function()); | 1980 Handle<JSFunction> object_function(native_context()->object_function()); |
| 1978 Handle<Map> generator_object_prototype_map = Map::Create(isolate(), 0); | 1981 Handle<Map> generator_object_prototype_map = Map::Create(isolate(), 0); |
| 1979 generator_object_prototype_map->set_prototype(*generator_object_prototype); | 1982 generator_object_prototype_map->SetPrototype(generator_object_prototype); |
| 1980 native_context()->set_generator_object_prototype_map( | 1983 native_context()->set_generator_object_prototype_map( |
| 1981 *generator_object_prototype_map); | 1984 *generator_object_prototype_map); |
| 1982 } | 1985 } |
| 1983 | 1986 |
| 1984 if (FLAG_disable_native_files) { | 1987 if (FLAG_disable_native_files) { |
| 1985 PrintF("Warning: Running without installed natives!\n"); | 1988 PrintF("Warning: Running without installed natives!\n"); |
| 1986 return true; | 1989 return true; |
| 1987 } | 1990 } |
| 1988 | 1991 |
| 1989 // Install public symbols. | 1992 // Install public symbols. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2070 Handle<JSObject> array_prototype( | 2073 Handle<JSObject> array_prototype( |
| 2071 JSObject::cast(array_constructor->instance_prototype())); | 2074 JSObject::cast(array_constructor->instance_prototype())); |
| 2072 | 2075 |
| 2073 // Add initial map. | 2076 // Add initial map. |
| 2074 Handle<Map> initial_map = | 2077 Handle<Map> initial_map = |
| 2075 factory()->NewMap(JS_ARRAY_TYPE, JSRegExpResult::kSize); | 2078 factory()->NewMap(JS_ARRAY_TYPE, JSRegExpResult::kSize); |
| 2076 initial_map->set_constructor(*array_constructor); | 2079 initial_map->set_constructor(*array_constructor); |
| 2077 | 2080 |
| 2078 // Set prototype on map. | 2081 // Set prototype on map. |
| 2079 initial_map->set_non_instance_prototype(false); | 2082 initial_map->set_non_instance_prototype(false); |
| 2080 initial_map->set_prototype(*array_prototype); | 2083 initial_map->SetPrototype(array_prototype); |
| 2081 | 2084 |
| 2082 // Update map with length accessor from Array and add "index" and "input". | 2085 // Update map with length accessor from Array and add "index" and "input". |
| 2083 Map::EnsureDescriptorSlack(initial_map, 3); | 2086 Map::EnsureDescriptorSlack(initial_map, 3); |
| 2084 | 2087 |
| 2085 { | 2088 { |
| 2086 JSFunction* array_function = native_context()->array_function(); | 2089 JSFunction* array_function = native_context()->array_function(); |
| 2087 Handle<DescriptorArray> array_descriptors( | 2090 Handle<DescriptorArray> array_descriptors( |
| 2088 array_function->initial_map()->instance_descriptors()); | 2091 array_function->initial_map()->instance_descriptors()); |
| 2089 Handle<String> length = factory()->length_string(); | 2092 Handle<String> length = factory()->length_string(); |
| 2090 int old = array_descriptors->SearchWithCache( | 2093 int old = array_descriptors->SearchWithCache( |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2826 return from + sizeof(NestingCounterType); | 2829 return from + sizeof(NestingCounterType); |
| 2827 } | 2830 } |
| 2828 | 2831 |
| 2829 | 2832 |
| 2830 // Called when the top-level V8 mutex is destroyed. | 2833 // Called when the top-level V8 mutex is destroyed. |
| 2831 void Bootstrapper::FreeThreadResources() { | 2834 void Bootstrapper::FreeThreadResources() { |
| 2832 DCHECK(!IsActive()); | 2835 DCHECK(!IsActive()); |
| 2833 } | 2836 } |
| 2834 | 2837 |
| 2835 } } // namespace v8::internal | 2838 } } // namespace v8::internal |
| OLD | NEW |