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

Issue 2549773002: Internalize strings in-place (Closed)
Patch Set: rebased Created 3 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
« no previous file with comments | « src/s390/code-stubs-s390.cc ('k') | src/value-serializer.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/s390/codegen-s390.h" 5 #include "src/s390/codegen-s390.h"
6 6
7 #if V8_TARGET_ARCH_S390 7 #if V8_TARGET_ARCH_S390
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 // ------------------------------------------------------------------------- 64 // -------------------------------------------------------------------------
65 // Code generators 65 // Code generators
66 66
67 #define __ ACCESS_MASM(masm) 67 #define __ ACCESS_MASM(masm)
68 68
69 // assume ip can be used as a scratch register below 69 // assume ip can be used as a scratch register below
70 void StringCharLoadGenerator::Generate(MacroAssembler* masm, Register string, 70 void StringCharLoadGenerator::Generate(MacroAssembler* masm, Register string,
71 Register index, Register result, 71 Register index, Register result,
72 Label* call_runtime) { 72 Label* call_runtime) {
73 Label indirect_string_loaded;
74 __ bind(&indirect_string_loaded);
75
73 // Fetch the instance type of the receiver into result register. 76 // Fetch the instance type of the receiver into result register.
74 __ LoadP(result, FieldMemOperand(string, HeapObject::kMapOffset)); 77 __ LoadP(result, FieldMemOperand(string, HeapObject::kMapOffset));
75 __ LoadlB(result, FieldMemOperand(result, Map::kInstanceTypeOffset)); 78 __ LoadlB(result, FieldMemOperand(result, Map::kInstanceTypeOffset));
76 79
77 // We need special handling for indirect strings. 80 // We need special handling for indirect strings.
78 Label check_sequential; 81 Label check_sequential;
79 __ mov(r0, Operand(kIsIndirectStringMask)); 82 __ mov(r0, Operand(kIsIndirectStringMask));
80 __ AndP(r0, result); 83 __ AndP(r0, result);
81 __ beq(&check_sequential, Label::kNear /*, cr0*/); 84 __ beq(&check_sequential, Label::kNear /*, cr0*/);
82 85
83 // Dispatch on the indirect string shape: slice or cons. 86 // Dispatch on the indirect string shape: slice or cons.
84 Label cons_string; 87 Label cons_string, thin_string;
85 __ mov(ip, Operand(kSlicedNotConsMask)); 88 __ LoadRR(ip, result);
86 __ LoadRR(r0, result); 89 __ nilf(ip, Operand(kStringRepresentationMask));
87 __ AndP(r0, ip /*, SetRC*/); // Should be okay to remove RC 90 __ CmpP(ip, Operand(kConsStringTag));
88 __ beq(&cons_string, Label::kNear /*, cr0*/); 91 __ beq(&cons_string);
92 __ CmpP(ip, Operand(kThinStringTag));
93 __ beq(&thin_string);
89 94
90 // Handle slices. 95 // Handle slices.
91 Label indirect_string_loaded;
92 __ LoadP(result, FieldMemOperand(string, SlicedString::kOffsetOffset)); 96 __ LoadP(result, FieldMemOperand(string, SlicedString::kOffsetOffset));
93 __ LoadP(string, FieldMemOperand(string, SlicedString::kParentOffset)); 97 __ LoadP(string, FieldMemOperand(string, SlicedString::kParentOffset));
94 __ SmiUntag(ip, result); 98 __ SmiUntag(ip, result);
95 __ AddP(index, ip); 99 __ AddP(index, ip);
96 __ b(&indirect_string_loaded, Label::kNear); 100 __ b(&indirect_string_loaded);
101
102 // Handle thin strings.
103 __ bind(&thin_string);
104 __ LoadP(string, FieldMemOperand(string, ThinString::kActualOffset));
105 __ b(&indirect_string_loaded);
97 106
98 // Handle cons strings. 107 // Handle cons strings.
99 // Check whether the right hand side is the empty string (i.e. if 108 // Check whether the right hand side is the empty string (i.e. if
100 // this is really a flat string in a cons string). If that is not 109 // this is really a flat string in a cons string). If that is not
101 // the case we would rather go to the runtime system now to flatten 110 // the case we would rather go to the runtime system now to flatten
102 // the string. 111 // the string.
103 __ bind(&cons_string); 112 __ bind(&cons_string);
104 __ LoadP(result, FieldMemOperand(string, ConsString::kSecondOffset)); 113 __ LoadP(result, FieldMemOperand(string, ConsString::kSecondOffset));
105 __ CompareRoot(result, Heap::kempty_stringRootIndex); 114 __ CompareRoot(result, Heap::kempty_stringRootIndex);
106 __ bne(call_runtime); 115 __ bne(call_runtime);
107 // Get the first of the two strings and load its instance type. 116 // Get the first of the two strings and load its instance type.
108 __ LoadP(string, FieldMemOperand(string, ConsString::kFirstOffset)); 117 __ LoadP(string, FieldMemOperand(string, ConsString::kFirstOffset));
109 118 __ b(&indirect_string_loaded);
110 __ bind(&indirect_string_loaded);
111 __ LoadP(result, FieldMemOperand(string, HeapObject::kMapOffset));
112 __ LoadlB(result, FieldMemOperand(result, Map::kInstanceTypeOffset));
113 119
114 // Distinguish sequential and external strings. Only these two string 120 // Distinguish sequential and external strings. Only these two string
115 // representations can reach here (slices and flat cons strings have been 121 // representations can reach here (slices and flat cons strings have been
116 // reduced to the underlying sequential or external string). 122 // reduced to the underlying sequential or external string).
117 Label external_string, check_encoding; 123 Label external_string, check_encoding;
118 __ bind(&check_sequential); 124 __ bind(&check_sequential);
119 STATIC_ASSERT(kSeqStringTag == 0); 125 STATIC_ASSERT(kSeqStringTag == 0);
120 __ mov(r0, Operand(kStringRepresentationMask)); 126 __ mov(r0, Operand(kStringRepresentationMask));
121 __ AndP(r0, result); 127 __ AndP(r0, result);
122 __ bne(&external_string, Label::kNear); 128 __ bne(&external_string, Label::kNear);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 // (kNoCodeAgeSequenceLength - kCodeAgingSequenceLength) bytes. 231 // (kNoCodeAgeSequenceLength - kCodeAgingSequenceLength) bytes.
226 patcher.masm()->nop(); // 2-byte nops(). 232 patcher.masm()->nop(); // 2-byte nops().
227 } 233 }
228 } 234 }
229 } 235 }
230 236
231 } // namespace internal 237 } // namespace internal
232 } // namespace v8 238 } // namespace v8
233 239
234 #endif // V8_TARGET_ARCH_S390 240 #endif // V8_TARGET_ARCH_S390
OLDNEW
« no previous file with comments | « src/s390/code-stubs-s390.cc ('k') | src/value-serializer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698