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

Side by Side Diff: src/x64/code-stubs-x64.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 | « src/mips/code-stubs-mips.cc ('k') | test/mjsunit/regress/regress-1757.js » ('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 4066 matching lines...) Expand 10 before | Expand all | Expand 10 after
4077 // ConsString. 4077 // ConsString.
4078 // Check whether the right hand side is the empty string (i.e. if 4078 // Check whether the right hand side is the empty string (i.e. if
4079 // this is really a flat string in a cons string). If that is not 4079 // this is really a flat string in a cons string). If that is not
4080 // the case we would rather go to the runtime system now to flatten 4080 // the case we would rather go to the runtime system now to flatten
4081 // the string. 4081 // the string.
4082 Label assure_seq_string; 4082 Label assure_seq_string;
4083 __ CompareRoot(FieldOperand(object_, ConsString::kSecondOffset), 4083 __ CompareRoot(FieldOperand(object_, ConsString::kSecondOffset),
4084 Heap::kEmptyStringRootIndex); 4084 Heap::kEmptyStringRootIndex);
4085 __ j(not_equal, &call_runtime_); 4085 __ j(not_equal, &call_runtime_);
4086 // Get the first of the two strings and load its instance type. 4086 // Get the first of the two strings and load its instance type.
4087 __ movq(object_, FieldOperand(object_, ConsString::kFirstOffset)); 4087 __ movq(kScratchRegister, FieldOperand(object_, ConsString::kFirstOffset));
4088 __ jmp(&assure_seq_string, Label::kNear); 4088 __ jmp(&assure_seq_string, Label::kNear);
4089 4089
4090 // SlicedString, unpack and add offset. 4090 // SlicedString, unpack and add offset.
4091 __ bind(&sliced_string); 4091 __ bind(&sliced_string);
4092 __ addq(scratch_, FieldOperand(object_, SlicedString::kOffsetOffset)); 4092 __ addq(scratch_, FieldOperand(object_, SlicedString::kOffsetOffset));
4093 __ movq(object_, FieldOperand(object_, SlicedString::kParentOffset)); 4093 __ movq(kScratchRegister, FieldOperand(object_, SlicedString::kParentOffset));
4094 4094
4095 __ bind(&assure_seq_string); 4095 __ bind(&assure_seq_string);
4096 __ movq(result_, FieldOperand(object_, HeapObject::kMapOffset)); 4096 __ movq(result_, FieldOperand(kScratchRegister, HeapObject::kMapOffset));
4097 __ movzxbl(result_, FieldOperand(result_, Map::kInstanceTypeOffset)); 4097 __ movzxbl(result_, FieldOperand(result_, Map::kInstanceTypeOffset));
4098 // If the first cons component is also non-flat, then go to runtime. 4098 // If the first cons component is also non-flat, then go to runtime.
4099 STATIC_ASSERT(kSeqStringTag == 0); 4099 STATIC_ASSERT(kSeqStringTag == 0);
4100 __ testb(result_, Immediate(kStringRepresentationMask)); 4100 __ testb(result_, Immediate(kStringRepresentationMask));
4101 __ j(not_zero, &call_runtime_); 4101 __ j(not_zero, &call_runtime_);
4102 __ jmp(&flat_string); 4102 __ movq(object_, kScratchRegister);
4103 4103
4104 // Check for 1-byte or 2-byte string. 4104 // Check for 1-byte or 2-byte string.
4105 __ bind(&flat_string); 4105 __ bind(&flat_string);
4106 STATIC_ASSERT((kStringEncodingMask & kAsciiStringTag) != 0); 4106 STATIC_ASSERT((kStringEncodingMask & kAsciiStringTag) != 0);
4107 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0); 4107 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0);
4108 __ testb(result_, Immediate(kStringEncodingMask)); 4108 __ testb(result_, Immediate(kStringEncodingMask));
4109 __ j(not_zero, &ascii_string); 4109 __ j(not_zero, &ascii_string);
4110 4110
4111 // 2-byte string. 4111 // 2-byte string.
4112 // Load the 2-byte character code into the result register. 4112 // Load the 2-byte character code into the result register.
(...skipping 1801 matching lines...) Expand 10 before | Expand all | Expand 10 after
5914 5914
5915 // Fall through when we need to inform the incremental marker. 5915 // Fall through when we need to inform the incremental marker.
5916 } 5916 }
5917 5917
5918 5918
5919 #undef __ 5919 #undef __
5920 5920
5921 } } // namespace v8::internal 5921 } } // namespace v8::internal
5922 5922
5923 #endif // V8_TARGET_ARCH_X64 5923 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | test/mjsunit/regress/regress-1757.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698