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

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

Issue 430503007: Rename ASSERT* to DCHECK*. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE and fixes Created 6 years, 4 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/arm/code-stubs-arm.cc ('k') | src/arm/constants-arm.h » ('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/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_ARM 7 #if V8_TARGET_ARCH_ARM
8 8
9 #include "src/arm/simulator-arm.h" 9 #include "src/arm/simulator-arm.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 if (masm.use_eabi_hardfloat()) { 58 if (masm.use_eabi_hardfloat()) {
59 __ vmov(d0, result); 59 __ vmov(d0, result);
60 } else { 60 } else {
61 __ vmov(r0, r1, result); 61 __ vmov(r0, r1, result);
62 } 62 }
63 __ Ret(); 63 __ Ret();
64 } 64 }
65 65
66 CodeDesc desc; 66 CodeDesc desc;
67 masm.GetCode(&desc); 67 masm.GetCode(&desc);
68 ASSERT(!RelocInfo::RequiresRelocation(desc)); 68 DCHECK(!RelocInfo::RequiresRelocation(desc));
69 69
70 CpuFeatures::FlushICache(buffer, actual_size); 70 CpuFeatures::FlushICache(buffer, actual_size);
71 base::OS::ProtectCode(buffer, actual_size); 71 base::OS::ProtectCode(buffer, actual_size);
72 72
73 #if !defined(USE_SIMULATOR) 73 #if !defined(USE_SIMULATOR)
74 return FUNCTION_CAST<UnaryMathFunction>(buffer); 74 return FUNCTION_CAST<UnaryMathFunction>(buffer);
75 #else 75 #else
76 fast_exp_arm_machine_code = buffer; 76 fast_exp_arm_machine_code = buffer;
77 return &fast_exp_simulator; 77 return &fast_exp_simulator;
78 #endif 78 #endif
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 __ mov(chars, Operand(chars, LSL, 31), SetCC); 218 __ mov(chars, Operand(chars, LSL, 31), SetCC);
219 // bit0 => Z (ne), bit1 => C (cs) 219 // bit0 => Z (ne), bit1 => C (cs)
220 __ ldrh(temp1, MemOperand(src, 2, PostIndex), cs); 220 __ ldrh(temp1, MemOperand(src, 2, PostIndex), cs);
221 __ strh(temp1, MemOperand(dest, 2, PostIndex), cs); 221 __ strh(temp1, MemOperand(dest, 2, PostIndex), cs);
222 __ ldrb(temp1, MemOperand(src), ne); 222 __ ldrb(temp1, MemOperand(src), ne);
223 __ strb(temp1, MemOperand(dest), ne); 223 __ strb(temp1, MemOperand(dest), ne);
224 __ Ret(); 224 __ Ret();
225 225
226 CodeDesc desc; 226 CodeDesc desc;
227 masm.GetCode(&desc); 227 masm.GetCode(&desc);
228 ASSERT(!RelocInfo::RequiresRelocation(desc)); 228 DCHECK(!RelocInfo::RequiresRelocation(desc));
229 229
230 CpuFeatures::FlushICache(buffer, actual_size); 230 CpuFeatures::FlushICache(buffer, actual_size);
231 base::OS::ProtectCode(buffer, actual_size); 231 base::OS::ProtectCode(buffer, actual_size);
232 return FUNCTION_CAST<MemCopyUint8Function>(buffer); 232 return FUNCTION_CAST<MemCopyUint8Function>(buffer);
233 #endif 233 #endif
234 } 234 }
235 235
236 236
237 // Convert 8 to 16. The number of character to copy must be at least 8. 237 // Convert 8 to 16. The number of character to copy must be at least 8.
238 MemCopyUint16Uint8Function CreateMemCopyUint16Uint8Function( 238 MemCopyUint16Uint8Function CreateMemCopyUint16Uint8Function(
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 333
334 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); 334 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size));
335 335
336 __ MovFromFloatParameter(d0); 336 __ MovFromFloatParameter(d0);
337 __ vsqrt(d0, d0); 337 __ vsqrt(d0, d0);
338 __ MovToFloatResult(d0); 338 __ MovToFloatResult(d0);
339 __ Ret(); 339 __ Ret();
340 340
341 CodeDesc desc; 341 CodeDesc desc;
342 masm.GetCode(&desc); 342 masm.GetCode(&desc);
343 ASSERT(!RelocInfo::RequiresRelocation(desc)); 343 DCHECK(!RelocInfo::RequiresRelocation(desc));
344 344
345 CpuFeatures::FlushICache(buffer, actual_size); 345 CpuFeatures::FlushICache(buffer, actual_size);
346 base::OS::ProtectCode(buffer, actual_size); 346 base::OS::ProtectCode(buffer, actual_size);
347 return FUNCTION_CAST<UnaryMathFunction>(buffer); 347 return FUNCTION_CAST<UnaryMathFunction>(buffer);
348 #endif 348 #endif
349 } 349 }
350 350
351 #undef __ 351 #undef __
352 352
353 353
354 // ------------------------------------------------------------------------- 354 // -------------------------------------------------------------------------
355 // Platform-specific RuntimeCallHelper functions. 355 // Platform-specific RuntimeCallHelper functions.
356 356
357 void StubRuntimeCallHelper::BeforeCall(MacroAssembler* masm) const { 357 void StubRuntimeCallHelper::BeforeCall(MacroAssembler* masm) const {
358 masm->EnterFrame(StackFrame::INTERNAL); 358 masm->EnterFrame(StackFrame::INTERNAL);
359 ASSERT(!masm->has_frame()); 359 DCHECK(!masm->has_frame());
360 masm->set_has_frame(true); 360 masm->set_has_frame(true);
361 } 361 }
362 362
363 363
364 void StubRuntimeCallHelper::AfterCall(MacroAssembler* masm) const { 364 void StubRuntimeCallHelper::AfterCall(MacroAssembler* masm) const {
365 masm->LeaveFrame(StackFrame::INTERNAL); 365 masm->LeaveFrame(StackFrame::INTERNAL);
366 ASSERT(masm->has_frame()); 366 DCHECK(masm->has_frame());
367 masm->set_has_frame(false); 367 masm->set_has_frame(false);
368 } 368 }
369 369
370 370
371 // ------------------------------------------------------------------------- 371 // -------------------------------------------------------------------------
372 // Code generators 372 // Code generators
373 373
374 #define __ ACCESS_MASM(masm) 374 #define __ ACCESS_MASM(masm)
375 375
376 void ElementsTransitionGenerator::GenerateMapChangeElementsTransition( 376 void ElementsTransitionGenerator::GenerateMapChangeElementsTransition(
377 MacroAssembler* masm, 377 MacroAssembler* masm,
378 Register receiver, 378 Register receiver,
379 Register key, 379 Register key,
380 Register value, 380 Register value,
381 Register target_map, 381 Register target_map,
382 AllocationSiteMode mode, 382 AllocationSiteMode mode,
383 Label* allocation_memento_found) { 383 Label* allocation_memento_found) {
384 Register scratch_elements = r4; 384 Register scratch_elements = r4;
385 ASSERT(!AreAliased(receiver, key, value, target_map, 385 DCHECK(!AreAliased(receiver, key, value, target_map,
386 scratch_elements)); 386 scratch_elements));
387 387
388 if (mode == TRACK_ALLOCATION_SITE) { 388 if (mode == TRACK_ALLOCATION_SITE) {
389 ASSERT(allocation_memento_found != NULL); 389 DCHECK(allocation_memento_found != NULL);
390 __ JumpIfJSArrayHasAllocationMemento( 390 __ JumpIfJSArrayHasAllocationMemento(
391 receiver, scratch_elements, allocation_memento_found); 391 receiver, scratch_elements, allocation_memento_found);
392 } 392 }
393 393
394 // Set transitioned map. 394 // Set transitioned map.
395 __ str(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); 395 __ str(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset));
396 __ RecordWriteField(receiver, 396 __ RecordWriteField(receiver,
397 HeapObject::kMapOffset, 397 HeapObject::kMapOffset,
398 target_map, 398 target_map,
399 r9, 399 r9,
(...skipping 17 matching lines...) Expand all
417 Register elements = r4; 417 Register elements = r4;
418 Register length = r5; 418 Register length = r5;
419 Register array = r6; 419 Register array = r6;
420 Register array_end = array; 420 Register array_end = array;
421 421
422 // target_map parameter can be clobbered. 422 // target_map parameter can be clobbered.
423 Register scratch1 = target_map; 423 Register scratch1 = target_map;
424 Register scratch2 = r9; 424 Register scratch2 = r9;
425 425
426 // Verify input registers don't conflict with locals. 426 // Verify input registers don't conflict with locals.
427 ASSERT(!AreAliased(receiver, key, value, target_map, 427 DCHECK(!AreAliased(receiver, key, value, target_map,
428 elements, length, array, scratch2)); 428 elements, length, array, scratch2));
429 429
430 if (mode == TRACK_ALLOCATION_SITE) { 430 if (mode == TRACK_ALLOCATION_SITE) {
431 __ JumpIfJSArrayHasAllocationMemento(receiver, elements, fail); 431 __ JumpIfJSArrayHasAllocationMemento(receiver, elements, fail);
432 } 432 }
433 433
434 // Check for empty arrays, which only require a map transition and no changes 434 // Check for empty arrays, which only require a map transition and no changes
435 // to the backing store. 435 // to the backing store.
436 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); 436 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset));
437 __ CompareRoot(elements, Heap::kEmptyFixedArrayRootIndex); 437 __ CompareRoot(elements, Heap::kEmptyFixedArrayRootIndex);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 AllocationSiteMode mode, 555 AllocationSiteMode mode,
556 Label* fail) { 556 Label* fail) {
557 // Register lr contains the return address. 557 // Register lr contains the return address.
558 Label entry, loop, convert_hole, gc_required, only_change_map; 558 Label entry, loop, convert_hole, gc_required, only_change_map;
559 Register elements = r4; 559 Register elements = r4;
560 Register array = r6; 560 Register array = r6;
561 Register length = r5; 561 Register length = r5;
562 Register scratch = r9; 562 Register scratch = r9;
563 563
564 // Verify input registers don't conflict with locals. 564 // Verify input registers don't conflict with locals.
565 ASSERT(!AreAliased(receiver, key, value, target_map, 565 DCHECK(!AreAliased(receiver, key, value, target_map,
566 elements, array, length, scratch)); 566 elements, array, length, scratch));
567 567
568 if (mode == TRACK_ALLOCATION_SITE) { 568 if (mode == TRACK_ALLOCATION_SITE) {
569 __ JumpIfJSArrayHasAllocationMemento(receiver, elements, fail); 569 __ JumpIfJSArrayHasAllocationMemento(receiver, elements, fail);
570 } 570 }
571 571
572 // Check for empty arrays, which only require a map transition and no changes 572 // Check for empty arrays, which only require a map transition and no changes
573 // to the backing store. 573 // to the backing store.
574 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); 574 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset));
575 __ CompareRoot(elements, Heap::kEmptyFixedArrayRootIndex); 575 __ CompareRoot(elements, Heap::kEmptyFixedArrayRootIndex);
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 780
781 781
782 void MathExpGenerator::EmitMathExp(MacroAssembler* masm, 782 void MathExpGenerator::EmitMathExp(MacroAssembler* masm,
783 DwVfpRegister input, 783 DwVfpRegister input,
784 DwVfpRegister result, 784 DwVfpRegister result,
785 DwVfpRegister double_scratch1, 785 DwVfpRegister double_scratch1,
786 DwVfpRegister double_scratch2, 786 DwVfpRegister double_scratch2,
787 Register temp1, 787 Register temp1,
788 Register temp2, 788 Register temp2,
789 Register temp3) { 789 Register temp3) {
790 ASSERT(!input.is(result)); 790 DCHECK(!input.is(result));
791 ASSERT(!input.is(double_scratch1)); 791 DCHECK(!input.is(double_scratch1));
792 ASSERT(!input.is(double_scratch2)); 792 DCHECK(!input.is(double_scratch2));
793 ASSERT(!result.is(double_scratch1)); 793 DCHECK(!result.is(double_scratch1));
794 ASSERT(!result.is(double_scratch2)); 794 DCHECK(!result.is(double_scratch2));
795 ASSERT(!double_scratch1.is(double_scratch2)); 795 DCHECK(!double_scratch1.is(double_scratch2));
796 ASSERT(!temp1.is(temp2)); 796 DCHECK(!temp1.is(temp2));
797 ASSERT(!temp1.is(temp3)); 797 DCHECK(!temp1.is(temp3));
798 ASSERT(!temp2.is(temp3)); 798 DCHECK(!temp2.is(temp3));
799 ASSERT(ExternalReference::math_exp_constants(0).address() != NULL); 799 DCHECK(ExternalReference::math_exp_constants(0).address() != NULL);
800 800
801 Label zero, infinity, done; 801 Label zero, infinity, done;
802 802
803 __ mov(temp3, Operand(ExternalReference::math_exp_constants(0))); 803 __ mov(temp3, Operand(ExternalReference::math_exp_constants(0)));
804 804
805 __ vldr(double_scratch1, ExpConstant(0, temp3)); 805 __ vldr(double_scratch1, ExpConstant(0, temp3));
806 __ VFPCompareAndSetFlags(double_scratch1, input); 806 __ VFPCompareAndSetFlags(double_scratch1, input);
807 __ b(ge, &zero); 807 __ b(ge, &zero);
808 808
809 __ vldr(double_scratch2, ExpConstant(1, temp3)); 809 __ vldr(double_scratch2, ExpConstant(1, temp3));
(...skipping 10 matching lines...) Expand all
820 __ vldr(double_scratch2, ExpConstant(5, temp3)); 820 __ vldr(double_scratch2, ExpConstant(5, temp3));
821 __ vmul(double_scratch1, double_scratch1, double_scratch2); 821 __ vmul(double_scratch1, double_scratch1, double_scratch2);
822 __ vsub(double_scratch1, double_scratch1, input); 822 __ vsub(double_scratch1, double_scratch1, input);
823 __ vsub(result, result, double_scratch1); 823 __ vsub(result, result, double_scratch1);
824 __ vmul(double_scratch2, double_scratch1, double_scratch1); 824 __ vmul(double_scratch2, double_scratch1, double_scratch1);
825 __ vmul(result, result, double_scratch2); 825 __ vmul(result, result, double_scratch2);
826 __ vldr(double_scratch2, ExpConstant(7, temp3)); 826 __ vldr(double_scratch2, ExpConstant(7, temp3));
827 __ vmul(result, result, double_scratch2); 827 __ vmul(result, result, double_scratch2);
828 __ vsub(result, result, double_scratch1); 828 __ vsub(result, result, double_scratch1);
829 // Mov 1 in double_scratch2 as math_exp_constants_array[8] == 1. 829 // Mov 1 in double_scratch2 as math_exp_constants_array[8] == 1.
830 ASSERT(*reinterpret_cast<double*> 830 DCHECK(*reinterpret_cast<double*>
831 (ExternalReference::math_exp_constants(8).address()) == 1); 831 (ExternalReference::math_exp_constants(8).address()) == 1);
832 __ vmov(double_scratch2, 1); 832 __ vmov(double_scratch2, 1);
833 __ vadd(result, result, double_scratch2); 833 __ vadd(result, result, double_scratch2);
834 __ mov(temp1, Operand(temp2, LSR, 11)); 834 __ mov(temp1, Operand(temp2, LSR, 11));
835 __ Ubfx(temp2, temp2, 0, 11); 835 __ Ubfx(temp2, temp2, 0, 11);
836 __ add(temp1, temp1, Operand(0x3ff)); 836 __ add(temp1, temp1, Operand(0x3ff));
837 837
838 // Must not call ExpConstant() after overwriting temp3! 838 // Must not call ExpConstant() after overwriting temp3!
839 __ mov(temp3, Operand(ExternalReference::math_exp_log_table())); 839 __ mov(temp3, Operand(ExternalReference::math_exp_log_table()));
840 __ add(temp3, temp3, Operand(temp2, LSL, 3)); 840 __ add(temp3, temp3, Operand(temp2, LSL, 3));
(...skipping 20 matching lines...) Expand all
861 } 861 }
862 862
863 #undef __ 863 #undef __
864 864
865 #ifdef DEBUG 865 #ifdef DEBUG
866 // add(r0, pc, Operand(-8)) 866 // add(r0, pc, Operand(-8))
867 static const uint32_t kCodeAgePatchFirstInstruction = 0xe24f0008; 867 static const uint32_t kCodeAgePatchFirstInstruction = 0xe24f0008;
868 #endif 868 #endif
869 869
870 CodeAgingHelper::CodeAgingHelper() { 870 CodeAgingHelper::CodeAgingHelper() {
871 ASSERT(young_sequence_.length() == kNoCodeAgeSequenceLength); 871 DCHECK(young_sequence_.length() == kNoCodeAgeSequenceLength);
872 // Since patcher is a large object, allocate it dynamically when needed, 872 // Since patcher is a large object, allocate it dynamically when needed,
873 // to avoid overloading the stack in stress conditions. 873 // to avoid overloading the stack in stress conditions.
874 // DONT_FLUSH is used because the CodeAgingHelper is initialized early in 874 // DONT_FLUSH is used because the CodeAgingHelper is initialized early in
875 // the process, before ARM simulator ICache is setup. 875 // the process, before ARM simulator ICache is setup.
876 SmartPointer<CodePatcher> patcher( 876 SmartPointer<CodePatcher> patcher(
877 new CodePatcher(young_sequence_.start(), 877 new CodePatcher(young_sequence_.start(),
878 young_sequence_.length() / Assembler::kInstrSize, 878 young_sequence_.length() / Assembler::kInstrSize,
879 CodePatcher::DONT_FLUSH)); 879 CodePatcher::DONT_FLUSH));
880 PredictableCodeSizeScope scope(patcher->masm(), young_sequence_.length()); 880 PredictableCodeSizeScope scope(patcher->masm(), young_sequence_.length());
881 patcher->masm()->PushFixedFrame(r1); 881 patcher->masm()->PushFixedFrame(r1);
882 patcher->masm()->nop(ip.code()); 882 patcher->masm()->nop(ip.code());
883 patcher->masm()->add( 883 patcher->masm()->add(
884 fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); 884 fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
885 } 885 }
886 886
887 887
888 #ifdef DEBUG 888 #ifdef DEBUG
889 bool CodeAgingHelper::IsOld(byte* candidate) const { 889 bool CodeAgingHelper::IsOld(byte* candidate) const {
890 return Memory::uint32_at(candidate) == kCodeAgePatchFirstInstruction; 890 return Memory::uint32_at(candidate) == kCodeAgePatchFirstInstruction;
891 } 891 }
892 #endif 892 #endif
893 893
894 894
895 bool Code::IsYoungSequence(Isolate* isolate, byte* sequence) { 895 bool Code::IsYoungSequence(Isolate* isolate, byte* sequence) {
896 bool result = isolate->code_aging_helper()->IsYoung(sequence); 896 bool result = isolate->code_aging_helper()->IsYoung(sequence);
897 ASSERT(result || isolate->code_aging_helper()->IsOld(sequence)); 897 DCHECK(result || isolate->code_aging_helper()->IsOld(sequence));
898 return result; 898 return result;
899 } 899 }
900 900
901 901
902 void Code::GetCodeAgeAndParity(Isolate* isolate, byte* sequence, Age* age, 902 void Code::GetCodeAgeAndParity(Isolate* isolate, byte* sequence, Age* age,
903 MarkingParity* parity) { 903 MarkingParity* parity) {
904 if (IsYoungSequence(isolate, sequence)) { 904 if (IsYoungSequence(isolate, sequence)) {
905 *age = kNoAgeCodeAge; 905 *age = kNoAgeCodeAge;
906 *parity = NO_MARKING_PARITY; 906 *parity = NO_MARKING_PARITY;
907 } else { 907 } else {
(...skipping 19 matching lines...) Expand all
927 patcher.masm()->add(r0, pc, Operand(-8)); 927 patcher.masm()->add(r0, pc, Operand(-8));
928 patcher.masm()->ldr(pc, MemOperand(pc, -4)); 928 patcher.masm()->ldr(pc, MemOperand(pc, -4));
929 patcher.masm()->emit_code_stub_address(stub); 929 patcher.masm()->emit_code_stub_address(stub);
930 } 930 }
931 } 931 }
932 932
933 933
934 } } // namespace v8::internal 934 } } // namespace v8::internal
935 935
936 #endif // V8_TARGET_ARCH_ARM 936 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/arm/constants-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698