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

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

Issue 172483002: A64: Fix int32 use in Lithium string functions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix typo in assertion. Created 6 years, 10 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/a64/codegen-a64.h ('k') | src/a64/lithium-codegen-a64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 MacroAssembler::EmitCodeAgeSequence(&patcher, stub); 403 MacroAssembler::EmitCodeAgeSequence(&patcher, stub);
404 } 404 }
405 } 405 }
406 406
407 407
408 void StringCharLoadGenerator::Generate(MacroAssembler* masm, 408 void StringCharLoadGenerator::Generate(MacroAssembler* masm,
409 Register string, 409 Register string,
410 Register index, 410 Register index,
411 Register result, 411 Register result,
412 Label* call_runtime) { 412 Label* call_runtime) {
413 ASSERT(string.Is64Bits() && index.Is32Bits() && result.Is64Bits());
413 // Fetch the instance type of the receiver into result register. 414 // Fetch the instance type of the receiver into result register.
414 __ Ldr(result, FieldMemOperand(string, HeapObject::kMapOffset)); 415 __ Ldr(result, FieldMemOperand(string, HeapObject::kMapOffset));
415 __ Ldrb(result, FieldMemOperand(result, Map::kInstanceTypeOffset)); 416 __ Ldrb(result, FieldMemOperand(result, Map::kInstanceTypeOffset));
416 417
417 // We need special handling for indirect strings. 418 // We need special handling for indirect strings.
418 Label check_sequential; 419 Label check_sequential;
419 __ TestAndBranchIfAllClear(result, kIsIndirectStringMask, &check_sequential); 420 __ TestAndBranchIfAllClear(result, kIsIndirectStringMask, &check_sequential);
420 421
421 // Dispatch on the indirect string shape: slice or cons. 422 // Dispatch on the indirect string shape: slice or cons.
422 Label cons_string; 423 Label cons_string;
423 __ TestAndBranchIfAllClear(result, kSlicedNotConsMask, &cons_string); 424 __ TestAndBranchIfAllClear(result, kSlicedNotConsMask, &cons_string);
424 425
425 // Handle slices. 426 // Handle slices.
426 Label indirect_string_loaded; 427 Label indirect_string_loaded;
427 __ Ldrsw(result, 428 __ Ldr(result.W(),
428 UntagSmiFieldMemOperand(string, SlicedString::kOffsetOffset)); 429 UntagSmiFieldMemOperand(string, SlicedString::kOffsetOffset));
429 __ Ldr(string, FieldMemOperand(string, SlicedString::kParentOffset)); 430 __ Ldr(string, FieldMemOperand(string, SlicedString::kParentOffset));
430 __ Add(index, index, result); 431 __ Add(index, index, result.W());
431 __ B(&indirect_string_loaded); 432 __ B(&indirect_string_loaded);
432 433
433 // Handle cons strings. 434 // Handle cons strings.
434 // Check whether the right hand side is the empty string (i.e. if 435 // Check whether the right hand side is the empty string (i.e. if
435 // this is really a flat string in a cons string). If that is not 436 // this is really a flat string in a cons string). If that is not
436 // the case we would rather go to the runtime system now to flatten 437 // the case we would rather go to the runtime system now to flatten
437 // the string. 438 // the string.
438 __ Bind(&cons_string); 439 __ Bind(&cons_string);
439 __ Ldr(result, FieldMemOperand(string, ConsString::kSecondOffset)); 440 __ Ldr(result, FieldMemOperand(string, ConsString::kSecondOffset));
440 __ JumpIfNotRoot(result, Heap::kempty_stringRootIndex, call_runtime); 441 __ JumpIfNotRoot(result, Heap::kempty_stringRootIndex, call_runtime);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 // can be bound far away in deferred code. 473 // can be bound far away in deferred code.
473 __ Tst(result, kShortExternalStringMask); 474 __ Tst(result, kShortExternalStringMask);
474 __ B(ne, call_runtime); 475 __ B(ne, call_runtime);
475 __ Ldr(string, FieldMemOperand(string, ExternalString::kResourceDataOffset)); 476 __ Ldr(string, FieldMemOperand(string, ExternalString::kResourceDataOffset));
476 477
477 Label ascii, done; 478 Label ascii, done;
478 __ Bind(&check_encoding); 479 __ Bind(&check_encoding);
479 STATIC_ASSERT(kTwoByteStringTag == 0); 480 STATIC_ASSERT(kTwoByteStringTag == 0);
480 __ TestAndBranchIfAnySet(result, kStringEncodingMask, &ascii); 481 __ TestAndBranchIfAnySet(result, kStringEncodingMask, &ascii);
481 // Two-byte string. 482 // Two-byte string.
482 __ Ldrh(result, MemOperand(string, index, LSL, 1)); 483 __ Ldrh(result, MemOperand(string, index, SXTW, 1));
483 __ B(&done); 484 __ B(&done);
484 __ Bind(&ascii); 485 __ Bind(&ascii);
485 // Ascii string. 486 // Ascii string.
486 __ Ldrb(result, MemOperand(string, index)); 487 __ Ldrb(result, MemOperand(string, index, SXTW));
487 __ Bind(&done); 488 __ Bind(&done);
488 } 489 }
489 490
490 491
491 static MemOperand ExpConstant(Register base, int index) { 492 static MemOperand ExpConstant(Register base, int index) {
492 return MemOperand(base, index * kDoubleSize); 493 return MemOperand(base, index * kDoubleSize);
493 } 494 }
494 495
495 496
496 void MathExpGenerator::EmitMathExp(MacroAssembler* masm, 497 void MathExpGenerator::EmitMathExp(MacroAssembler* masm,
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 __ Fmul(result, double_temp3, double_temp1); 608 __ Fmul(result, double_temp3, double_temp1);
608 609
609 __ Bind(&done); 610 __ Bind(&done);
610 } 611 }
611 612
612 #undef __ 613 #undef __
613 614
614 } } // namespace v8::internal 615 } } // namespace v8::internal
615 616
616 #endif // V8_TARGET_ARCH_A64 617 #endif // V8_TARGET_ARCH_A64
OLDNEW
« no previous file with comments | « src/a64/codegen-a64.h ('k') | src/a64/lithium-codegen-a64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698