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

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

Issue 2627783006: Version 5.7.442.2 (cherry-pick) (Closed)
Patch Set: 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/arm/code-stubs-arm.cc ('k') | src/arm64/code-stubs-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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/arm/codegen-arm.h" 5 #include "src/arm/codegen-arm.h"
6 6
7 #if V8_TARGET_ARCH_ARM 7 #if V8_TARGET_ARCH_ARM
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 // ------------------------------------------------------------------------- 315 // -------------------------------------------------------------------------
316 // Code generators 316 // Code generators
317 317
318 #define __ ACCESS_MASM(masm) 318 #define __ ACCESS_MASM(masm)
319 319
320 void StringCharLoadGenerator::Generate(MacroAssembler* masm, 320 void StringCharLoadGenerator::Generate(MacroAssembler* masm,
321 Register string, 321 Register string,
322 Register index, 322 Register index,
323 Register result, 323 Register result,
324 Label* call_runtime) { 324 Label* call_runtime) {
325 Label indirect_string_loaded;
326 __ bind(&indirect_string_loaded);
327
328 // Fetch the instance type of the receiver into result register. 325 // Fetch the instance type of the receiver into result register.
329 __ ldr(result, FieldMemOperand(string, HeapObject::kMapOffset)); 326 __ ldr(result, FieldMemOperand(string, HeapObject::kMapOffset));
330 __ ldrb(result, FieldMemOperand(result, Map::kInstanceTypeOffset)); 327 __ ldrb(result, FieldMemOperand(result, Map::kInstanceTypeOffset));
331 328
332 // We need special handling for indirect strings. 329 // We need special handling for indirect strings.
333 Label check_sequential; 330 Label check_sequential;
334 __ tst(result, Operand(kIsIndirectStringMask)); 331 __ tst(result, Operand(kIsIndirectStringMask));
335 __ b(eq, &check_sequential); 332 __ b(eq, &check_sequential);
336 333
337 // Dispatch on the indirect string shape: slice or cons. 334 // Dispatch on the indirect string shape: slice or cons.
338 Label cons_string, thin_string; 335 Label cons_string;
339 __ and_(result, result, Operand(kStringRepresentationMask)); 336 __ tst(result, Operand(kSlicedNotConsMask));
340 __ cmp(result, Operand(kConsStringTag));
341 __ b(eq, &cons_string); 337 __ b(eq, &cons_string);
342 __ cmp(result, Operand(kThinStringTag));
343 __ b(eq, &thin_string);
344 338
345 // Handle slices. 339 // Handle slices.
340 Label indirect_string_loaded;
346 __ ldr(result, FieldMemOperand(string, SlicedString::kOffsetOffset)); 341 __ ldr(result, FieldMemOperand(string, SlicedString::kOffsetOffset));
347 __ ldr(string, FieldMemOperand(string, SlicedString::kParentOffset)); 342 __ ldr(string, FieldMemOperand(string, SlicedString::kParentOffset));
348 __ add(index, index, Operand::SmiUntag(result)); 343 __ add(index, index, Operand::SmiUntag(result));
349 __ jmp(&indirect_string_loaded); 344 __ jmp(&indirect_string_loaded);
350 345
351 // Handle thin strings.
352 __ bind(&thin_string);
353 __ ldr(string, FieldMemOperand(string, ThinString::kActualOffset));
354 __ jmp(&indirect_string_loaded);
355
356 // Handle cons strings. 346 // Handle cons strings.
357 // Check whether the right hand side is the empty string (i.e. if 347 // Check whether the right hand side is the empty string (i.e. if
358 // this is really a flat string in a cons string). If that is not 348 // this is really a flat string in a cons string). If that is not
359 // the case we would rather go to the runtime system now to flatten 349 // the case we would rather go to the runtime system now to flatten
360 // the string. 350 // the string.
361 __ bind(&cons_string); 351 __ bind(&cons_string);
362 __ ldr(result, FieldMemOperand(string, ConsString::kSecondOffset)); 352 __ ldr(result, FieldMemOperand(string, ConsString::kSecondOffset));
363 __ CompareRoot(result, Heap::kempty_stringRootIndex); 353 __ CompareRoot(result, Heap::kempty_stringRootIndex);
364 __ b(ne, call_runtime); 354 __ b(ne, call_runtime);
365 // Get the first of the two strings and load its instance type. 355 // Get the first of the two strings and load its instance type.
366 __ ldr(string, FieldMemOperand(string, ConsString::kFirstOffset)); 356 __ ldr(string, FieldMemOperand(string, ConsString::kFirstOffset));
367 __ jmp(&indirect_string_loaded); 357
358 __ bind(&indirect_string_loaded);
359 __ ldr(result, FieldMemOperand(string, HeapObject::kMapOffset));
360 __ ldrb(result, FieldMemOperand(result, Map::kInstanceTypeOffset));
368 361
369 // Distinguish sequential and external strings. Only these two string 362 // Distinguish sequential and external strings. Only these two string
370 // representations can reach here (slices and flat cons strings have been 363 // representations can reach here (slices and flat cons strings have been
371 // reduced to the underlying sequential or external string). 364 // reduced to the underlying sequential or external string).
372 Label external_string, check_encoding; 365 Label external_string, check_encoding;
373 __ bind(&check_sequential); 366 __ bind(&check_sequential);
374 STATIC_ASSERT(kSeqStringTag == 0); 367 STATIC_ASSERT(kSeqStringTag == 0);
375 __ tst(result, Operand(kStringRepresentationMask)); 368 __ tst(result, Operand(kStringRepresentationMask));
376 __ b(ne, &external_string); 369 __ b(ne, &external_string);
377 370
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 patcher.masm()->add(r0, pc, Operand(-8)); 462 patcher.masm()->add(r0, pc, Operand(-8));
470 patcher.masm()->ldr(pc, MemOperand(pc, -4)); 463 patcher.masm()->ldr(pc, MemOperand(pc, -4));
471 patcher.masm()->emit_code_stub_address(stub); 464 patcher.masm()->emit_code_stub_address(stub);
472 } 465 }
473 } 466 }
474 467
475 } // namespace internal 468 } // namespace internal
476 } // namespace v8 469 } // namespace v8
477 470
478 #endif // V8_TARGET_ARCH_ARM 471 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/arm64/code-stubs-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698