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

Side by Side Diff: src/bootstrapper.cc

Issue 10808011: Let DescriptorArray::Append insert at proper position, avoiding need for resorting. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments 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 | src/factory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 void TransferIndexedProperties(Handle<JSObject> from, Handle<JSObject> to); 248 void TransferIndexedProperties(Handle<JSObject> from, Handle<JSObject> to);
249 249
250 enum PrototypePropertyMode { 250 enum PrototypePropertyMode {
251 DONT_ADD_PROTOTYPE, 251 DONT_ADD_PROTOTYPE,
252 ADD_READONLY_PROTOTYPE, 252 ADD_READONLY_PROTOTYPE,
253 ADD_WRITEABLE_PROTOTYPE 253 ADD_WRITEABLE_PROTOTYPE
254 }; 254 };
255 255
256 Handle<Map> CreateFunctionMap(PrototypePropertyMode prototype_mode); 256 Handle<Map> CreateFunctionMap(PrototypePropertyMode prototype_mode);
257 257
258 Handle<DescriptorArray> ComputeFunctionInstanceDescriptor( 258 void SetFunctionInstanceDescriptor(Handle<Map> map,
259 PrototypePropertyMode prototypeMode); 259 PrototypePropertyMode prototypeMode);
260 void MakeFunctionInstancePrototypeWritable(); 260 void MakeFunctionInstancePrototypeWritable();
261 261
262 Handle<Map> CreateStrictModeFunctionMap( 262 Handle<Map> CreateStrictModeFunctionMap(
263 PrototypePropertyMode prototype_mode, 263 PrototypePropertyMode prototype_mode,
264 Handle<JSFunction> empty_function); 264 Handle<JSFunction> empty_function);
265 265
266 Handle<DescriptorArray> ComputeStrictFunctionInstanceDescriptor( 266 void SetStrictFunctionInstanceDescriptor(Handle<Map> map,
267 PrototypePropertyMode propertyMode); 267 PrototypePropertyMode propertyMode);
268 268
269 static bool CompileBuiltin(Isolate* isolate, int index); 269 static bool CompileBuiltin(Isolate* isolate, int index);
270 static bool CompileExperimentalBuiltin(Isolate* isolate, int index); 270 static bool CompileExperimentalBuiltin(Isolate* isolate, int index);
271 static bool CompileNative(Vector<const char> name, Handle<String> source); 271 static bool CompileNative(Vector<const char> name, Handle<String> source);
272 static bool CompileScriptCached(Vector<const char> name, 272 static bool CompileScriptCached(Vector<const char> name,
273 Handle<String> source, 273 Handle<String> source,
274 SourceCodeCache* cache, 274 SourceCodeCache* cache,
275 v8::Extension* extension, 275 v8::Extension* extension,
276 Handle<Context> top_context, 276 Handle<Context> top_context,
277 bool use_runtime_context); 277 bool use_runtime_context);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 JSObject::SetLocalPropertyIgnoreAttributes( 376 JSObject::SetLocalPropertyIgnoreAttributes(
377 target, symbol, function, attributes)); 377 target, symbol, function, attributes));
378 if (is_ecma_native) { 378 if (is_ecma_native) {
379 function->shared()->set_instance_class_name(*symbol); 379 function->shared()->set_instance_class_name(*symbol);
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 Handle<DescriptorArray> Genesis::ComputeFunctionInstanceDescriptor( 386 void Genesis::SetFunctionInstanceDescriptor(
387 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 PropertyAttributes attribs = static_cast<PropertyAttributes>( 390 PropertyAttributes attribs = static_cast<PropertyAttributes>(
391 DONT_ENUM | DONT_DELETE | READ_ONLY); 391 DONT_ENUM | DONT_DELETE | READ_ONLY);
392 392
393 DescriptorArray::WhitenessWitness witness(*descriptors); 393 DescriptorArray::WhitenessWitness witness(*descriptors);
394 394
395 { // Add length. 395 { // Add length.
396 Handle<Foreign> f(factory()->NewForeign(&Accessors::FunctionLength)); 396 Handle<Foreign> f(factory()->NewForeign(&Accessors::FunctionLength));
397 CallbacksDescriptor d(*factory()->length_symbol(), *f, attribs); 397 CallbacksDescriptor d(*factory()->length_symbol(), *f, attribs);
(...skipping 17 matching lines...) Expand all
415 if (prototypeMode != DONT_ADD_PROTOTYPE) { 415 if (prototypeMode != DONT_ADD_PROTOTYPE) {
416 // Add prototype. 416 // Add prototype.
417 if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) { 417 if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) {
418 attribs = static_cast<PropertyAttributes>(attribs & ~READ_ONLY); 418 attribs = static_cast<PropertyAttributes>(attribs & ~READ_ONLY);
419 } 419 }
420 Handle<Foreign> f(factory()->NewForeign(&Accessors::FunctionPrototype)); 420 Handle<Foreign> f(factory()->NewForeign(&Accessors::FunctionPrototype));
421 CallbacksDescriptor d(*factory()->prototype_symbol(), *f, attribs); 421 CallbacksDescriptor d(*factory()->prototype_symbol(), *f, attribs);
422 descriptors->Append(&d, witness); 422 descriptors->Append(&d, witness);
423 } 423 }
424 424
425 descriptors->Sort(witness); 425 map->set_instance_descriptors(*descriptors);
426 return descriptors;
427 } 426 }
428 427
429 428
430 Handle<Map> Genesis::CreateFunctionMap(PrototypePropertyMode prototype_mode) { 429 Handle<Map> Genesis::CreateFunctionMap(PrototypePropertyMode prototype_mode) {
431 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); 430 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize);
432 Handle<DescriptorArray> descriptors = 431 SetFunctionInstanceDescriptor(map, prototype_mode);
433 ComputeFunctionInstanceDescriptor(prototype_mode);
434 map->set_instance_descriptors(*descriptors);
435 map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE); 432 map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE);
436 return map; 433 return map;
437 } 434 }
438 435
439 436
440 Handle<JSFunction> Genesis::CreateEmptyFunction(Isolate* isolate) { 437 Handle<JSFunction> Genesis::CreateEmptyFunction(Isolate* isolate) {
441 // Allocate the map for function instances. Maps are allocated first and their 438 // Allocate the map for function instances. Maps are allocated first and their
442 // prototypes patched later, once empty function is created. 439 // prototypes patched later, once empty function is created.
443 440
444 // Please note that the prototype property for function instances must be 441 // Please note that the prototype property for function instances must be
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 477
481 global_context()->set_object_function(*object_fun); 478 global_context()->set_object_function(*object_fun);
482 479
483 // Allocate a new prototype for the object function. 480 // Allocate a new prototype for the object function.
484 Handle<JSObject> prototype = factory->NewJSObject( 481 Handle<JSObject> prototype = factory->NewJSObject(
485 isolate->object_function(), 482 isolate->object_function(),
486 TENURED); 483 TENURED);
487 484
488 global_context()->set_initial_object_prototype(*prototype); 485 global_context()->set_initial_object_prototype(*prototype);
489 SetPrototype(object_fun, prototype); 486 SetPrototype(object_fun, prototype);
490 object_function_map->set_instance_descriptors(
491 heap->empty_descriptor_array());
492 } 487 }
493 488
494 // Allocate the empty function as the prototype for function ECMAScript 489 // Allocate the empty function as the prototype for function ECMAScript
495 // 262 15.3.4. 490 // 262 15.3.4.
496 Handle<String> symbol = factory->LookupAsciiSymbol("Empty"); 491 Handle<String> symbol = factory->LookupAsciiSymbol("Empty");
497 Handle<JSFunction> empty_function = 492 Handle<JSFunction> empty_function =
498 factory->NewFunctionWithoutPrototype(symbol, CLASSIC_MODE); 493 factory->NewFunctionWithoutPrototype(symbol, CLASSIC_MODE);
499 494
500 // --- E m p t y --- 495 // --- E m p t y ---
501 Handle<Code> code = 496 Handle<Code> code =
(...skipping 18 matching lines...) Expand all
520 515
521 // Allocate the function map first and then patch the prototype later 516 // Allocate the function map first and then patch the prototype later
522 Handle<Map> empty_function_map = CreateFunctionMap(DONT_ADD_PROTOTYPE); 517 Handle<Map> empty_function_map = CreateFunctionMap(DONT_ADD_PROTOTYPE);
523 empty_function_map->set_prototype( 518 empty_function_map->set_prototype(
524 global_context()->object_function()->prototype()); 519 global_context()->object_function()->prototype());
525 empty_function->set_map(*empty_function_map); 520 empty_function->set_map(*empty_function_map);
526 return empty_function; 521 return empty_function;
527 } 522 }
528 523
529 524
530 Handle<DescriptorArray> Genesis::ComputeStrictFunctionInstanceDescriptor( 525 void Genesis::SetStrictFunctionInstanceDescriptor(
531 PrototypePropertyMode prototypeMode) { 526 Handle<Map> map, PrototypePropertyMode prototypeMode) {
532 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5; 527 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5;
533 Handle<DescriptorArray> descriptors(factory()->NewDescriptorArray(size)); 528 Handle<DescriptorArray> descriptors(factory()->NewDescriptorArray(size));
534 PropertyAttributes attribs = static_cast<PropertyAttributes>( 529 PropertyAttributes attribs = static_cast<PropertyAttributes>(
535 DONT_ENUM | DONT_DELETE); 530 DONT_ENUM | DONT_DELETE);
536 531
537 DescriptorArray::WhitenessWitness witness(*descriptors); 532 DescriptorArray::WhitenessWitness witness(*descriptors);
538 533
539 { // Add length. 534 { // Add length.
540 Handle<Foreign> f(factory()->NewForeign(&Accessors::FunctionLength)); 535 Handle<Foreign> f(factory()->NewForeign(&Accessors::FunctionLength));
541 CallbacksDescriptor d(*factory()->length_symbol(), *f, attribs); 536 CallbacksDescriptor d(*factory()->length_symbol(), *f, attribs);
(...skipping 18 matching lines...) Expand all
560 if (prototypeMode != DONT_ADD_PROTOTYPE) { 555 if (prototypeMode != DONT_ADD_PROTOTYPE) {
561 // Add prototype. 556 // Add prototype.
562 if (prototypeMode != ADD_WRITEABLE_PROTOTYPE) { 557 if (prototypeMode != ADD_WRITEABLE_PROTOTYPE) {
563 attribs = static_cast<PropertyAttributes>(attribs | READ_ONLY); 558 attribs = static_cast<PropertyAttributes>(attribs | READ_ONLY);
564 } 559 }
565 Handle<Foreign> f(factory()->NewForeign(&Accessors::FunctionPrototype)); 560 Handle<Foreign> f(factory()->NewForeign(&Accessors::FunctionPrototype));
566 CallbacksDescriptor d(*factory()->prototype_symbol(), *f, attribs); 561 CallbacksDescriptor d(*factory()->prototype_symbol(), *f, attribs);
567 descriptors->Append(&d, witness); 562 descriptors->Append(&d, witness);
568 } 563 }
569 564
570 descriptors->Sort(witness); 565 map->set_instance_descriptors(*descriptors);
571 return descriptors;
572 } 566 }
573 567
574 568
575 // ECMAScript 5th Edition, 13.2.3 569 // ECMAScript 5th Edition, 13.2.3
576 Handle<JSFunction> Genesis::GetThrowTypeErrorFunction() { 570 Handle<JSFunction> Genesis::GetThrowTypeErrorFunction() {
577 if (throw_type_error_function.is_null()) { 571 if (throw_type_error_function.is_null()) {
578 Handle<String> name = factory()->LookupAsciiSymbol("ThrowTypeError"); 572 Handle<String> name = factory()->LookupAsciiSymbol("ThrowTypeError");
579 throw_type_error_function = 573 throw_type_error_function =
580 factory()->NewFunctionWithoutPrototype(name, CLASSIC_MODE); 574 factory()->NewFunctionWithoutPrototype(name, CLASSIC_MODE);
581 Handle<Code> code(isolate()->builtins()->builtin( 575 Handle<Code> code(isolate()->builtins()->builtin(
582 Builtins::kStrictModePoisonPill)); 576 Builtins::kStrictModePoisonPill));
583 throw_type_error_function->set_map( 577 throw_type_error_function->set_map(
584 global_context()->function_map()); 578 global_context()->function_map());
585 throw_type_error_function->set_code(*code); 579 throw_type_error_function->set_code(*code);
586 throw_type_error_function->shared()->set_code(*code); 580 throw_type_error_function->shared()->set_code(*code);
587 throw_type_error_function->shared()->DontAdaptArguments(); 581 throw_type_error_function->shared()->DontAdaptArguments();
588 582
589 JSObject::PreventExtensions(throw_type_error_function); 583 JSObject::PreventExtensions(throw_type_error_function);
590 } 584 }
591 return throw_type_error_function; 585 return throw_type_error_function;
592 } 586 }
593 587
594 588
595 Handle<Map> Genesis::CreateStrictModeFunctionMap( 589 Handle<Map> Genesis::CreateStrictModeFunctionMap(
596 PrototypePropertyMode prototype_mode, 590 PrototypePropertyMode prototype_mode,
597 Handle<JSFunction> empty_function) { 591 Handle<JSFunction> empty_function) {
598 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); 592 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize);
599 Handle<DescriptorArray> descriptors = 593 SetStrictFunctionInstanceDescriptor(map, prototype_mode);
600 ComputeStrictFunctionInstanceDescriptor(prototype_mode);
601 map->set_instance_descriptors(*descriptors);
602 map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE); 594 map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE);
603 map->set_prototype(*empty_function); 595 map->set_prototype(*empty_function);
604 return map; 596 return map;
605 } 597 }
606 598
607 599
608 void Genesis::CreateStrictModeFunctionMaps(Handle<JSFunction> empty) { 600 void Genesis::CreateStrictModeFunctionMaps(Handle<JSFunction> empty) {
609 // Allocate map for the strict mode function instances. 601 // Allocate map for the strict mode function instances.
610 Handle<Map> strict_mode_function_instance_map = 602 Handle<Map> strict_mode_function_instance_map =
611 CreateStrictModeFunctionMap(ADD_WRITEABLE_PROTOTYPE, empty); 603 CreateStrictModeFunctionMap(ADD_WRITEABLE_PROTOTYPE, empty);
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 } 985 }
994 { 986 {
995 // ECMA-262, section 15.10.7.5. 987 // ECMA-262, section 15.10.7.5.
996 PropertyAttributes writable = 988 PropertyAttributes writable =
997 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); 989 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE);
998 FieldDescriptor field(heap->last_index_symbol(), 990 FieldDescriptor field(heap->last_index_symbol(),
999 JSRegExp::kLastIndexFieldIndex, 991 JSRegExp::kLastIndexFieldIndex,
1000 writable); 992 writable);
1001 descriptors->Append(&field, witness); 993 descriptors->Append(&field, witness);
1002 } 994 }
1003 descriptors->Sort(witness); 995 initial_map->set_instance_descriptors(*descriptors);
1004 996
1005 initial_map->set_inobject_properties(5); 997 initial_map->set_inobject_properties(5);
1006 initial_map->set_pre_allocated_property_fields(5); 998 initial_map->set_pre_allocated_property_fields(5);
1007 initial_map->set_unused_property_fields(0); 999 initial_map->set_unused_property_fields(0);
1008 initial_map->set_instance_size( 1000 initial_map->set_instance_size(
1009 initial_map->instance_size() + 5 * kPointerSize); 1001 initial_map->instance_size() + 5 * kPointerSize);
1010 initial_map->set_instance_descriptors(*descriptors);
1011 initial_map->set_visitor_id(StaticVisitorBase::GetVisitorId(*initial_map)); 1002 initial_map->set_visitor_id(StaticVisitorBase::GetVisitorId(*initial_map));
1012 1003
1013 // RegExp prototype object is itself a RegExp. 1004 // RegExp prototype object is itself a RegExp.
1014 Handle<Map> proto_map = factory->CopyMap(initial_map); 1005 Handle<Map> proto_map = factory->CopyMap(initial_map);
1015 proto_map->set_prototype(global_context()->initial_object_prototype()); 1006 proto_map->set_prototype(global_context()->initial_object_prototype());
1016 Handle<JSObject> proto = factory->NewJSObjectFromMap(proto_map); 1007 Handle<JSObject> proto = factory->NewJSObjectFromMap(proto_map);
1017 proto->InObjectPropertyAtPut(JSRegExp::kSourceFieldIndex, 1008 proto->InObjectPropertyAtPut(JSRegExp::kSourceFieldIndex,
1018 heap->query_colon_symbol()); 1009 heap->query_colon_symbol());
1019 proto->InObjectPropertyAtPut(JSRegExp::kGlobalFieldIndex, 1010 proto->InObjectPropertyAtPut(JSRegExp::kGlobalFieldIndex,
1020 heap->false_value()); 1011 heap->false_value());
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 1125
1135 Handle<JSFunction> throw_function = 1126 Handle<JSFunction> throw_function =
1136 GetThrowTypeErrorFunction(); 1127 GetThrowTypeErrorFunction();
1137 1128
1138 // Install the ThrowTypeError functions. 1129 // Install the ThrowTypeError functions.
1139 callee->set_getter(*throw_function); 1130 callee->set_getter(*throw_function);
1140 callee->set_setter(*throw_function); 1131 callee->set_setter(*throw_function);
1141 caller->set_getter(*throw_function); 1132 caller->set_getter(*throw_function);
1142 caller->set_setter(*throw_function); 1133 caller->set_setter(*throw_function);
1143 1134
1135 // Create the map. Allocate one in-object field for length.
1136 Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE,
1137 Heap::kArgumentsObjectSizeStrict);
1144 // Create the descriptor array for the arguments object. 1138 // Create the descriptor array for the arguments object.
1145 Handle<DescriptorArray> descriptors = factory->NewDescriptorArray(3); 1139 Handle<DescriptorArray> descriptors = factory->NewDescriptorArray(3);
1146 DescriptorArray::WhitenessWitness witness(*descriptors); 1140 DescriptorArray::WhitenessWitness witness(*descriptors);
1147 { // length 1141 { // length
1148 FieldDescriptor d(*factory->length_symbol(), 0, DONT_ENUM); 1142 FieldDescriptor d(*factory->length_symbol(), 0, DONT_ENUM);
1149 descriptors->Append(&d, witness); 1143 descriptors->Append(&d, witness);
1150 } 1144 }
1151 { // callee 1145 { // callee
1152 CallbacksDescriptor d(*factory->callee_symbol(), 1146 CallbacksDescriptor d(*factory->callee_symbol(),
1153 *callee, 1147 *callee,
1154 attributes); 1148 attributes);
1155 descriptors->Append(&d, witness); 1149 descriptors->Append(&d, witness);
1156 } 1150 }
1157 { // caller 1151 { // caller
1158 CallbacksDescriptor d(*factory->caller_symbol(), 1152 CallbacksDescriptor d(*factory->caller_symbol(),
1159 *caller, 1153 *caller,
1160 attributes); 1154 attributes);
1161 descriptors->Append(&d, witness); 1155 descriptors->Append(&d, witness);
1162 } 1156 }
1163 descriptors->Sort(witness); 1157 map->set_instance_descriptors(*descriptors);
1164 1158
1165 // Create the map. Allocate one in-object field for length.
1166 Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE,
1167 Heap::kArgumentsObjectSizeStrict);
1168 map->set_instance_descriptors(*descriptors);
1169 map->set_function_with_prototype(true); 1159 map->set_function_with_prototype(true);
1170 map->set_prototype(global_context()->object_function()->prototype()); 1160 map->set_prototype(global_context()->object_function()->prototype());
1171 map->set_pre_allocated_property_fields(1); 1161 map->set_pre_allocated_property_fields(1);
1172 map->set_inobject_properties(1); 1162 map->set_inobject_properties(1);
1173 1163
1174 // Copy constructor from the non-strict arguments boilerplate. 1164 // Copy constructor from the non-strict arguments boilerplate.
1175 map->set_constructor( 1165 map->set_constructor(
1176 global_context()->arguments_boilerplate()->map()->constructor()); 1166 global_context()->arguments_boilerplate()->map()->constructor());
1177 1167
1178 // Allocate the arguments boilerplate object. 1168 // Allocate the arguments boilerplate object.
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 isolate()->initial_object_prototype(), 1470 isolate()->initial_object_prototype(),
1481 Builtins::kIllegal, false); 1471 Builtins::kIllegal, false);
1482 Handle<JSObject> prototype = 1472 Handle<JSObject> prototype =
1483 factory()->NewJSObject(isolate()->object_function(), TENURED); 1473 factory()->NewJSObject(isolate()->object_function(), TENURED);
1484 SetPrototype(script_fun, prototype); 1474 SetPrototype(script_fun, prototype);
1485 global_context()->set_script_function(*script_fun); 1475 global_context()->set_script_function(*script_fun);
1486 1476
1487 PropertyAttributes attribs = 1477 PropertyAttributes attribs =
1488 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); 1478 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
1489 1479
1480 Handle<Map> script_map = Handle<Map>(script_fun->initial_map());
1481
1490 Handle<DescriptorArray> script_descriptors( 1482 Handle<DescriptorArray> script_descriptors(
1491 factory()->NewDescriptorArray(13)); 1483 factory()->NewDescriptorArray(13));
1492 1484
1493 DescriptorArray::WhitenessWitness witness(*script_descriptors); 1485 DescriptorArray::WhitenessWitness witness(*script_descriptors);
1494 1486
1495 { 1487 {
1496 Handle<Foreign> f(factory()->NewForeign(&Accessors::ScriptSource)); 1488 Handle<Foreign> f(factory()->NewForeign(&Accessors::ScriptSource));
1497 CallbacksDescriptor d( 1489 CallbacksDescriptor d(
1498 *factory()->LookupAsciiSymbol("source"), *f, attribs); 1490 *factory()->LookupAsciiSymbol("source"), *f, attribs);
1499 script_descriptors->Append(&d, witness); 1491 script_descriptors->Append(&d, witness);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1584 { 1576 {
1585 Handle<Foreign> f(factory()->NewForeign( 1577 Handle<Foreign> f(factory()->NewForeign(
1586 &Accessors::ScriptEvalFromFunctionName)); 1578 &Accessors::ScriptEvalFromFunctionName));
1587 CallbacksDescriptor d( 1579 CallbacksDescriptor d(
1588 *factory()->LookupAsciiSymbol("eval_from_function_name"), 1580 *factory()->LookupAsciiSymbol("eval_from_function_name"),
1589 *f, 1581 *f,
1590 attribs); 1582 attribs);
1591 script_descriptors->Append(&d, witness); 1583 script_descriptors->Append(&d, witness);
1592 } 1584 }
1593 1585
1594 script_descriptors->Sort(witness);
1595
1596 Handle<Map> script_map = Handle<Map>(script_fun->initial_map());
1597 script_map->set_instance_descriptors(*script_descriptors); 1586 script_map->set_instance_descriptors(*script_descriptors);
1598 1587
1599 // Allocate the empty script. 1588 // Allocate the empty script.
1600 Handle<Script> script = factory()->NewScript(factory()->empty_string()); 1589 Handle<Script> script = factory()->NewScript(factory()->empty_string());
1601 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); 1590 script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
1602 heap()->public_set_empty_script(*script); 1591 heap()->public_set_empty_script(*script);
1603 } 1592 }
1604 { 1593 {
1605 // Builtin function for OpaqueReference -- a JSValue-based object, 1594 // Builtin function for OpaqueReference -- a JSValue-based object,
1606 // that keeps its field isolated from JavaScript code. It may store 1595 // that keeps its field isolated from JavaScript code. It may store
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1656 DONT_ENUM | DONT_DELETE); 1645 DONT_ENUM | DONT_DELETE);
1657 1646
1658 DescriptorArray::WhitenessWitness witness(*array_descriptors); 1647 DescriptorArray::WhitenessWitness witness(*array_descriptors);
1659 1648
1660 { // Add length. 1649 { // Add length.
1661 Handle<Foreign> f(factory()->NewForeign(&Accessors::ArrayLength)); 1650 Handle<Foreign> f(factory()->NewForeign(&Accessors::ArrayLength));
1662 CallbacksDescriptor d(*factory()->length_symbol(), *f, attribs); 1651 CallbacksDescriptor d(*factory()->length_symbol(), *f, attribs);
1663 array_descriptors->Append(&d, witness); 1652 array_descriptors->Append(&d, witness);
1664 } 1653 }
1665 1654
1666 array_function->initial_map()->set_instance_descriptors( 1655 array_function->initial_map()->set_instance_descriptors(*array_descriptors);
1667 *array_descriptors);
1668 1656
1669 global_context()->set_internal_array_function(*array_function); 1657 global_context()->set_internal_array_function(*array_function);
1670 } 1658 }
1671 1659
1672 if (FLAG_disable_native_files) { 1660 if (FLAG_disable_native_files) {
1673 PrintF("Warning: Running without installed natives!\n"); 1661 PrintF("Warning: Running without installed natives!\n");
1674 return true; 1662 return true;
1675 } 1663 }
1676 1664
1677 // Install natives. 1665 // Install natives.
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1768 NONE); 1756 NONE);
1769 reresult_descriptors->Append(&index_field, witness); 1757 reresult_descriptors->Append(&index_field, witness);
1770 } 1758 }
1771 1759
1772 { 1760 {
1773 FieldDescriptor input_field(heap()->input_symbol(), 1761 FieldDescriptor input_field(heap()->input_symbol(),
1774 JSRegExpResult::kInputIndex, 1762 JSRegExpResult::kInputIndex,
1775 NONE); 1763 NONE);
1776 reresult_descriptors->Append(&input_field, witness); 1764 reresult_descriptors->Append(&input_field, witness);
1777 } 1765 }
1778 reresult_descriptors->Sort(witness); 1766 initial_map->set_instance_descriptors(*reresult_descriptors);
1779 1767
1780 initial_map->set_inobject_properties(2); 1768 initial_map->set_inobject_properties(2);
1781 initial_map->set_pre_allocated_property_fields(2); 1769 initial_map->set_pre_allocated_property_fields(2);
1782 initial_map->set_unused_property_fields(0); 1770 initial_map->set_unused_property_fields(0);
1783 initial_map->set_instance_descriptors(*reresult_descriptors);
1784 1771
1785 global_context()->set_regexp_result_map(*initial_map); 1772 global_context()->set_regexp_result_map(*initial_map);
1786 } 1773 }
1787 1774
1788 #ifdef DEBUG 1775 #ifdef DEBUG
1789 builtins->Verify(); 1776 builtins->Verify();
1790 #endif 1777 #endif
1791 1778
1792 return true; 1779 return true;
1793 } 1780 }
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
2375 return from + sizeof(NestingCounterType); 2362 return from + sizeof(NestingCounterType);
2376 } 2363 }
2377 2364
2378 2365
2379 // Called when the top-level V8 mutex is destroyed. 2366 // Called when the top-level V8 mutex is destroyed.
2380 void Bootstrapper::FreeThreadResources() { 2367 void Bootstrapper::FreeThreadResources() {
2381 ASSERT(!IsActive()); 2368 ASSERT(!IsActive());
2382 } 2369 }
2383 2370
2384 } } // namespace v8::internal 2371 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698