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

Side by Side Diff: runtime/vm/intrinsifier_arm.cc

Issue 2895183002: More compact string representation on 64 bit. (Closed)
Patch Set: Created 3 years, 7 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 | « runtime/vm/intermediate_language_x64.cc ('k') | runtime/vm/intrinsifier_arm64.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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/intrinsifier.h" 8 #include "vm/intrinsifier.h"
9 9
10 #include "vm/assembler.h" 10 #include "vm/assembler.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 __ tst(R2, Operand(kSmiTagMask)); \ 169 __ tst(R2, Operand(kSmiTagMask)); \
170 __ b(&fall_through, NE); \ 170 __ b(&fall_through, NE); \
171 __ CompareImmediate(R2, 0); \ 171 __ CompareImmediate(R2, 0); \
172 __ b(&fall_through, LT); \ 172 __ b(&fall_through, LT); \
173 __ SmiUntag(R2); \ 173 __ SmiUntag(R2); \
174 /* Check for maximum allowed length. */ \ 174 /* Check for maximum allowed length. */ \
175 /* R2: untagged array length. */ \ 175 /* R2: untagged array length. */ \
176 __ CompareImmediate(R2, max_len); \ 176 __ CompareImmediate(R2, max_len); \
177 __ b(&fall_through, GT); \ 177 __ b(&fall_through, GT); \
178 __ mov(R2, Operand(R2, LSL, scale_shift)); \ 178 __ mov(R2, Operand(R2, LSL, scale_shift)); \
179 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \ 179 const intptr_t fixed_size_plus_alignment_padding = \
180 __ AddImmediate(R2, fixed_size); \ 180 sizeof(Raw##type_name) + kObjectAlignment - 1; \
181 __ AddImmediate(R2, fixed_size_plus_alignment_padding); \
181 __ bic(R2, R2, Operand(kObjectAlignment - 1)); \ 182 __ bic(R2, R2, Operand(kObjectAlignment - 1)); \
182 Heap::Space space = Heap::kNew; \ 183 Heap::Space space = Heap::kNew; \
183 __ ldr(R3, Address(THR, Thread::heap_offset())); \ 184 __ ldr(R3, Address(THR, Thread::heap_offset())); \
184 __ ldr(R0, Address(R3, Heap::TopOffset(space))); \ 185 __ ldr(R0, Address(R3, Heap::TopOffset(space))); \
185 \ 186 \
186 /* R2: allocation size. */ \ 187 /* R2: allocation size. */ \
187 __ adds(R1, R0, Operand(R2)); \ 188 __ adds(R1, R0, Operand(R2)); \
188 __ b(&fall_through, CS); /* Fail on unsigned overflow. */ \ 189 __ b(&fall_through, CS); /* Fail on unsigned overflow. */ \
189 \ 190 \
190 /* Check if the allocation fits into the remaining space. */ \ 191 /* Check if the allocation fits into the remaining space. */ \
(...skipping 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after
1990 // Returns new string as tagged pointer in R0. 1991 // Returns new string as tagged pointer in R0.
1991 static void TryAllocateOnebyteString(Assembler* assembler, 1992 static void TryAllocateOnebyteString(Assembler* assembler,
1992 Label* ok, 1993 Label* ok,
1993 Label* failure) { 1994 Label* failure) {
1994 const Register length_reg = R2; 1995 const Register length_reg = R2;
1995 Label fail; 1996 Label fail;
1996 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kOneByteStringCid, R0, failure)); 1997 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kOneByteStringCid, R0, failure));
1997 __ mov(R8, Operand(length_reg)); // Save the length register. 1998 __ mov(R8, Operand(length_reg)); // Save the length register.
1998 // TODO(koda): Protect against negative length and overflow here. 1999 // TODO(koda): Protect against negative length and overflow here.
1999 __ SmiUntag(length_reg); 2000 __ SmiUntag(length_reg);
2000 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; 2001 const intptr_t fixed_size_plus_alignment_padding =
2001 __ AddImmediate(length_reg, fixed_size); 2002 sizeof(RawString) + kObjectAlignment - 1;
2003 __ AddImmediate(length_reg, fixed_size_plus_alignment_padding);
2002 __ bic(length_reg, length_reg, Operand(kObjectAlignment - 1)); 2004 __ bic(length_reg, length_reg, Operand(kObjectAlignment - 1));
2003 2005
2004 const intptr_t cid = kOneByteStringCid; 2006 const intptr_t cid = kOneByteStringCid;
2005 Heap::Space space = Heap::kNew; 2007 Heap::Space space = Heap::kNew;
2006 __ ldr(R3, Address(THR, Thread::heap_offset())); 2008 __ ldr(R3, Address(THR, Thread::heap_offset()));
2007 __ ldr(R0, Address(R3, Heap::TopOffset(space))); 2009 __ ldr(R0, Address(R3, Heap::TopOffset(space)));
2008 2010
2009 // length_reg: allocation size. 2011 // length_reg: allocation size.
2010 __ adds(R1, R0, Operand(length_reg)); 2012 __ adds(R1, R0, Operand(length_reg));
2011 __ b(&fail, CS); // Fail on unsigned overflow. 2013 __ b(&fail, CS); // Fail on unsigned overflow.
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
2310 2312
2311 void Intrinsifier::SetAsyncThreadStackTrace(Assembler* assembler) { 2313 void Intrinsifier::SetAsyncThreadStackTrace(Assembler* assembler) {
2312 __ ldr(R0, Address(THR, Thread::async_stack_trace_offset())); 2314 __ ldr(R0, Address(THR, Thread::async_stack_trace_offset()));
2313 __ LoadObject(R0, Object::null_object()); 2315 __ LoadObject(R0, Object::null_object());
2314 __ Ret(); 2316 __ Ret();
2315 } 2317 }
2316 2318
2317 } // namespace dart 2319 } // namespace dart
2318 2320
2319 #endif // defined TARGET_ARCH_ARM 2321 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | runtime/vm/intrinsifier_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698