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

Side by Side Diff: src/ppc/codegen-ppc.cc

Issue 2549773002: Internalize strings in-place (Closed)
Patch Set: forgot one Created 3 years, 12 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/ppc/codegen-ppc.h" 5 #include "src/ppc/codegen-ppc.h"
6 6
7 #if V8_TARGET_ARCH_PPC 7 #if V8_TARGET_ARCH_PPC
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 Label* call_runtime) { 79 Label* call_runtime) {
80 // Fetch the instance type of the receiver into result register. 80 // Fetch the instance type of the receiver into result register.
81 __ LoadP(result, FieldMemOperand(string, HeapObject::kMapOffset)); 81 __ LoadP(result, FieldMemOperand(string, HeapObject::kMapOffset));
82 __ lbz(result, FieldMemOperand(result, Map::kInstanceTypeOffset)); 82 __ lbz(result, FieldMemOperand(result, Map::kInstanceTypeOffset));
83 83
84 // We need special handling for indirect strings. 84 // We need special handling for indirect strings.
85 Label check_sequential; 85 Label check_sequential;
86 __ andi(r0, result, Operand(kIsIndirectStringMask)); 86 __ andi(r0, result, Operand(kIsIndirectStringMask));
87 __ beq(&check_sequential, cr0); 87 __ beq(&check_sequential, cr0);
88 88
89 // Dispatch on the indirect string shape: slice or cons. 89 // Dispatch on the indirect string shape: slice or cons or thin.
90 Label cons_string; 90 Label cons_string, thin_string;
91 __ mov(ip, Operand(kSlicedNotConsMask)); 91 __ andi(ip, result, Operand(kStringRepresentationMask));
92 __ and_(r0, result, ip, SetRC); 92 __ cmpi(ip, Operand(kConsStringTag));
93 __ beq(&cons_string, cr0); 93 __ beq(&cons_string);
94 __ cmpi(ip, Operand(kThinStringTag));
95 __ beq(&thin_string);
94 96
95 // Handle slices. 97 // Handle slices.
96 Label indirect_string_loaded; 98 Label indirect_string_loaded;
97 __ LoadP(result, FieldMemOperand(string, SlicedString::kOffsetOffset)); 99 __ LoadP(result, FieldMemOperand(string, SlicedString::kOffsetOffset));
98 __ LoadP(string, FieldMemOperand(string, SlicedString::kParentOffset)); 100 __ LoadP(string, FieldMemOperand(string, SlicedString::kParentOffset));
99 __ SmiUntag(ip, result); 101 __ SmiUntag(ip, result);
100 __ add(index, index, ip); 102 __ add(index, index, ip);
101 __ b(&indirect_string_loaded); 103 __ b(&indirect_string_loaded);
102 104
105 // Handle thin strings.
106 __ bind(&thin_string);
107 __ LoadP(string, FieldMemOperand(string, ThinString::kActualOffset));
108 __ b(&indirect_string_loaded);
109
103 // Handle cons strings. 110 // Handle cons strings.
104 // Check whether the right hand side is the empty string (i.e. if 111 // Check whether the right hand side is the empty string (i.e. if
105 // this is really a flat string in a cons string). If that is not 112 // this is really a flat string in a cons string). If that is not
106 // the case we would rather go to the runtime system now to flatten 113 // the case we would rather go to the runtime system now to flatten
107 // the string. 114 // the string.
108 __ bind(&cons_string); 115 __ bind(&cons_string);
109 __ LoadP(result, FieldMemOperand(string, ConsString::kSecondOffset)); 116 __ LoadP(result, FieldMemOperand(string, ConsString::kSecondOffset));
110 __ CompareRoot(result, Heap::kempty_stringRootIndex); 117 __ CompareRoot(result, Heap::kempty_stringRootIndex);
111 __ bne(call_runtime); 118 __ bne(call_runtime);
112 // Get the first of the two strings and load its instance type. 119 // Get the first of the two strings and load its instance type.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 patcher.masm()->Jump(r3); 232 patcher.masm()->Jump(r3);
226 for (int i = 0; i < kCodeAgingSequenceNops; i++) { 233 for (int i = 0; i < kCodeAgingSequenceNops; i++) {
227 patcher.masm()->nop(); 234 patcher.masm()->nop();
228 } 235 }
229 } 236 }
230 } 237 }
231 } // namespace internal 238 } // namespace internal
232 } // namespace v8 239 } // namespace v8
233 240
234 #endif // V8_TARGET_ARCH_PPC 241 #endif // V8_TARGET_ARCH_PPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698