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

Side by Side Diff: runtime/vm/intermediate_language_ia32.cc

Issue 10509004: Implement AllocateContextComp, ChainContext, CloneContext on ia32 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/flow_graph_compiler.h" 10 #include "vm/flow_graph_compiler.h"
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 } 640 }
641 641
642 642
643 void ExtractConstructorInstantiatorComp::EmitNativeCode( 643 void ExtractConstructorInstantiatorComp::EmitNativeCode(
644 FlowGraphCompiler* compiler) { 644 FlowGraphCompiler* compiler) {
645 UNIMPLEMENTED(); 645 UNIMPLEMENTED();
646 } 646 }
647 647
648 648
649 LocationSummary* AllocateContextComp::MakeLocationSummary() const { 649 LocationSummary* AllocateContextComp::MakeLocationSummary() const {
650 return NULL; 650 const intptr_t kNumInputs = 0;
651 const intptr_t kNumTemps = 1;
652 LocationSummary* locs = new LocationSummary(kNumInputs, kNumTemps);
653 locs->set_temp(0, Location::RegisterLocation(EDX));
654 locs->set_out(Location::RegisterLocation(EAX));
655 return locs;
651 } 656 }
652 657
653 658
654 void AllocateContextComp::EmitNativeCode(FlowGraphCompiler* compiler) { 659 void AllocateContextComp::EmitNativeCode(FlowGraphCompiler* compiler) {
655 UNIMPLEMENTED(); 660 ASSERT(locs()->temp(0).reg() == EDX);
661 ASSERT(locs()->out().reg() == EAX);
662
663 __ movl(EDX, Immediate(num_context_variables()));
664 const ExternalLabel label("alloc_context",
665 StubCode::AllocateContextEntryPoint());
666 compiler->GenerateCall(token_index(),
667 try_index(),
668 &label,
669 PcDescriptors::kOther);
656 } 670 }
657 671
658 672
659 LocationSummary* ChainContextComp::MakeLocationSummary() const { 673 LocationSummary* ChainContextComp::MakeLocationSummary() const {
660 return NULL; 674 return LocationSummary::Make(1, Location::NoLocation());
661 } 675 }
662 676
663 677
664 void ChainContextComp::EmitNativeCode(FlowGraphCompiler* compiler) { 678 void ChainContextComp::EmitNativeCode(FlowGraphCompiler* compiler) {
665 UNIMPLEMENTED(); 679 Register context_value = locs()->in(0).reg();
680
681 // Chain the new context in context_value to its parent in CTX.
682 __ StoreIntoObject(context_value,
683 FieldAddress(context_value, Context::parent_offset()),
684 CTX);
685 // Set new context as current context.
686 __ movl(CTX, context_value);
666 } 687 }
667 688
668 689
669 LocationSummary* CloneContextComp::MakeLocationSummary() const { 690 LocationSummary* CloneContextComp::MakeLocationSummary() const {
670 return NULL; 691 return LocationSummary::Make(1, Location::RequiresRegister());
671 } 692 }
672 693
673 694
674 void CloneContextComp::EmitNativeCode(FlowGraphCompiler* compiler) { 695 void CloneContextComp::EmitNativeCode(FlowGraphCompiler* compiler) {
675 UNIMPLEMENTED(); 696 Register context_value = locs()->in(0).reg();
697 Register result = locs()->out().reg();
698
699 __ PushObject(Object::ZoneHandle()); // Make room for the result.
700 __ pushl(context_value);
701 compiler->GenerateCallRuntime(cid(),
702 token_index(),
703 try_index(),
704 kCloneContextRuntimeEntry);
705 __ popl(result); // Remove argument.
706 __ popl(result); // Get result (cloned context).
676 } 707 }
677 708
678 709
679 LocationSummary* CatchEntryComp::MakeLocationSummary() const { 710 LocationSummary* CatchEntryComp::MakeLocationSummary() const {
680 return NULL; 711 return NULL;
681 } 712 }
682 713
683 714
684 void CatchEntryComp::EmitNativeCode(FlowGraphCompiler* compiler) { 715 void CatchEntryComp::EmitNativeCode(FlowGraphCompiler* compiler) {
685 UNIMPLEMENTED(); 716 UNIMPLEMENTED();
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 UNREACHABLE(); 852 UNREACHABLE();
822 } 853 }
823 } 854 }
824 855
825 856
826 } // namespace dart 857 } // namespace dart
827 858
828 #undef __ 859 #undef __
829 860
830 #endif // defined TARGET_ARCH_X64 861 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698