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

Side by Side Diff: src/code-stubs-hydrogen.cc

Issue 149063010: Remake of the load elimination fix made earlier (r18884). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebasing on r19056. Created 6 years, 10 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/hydrogen.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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 checker.If<HCompareNumericAndBranch>(boilerplate_size, 441 checker.If<HCompareNumericAndBranch>(boilerplate_size,
442 size_in_words, Token::EQ); 442 size_in_words, Token::EQ);
443 checker.Then(); 443 checker.Then();
444 444
445 HValue* size_in_bytes = Add<HConstant>(size); 445 HValue* size_in_bytes = Add<HConstant>(size);
446 446
447 HInstruction* object = Add<HAllocate>(size_in_bytes, HType::JSObject(), 447 HInstruction* object = Add<HAllocate>(size_in_bytes, HType::JSObject(),
448 NOT_TENURED, JS_OBJECT_TYPE); 448 NOT_TENURED, JS_OBJECT_TYPE);
449 449
450 for (int i = 0; i < object_size; i += kPointerSize) { 450 for (int i = 0; i < object_size; i += kPointerSize) {
451 HObjectAccess access = HObjectAccess::ForJSObjectOffset(i); 451 HObjectAccess access = HObjectAccess::ForObservableJSObjectOffset(i);
452 Add<HStoreNamedField>( 452 Add<HStoreNamedField>(
453 object, access, Add<HLoadNamedField>( 453 object, access, Add<HLoadNamedField>(
454 boilerplate, static_cast<HValue*>(NULL), access), 454 boilerplate, static_cast<HValue*>(NULL), access));
455 INITIALIZING_STORE);
456 } 455 }
457 456
458 ASSERT(FLAG_allocation_site_pretenuring || (size == object_size)); 457 ASSERT(FLAG_allocation_site_pretenuring || (size == object_size));
459 if (FLAG_allocation_site_pretenuring) { 458 if (FLAG_allocation_site_pretenuring) {
460 BuildCreateAllocationMemento( 459 BuildCreateAllocationMemento(
461 object, Add<HConstant>(object_size), allocation_site); 460 object, Add<HConstant>(object_size), allocation_site);
462 } 461 }
463 462
464 environment()->Push(object); 463 environment()->Push(object);
465 checker.ElseDeopt("Uninitialized boilerplate in fast clone"); 464 checker.ElseDeopt("Uninitialized boilerplate in fast clone");
(...skipping 16 matching lines...) Expand all
482 481
483 // Store the map 482 // Store the map
484 Handle<Map> allocation_site_map = isolate()->factory()->allocation_site_map(); 483 Handle<Map> allocation_site_map = isolate()->factory()->allocation_site_map();
485 AddStoreMapConstant(object, allocation_site_map); 484 AddStoreMapConstant(object, allocation_site_map);
486 485
487 // Store the payload (smi elements kind) 486 // Store the payload (smi elements kind)
488 HValue* initial_elements_kind = Add<HConstant>(GetInitialFastElementsKind()); 487 HValue* initial_elements_kind = Add<HConstant>(GetInitialFastElementsKind());
489 Add<HStoreNamedField>(object, 488 Add<HStoreNamedField>(object,
490 HObjectAccess::ForAllocationSiteOffset( 489 HObjectAccess::ForAllocationSiteOffset(
491 AllocationSite::kTransitionInfoOffset), 490 AllocationSite::kTransitionInfoOffset),
492 initial_elements_kind, 491 initial_elements_kind);
493 INITIALIZING_STORE);
494 492
495 // Unlike literals, constructed arrays don't have nested sites 493 // Unlike literals, constructed arrays don't have nested sites
496 Add<HStoreNamedField>(object, 494 Add<HStoreNamedField>(object,
497 HObjectAccess::ForAllocationSiteOffset( 495 HObjectAccess::ForAllocationSiteOffset(
498 AllocationSite::kNestedSiteOffset), 496 AllocationSite::kNestedSiteOffset),
499 graph()->GetConstant0(), 497 graph()->GetConstant0());
500 INITIALIZING_STORE);
501 498
502 // Pretenuring calculation field. 499 // Pretenuring calculation field.
503 Add<HStoreNamedField>(object, 500 Add<HStoreNamedField>(object,
504 HObjectAccess::ForAllocationSiteOffset( 501 HObjectAccess::ForAllocationSiteOffset(
505 AllocationSite::kPretenureDataOffset), 502 AllocationSite::kPretenureDataOffset),
506 graph()->GetConstant0(), 503 graph()->GetConstant0());
507 INITIALIZING_STORE);
508 504
509 // Pretenuring memento creation count field. 505 // Pretenuring memento creation count field.
510 Add<HStoreNamedField>(object, 506 Add<HStoreNamedField>(object,
511 HObjectAccess::ForAllocationSiteOffset( 507 HObjectAccess::ForAllocationSiteOffset(
512 AllocationSite::kPretenureCreateCountOffset), 508 AllocationSite::kPretenureCreateCountOffset),
513 graph()->GetConstant0(), 509 graph()->GetConstant0());
514 INITIALIZING_STORE);
515 510
516 // Store an empty fixed array for the code dependency. 511 // Store an empty fixed array for the code dependency.
517 HConstant* empty_fixed_array = 512 HConstant* empty_fixed_array =
518 Add<HConstant>(isolate()->factory()->empty_fixed_array()); 513 Add<HConstant>(isolate()->factory()->empty_fixed_array());
519 HStoreNamedField* store = Add<HStoreNamedField>( 514 HStoreNamedField* store = Add<HStoreNamedField>(
520 object, 515 object,
521 HObjectAccess::ForAllocationSiteOffset( 516 HObjectAccess::ForAllocationSiteOffset(
522 AllocationSite::kDependentCodeOffset), 517 AllocationSite::kDependentCodeOffset),
523 empty_fixed_array, 518 empty_fixed_array);
524 INITIALIZING_STORE);
525 519
526 // Link the object to the allocation site list 520 // Link the object to the allocation site list
527 HValue* site_list = Add<HConstant>( 521 HValue* site_list = Add<HConstant>(
528 ExternalReference::allocation_sites_list_address(isolate())); 522 ExternalReference::allocation_sites_list_address(isolate()));
529 HValue* site = Add<HLoadNamedField>( 523 HValue* site = Add<HLoadNamedField>(
530 site_list, static_cast<HValue*>(NULL), 524 site_list, static_cast<HValue*>(NULL),
531 HObjectAccess::ForAllocationSiteList()); 525 HObjectAccess::ForAllocationSiteList());
532 store = Add<HStoreNamedField>(object, 526 store = Add<HStoreNamedField>(object,
533 HObjectAccess::ForAllocationSiteOffset(AllocationSite::kWeakNextOffset), 527 HObjectAccess::ForAllocationSiteOffset(AllocationSite::kWeakNextOffset),
534 site, INITIALIZING_STORE); 528 site);
535 store->SkipWriteBarrier(); 529 store->SkipWriteBarrier();
536 Add<HStoreNamedField>(site_list, HObjectAccess::ForAllocationSiteList(), 530 Add<HStoreNamedField>(site_list, HObjectAccess::ForAllocationSiteList(),
537 object, INITIALIZING_STORE); 531 object);
538 532
539 // We use a hammer (SkipWriteBarrier()) to indicate that we know the input 533 // We use a hammer (SkipWriteBarrier()) to indicate that we know the input
540 // cell is really a Cell, and so no write barrier is needed. 534 // cell is really a Cell, and so no write barrier is needed.
541 // TODO(mvstanton): Add a debug_code check to verify the input cell is really 535 // TODO(mvstanton): Add a debug_code check to verify the input cell is really
542 // a cell. (perhaps with a new instruction, HAssert). 536 // a cell. (perhaps with a new instruction, HAssert).
543 HInstruction* cell = GetParameter(0); 537 HInstruction* cell = GetParameter(0);
544 HObjectAccess access = HObjectAccess::ForCellValue(); 538 HObjectAccess access = HObjectAccess::ForCellValue();
545 store = Add<HStoreNamedField>(cell, access, object, INITIALIZING_STORE); 539 store = Add<HStoreNamedField>(cell, access, object);
546 store->SkipWriteBarrier(); 540 store->SkipWriteBarrier();
547 return cell; 541 return cell;
548 } 542 }
549 543
550 544
551 Handle<Code> CreateAllocationSiteStub::GenerateCode(Isolate* isolate) { 545 Handle<Code> CreateAllocationSiteStub::GenerateCode(Isolate* isolate) {
552 return DoGenerateCode(isolate, this); 546 return DoGenerateCode(isolate, this);
553 } 547 }
554 548
555 549
556 template <> 550 template <>
557 HValue* CodeStubGraphBuilder<KeyedLoadFastElementStub>::BuildCodeStub() { 551 HValue* CodeStubGraphBuilder<KeyedLoadFastElementStub>::BuildCodeStub() {
558 HInstruction* load = BuildUncheckedMonomorphicElementAccess( 552 HInstruction* load = BuildUncheckedMonomorphicElementAccess(
559 GetParameter(0), GetParameter(1), NULL, 553 GetParameter(0), GetParameter(1), NULL,
560 casted_stub()->is_js_array(), casted_stub()->elements_kind(), 554 casted_stub()->is_js_array(), casted_stub()->elements_kind(),
561 false, NEVER_RETURN_HOLE, STANDARD_STORE); 555 false, NEVER_RETURN_HOLE, STANDARD_STORE);
562 return load; 556 return load;
563 } 557 }
564 558
565 559
566 Handle<Code> KeyedLoadFastElementStub::GenerateCode(Isolate* isolate) { 560 Handle<Code> KeyedLoadFastElementStub::GenerateCode(Isolate* isolate) {
567 return DoGenerateCode(isolate, this); 561 return DoGenerateCode(isolate, this);
568 } 562 }
569 563
570 564
571 template<> 565 template<>
572 HValue* CodeStubGraphBuilder<LoadFieldStub>::BuildCodeStub() { 566 HValue* CodeStubGraphBuilder<LoadFieldStub>::BuildCodeStub() {
573 Representation rep = casted_stub()->representation(); 567 Representation rep = casted_stub()->representation();
568 int offset = casted_stub()->offset();
574 HObjectAccess access = casted_stub()->is_inobject() ? 569 HObjectAccess access = casted_stub()->is_inobject() ?
575 HObjectAccess::ForJSObjectOffset(casted_stub()->offset(), rep) : 570 HObjectAccess::ForObservableJSObjectOffset(offset, rep) :
576 HObjectAccess::ForBackingStoreOffset(casted_stub()->offset(), rep); 571 HObjectAccess::ForBackingStoreOffset(offset, rep);
577 return AddLoadNamedField(GetParameter(0), access); 572 return AddLoadNamedField(GetParameter(0), access);
578 } 573 }
579 574
580 575
581 Handle<Code> LoadFieldStub::GenerateCode(Isolate* isolate) { 576 Handle<Code> LoadFieldStub::GenerateCode(Isolate* isolate) {
582 return DoGenerateCode(isolate, this); 577 return DoGenerateCode(isolate, this);
583 } 578 }
584 579
585 580
586 template<> 581 template<>
587 HValue* CodeStubGraphBuilder<KeyedLoadFieldStub>::BuildCodeStub() { 582 HValue* CodeStubGraphBuilder<KeyedLoadFieldStub>::BuildCodeStub() {
588 Representation rep = casted_stub()->representation(); 583 Representation rep = casted_stub()->representation();
584 int offset = casted_stub()->offset();
589 HObjectAccess access = casted_stub()->is_inobject() ? 585 HObjectAccess access = casted_stub()->is_inobject() ?
590 HObjectAccess::ForJSObjectOffset(casted_stub()->offset(), rep) : 586 HObjectAccess::ForObservableJSObjectOffset(offset, rep) :
591 HObjectAccess::ForBackingStoreOffset(casted_stub()->offset(), rep); 587 HObjectAccess::ForBackingStoreOffset(offset, rep);
592 return AddLoadNamedField(GetParameter(0), access); 588 return AddLoadNamedField(GetParameter(0), access);
593 } 589 }
594 590
595 591
596 Handle<Code> KeyedLoadFieldStub::GenerateCode(Isolate* isolate) { 592 Handle<Code> KeyedLoadFieldStub::GenerateCode(Isolate* isolate) {
597 return DoGenerateCode(isolate, this); 593 return DoGenerateCode(isolate, this);
598 } 594 }
599 595
600 596
601 template <> 597 template <>
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 // Now populate the elements correctly. 720 // Now populate the elements correctly.
725 LoopBuilder builder(this, 721 LoopBuilder builder(this,
726 context(), 722 context(),
727 LoopBuilder::kPostIncrement); 723 LoopBuilder::kPostIncrement);
728 HValue* start = graph()->GetConstant0(); 724 HValue* start = graph()->GetConstant0();
729 HValue* key = builder.BeginBody(start, checked_length, Token::LT); 725 HValue* key = builder.BeginBody(start, checked_length, Token::LT);
730 HInstruction* argument_elements = Add<HArgumentsElements>(false); 726 HInstruction* argument_elements = Add<HArgumentsElements>(false);
731 HInstruction* argument = Add<HAccessArgumentsAt>( 727 HInstruction* argument = Add<HAccessArgumentsAt>(
732 argument_elements, checked_length, key); 728 argument_elements, checked_length, key);
733 729
734 Add<HStoreKeyed>(elements, key, argument, kind, INITIALIZING_STORE); 730 Add<HStoreKeyed>(elements, key, argument, kind);
735 builder.EndBody(); 731 builder.EndBody();
736 return new_object; 732 return new_object;
737 } 733 }
738 734
739 735
740 template <> 736 template <>
741 HValue* CodeStubGraphBuilder<ArrayNoArgumentConstructorStub>::BuildCodeStub() { 737 HValue* CodeStubGraphBuilder<ArrayNoArgumentConstructorStub>::BuildCodeStub() {
742 ElementsKind kind = casted_stub()->elements_kind(); 738 ElementsKind kind = casted_stub()->elements_kind();
743 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode(); 739 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode();
744 return BuildArrayConstructor(kind, override_mode, NONE); 740 return BuildArrayConstructor(kind, override_mode, NONE);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 result = EnforceNumberType(result, result_type); 931 result = EnforceNumberType(result, result_type);
936 } 932 }
937 933
938 // Reuse the double box of one of the operands if we are allowed to (i.e. 934 // Reuse the double box of one of the operands if we are allowed to (i.e.
939 // chained binops). 935 // chained binops).
940 if (state.CanReuseDoubleBox()) { 936 if (state.CanReuseDoubleBox()) {
941 HValue* operand = (state.mode() == OVERWRITE_LEFT) ? left : right; 937 HValue* operand = (state.mode() == OVERWRITE_LEFT) ? left : right;
942 IfBuilder if_heap_number(this); 938 IfBuilder if_heap_number(this);
943 if_heap_number.IfNot<HIsSmiAndBranch>(operand); 939 if_heap_number.IfNot<HIsSmiAndBranch>(operand);
944 if_heap_number.Then(); 940 if_heap_number.Then();
945 Add<HStoreNamedField>(operand, HObjectAccess::ForHeapNumberValue(), result, 941 Add<HStoreNamedField>(operand, HObjectAccess::ForHeapNumberValue(), result);
946 INITIALIZING_STORE);
947 Push(operand); 942 Push(operand);
948 if_heap_number.Else(); 943 if_heap_number.Else();
949 Push(result); 944 Push(result);
950 if_heap_number.End(); 945 if_heap_number.End();
951 result = Pop(); 946 result = Pop();
952 } 947 }
953 948
954 return result; 949 return result;
955 } 950 }
956 951
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 } else { 1055 } else {
1061 // Load the payload of the global parameter cell. A hole indicates that the 1056 // Load the payload of the global parameter cell. A hole indicates that the
1062 // property has been deleted and that the store must be handled by the 1057 // property has been deleted and that the store must be handled by the
1063 // runtime. 1058 // runtime.
1064 IfBuilder builder(this); 1059 IfBuilder builder(this);
1065 HValue* hole_value = Add<HConstant>(hole); 1060 HValue* hole_value = Add<HConstant>(hole);
1066 builder.If<HCompareObjectEqAndBranch>(cell_contents, hole_value); 1061 builder.If<HCompareObjectEqAndBranch>(cell_contents, hole_value);
1067 builder.Then(); 1062 builder.Then();
1068 builder.Deopt("Unexpected cell contents in global store"); 1063 builder.Deopt("Unexpected cell contents in global store");
1069 builder.Else(); 1064 builder.Else();
1070 Add<HStoreNamedField>(cell, access, value, INITIALIZING_STORE); 1065 Add<HStoreNamedField>(cell, access, value);
1071 builder.End(); 1066 builder.End();
1072 } 1067 }
1073 1068
1074 return value; 1069 return value;
1075 } 1070 }
1076 1071
1077 1072
1078 Handle<Code> StoreGlobalStub::GenerateCode(Isolate* isolate) { 1073 Handle<Code> StoreGlobalStub::GenerateCode(Isolate* isolate) {
1079 return DoGenerateCode(isolate, this); 1074 return DoGenerateCode(isolate, this);
1080 } 1075 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 // map and either unmangle them on marking or do nothing as the whole map is 1120 // map and either unmangle them on marking or do nothing as the whole map is
1126 // discarded on major GC anyway. 1121 // discarded on major GC anyway.
1127 Add<HStoreCodeEntry>(js_function, code_object); 1122 Add<HStoreCodeEntry>(js_function, code_object);
1128 1123
1129 // Now link a function into a list of optimized functions. 1124 // Now link a function into a list of optimized functions.
1130 HValue* optimized_functions_list = Add<HLoadNamedField>( 1125 HValue* optimized_functions_list = Add<HLoadNamedField>(
1131 native_context, static_cast<HValue*>(NULL), 1126 native_context, static_cast<HValue*>(NULL),
1132 HObjectAccess::ForContextSlot(Context::OPTIMIZED_FUNCTIONS_LIST)); 1127 HObjectAccess::ForContextSlot(Context::OPTIMIZED_FUNCTIONS_LIST));
1133 Add<HStoreNamedField>(js_function, 1128 Add<HStoreNamedField>(js_function,
1134 HObjectAccess::ForNextFunctionLinkPointer(), 1129 HObjectAccess::ForNextFunctionLinkPointer(),
1135 optimized_functions_list, INITIALIZING_STORE); 1130 optimized_functions_list);
1136 1131
1137 // This store is the only one that should have a write barrier. 1132 // This store is the only one that should have a write barrier.
1138 Add<HStoreNamedField>(native_context, 1133 Add<HStoreNamedField>(native_context,
1139 HObjectAccess::ForContextSlot(Context::OPTIMIZED_FUNCTIONS_LIST), 1134 HObjectAccess::ForContextSlot(Context::OPTIMIZED_FUNCTIONS_LIST),
1140 js_function, INITIALIZING_STORE); 1135 js_function);
1141 } 1136 }
1142 1137
1143 1138
1144 void CodeStubGraphBuilderBase::BuildInstallCode(HValue* js_function, 1139 void CodeStubGraphBuilderBase::BuildInstallCode(HValue* js_function,
1145 HValue* shared_info) { 1140 HValue* shared_info) {
1146 Add<HStoreNamedField>(js_function, 1141 Add<HStoreNamedField>(js_function,
1147 HObjectAccess::ForNextFunctionLinkPointer(), 1142 HObjectAccess::ForNextFunctionLinkPointer(),
1148 graph()->GetConstantUndefined(), 1143 graph()->GetConstantUndefined());
1149 INITIALIZING_STORE);
1150 HValue* code_object = Add<HLoadNamedField>( 1144 HValue* code_object = Add<HLoadNamedField>(
1151 shared_info, static_cast<HValue*>(NULL), HObjectAccess::ForCodeOffset()); 1145 shared_info, static_cast<HValue*>(NULL), HObjectAccess::ForCodeOffset());
1152 Add<HStoreCodeEntry>(js_function, code_object); 1146 Add<HStoreCodeEntry>(js_function, code_object);
1153 } 1147 }
1154 1148
1155 1149
1156 void CodeStubGraphBuilderBase::BuildInstallFromOptimizedCodeMap( 1150 void CodeStubGraphBuilderBase::BuildInstallFromOptimizedCodeMap(
1157 HValue* js_function, 1151 HValue* js_function,
1158 HValue* shared_info, 1152 HValue* shared_info,
1159 HValue* native_context) { 1153 HValue* native_context) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 1276
1283 int map_index = Context::FunctionMapIndex(casted_stub()->language_mode(), 1277 int map_index = Context::FunctionMapIndex(casted_stub()->language_mode(),
1284 casted_stub()->is_generator()); 1278 casted_stub()->is_generator());
1285 1279
1286 // Compute the function map in the current native context and set that 1280 // Compute the function map in the current native context and set that
1287 // as the map of the allocated object. 1281 // as the map of the allocated object.
1288 HInstruction* native_context = BuildGetNativeContext(); 1282 HInstruction* native_context = BuildGetNativeContext();
1289 HInstruction* map_slot_value = Add<HLoadNamedField>( 1283 HInstruction* map_slot_value = Add<HLoadNamedField>(
1290 native_context, static_cast<HValue*>(NULL), 1284 native_context, static_cast<HValue*>(NULL),
1291 HObjectAccess::ForContextSlot(map_index)); 1285 HObjectAccess::ForContextSlot(map_index));
1292 Add<HStoreNamedField>(js_function, HObjectAccess::ForMap(), map_slot_value, 1286 Add<HStoreNamedField>(js_function, HObjectAccess::ForMap(), map_slot_value);
1293 INITIALIZING_STORE);
1294 1287
1295 // Initialize the rest of the function. 1288 // Initialize the rest of the function.
1296 Add<HStoreNamedField>(js_function, HObjectAccess::ForPropertiesPointer(), 1289 Add<HStoreNamedField>(js_function, HObjectAccess::ForPropertiesPointer(),
1297 empty_fixed_array, INITIALIZING_STORE); 1290 empty_fixed_array);
1298 Add<HStoreNamedField>(js_function, HObjectAccess::ForElementsPointer(), 1291 Add<HStoreNamedField>(js_function, HObjectAccess::ForElementsPointer(),
1299 empty_fixed_array, INITIALIZING_STORE); 1292 empty_fixed_array);
1300 Add<HStoreNamedField>(js_function, HObjectAccess::ForLiteralsPointer(), 1293 Add<HStoreNamedField>(js_function, HObjectAccess::ForLiteralsPointer(),
1301 empty_fixed_array, INITIALIZING_STORE); 1294 empty_fixed_array);
1302 Add<HStoreNamedField>(js_function, HObjectAccess::ForPrototypeOrInitialMap(), 1295 Add<HStoreNamedField>(js_function, HObjectAccess::ForPrototypeOrInitialMap(),
1303 graph()->GetConstantHole(), INITIALIZING_STORE); 1296 graph()->GetConstantHole());
1304 Add<HStoreNamedField>(js_function, 1297 Add<HStoreNamedField>(js_function,
1305 HObjectAccess::ForSharedFunctionInfoPointer(), 1298 HObjectAccess::ForSharedFunctionInfoPointer(),
1306 shared_info, INITIALIZING_STORE); 1299 shared_info);
1307 Add<HStoreNamedField>(js_function, HObjectAccess::ForFunctionContextPointer(), 1300 Add<HStoreNamedField>(js_function, HObjectAccess::ForFunctionContextPointer(),
1308 context(), INITIALIZING_STORE); 1301 context());
1309 1302
1310 // Initialize the code pointer in the function to be the one 1303 // Initialize the code pointer in the function to be the one
1311 // found in the shared function info object. 1304 // found in the shared function info object.
1312 // But first check if there is an optimized version for our context. 1305 // But first check if there is an optimized version for our context.
1313 if (FLAG_cache_optimized_code) { 1306 if (FLAG_cache_optimized_code) {
1314 BuildInstallFromOptimizedCodeMap(js_function, shared_info, native_context); 1307 BuildInstallFromOptimizedCodeMap(js_function, shared_info, native_context);
1315 } else { 1308 } else {
1316 BuildInstallCode(js_function, shared_info); 1309 BuildInstallCode(js_function, shared_info);
1317 } 1310 }
1318 1311
(...skipping 16 matching lines...) Expand all
1335 // Allocate the context in new space. 1328 // Allocate the context in new space.
1336 HAllocate* function_context = Add<HAllocate>( 1329 HAllocate* function_context = Add<HAllocate>(
1337 Add<HConstant>(length * kPointerSize + FixedArray::kHeaderSize), 1330 Add<HConstant>(length * kPointerSize + FixedArray::kHeaderSize),
1338 HType::Tagged(), NOT_TENURED, FIXED_ARRAY_TYPE); 1331 HType::Tagged(), NOT_TENURED, FIXED_ARRAY_TYPE);
1339 1332
1340 // Set up the object header. 1333 // Set up the object header.
1341 AddStoreMapConstant(function_context, 1334 AddStoreMapConstant(function_context,
1342 isolate()->factory()->function_context_map()); 1335 isolate()->factory()->function_context_map());
1343 Add<HStoreNamedField>(function_context, 1336 Add<HStoreNamedField>(function_context,
1344 HObjectAccess::ForFixedArrayLength(), 1337 HObjectAccess::ForFixedArrayLength(),
1345 Add<HConstant>(length), INITIALIZING_STORE); 1338 Add<HConstant>(length));
1346 1339
1347 // Set up the fixed slots. 1340 // Set up the fixed slots.
1348 Add<HStoreNamedField>(function_context, 1341 Add<HStoreNamedField>(function_context,
1349 HObjectAccess::ForContextSlot(Context::CLOSURE_INDEX), 1342 HObjectAccess::ForContextSlot(Context::CLOSURE_INDEX),
1350 function, INITIALIZING_STORE); 1343 function);
1351 Add<HStoreNamedField>(function_context, 1344 Add<HStoreNamedField>(function_context,
1352 HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX), 1345 HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX),
1353 context(), INITIALIZING_STORE); 1346 context());
1354 Add<HStoreNamedField>(function_context, 1347 Add<HStoreNamedField>(function_context,
1355 HObjectAccess::ForContextSlot(Context::EXTENSION_INDEX), 1348 HObjectAccess::ForContextSlot(Context::EXTENSION_INDEX),
1356 graph()->GetConstant0(), INITIALIZING_STORE); 1349 graph()->GetConstant0());
1357 1350
1358 // Copy the global object from the previous context. 1351 // Copy the global object from the previous context.
1359 HValue* global_object = Add<HLoadNamedField>( 1352 HValue* global_object = Add<HLoadNamedField>(
1360 context(), static_cast<HValue*>(NULL), 1353 context(), static_cast<HValue*>(NULL),
1361 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); 1354 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
1362 Add<HStoreNamedField>(function_context, 1355 Add<HStoreNamedField>(function_context,
1363 HObjectAccess::ForContextSlot( 1356 HObjectAccess::ForContextSlot(
1364 Context::GLOBAL_OBJECT_INDEX), 1357 Context::GLOBAL_OBJECT_INDEX),
1365 global_object, 1358 global_object);
1366 INITIALIZING_STORE);
1367 1359
1368 // Initialize the rest of the slots to undefined. 1360 // Initialize the rest of the slots to undefined.
1369 for (int i = Context::MIN_CONTEXT_SLOTS; i < length; ++i) { 1361 for (int i = Context::MIN_CONTEXT_SLOTS; i < length; ++i) {
1370 Add<HStoreNamedField>(function_context, 1362 Add<HStoreNamedField>(function_context,
1371 HObjectAccess::ForContextSlot(i), 1363 HObjectAccess::ForContextSlot(i),
1372 graph()->GetConstantUndefined(), 1364 graph()->GetConstantUndefined());
1373 INITIALIZING_STORE);
1374 } 1365 }
1375 1366
1376 return function_context; 1367 return function_context;
1377 } 1368 }
1378 1369
1379 1370
1380 Handle<Code> FastNewContextStub::GenerateCode(Isolate* isolate) { 1371 Handle<Code> FastNewContextStub::GenerateCode(Isolate* isolate) {
1381 return DoGenerateCode(isolate, this); 1372 return DoGenerateCode(isolate, this);
1382 } 1373 }
1383 1374
(...skipping 24 matching lines...) Expand all
1408 return BuildRegExpConstructResult(length, index, input); 1399 return BuildRegExpConstructResult(length, index, input);
1409 } 1400 }
1410 1401
1411 1402
1412 Handle<Code> RegExpConstructResultStub::GenerateCode(Isolate* isolate) { 1403 Handle<Code> RegExpConstructResultStub::GenerateCode(Isolate* isolate) {
1413 return DoGenerateCode(isolate, this); 1404 return DoGenerateCode(isolate, this);
1414 } 1405 }
1415 1406
1416 1407
1417 } } // namespace v8::internal 1408 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698