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

Side by Side Diff: src/ia32/lithium-ia32.cc

Issue 6142011: Crankshaft: Move LEnvironment and LPointerMap classes to platform-independent... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 11 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/ia32/lithium-ia32.h ('k') | src/lithium.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 int index = chunk_->AddInstruction(instr, current_block_); 881 int index = chunk_->AddInstruction(instr, current_block_);
882 allocator_->SummarizeInstruction(index); 882 allocator_->SummarizeInstruction(index);
883 } else { 883 } else {
884 // This instruction should be omitted. 884 // This instruction should be omitted.
885 allocator_->OmitInstruction(); 885 allocator_->OmitInstruction();
886 } 886 }
887 current_instruction_ = old_current; 887 current_instruction_ = old_current;
888 } 888 }
889 889
890 890
891 void LEnvironment::WriteTranslation(LCodeGen* cgen,
892 Translation* translation) const {
893 if (this == NULL) return;
894
895 // The translation includes one command per value in the environment.
896 int translation_size = values()->length();
897 // The output frame height does not include the parameters.
898 int height = translation_size - parameter_count();
899
900 outer()->WriteTranslation(cgen, translation);
901 int closure_id = cgen->DefineDeoptimizationLiteral(closure());
902 translation->BeginFrame(ast_id(), closure_id, height);
903 for (int i = 0; i < translation_size; ++i) {
904 LOperand* value = values()->at(i);
905 // spilled_registers_ and spilled_double_registers_ are either
906 // both NULL or both set.
907 if (spilled_registers_ != NULL && value != NULL) {
908 if (value->IsRegister() &&
909 spilled_registers_[value->index()] != NULL) {
910 translation->MarkDuplicate();
911 cgen->AddToTranslation(translation,
912 spilled_registers_[value->index()],
913 HasTaggedValueAt(i));
914 } else if (value->IsDoubleRegister() &&
915 spilled_double_registers_[value->index()] != NULL) {
916 translation->MarkDuplicate();
917 cgen->AddToTranslation(translation,
918 spilled_double_registers_[value->index()],
919 false);
920 }
921 }
922
923 cgen->AddToTranslation(translation, value, HasTaggedValueAt(i));
924 }
925 }
926
927
928 void LEnvironment::PrintTo(StringStream* stream) {
929 stream->Add("[id=%d|", ast_id());
930 stream->Add("[parameters=%d|", parameter_count());
931 stream->Add("[arguments_stack_height=%d|", arguments_stack_height());
932 for (int i = 0; i < values_.length(); ++i) {
933 if (i != 0) stream->Add(";");
934 if (values_[i] == NULL) {
935 stream->Add("[hole]");
936 } else {
937 values_[i]->PrintTo(stream);
938 }
939 }
940 stream->Add("]");
941 }
942
943
944 LEnvironment* LChunkBuilder::CreateEnvironment(HEnvironment* hydrogen_env) { 891 LEnvironment* LChunkBuilder::CreateEnvironment(HEnvironment* hydrogen_env) {
945 if (hydrogen_env == NULL) return NULL; 892 if (hydrogen_env == NULL) return NULL;
946 893
947 LEnvironment* outer = CreateEnvironment(hydrogen_env->outer()); 894 LEnvironment* outer = CreateEnvironment(hydrogen_env->outer());
948 int ast_id = hydrogen_env->ast_id(); 895 int ast_id = hydrogen_env->ast_id();
949 ASSERT(ast_id != AstNode::kNoNumber); 896 ASSERT(ast_id != AstNode::kNoNumber);
950 int value_count = hydrogen_env->length(); 897 int value_count = hydrogen_env->length();
951 LEnvironment* result = new LEnvironment(hydrogen_env->closure(), 898 LEnvironment* result = new LEnvironment(hydrogen_env->closure(),
952 ast_id, 899 ast_id,
953 hydrogen_env->parameter_count(), 900 hydrogen_env->parameter_count(),
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 } 1858 }
1912 1859
1913 1860
1914 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { 1861 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) {
1915 HEnvironment* outer = current_block_->last_environment()->outer(); 1862 HEnvironment* outer = current_block_->last_environment()->outer();
1916 current_block_->UpdateEnvironment(outer); 1863 current_block_->UpdateEnvironment(outer);
1917 return NULL; 1864 return NULL;
1918 } 1865 }
1919 1866
1920 1867
1921 void LPointerMap::RecordPointer(LOperand* op) {
1922 // Do not record arguments as pointers.
1923 if (op->IsStackSlot() && op->index() < 0) return;
1924 ASSERT(!op->IsDoubleRegister() && !op->IsDoubleStackSlot());
1925 pointer_operands_.Add(op);
1926 }
1927
1928
1929 void LPointerMap::PrintTo(StringStream* stream) {
1930 stream->Add("{");
1931 for (int i = 0; i < pointer_operands_.length(); ++i) {
1932 if (i != 0) stream->Add(";");
1933 pointer_operands_[i]->PrintTo(stream);
1934 }
1935 stream->Add("} @%d", position());
1936 }
1937
1938 } } // namespace v8::internal 1868 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/lithium.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698