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

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

Issue 8217011: Fixing issue 1757 (string slices of external strings). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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/ia32/code-stubs-ia32.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 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 5070 matching lines...) Expand 10 before | Expand all | Expand 10 after
5081 // Check whether the right hand side is the empty string (i.e. if 5081 // Check whether the right hand side is the empty string (i.e. if
5082 // this is really a flat string in a cons string). If that is not 5082 // this is really a flat string in a cons string). If that is not
5083 // the case we would rather go to the runtime system now to flatten 5083 // the case we would rather go to the runtime system now to flatten
5084 // the string. 5084 // the string.
5085 Label assure_seq_string; 5085 Label assure_seq_string;
5086 __ ldr(result_, FieldMemOperand(object_, ConsString::kSecondOffset)); 5086 __ ldr(result_, FieldMemOperand(object_, ConsString::kSecondOffset));
5087 __ LoadRoot(ip, Heap::kEmptyStringRootIndex); 5087 __ LoadRoot(ip, Heap::kEmptyStringRootIndex);
5088 __ cmp(result_, Operand(ip)); 5088 __ cmp(result_, Operand(ip));
5089 __ b(ne, &call_runtime_); 5089 __ b(ne, &call_runtime_);
5090 // Get the first of the two strings and load its instance type. 5090 // Get the first of the two strings and load its instance type.
5091 __ ldr(object_, FieldMemOperand(object_, ConsString::kFirstOffset)); 5091 __ ldr(result_, FieldMemOperand(object_, ConsString::kFirstOffset));
5092 __ jmp(&assure_seq_string); 5092 __ jmp(&assure_seq_string);
5093 5093
5094 // SlicedString, unpack and add offset. 5094 // SlicedString, unpack and add offset.
5095 __ bind(&sliced_string); 5095 __ bind(&sliced_string);
5096 __ ldr(result_, FieldMemOperand(object_, SlicedString::kOffsetOffset)); 5096 __ ldr(result_, FieldMemOperand(object_, SlicedString::kOffsetOffset));
5097 __ add(scratch_, scratch_, result_); 5097 __ add(scratch_, scratch_, result_);
5098 __ ldr(object_, FieldMemOperand(object_, SlicedString::kParentOffset)); 5098 __ ldr(result_, FieldMemOperand(object_, SlicedString::kParentOffset));
5099 5099
5100 // Assure that we are dealing with a sequential string. Go to runtime if not. 5100 // Assure that we are dealing with a sequential string. Go to runtime if not.
5101 __ bind(&assure_seq_string); 5101 __ bind(&assure_seq_string);
5102 __ ldr(result_, FieldMemOperand(object_, HeapObject::kMapOffset)); 5102 __ ldr(result_, FieldMemOperand(result_, HeapObject::kMapOffset));
5103 __ ldrb(result_, FieldMemOperand(result_, Map::kInstanceTypeOffset)); 5103 __ ldrb(result_, FieldMemOperand(result_, Map::kInstanceTypeOffset));
5104 // Check that parent is not an external string. Go to runtime otherwise. 5104 // Check that parent is not an external string. Go to runtime otherwise.
5105 STATIC_ASSERT(kSeqStringTag == 0); 5105 STATIC_ASSERT(kSeqStringTag == 0);
5106 __ tst(result_, Operand(kStringRepresentationMask)); 5106 __ tst(result_, Operand(kStringRepresentationMask));
5107 __ b(ne, &call_runtime_); 5107 __ b(ne, &call_runtime_);
5108 // Actually fetch the parent string if it is confirmed to be sequential.
5109 STATIC_ASSERT(SlicedString::kParentOffset == ConsString::kFirstOffset);
5110 __ ldr(object_, FieldMemOperand(object_, SlicedString::kParentOffset));
5108 5111
5109 // Check for 1-byte or 2-byte string. 5112 // Check for 1-byte or 2-byte string.
5110 __ bind(&flat_string); 5113 __ bind(&flat_string);
5111 STATIC_ASSERT((kStringEncodingMask & kAsciiStringTag) != 0); 5114 STATIC_ASSERT((kStringEncodingMask & kAsciiStringTag) != 0);
5112 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0); 5115 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0);
5113 __ tst(result_, Operand(kStringEncodingMask)); 5116 __ tst(result_, Operand(kStringEncodingMask));
5114 __ b(ne, &ascii_string); 5117 __ b(ne, &ascii_string);
5115 5118
5116 // 2-byte string. 5119 // 2-byte string.
5117 // Load the 2-byte character code into the result register. We can 5120 // Load the 2-byte character code into the result register. We can
(...skipping 2045 matching lines...) Expand 10 before | Expand all | Expand 10 after
7163 7166
7164 // Fall through when we need to inform the incremental marker. 7167 // Fall through when we need to inform the incremental marker.
7165 } 7168 }
7166 7169
7167 7170
7168 #undef __ 7171 #undef __
7169 7172
7170 } } // namespace v8::internal 7173 } } // namespace v8::internal
7171 7174
7172 #endif // V8_TARGET_ARCH_ARM 7175 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698