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

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

Issue 148883002: Synchronize with r15594. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: 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 | « src/builtins.cc ('k') | src/d8.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 439
440 // Store the map 440 // Store the map
441 Handle<Map> allocation_site_map(isolate()->heap()->allocation_site_map(), 441 Handle<Map> allocation_site_map(isolate()->heap()->allocation_site_map(),
442 isolate()); 442 isolate());
443 AddStoreMapConstant(object, allocation_site_map); 443 AddStoreMapConstant(object, allocation_site_map);
444 444
445 // Store the payload (smi elements kind) 445 // Store the payload (smi elements kind)
446 HValue* initial_elements_kind = AddInstruction(new(zone) HConstant( 446 HValue* initial_elements_kind = AddInstruction(new(zone) HConstant(
447 GetInitialFastElementsKind())); 447 GetInitialFastElementsKind()));
448 AddInstruction(new(zone) HStoreNamedField(object, 448 AddInstruction(new(zone) HStoreNamedField(object,
449 HObjectAccess::ForAllocationSitePayload(), initial_elements_kind)); 449 HObjectAccess::ForAllocationSiteTransitionInfo(), initial_elements_kind));
450 450
451 // We use a hammer (SkipWriteBarrier()) to indicate that we know the input 451 // We use a hammer (SkipWriteBarrier()) to indicate that we know the input
452 // cell is really a Cell, and so no write barrier is needed. 452 // cell is really a Cell, and so no write barrier is needed.
453 // TODO(mvstanton): Add a debug_code check to verify the input cell is really 453 // TODO(mvstanton): Add a debug_code check to verify the input cell is really
454 // a cell. (perhaps with a new instruction, HAssert). 454 // a cell. (perhaps with a new instruction, HAssert).
455 HInstruction* cell = GetParameter(0); 455 HInstruction* cell = GetParameter(0);
456 HObjectAccess access = HObjectAccess::ForCellValue(); 456 HObjectAccess access = HObjectAccess::ForCellValue();
457 HStoreNamedField* store = AddStore(cell, access, object); 457 HStoreNamedField* store = AddStore(cell, access, object);
458 store->SkipWriteBarrier(); 458 store->SkipWriteBarrier();
459 return cell; 459 return cell;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 } 521 }
522 522
523 523
524 Handle<Code> KeyedStoreFastElementStub::GenerateCode() { 524 Handle<Code> KeyedStoreFastElementStub::GenerateCode() {
525 return DoGenerateCode(this); 525 return DoGenerateCode(this);
526 } 526 }
527 527
528 528
529 template <> 529 template <>
530 HValue* CodeStubGraphBuilder<TransitionElementsKindStub>::BuildCodeStub() { 530 HValue* CodeStubGraphBuilder<TransitionElementsKindStub>::BuildCodeStub() {
531 Zone* zone = this->zone(); 531 TransitionElementsKindStub* stub = casted_stub();
532 ElementsKind from_kind = stub->from_kind();
533 ElementsKind to_kind = stub->to_kind();
532 534
533 HValue* js_array = GetParameter(0); 535 HValue* js_array = GetParameter(0);
534 HValue* map = GetParameter(1); 536 HValue* map = GetParameter(1);
535 537
536 info()->MarkAsSavesCallerDoubles(); 538 info()->MarkAsSavesCallerDoubles();
537 539
538 AddInstruction(new(zone) HTrapAllocationMemento(js_array)); 540 if (AllocationSite::GetMode(from_kind, to_kind) == TRACK_ALLOCATION_SITE) {
541 Add<HTrapAllocationMemento>(js_array);
542 }
539 543
540 HInstruction* array_length = 544 HInstruction* array_length =
541 AddLoad(js_array, HObjectAccess::ForArrayLength()); 545 AddLoad(js_array, HObjectAccess::ForArrayLength());
542 array_length->set_type(HType::Smi()); 546 array_length->set_type(HType::Smi());
543 547
544 ElementsKind to_kind = casted_stub()->to_kind();
545 BuildNewSpaceArrayCheck(array_length, to_kind);
546
547 IfBuilder if_builder(this); 548 IfBuilder if_builder(this);
548 549
549 if_builder.If<HCompareNumericAndBranch>(array_length, 550 if_builder.IfNot<HCompareNumericAndBranch>(array_length,
550 graph()->GetConstant0(), 551 graph()->GetConstant0(),
551 Token::EQ); 552 Token::EQ);
552 if_builder.Then(); 553 if_builder.Then();
553 554
554 // Nothing to do, just change the map.
555
556 if_builder.Else();
557
558 HInstruction* elements = AddLoadElements(js_array); 555 HInstruction* elements = AddLoadElements(js_array);
559 556
560 HInstruction* elements_length = AddLoadFixedArrayLength(elements); 557 HInstruction* elements_length = AddLoadFixedArrayLength(elements);
561 558
562 HValue* new_elements = BuildAllocateElementsAndInitializeElementsHeader( 559 BuildGrowElementsCapacity(js_array, elements, from_kind, to_kind,
563 context(), to_kind, elements_length); 560 array_length, elements_length);
564
565 BuildCopyElements(context(), elements,
566 casted_stub()->from_kind(), new_elements,
567 to_kind, array_length, elements_length);
568
569 AddStore(js_array, HObjectAccess::ForElementsPointer(), new_elements);
570 561
571 if_builder.End(); 562 if_builder.End();
572 563
573 AddStore(js_array, HObjectAccess::ForMap(), map); 564 AddStore(js_array, HObjectAccess::ForMap(), map);
574 565
575 return js_array; 566 return js_array;
576 } 567 }
577 568
578 569
579 Handle<Code> TransitionElementsKindStub::GenerateCode() { 570 Handle<Code> TransitionElementsKindStub::GenerateCode() {
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 return value; 903 return value;
913 } 904 }
914 905
915 906
916 Handle<Code> StoreGlobalStub::GenerateCode() { 907 Handle<Code> StoreGlobalStub::GenerateCode() {
917 return DoGenerateCode(this); 908 return DoGenerateCode(this);
918 } 909 }
919 910
920 911
921 } } // namespace v8::internal 912 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/d8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698