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

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: Review notes applied 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') | src/hydrogen.cc » ('J')
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::ForObservableJSObjectPropertyAt(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::ForObservableJSObjectPropertyAt(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::ForObservableJSObjectPropertyAt(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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 // Now populate the elements correctly. 747 // Now populate the elements correctly.
752 LoopBuilder builder(this, 748 LoopBuilder builder(this,
753 context(), 749 context(),
754 LoopBuilder::kPostIncrement); 750 LoopBuilder::kPostIncrement);
755 HValue* start = graph()->GetConstant0(); 751 HValue* start = graph()->GetConstant0();
756 HValue* key = builder.BeginBody(start, checked_length, Token::LT); 752 HValue* key = builder.BeginBody(start, checked_length, Token::LT);
757 HInstruction* argument_elements = Add<HArgumentsElements>(false); 753 HInstruction* argument_elements = Add<HArgumentsElements>(false);
758 HInstruction* argument = Add<HAccessArgumentsAt>( 754 HInstruction* argument = Add<HAccessArgumentsAt>(
759 argument_elements, checked_length, key); 755 argument_elements, checked_length, key);
760 756
761 Add<HStoreKeyed>(elements, key, argument, kind, INITIALIZING_STORE); 757 Add<HStoreKeyed>(elements, key, argument, kind);
762 builder.EndBody(); 758 builder.EndBody();
763 return new_object; 759 return new_object;
764 } 760 }
765 761
766 762
767 template <> 763 template <>
768 HValue* CodeStubGraphBuilder<ArrayNoArgumentConstructorStub>::BuildCodeStub() { 764 HValue* CodeStubGraphBuilder<ArrayNoArgumentConstructorStub>::BuildCodeStub() {
769 ElementsKind kind = casted_stub()->elements_kind(); 765 ElementsKind kind = casted_stub()->elements_kind();
770 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode(); 766 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode();
771 return BuildArrayConstructor(kind, override_mode, NONE); 767 return BuildArrayConstructor(kind, override_mode, NONE);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 result = EnforceNumberType(result, result_type); 958 result = EnforceNumberType(result, result_type);
963 } 959 }
964 960
965 // Reuse the double box of one of the operands if we are allowed to (i.e. 961 // Reuse the double box of one of the operands if we are allowed to (i.e.
966 // chained binops). 962 // chained binops).
967 if (state.CanReuseDoubleBox()) { 963 if (state.CanReuseDoubleBox()) {
968 HValue* operand = (state.mode() == OVERWRITE_LEFT) ? left : right; 964 HValue* operand = (state.mode() == OVERWRITE_LEFT) ? left : right;
969 IfBuilder if_heap_number(this); 965 IfBuilder if_heap_number(this);
970 if_heap_number.IfNot<HIsSmiAndBranch>(operand); 966 if_heap_number.IfNot<HIsSmiAndBranch>(operand);
971 if_heap_number.Then(); 967 if_heap_number.Then();
972 Add<HStoreNamedField>(operand, HObjectAccess::ForHeapNumberValue(), result, 968 Add<HStoreNamedField>(operand, HObjectAccess::ForHeapNumberValue(), result);
973 INITIALIZING_STORE);
974 Push(operand); 969 Push(operand);
975 if_heap_number.Else(); 970 if_heap_number.Else();
976 Push(result); 971 Push(result);
977 if_heap_number.End(); 972 if_heap_number.End();
978 result = Pop(); 973 result = Pop();
979 } 974 }
980 975
981 return result; 976 return result;
982 } 977 }
983 978
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 } else { 1082 } else {
1088 // Load the payload of the global parameter cell. A hole indicates that the 1083 // Load the payload of the global parameter cell. A hole indicates that the
1089 // property has been deleted and that the store must be handled by the 1084 // property has been deleted and that the store must be handled by the
1090 // runtime. 1085 // runtime.
1091 IfBuilder builder(this); 1086 IfBuilder builder(this);
1092 HValue* hole_value = Add<HConstant>(hole); 1087 HValue* hole_value = Add<HConstant>(hole);
1093 builder.If<HCompareObjectEqAndBranch>(cell_contents, hole_value); 1088 builder.If<HCompareObjectEqAndBranch>(cell_contents, hole_value);
1094 builder.Then(); 1089 builder.Then();
1095 builder.Deopt("Unexpected cell contents in global store"); 1090 builder.Deopt("Unexpected cell contents in global store");
1096 builder.Else(); 1091 builder.Else();
1097 Add<HStoreNamedField>(cell, access, value, INITIALIZING_STORE); 1092 Add<HStoreNamedField>(cell, access, value);
1098 builder.End(); 1093 builder.End();
1099 } 1094 }
1100 1095
1101 return value; 1096 return value;
1102 } 1097 }
1103 1098
1104 1099
1105 Handle<Code> StoreGlobalStub::GenerateCode(Isolate* isolate) { 1100 Handle<Code> StoreGlobalStub::GenerateCode(Isolate* isolate) {
1106 return DoGenerateCode(isolate, this); 1101 return DoGenerateCode(isolate, this);
1107 } 1102 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 // map and either unmangle them on marking or do nothing as the whole map is 1147 // map and either unmangle them on marking or do nothing as the whole map is
1153 // discarded on major GC anyway. 1148 // discarded on major GC anyway.
1154 Add<HStoreCodeEntry>(js_function, code_object); 1149 Add<HStoreCodeEntry>(js_function, code_object);
1155 1150
1156 // Now link a function into a list of optimized functions. 1151 // Now link a function into a list of optimized functions.
1157 HValue* optimized_functions_list = Add<HLoadNamedField>( 1152 HValue* optimized_functions_list = Add<HLoadNamedField>(
1158 native_context, static_cast<HValue*>(NULL), 1153 native_context, static_cast<HValue*>(NULL),
1159 HObjectAccess::ForContextSlot(Context::OPTIMIZED_FUNCTIONS_LIST)); 1154 HObjectAccess::ForContextSlot(Context::OPTIMIZED_FUNCTIONS_LIST));
1160 Add<HStoreNamedField>(js_function, 1155 Add<HStoreNamedField>(js_function,
1161 HObjectAccess::ForNextFunctionLinkPointer(), 1156 HObjectAccess::ForNextFunctionLinkPointer(),
1162 optimized_functions_list, INITIALIZING_STORE); 1157 optimized_functions_list);
1163 1158
1164 // This store is the only one that should have a write barrier. 1159 // This store is the only one that should have a write barrier.
1165 Add<HStoreNamedField>(native_context, 1160 Add<HStoreNamedField>(native_context,
1166 HObjectAccess::ForContextSlot(Context::OPTIMIZED_FUNCTIONS_LIST), 1161 HObjectAccess::ForContextSlot(Context::OPTIMIZED_FUNCTIONS_LIST),
1167 js_function, INITIALIZING_STORE); 1162 js_function);
1168 } 1163 }
1169 1164
1170 1165
1171 void CodeStubGraphBuilderBase::BuildInstallCode(HValue* js_function, 1166 void CodeStubGraphBuilderBase::BuildInstallCode(HValue* js_function,
1172 HValue* shared_info) { 1167 HValue* shared_info) {
1173 Add<HStoreNamedField>(js_function, 1168 Add<HStoreNamedField>(js_function,
1174 HObjectAccess::ForNextFunctionLinkPointer(), 1169 HObjectAccess::ForNextFunctionLinkPointer(),
1175 graph()->GetConstantUndefined(), 1170 graph()->GetConstantUndefined());
1176 INITIALIZING_STORE);
1177 HValue* code_object = Add<HLoadNamedField>( 1171 HValue* code_object = Add<HLoadNamedField>(
1178 shared_info, static_cast<HValue*>(NULL), HObjectAccess::ForCodeOffset()); 1172 shared_info, static_cast<HValue*>(NULL), HObjectAccess::ForCodeOffset());
1179 Add<HStoreCodeEntry>(js_function, code_object); 1173 Add<HStoreCodeEntry>(js_function, code_object);
1180 } 1174 }
1181 1175
1182 1176
1183 void CodeStubGraphBuilderBase::BuildInstallFromOptimizedCodeMap( 1177 void CodeStubGraphBuilderBase::BuildInstallFromOptimizedCodeMap(
1184 HValue* js_function, 1178 HValue* js_function,
1185 HValue* shared_info, 1179 HValue* shared_info,
1186 HValue* native_context) { 1180 HValue* native_context) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 1303
1310 int map_index = Context::FunctionMapIndex(casted_stub()->language_mode(), 1304 int map_index = Context::FunctionMapIndex(casted_stub()->language_mode(),
1311 casted_stub()->is_generator()); 1305 casted_stub()->is_generator());
1312 1306
1313 // Compute the function map in the current native context and set that 1307 // Compute the function map in the current native context and set that
1314 // as the map of the allocated object. 1308 // as the map of the allocated object.
1315 HInstruction* native_context = BuildGetNativeContext(); 1309 HInstruction* native_context = BuildGetNativeContext();
1316 HInstruction* map_slot_value = Add<HLoadNamedField>( 1310 HInstruction* map_slot_value = Add<HLoadNamedField>(
1317 native_context, static_cast<HValue*>(NULL), 1311 native_context, static_cast<HValue*>(NULL),
1318 HObjectAccess::ForContextSlot(map_index)); 1312 HObjectAccess::ForContextSlot(map_index));
1319 Add<HStoreNamedField>(js_function, HObjectAccess::ForMap(), map_slot_value, 1313 Add<HStoreNamedField>(js_function, HObjectAccess::ForMap(), map_slot_value);
1320 INITIALIZING_STORE);
1321 1314
1322 // Initialize the rest of the function. 1315 // Initialize the rest of the function.
1323 Add<HStoreNamedField>(js_function, HObjectAccess::ForPropertiesPointer(), 1316 Add<HStoreNamedField>(js_function, HObjectAccess::ForPropertiesPointer(),
1324 empty_fixed_array, INITIALIZING_STORE); 1317 empty_fixed_array);
1325 Add<HStoreNamedField>(js_function, HObjectAccess::ForElementsPointer(), 1318 Add<HStoreNamedField>(js_function, HObjectAccess::ForElementsPointer(),
1326 empty_fixed_array, INITIALIZING_STORE); 1319 empty_fixed_array);
1327 Add<HStoreNamedField>(js_function, HObjectAccess::ForLiteralsPointer(), 1320 Add<HStoreNamedField>(js_function, HObjectAccess::ForLiteralsPointer(),
1328 empty_fixed_array, INITIALIZING_STORE); 1321 empty_fixed_array);
1329 Add<HStoreNamedField>(js_function, HObjectAccess::ForPrototypeOrInitialMap(), 1322 Add<HStoreNamedField>(js_function, HObjectAccess::ForPrototypeOrInitialMap(),
1330 graph()->GetConstantHole(), INITIALIZING_STORE); 1323 graph()->GetConstantHole());
1331 Add<HStoreNamedField>(js_function, 1324 Add<HStoreNamedField>(js_function,
1332 HObjectAccess::ForSharedFunctionInfoPointer(), 1325 HObjectAccess::ForSharedFunctionInfoPointer(),
1333 shared_info, INITIALIZING_STORE); 1326 shared_info);
1334 Add<HStoreNamedField>(js_function, HObjectAccess::ForFunctionContextPointer(), 1327 Add<HStoreNamedField>(js_function, HObjectAccess::ForFunctionContextPointer(),
1335 context(), INITIALIZING_STORE); 1328 context());
1336 1329
1337 // Initialize the code pointer in the function to be the one 1330 // Initialize the code pointer in the function to be the one
1338 // found in the shared function info object. 1331 // found in the shared function info object.
1339 // But first check if there is an optimized version for our context. 1332 // But first check if there is an optimized version for our context.
1340 if (FLAG_cache_optimized_code) { 1333 if (FLAG_cache_optimized_code) {
1341 BuildInstallFromOptimizedCodeMap(js_function, shared_info, native_context); 1334 BuildInstallFromOptimizedCodeMap(js_function, shared_info, native_context);
1342 } else { 1335 } else {
1343 BuildInstallCode(js_function, shared_info); 1336 BuildInstallCode(js_function, shared_info);
1344 } 1337 }
1345 1338
(...skipping 16 matching lines...) Expand all
1362 // Allocate the context in new space. 1355 // Allocate the context in new space.
1363 HAllocate* function_context = Add<HAllocate>( 1356 HAllocate* function_context = Add<HAllocate>(
1364 Add<HConstant>(length * kPointerSize + FixedArray::kHeaderSize), 1357 Add<HConstant>(length * kPointerSize + FixedArray::kHeaderSize),
1365 HType::Tagged(), NOT_TENURED, FIXED_ARRAY_TYPE); 1358 HType::Tagged(), NOT_TENURED, FIXED_ARRAY_TYPE);
1366 1359
1367 // Set up the object header. 1360 // Set up the object header.
1368 AddStoreMapConstant(function_context, 1361 AddStoreMapConstant(function_context,
1369 isolate()->factory()->function_context_map()); 1362 isolate()->factory()->function_context_map());
1370 Add<HStoreNamedField>(function_context, 1363 Add<HStoreNamedField>(function_context,
1371 HObjectAccess::ForFixedArrayLength(), 1364 HObjectAccess::ForFixedArrayLength(),
1372 Add<HConstant>(length), INITIALIZING_STORE); 1365 Add<HConstant>(length));
1373 1366
1374 // Set up the fixed slots. 1367 // Set up the fixed slots.
1375 Add<HStoreNamedField>(function_context, 1368 Add<HStoreNamedField>(function_context,
1376 HObjectAccess::ForContextSlot(Context::CLOSURE_INDEX), 1369 HObjectAccess::ForContextSlot(Context::CLOSURE_INDEX),
1377 function, INITIALIZING_STORE); 1370 function);
1378 Add<HStoreNamedField>(function_context, 1371 Add<HStoreNamedField>(function_context,
1379 HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX), 1372 HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX),
1380 context(), INITIALIZING_STORE); 1373 context());
1381 Add<HStoreNamedField>(function_context, 1374 Add<HStoreNamedField>(function_context,
1382 HObjectAccess::ForContextSlot(Context::EXTENSION_INDEX), 1375 HObjectAccess::ForContextSlot(Context::EXTENSION_INDEX),
1383 graph()->GetConstant0(), INITIALIZING_STORE); 1376 graph()->GetConstant0());
1384 1377
1385 // Copy the global object from the previous context. 1378 // Copy the global object from the previous context.
1386 HValue* global_object = Add<HLoadNamedField>( 1379 HValue* global_object = Add<HLoadNamedField>(
1387 context(), static_cast<HValue*>(NULL), 1380 context(), static_cast<HValue*>(NULL),
1388 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); 1381 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
1389 Add<HStoreNamedField>(function_context, 1382 Add<HStoreNamedField>(function_context,
1390 HObjectAccess::ForContextSlot( 1383 HObjectAccess::ForContextSlot(
1391 Context::GLOBAL_OBJECT_INDEX), 1384 Context::GLOBAL_OBJECT_INDEX),
1392 global_object, 1385 global_object);
1393 INITIALIZING_STORE);
1394 1386
1395 // Initialize the rest of the slots to undefined. 1387 // Initialize the rest of the slots to undefined.
1396 for (int i = Context::MIN_CONTEXT_SLOTS; i < length; ++i) { 1388 for (int i = Context::MIN_CONTEXT_SLOTS; i < length; ++i) {
1397 Add<HStoreNamedField>(function_context, 1389 Add<HStoreNamedField>(function_context,
1398 HObjectAccess::ForContextSlot(i), 1390 HObjectAccess::ForContextSlot(i),
1399 graph()->GetConstantUndefined(), 1391 graph()->GetConstantUndefined());
1400 INITIALIZING_STORE);
1401 } 1392 }
1402 1393
1403 return function_context; 1394 return function_context;
1404 } 1395 }
1405 1396
1406 1397
1407 Handle<Code> FastNewContextStub::GenerateCode(Isolate* isolate) { 1398 Handle<Code> FastNewContextStub::GenerateCode(Isolate* isolate) {
1408 return DoGenerateCode(isolate, this); 1399 return DoGenerateCode(isolate, this);
1409 } 1400 }
1410 1401
(...skipping 24 matching lines...) Expand all
1435 return BuildRegExpConstructResult(length, index, input); 1426 return BuildRegExpConstructResult(length, index, input);
1436 } 1427 }
1437 1428
1438 1429
1439 Handle<Code> RegExpConstructResultStub::GenerateCode(Isolate* isolate) { 1430 Handle<Code> RegExpConstructResultStub::GenerateCode(Isolate* isolate) {
1440 return DoGenerateCode(isolate, this); 1431 return DoGenerateCode(isolate, this);
1441 } 1432 }
1442 1433
1443 1434
1444 } } // namespace v8::internal 1435 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen.h » ('j') | src/hydrogen.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698