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/ia32/codegen-ia32.cc

Issue 385004: Remove sliced string string type... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 1 month 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/heap.cc ('k') | src/mark-compact.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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 4659 matching lines...) Expand 10 before | Expand all | Expand 10 after
4670 value.ToRegister(); 4670 value.ToRegister();
4671 ASSERT(value.is_valid()); 4671 ASSERT(value.is_valid());
4672 __ test(value.reg(), Immediate(kSmiTagMask | 0x80000000)); 4672 __ test(value.reg(), Immediate(kSmiTagMask | 0x80000000));
4673 value.Unuse(); 4673 value.Unuse();
4674 destination()->Split(zero); 4674 destination()->Split(zero);
4675 } 4675 }
4676 4676
4677 4677
4678 // This generates code that performs a charCodeAt() call or returns 4678 // This generates code that performs a charCodeAt() call or returns
4679 // undefined in order to trigger the slow case, Runtime_StringCharCodeAt. 4679 // undefined in order to trigger the slow case, Runtime_StringCharCodeAt.
4680 // It can handle flat and sliced strings, 8 and 16 bit characters and 4680 // It can handle flat, 8 and 16 bit characters and cons strings where the
4681 // cons strings where the answer is found in the left hand branch of the 4681 // answer is found in the left hand branch of the cons. The slow case will
4682 // cons. The slow case will flatten the string, which will ensure that 4682 // flatten the string, which will ensure that the answer is in the left hand
4683 // the answer is in the left hand side the next time around. 4683 // side the next time around.
4684 void CodeGenerator::GenerateFastCharCodeAt(ZoneList<Expression*>* args) { 4684 void CodeGenerator::GenerateFastCharCodeAt(ZoneList<Expression*>* args) {
4685 Comment(masm_, "[ GenerateFastCharCodeAt"); 4685 Comment(masm_, "[ GenerateFastCharCodeAt");
4686 ASSERT(args->length() == 2); 4686 ASSERT(args->length() == 2);
4687 4687
4688 Label slow_case; 4688 Label slow_case;
4689 Label end; 4689 Label end;
4690 Label not_a_flat_string; 4690 Label not_a_flat_string;
4691 Label a_cons_string;
4692 Label try_again_with_new_string; 4691 Label try_again_with_new_string;
4693 Label ascii_string; 4692 Label ascii_string;
4694 Label got_char_code; 4693 Label got_char_code;
4695 4694
4696 Load(args->at(0)); 4695 Load(args->at(0));
4697 Load(args->at(1)); 4696 Load(args->at(1));
4698 Result index = frame_->Pop(); 4697 Result index = frame_->Pop();
4699 Result object = frame_->Pop(); 4698 Result object = frame_->Pop();
4700 4699
4701 // Get register ecx to use as shift amount later. 4700 // Get register ecx to use as shift amount later.
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
4803 SeqAsciiString::kHeaderSize)); 4802 SeqAsciiString::kHeaderSize));
4804 __ bind(&got_char_code); 4803 __ bind(&got_char_code);
4805 ASSERT(kSmiTag == 0); 4804 ASSERT(kSmiTag == 0);
4806 __ shl(temp.reg(), kSmiTagSize); 4805 __ shl(temp.reg(), kSmiTagSize);
4807 __ jmp(&end); 4806 __ jmp(&end);
4808 4807
4809 // Handle non-flat strings. 4808 // Handle non-flat strings.
4810 __ bind(&not_a_flat_string); 4809 __ bind(&not_a_flat_string);
4811 __ and_(temp.reg(), kStringRepresentationMask); 4810 __ and_(temp.reg(), kStringRepresentationMask);
4812 __ cmp(temp.reg(), kConsStringTag); 4811 __ cmp(temp.reg(), kConsStringTag);
4813 __ j(equal, &a_cons_string);
4814 __ cmp(temp.reg(), kSlicedStringTag);
4815 __ j(not_equal, &slow_case); 4812 __ j(not_equal, &slow_case);
4816 4813
4817 // SlicedString.
4818 // Add the offset to the index and trigger the slow case on overflow.
4819 __ add(index.reg(), FieldOperand(object.reg(), SlicedString::kStartOffset));
4820 __ j(overflow, &slow_case);
4821 // Getting the underlying string is done by running the cons string code.
4822
4823 // ConsString. 4814 // ConsString.
4824 __ bind(&a_cons_string); 4815 // Get the first of the two strings.
4825 // Get the first of the two strings. Both sliced and cons strings
4826 // store their source string at the same offset.
4827 ASSERT(SlicedString::kBufferOffset == ConsString::kFirstOffset);
4828 __ mov(object.reg(), FieldOperand(object.reg(), ConsString::kFirstOffset)); 4816 __ mov(object.reg(), FieldOperand(object.reg(), ConsString::kFirstOffset));
4829 __ jmp(&try_again_with_new_string); 4817 __ jmp(&try_again_with_new_string);
4830 4818
4831 __ bind(&slow_case); 4819 __ bind(&slow_case);
4832 // Move the undefined value into the result register, which will 4820 // Move the undefined value into the result register, which will
4833 // trigger the slow case. 4821 // trigger the slow case.
4834 __ Set(temp.reg(), Immediate(Factory::undefined_value())); 4822 __ Set(temp.reg(), Immediate(Factory::undefined_value()));
4835 4823
4836 __ bind(&end); 4824 __ bind(&end);
4837 frame_->Push(&temp); 4825 frame_->Push(&temp);
(...skipping 3281 matching lines...) Expand 10 before | Expand all | Expand 10 after
8119 8107
8120 int CompareStub::MinorKey() { 8108 int CompareStub::MinorKey() {
8121 // Encode the two parameters in a unique 16 bit value. 8109 // Encode the two parameters in a unique 16 bit value.
8122 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); 8110 ASSERT(static_cast<unsigned>(cc_) < (1 << 15));
8123 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); 8111 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0);
8124 } 8112 }
8125 8113
8126 #undef __ 8114 #undef __
8127 8115
8128 } } // namespace v8::internal 8116 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698