OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 25 matching lines...) Expand all Loading... |
36 #include "debug.h" | 36 #include "debug.h" |
37 #include "runtime.h" | 37 #include "runtime.h" |
38 | 38 |
39 namespace v8 { | 39 namespace v8 { |
40 namespace internal { | 40 namespace internal { |
41 | 41 |
42 MacroAssembler::MacroAssembler(void* buffer, int size) | 42 MacroAssembler::MacroAssembler(void* buffer, int size) |
43 : Assembler(buffer, size), | 43 : Assembler(buffer, size), |
44 generating_stub_(false), | 44 generating_stub_(false), |
45 allow_stub_calls_(true), | 45 allow_stub_calls_(true), |
46 code_object_(Heap::undefined_value()) { | 46 code_object_(HEAP->undefined_value()) { |
47 } | 47 } |
48 | 48 |
49 | 49 |
50 // We always generate arm code, never thumb code, even if V8 is compiled to | 50 // We always generate arm code, never thumb code, even if V8 is compiled to |
51 // thumb, so we require inter-working support | 51 // thumb, so we require inter-working support |
52 #if defined(__thumb__) && !defined(USE_THUMB_INTERWORK) | 52 #if defined(__thumb__) && !defined(USE_THUMB_INTERWORK) |
53 #error "flag -mthumb-interwork missing" | 53 #error "flag -mthumb-interwork missing" |
54 #endif | 54 #endif |
55 | 55 |
56 | 56 |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 285 |
286 void MacroAssembler::And(Register dst, Register src1, const Operand& src2, | 286 void MacroAssembler::And(Register dst, Register src1, const Operand& src2, |
287 Condition cond) { | 287 Condition cond) { |
288 if (!src2.is_reg() && | 288 if (!src2.is_reg() && |
289 !src2.must_use_constant_pool() && | 289 !src2.must_use_constant_pool() && |
290 src2.immediate() == 0) { | 290 src2.immediate() == 0) { |
291 mov(dst, Operand(0, RelocInfo::NONE), LeaveCC, cond); | 291 mov(dst, Operand(0, RelocInfo::NONE), LeaveCC, cond); |
292 | 292 |
293 } else if (!src2.is_single_instruction() && | 293 } else if (!src2.is_single_instruction() && |
294 !src2.must_use_constant_pool() && | 294 !src2.must_use_constant_pool() && |
295 CpuFeatures::IsSupported(ARMv7) && | 295 Isolate::Current()->cpu_features()->IsSupported(ARMv7) && |
296 IsPowerOf2(src2.immediate() + 1)) { | 296 IsPowerOf2(src2.immediate() + 1)) { |
297 ubfx(dst, src1, 0, WhichPowerOf2(src2.immediate() + 1), cond); | 297 ubfx(dst, src1, 0, WhichPowerOf2(src2.immediate() + 1), cond); |
298 | 298 |
299 } else { | 299 } else { |
300 and_(dst, src1, src2, LeaveCC, cond); | 300 and_(dst, src1, src2, LeaveCC, cond); |
301 } | 301 } |
302 } | 302 } |
303 | 303 |
304 | 304 |
305 void MacroAssembler::Ubfx(Register dst, Register src1, int lsb, int width, | 305 void MacroAssembler::Ubfx(Register dst, Register src1, int lsb, int width, |
306 Condition cond) { | 306 Condition cond) { |
307 ASSERT(lsb < 32); | 307 ASSERT(lsb < 32); |
308 if (!CpuFeatures::IsSupported(ARMv7)) { | 308 if (!Isolate::Current()->cpu_features()->IsSupported(ARMv7)) { |
309 int mask = (1 << (width + lsb)) - 1 - ((1 << lsb) - 1); | 309 int mask = (1 << (width + lsb)) - 1 - ((1 << lsb) - 1); |
310 and_(dst, src1, Operand(mask), LeaveCC, cond); | 310 and_(dst, src1, Operand(mask), LeaveCC, cond); |
311 if (lsb != 0) { | 311 if (lsb != 0) { |
312 mov(dst, Operand(dst, LSR, lsb), LeaveCC, cond); | 312 mov(dst, Operand(dst, LSR, lsb), LeaveCC, cond); |
313 } | 313 } |
314 } else { | 314 } else { |
315 ubfx(dst, src1, lsb, width, cond); | 315 ubfx(dst, src1, lsb, width, cond); |
316 } | 316 } |
317 } | 317 } |
318 | 318 |
319 | 319 |
320 void MacroAssembler::Sbfx(Register dst, Register src1, int lsb, int width, | 320 void MacroAssembler::Sbfx(Register dst, Register src1, int lsb, int width, |
321 Condition cond) { | 321 Condition cond) { |
322 ASSERT(lsb < 32); | 322 ASSERT(lsb < 32); |
323 if (!CpuFeatures::IsSupported(ARMv7)) { | 323 if (!Isolate::Current()->cpu_features()->IsSupported(ARMv7)) { |
324 int mask = (1 << (width + lsb)) - 1 - ((1 << lsb) - 1); | 324 int mask = (1 << (width + lsb)) - 1 - ((1 << lsb) - 1); |
325 and_(dst, src1, Operand(mask), LeaveCC, cond); | 325 and_(dst, src1, Operand(mask), LeaveCC, cond); |
326 int shift_up = 32 - lsb - width; | 326 int shift_up = 32 - lsb - width; |
327 int shift_down = lsb + shift_up; | 327 int shift_down = lsb + shift_up; |
328 if (shift_up != 0) { | 328 if (shift_up != 0) { |
329 mov(dst, Operand(dst, LSL, shift_up), LeaveCC, cond); | 329 mov(dst, Operand(dst, LSL, shift_up), LeaveCC, cond); |
330 } | 330 } |
331 if (shift_down != 0) { | 331 if (shift_down != 0) { |
332 mov(dst, Operand(dst, ASR, shift_down), LeaveCC, cond); | 332 mov(dst, Operand(dst, ASR, shift_down), LeaveCC, cond); |
333 } | 333 } |
334 } else { | 334 } else { |
335 sbfx(dst, src1, lsb, width, cond); | 335 sbfx(dst, src1, lsb, width, cond); |
336 } | 336 } |
337 } | 337 } |
338 | 338 |
339 | 339 |
340 void MacroAssembler::Bfi(Register dst, | 340 void MacroAssembler::Bfi(Register dst, |
341 Register src, | 341 Register src, |
342 Register scratch, | 342 Register scratch, |
343 int lsb, | 343 int lsb, |
344 int width, | 344 int width, |
345 Condition cond) { | 345 Condition cond) { |
346 ASSERT(0 <= lsb && lsb < 32); | 346 ASSERT(0 <= lsb && lsb < 32); |
347 ASSERT(0 <= width && width < 32); | 347 ASSERT(0 <= width && width < 32); |
348 ASSERT(lsb + width < 32); | 348 ASSERT(lsb + width < 32); |
349 ASSERT(!scratch.is(dst)); | 349 ASSERT(!scratch.is(dst)); |
350 if (width == 0) return; | 350 if (width == 0) return; |
351 if (!CpuFeatures::IsSupported(ARMv7)) { | 351 if (!Isolate::Current()->cpu_features()->IsSupported(ARMv7)) { |
352 int mask = (1 << (width + lsb)) - 1 - ((1 << lsb) - 1); | 352 int mask = (1 << (width + lsb)) - 1 - ((1 << lsb) - 1); |
353 bic(dst, dst, Operand(mask)); | 353 bic(dst, dst, Operand(mask)); |
354 and_(scratch, src, Operand((1 << width) - 1)); | 354 and_(scratch, src, Operand((1 << width) - 1)); |
355 mov(scratch, Operand(scratch, LSL, lsb)); | 355 mov(scratch, Operand(scratch, LSL, lsb)); |
356 orr(dst, dst, scratch); | 356 orr(dst, dst, scratch); |
357 } else { | 357 } else { |
358 bfi(dst, src, lsb, width, cond); | 358 bfi(dst, src, lsb, width, cond); |
359 } | 359 } |
360 } | 360 } |
361 | 361 |
362 | 362 |
363 void MacroAssembler::Bfc(Register dst, int lsb, int width, Condition cond) { | 363 void MacroAssembler::Bfc(Register dst, int lsb, int width, Condition cond) { |
364 ASSERT(lsb < 32); | 364 ASSERT(lsb < 32); |
365 if (!CpuFeatures::IsSupported(ARMv7)) { | 365 if (!Isolate::Current()->cpu_features()->IsSupported(ARMv7)) { |
366 int mask = (1 << (width + lsb)) - 1 - ((1 << lsb) - 1); | 366 int mask = (1 << (width + lsb)) - 1 - ((1 << lsb) - 1); |
367 bic(dst, dst, Operand(mask)); | 367 bic(dst, dst, Operand(mask)); |
368 } else { | 368 } else { |
369 bfc(dst, lsb, width, cond); | 369 bfc(dst, lsb, width, cond); |
370 } | 370 } |
371 } | 371 } |
372 | 372 |
373 | 373 |
374 void MacroAssembler::Usat(Register dst, int satpos, const Operand& src, | 374 void MacroAssembler::Usat(Register dst, int satpos, const Operand& src, |
375 Condition cond) { | 375 Condition cond) { |
376 if (!CpuFeatures::IsSupported(ARMv7)) { | 376 if (!Isolate::Current()->cpu_features()->IsSupported(ARMv7)) { |
377 ASSERT(!dst.is(pc) && !src.rm().is(pc)); | 377 ASSERT(!dst.is(pc) && !src.rm().is(pc)); |
378 ASSERT((satpos >= 0) && (satpos <= 31)); | 378 ASSERT((satpos >= 0) && (satpos <= 31)); |
379 | 379 |
380 // These asserts are required to ensure compatibility with the ARMv7 | 380 // These asserts are required to ensure compatibility with the ARMv7 |
381 // implementation. | 381 // implementation. |
382 ASSERT((src.shift_op() == ASR) || (src.shift_op() == LSL)); | 382 ASSERT((src.shift_op() == ASR) || (src.shift_op() == LSL)); |
383 ASSERT(src.rs().is(no_reg)); | 383 ASSERT(src.rs().is(no_reg)); |
384 | 384 |
385 Label done; | 385 Label done; |
386 int satval = (1 << satpos) - 1; | 386 int satval = (1 << satpos) - 1; |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 | 612 |
613 | 613 |
614 void MacroAssembler::Ldrd(Register dst1, Register dst2, | 614 void MacroAssembler::Ldrd(Register dst1, Register dst2, |
615 const MemOperand& src, Condition cond) { | 615 const MemOperand& src, Condition cond) { |
616 ASSERT(src.rm().is(no_reg)); | 616 ASSERT(src.rm().is(no_reg)); |
617 ASSERT(!dst1.is(lr)); // r14. | 617 ASSERT(!dst1.is(lr)); // r14. |
618 ASSERT_EQ(0, dst1.code() % 2); | 618 ASSERT_EQ(0, dst1.code() % 2); |
619 ASSERT_EQ(dst1.code() + 1, dst2.code()); | 619 ASSERT_EQ(dst1.code() + 1, dst2.code()); |
620 | 620 |
621 // Generate two ldr instructions if ldrd is not available. | 621 // Generate two ldr instructions if ldrd is not available. |
622 if (CpuFeatures::IsSupported(ARMv7)) { | 622 if (Isolate::Current()->cpu_features()->IsSupported(ARMv7)) { |
623 CpuFeatures::Scope scope(ARMv7); | 623 CpuFeatures::Scope scope(ARMv7); |
624 ldrd(dst1, dst2, src, cond); | 624 ldrd(dst1, dst2, src, cond); |
625 } else { | 625 } else { |
626 MemOperand src2(src); | 626 MemOperand src2(src); |
627 src2.set_offset(src2.offset() + 4); | 627 src2.set_offset(src2.offset() + 4); |
628 if (dst1.is(src.rn())) { | 628 if (dst1.is(src.rn())) { |
629 ldr(dst2, src2, cond); | 629 ldr(dst2, src2, cond); |
630 ldr(dst1, src, cond); | 630 ldr(dst1, src, cond); |
631 } else { | 631 } else { |
632 ldr(dst1, src, cond); | 632 ldr(dst1, src, cond); |
633 ldr(dst2, src2, cond); | 633 ldr(dst2, src2, cond); |
634 } | 634 } |
635 } | 635 } |
636 } | 636 } |
637 | 637 |
638 | 638 |
639 void MacroAssembler::Strd(Register src1, Register src2, | 639 void MacroAssembler::Strd(Register src1, Register src2, |
640 const MemOperand& dst, Condition cond) { | 640 const MemOperand& dst, Condition cond) { |
641 ASSERT(dst.rm().is(no_reg)); | 641 ASSERT(dst.rm().is(no_reg)); |
642 ASSERT(!src1.is(lr)); // r14. | 642 ASSERT(!src1.is(lr)); // r14. |
643 ASSERT_EQ(0, src1.code() % 2); | 643 ASSERT_EQ(0, src1.code() % 2); |
644 ASSERT_EQ(src1.code() + 1, src2.code()); | 644 ASSERT_EQ(src1.code() + 1, src2.code()); |
645 | 645 |
646 // Generate two str instructions if strd is not available. | 646 // Generate two str instructions if strd is not available. |
647 if (CpuFeatures::IsSupported(ARMv7)) { | 647 if (Isolate::Current()->cpu_features()->IsSupported(ARMv7)) { |
648 CpuFeatures::Scope scope(ARMv7); | 648 CpuFeatures::Scope scope(ARMv7); |
649 strd(src1, src2, dst, cond); | 649 strd(src1, src2, dst, cond); |
650 } else { | 650 } else { |
651 MemOperand dst2(dst); | 651 MemOperand dst2(dst); |
652 dst2.set_offset(dst2.offset() + 4); | 652 dst2.set_offset(dst2.offset() + 4); |
653 str(src1, dst, cond); | 653 str(src1, dst, cond); |
654 str(src2, dst2, cond); | 654 str(src2, dst2, cond); |
655 } | 655 } |
656 } | 656 } |
657 | 657 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 // Reserve room for saved entry sp and code object. | 732 // Reserve room for saved entry sp and code object. |
733 sub(sp, sp, Operand(2 * kPointerSize)); | 733 sub(sp, sp, Operand(2 * kPointerSize)); |
734 if (emit_debug_code()) { | 734 if (emit_debug_code()) { |
735 mov(ip, Operand(0)); | 735 mov(ip, Operand(0)); |
736 str(ip, MemOperand(fp, ExitFrameConstants::kSPOffset)); | 736 str(ip, MemOperand(fp, ExitFrameConstants::kSPOffset)); |
737 } | 737 } |
738 mov(ip, Operand(CodeObject())); | 738 mov(ip, Operand(CodeObject())); |
739 str(ip, MemOperand(fp, ExitFrameConstants::kCodeOffset)); | 739 str(ip, MemOperand(fp, ExitFrameConstants::kCodeOffset)); |
740 | 740 |
741 // Save the frame pointer and the context in top. | 741 // Save the frame pointer and the context in top. |
742 mov(ip, Operand(ExternalReference(Top::k_c_entry_fp_address))); | 742 mov(ip, Operand(ExternalReference(Isolate::k_c_entry_fp_address))); |
743 str(fp, MemOperand(ip)); | 743 str(fp, MemOperand(ip)); |
744 mov(ip, Operand(ExternalReference(Top::k_context_address))); | 744 mov(ip, Operand(ExternalReference(Isolate::k_context_address))); |
745 str(cp, MemOperand(ip)); | 745 str(cp, MemOperand(ip)); |
746 | 746 |
747 // Optionally save all double registers. | 747 // Optionally save all double registers. |
748 if (save_doubles) { | 748 if (save_doubles) { |
749 sub(sp, sp, Operand(DwVfpRegister::kNumRegisters * kDoubleSize)); | 749 sub(sp, sp, Operand(DwVfpRegister::kNumRegisters * kDoubleSize)); |
750 const int offset = -2 * kPointerSize; | 750 const int offset = -2 * kPointerSize; |
751 for (int i = 0; i < DwVfpRegister::kNumRegisters; i++) { | 751 for (int i = 0; i < DwVfpRegister::kNumRegisters; i++) { |
752 DwVfpRegister reg = DwVfpRegister::from_code(i); | 752 DwVfpRegister reg = DwVfpRegister::from_code(i); |
753 vstr(reg, fp, offset - ((i + 1) * kDoubleSize)); | 753 vstr(reg, fp, offset - ((i + 1) * kDoubleSize)); |
754 } | 754 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 if (save_doubles) { | 810 if (save_doubles) { |
811 for (int i = 0; i < DwVfpRegister::kNumRegisters; i++) { | 811 for (int i = 0; i < DwVfpRegister::kNumRegisters; i++) { |
812 DwVfpRegister reg = DwVfpRegister::from_code(i); | 812 DwVfpRegister reg = DwVfpRegister::from_code(i); |
813 const int offset = -2 * kPointerSize; | 813 const int offset = -2 * kPointerSize; |
814 vldr(reg, fp, offset - ((i + 1) * kDoubleSize)); | 814 vldr(reg, fp, offset - ((i + 1) * kDoubleSize)); |
815 } | 815 } |
816 } | 816 } |
817 | 817 |
818 // Clear top frame. | 818 // Clear top frame. |
819 mov(r3, Operand(0, RelocInfo::NONE)); | 819 mov(r3, Operand(0, RelocInfo::NONE)); |
820 mov(ip, Operand(ExternalReference(Top::k_c_entry_fp_address))); | 820 mov(ip, Operand(ExternalReference(Isolate::k_c_entry_fp_address))); |
821 str(r3, MemOperand(ip)); | 821 str(r3, MemOperand(ip)); |
822 | 822 |
823 // Restore current context from top and clear it in debug mode. | 823 // Restore current context from top and clear it in debug mode. |
824 mov(ip, Operand(ExternalReference(Top::k_context_address))); | 824 mov(ip, Operand(ExternalReference(Isolate::k_context_address))); |
825 ldr(cp, MemOperand(ip)); | 825 ldr(cp, MemOperand(ip)); |
826 #ifdef DEBUG | 826 #ifdef DEBUG |
827 str(r3, MemOperand(ip)); | 827 str(r3, MemOperand(ip)); |
828 #endif | 828 #endif |
829 | 829 |
830 // Tear down the exit frame, pop the arguments, and return. | 830 // Tear down the exit frame, pop the arguments, and return. |
831 mov(sp, Operand(fp)); | 831 mov(sp, Operand(fp)); |
832 ldm(ia_w, sp, fp.bit() | lr.bit()); | 832 ldm(ia_w, sp, fp.bit() | lr.bit()); |
833 if (argument_count.is_valid()) { | 833 if (argument_count.is_valid()) { |
834 add(sp, sp, Operand(argument_count, LSL, kPointerSizeLog2)); | 834 add(sp, sp, Operand(argument_count, LSL, kPointerSizeLog2)); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 } | 896 } |
897 } | 897 } |
898 | 898 |
899 if (!definitely_matches) { | 899 if (!definitely_matches) { |
900 if (!code_constant.is_null()) { | 900 if (!code_constant.is_null()) { |
901 mov(r3, Operand(code_constant)); | 901 mov(r3, Operand(code_constant)); |
902 add(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); | 902 add(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); |
903 } | 903 } |
904 | 904 |
905 Handle<Code> adaptor = | 905 Handle<Code> adaptor = |
906 Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)); | 906 Handle<Code>(Isolate::Current()->builtins()->builtin( |
| 907 Builtins::ArgumentsAdaptorTrampoline)); |
907 if (flag == CALL_FUNCTION) { | 908 if (flag == CALL_FUNCTION) { |
908 if (call_wrapper != NULL) { | 909 if (call_wrapper != NULL) { |
909 call_wrapper->BeforeCall(CallSize(adaptor, RelocInfo::CODE_TARGET)); | 910 call_wrapper->BeforeCall(CallSize(adaptor, RelocInfo::CODE_TARGET)); |
910 } | 911 } |
911 Call(adaptor, RelocInfo::CODE_TARGET); | 912 Call(adaptor, RelocInfo::CODE_TARGET); |
912 if (call_wrapper != NULL) call_wrapper->AfterCall(); | 913 if (call_wrapper != NULL) call_wrapper->AfterCall(); |
913 b(done); | 914 b(done); |
914 } else { | 915 } else { |
915 Jump(adaptor, RelocInfo::CODE_TARGET); | 916 Jump(adaptor, RelocInfo::CODE_TARGET); |
916 } | 917 } |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 if (type == TRY_CATCH_HANDLER) { | 1064 if (type == TRY_CATCH_HANDLER) { |
1064 mov(r3, Operand(StackHandler::TRY_CATCH)); | 1065 mov(r3, Operand(StackHandler::TRY_CATCH)); |
1065 } else { | 1066 } else { |
1066 mov(r3, Operand(StackHandler::TRY_FINALLY)); | 1067 mov(r3, Operand(StackHandler::TRY_FINALLY)); |
1067 } | 1068 } |
1068 ASSERT(StackHandlerConstants::kStateOffset == 1 * kPointerSize | 1069 ASSERT(StackHandlerConstants::kStateOffset == 1 * kPointerSize |
1069 && StackHandlerConstants::kFPOffset == 2 * kPointerSize | 1070 && StackHandlerConstants::kFPOffset == 2 * kPointerSize |
1070 && StackHandlerConstants::kPCOffset == 3 * kPointerSize); | 1071 && StackHandlerConstants::kPCOffset == 3 * kPointerSize); |
1071 stm(db_w, sp, r3.bit() | fp.bit() | lr.bit()); | 1072 stm(db_w, sp, r3.bit() | fp.bit() | lr.bit()); |
1072 // Save the current handler as the next handler. | 1073 // Save the current handler as the next handler. |
1073 mov(r3, Operand(ExternalReference(Top::k_handler_address))); | 1074 mov(r3, Operand(ExternalReference(Isolate::k_handler_address))); |
1074 ldr(r1, MemOperand(r3)); | 1075 ldr(r1, MemOperand(r3)); |
1075 ASSERT(StackHandlerConstants::kNextOffset == 0); | 1076 ASSERT(StackHandlerConstants::kNextOffset == 0); |
1076 push(r1); | 1077 push(r1); |
1077 // Link this handler as the new current one. | 1078 // Link this handler as the new current one. |
1078 str(sp, MemOperand(r3)); | 1079 str(sp, MemOperand(r3)); |
1079 } else { | 1080 } else { |
1080 // Must preserve r0-r4, r5-r7 are available. | 1081 // Must preserve r0-r4, r5-r7 are available. |
1081 ASSERT(try_location == IN_JS_ENTRY); | 1082 ASSERT(try_location == IN_JS_ENTRY); |
1082 // The frame pointer does not point to a JS frame so we save NULL | 1083 // The frame pointer does not point to a JS frame so we save NULL |
1083 // for fp. We expect the code throwing an exception to check fp | 1084 // for fp. We expect the code throwing an exception to check fp |
1084 // before dereferencing it to restore the context. | 1085 // before dereferencing it to restore the context. |
1085 mov(ip, Operand(0, RelocInfo::NONE)); // To save a NULL frame pointer. | 1086 mov(ip, Operand(0, RelocInfo::NONE)); // To save a NULL frame pointer. |
1086 mov(r6, Operand(StackHandler::ENTRY)); | 1087 mov(r6, Operand(StackHandler::ENTRY)); |
1087 ASSERT(StackHandlerConstants::kStateOffset == 1 * kPointerSize | 1088 ASSERT(StackHandlerConstants::kStateOffset == 1 * kPointerSize |
1088 && StackHandlerConstants::kFPOffset == 2 * kPointerSize | 1089 && StackHandlerConstants::kFPOffset == 2 * kPointerSize |
1089 && StackHandlerConstants::kPCOffset == 3 * kPointerSize); | 1090 && StackHandlerConstants::kPCOffset == 3 * kPointerSize); |
1090 stm(db_w, sp, r6.bit() | ip.bit() | lr.bit()); | 1091 stm(db_w, sp, r6.bit() | ip.bit() | lr.bit()); |
1091 // Save the current handler as the next handler. | 1092 // Save the current handler as the next handler. |
1092 mov(r7, Operand(ExternalReference(Top::k_handler_address))); | 1093 mov(r7, Operand(ExternalReference(Isolate::k_handler_address))); |
1093 ldr(r6, MemOperand(r7)); | 1094 ldr(r6, MemOperand(r7)); |
1094 ASSERT(StackHandlerConstants::kNextOffset == 0); | 1095 ASSERT(StackHandlerConstants::kNextOffset == 0); |
1095 push(r6); | 1096 push(r6); |
1096 // Link this handler as the new current one. | 1097 // Link this handler as the new current one. |
1097 str(sp, MemOperand(r7)); | 1098 str(sp, MemOperand(r7)); |
1098 } | 1099 } |
1099 } | 1100 } |
1100 | 1101 |
1101 | 1102 |
1102 void MacroAssembler::PopTryHandler() { | 1103 void MacroAssembler::PopTryHandler() { |
1103 ASSERT_EQ(0, StackHandlerConstants::kNextOffset); | 1104 ASSERT_EQ(0, StackHandlerConstants::kNextOffset); |
1104 pop(r1); | 1105 pop(r1); |
1105 mov(ip, Operand(ExternalReference(Top::k_handler_address))); | 1106 mov(ip, Operand(ExternalReference(Isolate::k_handler_address))); |
1106 add(sp, sp, Operand(StackHandlerConstants::kSize - kPointerSize)); | 1107 add(sp, sp, Operand(StackHandlerConstants::kSize - kPointerSize)); |
1107 str(r1, MemOperand(ip)); | 1108 str(r1, MemOperand(ip)); |
1108 } | 1109 } |
1109 | 1110 |
1110 | 1111 |
1111 void MacroAssembler::Throw(Register value) { | 1112 void MacroAssembler::Throw(Register value) { |
1112 // r0 is expected to hold the exception. | 1113 // r0 is expected to hold the exception. |
1113 if (!value.is(r0)) { | 1114 if (!value.is(r0)) { |
1114 mov(r0, value); | 1115 mov(r0, value); |
1115 } | 1116 } |
1116 | 1117 |
1117 // Adjust this code if not the case. | 1118 // Adjust this code if not the case. |
1118 STATIC_ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize); | 1119 STATIC_ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize); |
1119 | 1120 |
1120 // Drop the sp to the top of the handler. | 1121 // Drop the sp to the top of the handler. |
1121 mov(r3, Operand(ExternalReference(Top::k_handler_address))); | 1122 mov(r3, Operand(ExternalReference(Isolate::k_handler_address))); |
1122 ldr(sp, MemOperand(r3)); | 1123 ldr(sp, MemOperand(r3)); |
1123 | 1124 |
1124 // Restore the next handler and frame pointer, discard handler state. | 1125 // Restore the next handler and frame pointer, discard handler state. |
1125 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); | 1126 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); |
1126 pop(r2); | 1127 pop(r2); |
1127 str(r2, MemOperand(r3)); | 1128 str(r2, MemOperand(r3)); |
1128 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 2 * kPointerSize); | 1129 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 2 * kPointerSize); |
1129 ldm(ia_w, sp, r3.bit() | fp.bit()); // r3: discarded state. | 1130 ldm(ia_w, sp, r3.bit() | fp.bit()); // r3: discarded state. |
1130 | 1131 |
1131 // Before returning we restore the context from the frame pointer if | 1132 // Before returning we restore the context from the frame pointer if |
(...skipping 18 matching lines...) Expand all Loading... |
1150 Register value) { | 1151 Register value) { |
1151 // Adjust this code if not the case. | 1152 // Adjust this code if not the case. |
1152 STATIC_ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize); | 1153 STATIC_ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize); |
1153 | 1154 |
1154 // r0 is expected to hold the exception. | 1155 // r0 is expected to hold the exception. |
1155 if (!value.is(r0)) { | 1156 if (!value.is(r0)) { |
1156 mov(r0, value); | 1157 mov(r0, value); |
1157 } | 1158 } |
1158 | 1159 |
1159 // Drop sp to the top stack handler. | 1160 // Drop sp to the top stack handler. |
1160 mov(r3, Operand(ExternalReference(Top::k_handler_address))); | 1161 mov(r3, Operand(ExternalReference(Isolate::k_handler_address))); |
1161 ldr(sp, MemOperand(r3)); | 1162 ldr(sp, MemOperand(r3)); |
1162 | 1163 |
1163 // Unwind the handlers until the ENTRY handler is found. | 1164 // Unwind the handlers until the ENTRY handler is found. |
1164 Label loop, done; | 1165 Label loop, done; |
1165 bind(&loop); | 1166 bind(&loop); |
1166 // Load the type of the current stack handler. | 1167 // Load the type of the current stack handler. |
1167 const int kStateOffset = StackHandlerConstants::kStateOffset; | 1168 const int kStateOffset = StackHandlerConstants::kStateOffset; |
1168 ldr(r2, MemOperand(sp, kStateOffset)); | 1169 ldr(r2, MemOperand(sp, kStateOffset)); |
1169 cmp(r2, Operand(StackHandler::ENTRY)); | 1170 cmp(r2, Operand(StackHandler::ENTRY)); |
1170 b(eq, &done); | 1171 b(eq, &done); |
1171 // Fetch the next handler in the list. | 1172 // Fetch the next handler in the list. |
1172 const int kNextOffset = StackHandlerConstants::kNextOffset; | 1173 const int kNextOffset = StackHandlerConstants::kNextOffset; |
1173 ldr(sp, MemOperand(sp, kNextOffset)); | 1174 ldr(sp, MemOperand(sp, kNextOffset)); |
1174 jmp(&loop); | 1175 jmp(&loop); |
1175 bind(&done); | 1176 bind(&done); |
1176 | 1177 |
1177 // Set the top handler address to next handler past the current ENTRY handler. | 1178 // Set the top handler address to next handler past the current ENTRY handler. |
1178 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); | 1179 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); |
1179 pop(r2); | 1180 pop(r2); |
1180 str(r2, MemOperand(r3)); | 1181 str(r2, MemOperand(r3)); |
1181 | 1182 |
1182 if (type == OUT_OF_MEMORY) { | 1183 if (type == OUT_OF_MEMORY) { |
1183 // Set external caught exception to false. | 1184 // Set external caught exception to false. |
1184 ExternalReference external_caught(Top::k_external_caught_exception_address); | 1185 ExternalReference external_caught( |
| 1186 Isolate::k_external_caught_exception_address); |
1185 mov(r0, Operand(false, RelocInfo::NONE)); | 1187 mov(r0, Operand(false, RelocInfo::NONE)); |
1186 mov(r2, Operand(external_caught)); | 1188 mov(r2, Operand(external_caught)); |
1187 str(r0, MemOperand(r2)); | 1189 str(r0, MemOperand(r2)); |
1188 | 1190 |
1189 // Set pending exception and r0 to out of memory exception. | 1191 // Set pending exception and r0 to out of memory exception. |
1190 Failure* out_of_memory = Failure::OutOfMemoryException(); | 1192 Failure* out_of_memory = Failure::OutOfMemoryException(); |
1191 mov(r0, Operand(reinterpret_cast<int32_t>(out_of_memory))); | 1193 mov(r0, Operand(reinterpret_cast<int32_t>(out_of_memory))); |
1192 mov(r2, Operand(ExternalReference(Top::k_pending_exception_address))); | 1194 mov(r2, Operand(ExternalReference(Isolate::k_pending_exception_address))); |
1193 str(r0, MemOperand(r2)); | 1195 str(r0, MemOperand(r2)); |
1194 } | 1196 } |
1195 | 1197 |
1196 // Stack layout at this point. See also StackHandlerConstants. | 1198 // Stack layout at this point. See also StackHandlerConstants. |
1197 // sp -> state (ENTRY) | 1199 // sp -> state (ENTRY) |
1198 // fp | 1200 // fp |
1199 // lr | 1201 // lr |
1200 | 1202 |
1201 // Discard handler state (r2 is not used) and restore frame pointer. | 1203 // Discard handler state (r2 is not used) and restore frame pointer. |
1202 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 2 * kPointerSize); | 1204 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 2 * kPointerSize); |
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1889 | 1891 |
1890 // Tries to get a signed int32 out of a double precision floating point heap | 1892 // Tries to get a signed int32 out of a double precision floating point heap |
1891 // number. Rounds towards 0. Branch to 'not_int32' if the double is out of the | 1893 // number. Rounds towards 0. Branch to 'not_int32' if the double is out of the |
1892 // 32bits signed integer range. | 1894 // 32bits signed integer range. |
1893 void MacroAssembler::ConvertToInt32(Register source, | 1895 void MacroAssembler::ConvertToInt32(Register source, |
1894 Register dest, | 1896 Register dest, |
1895 Register scratch, | 1897 Register scratch, |
1896 Register scratch2, | 1898 Register scratch2, |
1897 DwVfpRegister double_scratch, | 1899 DwVfpRegister double_scratch, |
1898 Label *not_int32) { | 1900 Label *not_int32) { |
1899 if (CpuFeatures::IsSupported(VFP3)) { | 1901 if (Isolate::Current()->cpu_features()->IsSupported(VFP3)) { |
1900 CpuFeatures::Scope scope(VFP3); | 1902 CpuFeatures::Scope scope(VFP3); |
1901 sub(scratch, source, Operand(kHeapObjectTag)); | 1903 sub(scratch, source, Operand(kHeapObjectTag)); |
1902 vldr(double_scratch, scratch, HeapNumber::kValueOffset); | 1904 vldr(double_scratch, scratch, HeapNumber::kValueOffset); |
1903 vcvt_s32_f64(double_scratch.low(), double_scratch); | 1905 vcvt_s32_f64(double_scratch.low(), double_scratch); |
1904 vmov(dest, double_scratch.low()); | 1906 vmov(dest, double_scratch.low()); |
1905 // Signed vcvt instruction will saturate to the minimum (0x80000000) or | 1907 // Signed vcvt instruction will saturate to the minimum (0x80000000) or |
1906 // maximun (0x7fffffff) signed 32bits integer when the double is out of | 1908 // maximun (0x7fffffff) signed 32bits integer when the double is out of |
1907 // range. When substracting one, the minimum signed integer becomes the | 1909 // range. When substracting one, the minimum signed integer becomes the |
1908 // maximun signed integer. | 1910 // maximun signed integer. |
1909 sub(scratch, dest, Operand(1)); | 1911 sub(scratch, dest, Operand(1)); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1985 } | 1987 } |
1986 } | 1988 } |
1987 | 1989 |
1988 | 1990 |
1989 void MacroAssembler::EmitVFPTruncate(VFPRoundingMode rounding_mode, | 1991 void MacroAssembler::EmitVFPTruncate(VFPRoundingMode rounding_mode, |
1990 SwVfpRegister result, | 1992 SwVfpRegister result, |
1991 DwVfpRegister double_input, | 1993 DwVfpRegister double_input, |
1992 Register scratch1, | 1994 Register scratch1, |
1993 Register scratch2, | 1995 Register scratch2, |
1994 CheckForInexactConversion check_inexact) { | 1996 CheckForInexactConversion check_inexact) { |
1995 ASSERT(CpuFeatures::IsSupported(VFP3)); | 1997 ASSERT(Isolate::Current()->cpu_features()->IsSupported(VFP3)); |
1996 CpuFeatures::Scope scope(VFP3); | 1998 CpuFeatures::Scope scope(VFP3); |
1997 Register prev_fpscr = scratch1; | 1999 Register prev_fpscr = scratch1; |
1998 Register scratch = scratch2; | 2000 Register scratch = scratch2; |
1999 | 2001 |
2000 int32_t check_inexact_conversion = | 2002 int32_t check_inexact_conversion = |
2001 (check_inexact == kCheckForInexactConversion) ? kVFPInexactExceptionBit : 0; | 2003 (check_inexact == kCheckForInexactConversion) ? kVFPInexactExceptionBit : 0; |
2002 | 2004 |
2003 // Set custom FPCSR: | 2005 // Set custom FPCSR: |
2004 // - Set rounding mode. | 2006 // - Set rounding mode. |
2005 // - Clear vfp cumulative exception flags. | 2007 // - Clear vfp cumulative exception flags. |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2143 input_high, | 2145 input_high, |
2144 input_low, | 2146 input_low, |
2145 scratch); | 2147 scratch); |
2146 bind(&done); | 2148 bind(&done); |
2147 } | 2149 } |
2148 | 2150 |
2149 | 2151 |
2150 void MacroAssembler::GetLeastBitsFromSmi(Register dst, | 2152 void MacroAssembler::GetLeastBitsFromSmi(Register dst, |
2151 Register src, | 2153 Register src, |
2152 int num_least_bits) { | 2154 int num_least_bits) { |
2153 if (CpuFeatures::IsSupported(ARMv7)) { | 2155 if (Isolate::Current()->cpu_features()->IsSupported(ARMv7)) { |
2154 ubfx(dst, src, kSmiTagSize, num_least_bits); | 2156 ubfx(dst, src, kSmiTagSize, num_least_bits); |
2155 } else { | 2157 } else { |
2156 mov(dst, Operand(src, ASR, kSmiTagSize)); | 2158 mov(dst, Operand(src, ASR, kSmiTagSize)); |
2157 and_(dst, dst, Operand((1 << num_least_bits) - 1)); | 2159 and_(dst, dst, Operand((1 << num_least_bits) - 1)); |
2158 } | 2160 } |
2159 } | 2161 } |
2160 | 2162 |
2161 | 2163 |
2162 void MacroAssembler::GetLeastBitsFromInt32(Register dst, | 2164 void MacroAssembler::GetLeastBitsFromInt32(Register dst, |
2163 Register src, | 2165 Register src, |
2164 int num_least_bits) { | 2166 int num_least_bits) { |
2165 and_(dst, src, Operand((1 << num_least_bits) - 1)); | 2167 and_(dst, src, Operand((1 << num_least_bits) - 1)); |
2166 } | 2168 } |
2167 | 2169 |
2168 | 2170 |
2169 void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) { | 2171 void MacroAssembler::CallRuntime(const Runtime::Function* f, |
| 2172 int num_arguments) { |
2170 // All parameters are on the stack. r0 has the return value after call. | 2173 // All parameters are on the stack. r0 has the return value after call. |
2171 | 2174 |
2172 // If the expected number of arguments of the runtime function is | 2175 // If the expected number of arguments of the runtime function is |
2173 // constant, we check that the actual number of arguments match the | 2176 // constant, we check that the actual number of arguments match the |
2174 // expectation. | 2177 // expectation. |
2175 if (f->nargs >= 0 && f->nargs != num_arguments) { | 2178 if (f->nargs >= 0 && f->nargs != num_arguments) { |
2176 IllegalOperation(num_arguments); | 2179 IllegalOperation(num_arguments); |
2177 return; | 2180 return; |
2178 } | 2181 } |
2179 | 2182 |
2180 // TODO(1236192): Most runtime routines don't need the number of | 2183 // TODO(1236192): Most runtime routines don't need the number of |
2181 // arguments passed in because it is constant. At some point we | 2184 // arguments passed in because it is constant. At some point we |
2182 // should remove this need and make the runtime routine entry code | 2185 // should remove this need and make the runtime routine entry code |
2183 // smarter. | 2186 // smarter. |
2184 mov(r0, Operand(num_arguments)); | 2187 mov(r0, Operand(num_arguments)); |
2185 mov(r1, Operand(ExternalReference(f))); | 2188 mov(r1, Operand(ExternalReference(f))); |
2186 CEntryStub stub(1); | 2189 CEntryStub stub(1); |
2187 CallStub(&stub); | 2190 CallStub(&stub); |
2188 } | 2191 } |
2189 | 2192 |
2190 | 2193 |
2191 void MacroAssembler::CallRuntime(Runtime::FunctionId fid, int num_arguments) { | 2194 void MacroAssembler::CallRuntime(Runtime::FunctionId fid, int num_arguments) { |
2192 CallRuntime(Runtime::FunctionForId(fid), num_arguments); | 2195 CallRuntime(Runtime::FunctionForId(fid), num_arguments); |
2193 } | 2196 } |
2194 | 2197 |
2195 | 2198 |
2196 void MacroAssembler::CallRuntimeSaveDoubles(Runtime::FunctionId id) { | 2199 void MacroAssembler::CallRuntimeSaveDoubles(Runtime::FunctionId id) { |
2197 Runtime::Function* function = Runtime::FunctionForId(id); | 2200 const Runtime::Function* function = Runtime::FunctionForId(id); |
2198 mov(r0, Operand(function->nargs)); | 2201 mov(r0, Operand(function->nargs)); |
2199 mov(r1, Operand(ExternalReference(function))); | 2202 mov(r1, Operand(ExternalReference(function))); |
2200 CEntryStub stub(1); | 2203 CEntryStub stub(1); |
2201 stub.SaveDoubles(); | 2204 stub.SaveDoubles(); |
2202 CallStub(&stub); | 2205 CallStub(&stub); |
2203 } | 2206 } |
2204 | 2207 |
2205 | 2208 |
2206 void MacroAssembler::CallExternalReference(const ExternalReference& ext, | 2209 void MacroAssembler::CallExternalReference(const ExternalReference& ext, |
2207 int num_arguments) { | 2210 int num_arguments) { |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2764 Register scratch, | 2767 Register scratch, |
2765 Label* failure) { | 2768 Label* failure) { |
2766 int kFlatAsciiStringMask = | 2769 int kFlatAsciiStringMask = |
2767 kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask; | 2770 kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask; |
2768 int kFlatAsciiStringTag = ASCII_STRING_TYPE; | 2771 int kFlatAsciiStringTag = ASCII_STRING_TYPE; |
2769 and_(scratch, type, Operand(kFlatAsciiStringMask)); | 2772 and_(scratch, type, Operand(kFlatAsciiStringMask)); |
2770 cmp(scratch, Operand(kFlatAsciiStringTag)); | 2773 cmp(scratch, Operand(kFlatAsciiStringTag)); |
2771 b(ne, failure); | 2774 b(ne, failure); |
2772 } | 2775 } |
2773 | 2776 |
| 2777 static const int kRegisterPassedArguments = 4; |
2774 | 2778 |
2775 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) { | 2779 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) { |
2776 int frame_alignment = ActivationFrameAlignment(); | 2780 int frame_alignment = ActivationFrameAlignment(); |
| 2781 |
| 2782 // Reserve space for Isolate address which is always passed as last parameter |
| 2783 num_arguments += 1; |
| 2784 |
2777 // Up to four simple arguments are passed in registers r0..r3. | 2785 // Up to four simple arguments are passed in registers r0..r3. |
2778 int stack_passed_arguments = (num_arguments <= 4) ? 0 : num_arguments - 4; | 2786 int stack_passed_arguments = (num_arguments <= kRegisterPassedArguments) ? |
| 2787 0 : num_arguments - kRegisterPassedArguments; |
2779 if (frame_alignment > kPointerSize) { | 2788 if (frame_alignment > kPointerSize) { |
2780 // Make stack end at alignment and make room for num_arguments - 4 words | 2789 // Make stack end at alignment and make room for num_arguments - 4 words |
2781 // and the original value of sp. | 2790 // and the original value of sp. |
2782 mov(scratch, sp); | 2791 mov(scratch, sp); |
2783 sub(sp, sp, Operand((stack_passed_arguments + 1) * kPointerSize)); | 2792 sub(sp, sp, Operand((stack_passed_arguments + 1) * kPointerSize)); |
2784 ASSERT(IsPowerOf2(frame_alignment)); | 2793 ASSERT(IsPowerOf2(frame_alignment)); |
2785 and_(sp, sp, Operand(-frame_alignment)); | 2794 and_(sp, sp, Operand(-frame_alignment)); |
2786 str(scratch, MemOperand(sp, stack_passed_arguments * kPointerSize)); | 2795 str(scratch, MemOperand(sp, stack_passed_arguments * kPointerSize)); |
2787 } else { | 2796 } else { |
2788 sub(sp, sp, Operand(stack_passed_arguments * kPointerSize)); | 2797 sub(sp, sp, Operand(stack_passed_arguments * kPointerSize)); |
2789 } | 2798 } |
2790 } | 2799 } |
2791 | 2800 |
2792 | 2801 |
2793 void MacroAssembler::CallCFunction(ExternalReference function, | 2802 void MacroAssembler::CallCFunction(ExternalReference function, |
2794 int num_arguments) { | 2803 int num_arguments) { |
2795 mov(ip, Operand(function)); | 2804 CallCFunctionHelper(no_reg, function, ip, num_arguments); |
2796 CallCFunction(ip, num_arguments); | 2805 } |
| 2806 |
| 2807 void MacroAssembler::CallCFunction(Register function, |
| 2808 Register scratch, |
| 2809 int num_arguments) { |
| 2810 CallCFunctionHelper(function, |
| 2811 ExternalReference::the_hole_value_location(), |
| 2812 scratch, |
| 2813 num_arguments); |
2797 } | 2814 } |
2798 | 2815 |
2799 | 2816 |
2800 void MacroAssembler::CallCFunction(Register function, int num_arguments) { | 2817 void MacroAssembler::CallCFunctionHelper(Register function, |
| 2818 ExternalReference function_reference, |
| 2819 Register scratch, |
| 2820 int num_arguments) { |
| 2821 // Push Isolate address as the last argument. |
| 2822 if (num_arguments < kRegisterPassedArguments) { |
| 2823 Register arg_to_reg[] = {r0, r1, r2, r3}; |
| 2824 Register r = arg_to_reg[num_arguments]; |
| 2825 mov(r, Operand(ExternalReference::isolate_address())); |
| 2826 } else { |
| 2827 int stack_passed_arguments = num_arguments - kRegisterPassedArguments; |
| 2828 // Push Isolate address on the stack after the arguments. |
| 2829 mov(scratch, Operand(ExternalReference::isolate_address())); |
| 2830 str(scratch, MemOperand(sp, stack_passed_arguments * kPointerSize)); |
| 2831 } |
| 2832 num_arguments += 1; |
| 2833 |
2801 // Make sure that the stack is aligned before calling a C function unless | 2834 // Make sure that the stack is aligned before calling a C function unless |
2802 // running in the simulator. The simulator has its own alignment check which | 2835 // running in the simulator. The simulator has its own alignment check which |
2803 // provides more information. | 2836 // provides more information. |
2804 #if defined(V8_HOST_ARCH_ARM) | 2837 #if defined(V8_HOST_ARCH_ARM) |
2805 if (emit_debug_code()) { | 2838 if (emit_debug_code()) { |
2806 int frame_alignment = OS::ActivationFrameAlignment(); | 2839 int frame_alignment = OS::ActivationFrameAlignment(); |
2807 int frame_alignment_mask = frame_alignment - 1; | 2840 int frame_alignment_mask = frame_alignment - 1; |
2808 if (frame_alignment > kPointerSize) { | 2841 if (frame_alignment > kPointerSize) { |
2809 ASSERT(IsPowerOf2(frame_alignment)); | 2842 ASSERT(IsPowerOf2(frame_alignment)); |
2810 Label alignment_as_expected; | 2843 Label alignment_as_expected; |
2811 tst(sp, Operand(frame_alignment_mask)); | 2844 tst(sp, Operand(frame_alignment_mask)); |
2812 b(eq, &alignment_as_expected); | 2845 b(eq, &alignment_as_expected); |
2813 // Don't use Check here, as it will call Runtime_Abort possibly | 2846 // Don't use Check here, as it will call Runtime_Abort possibly |
2814 // re-entering here. | 2847 // re-entering here. |
2815 stop("Unexpected alignment"); | 2848 stop("Unexpected alignment"); |
2816 bind(&alignment_as_expected); | 2849 bind(&alignment_as_expected); |
2817 } | 2850 } |
2818 } | 2851 } |
2819 #endif | 2852 #endif |
2820 | 2853 |
2821 // Just call directly. The function called cannot cause a GC, or | 2854 // Just call directly. The function called cannot cause a GC, or |
2822 // allow preemption, so the return address in the link register | 2855 // allow preemption, so the return address in the link register |
2823 // stays correct. | 2856 // stays correct. |
| 2857 if (function.is(no_reg)) { |
| 2858 mov(scratch, Operand(function_reference)); |
| 2859 function = scratch; |
| 2860 } |
2824 Call(function); | 2861 Call(function); |
2825 int stack_passed_arguments = (num_arguments <= 4) ? 0 : num_arguments - 4; | 2862 int stack_passed_arguments = (num_arguments <= kRegisterPassedArguments) ? |
| 2863 0 : num_arguments - kRegisterPassedArguments; |
2826 if (OS::ActivationFrameAlignment() > kPointerSize) { | 2864 if (OS::ActivationFrameAlignment() > kPointerSize) { |
2827 ldr(sp, MemOperand(sp, stack_passed_arguments * kPointerSize)); | 2865 ldr(sp, MemOperand(sp, stack_passed_arguments * kPointerSize)); |
2828 } else { | 2866 } else { |
2829 add(sp, sp, Operand(stack_passed_arguments * sizeof(kPointerSize))); | 2867 add(sp, sp, Operand(stack_passed_arguments * sizeof(kPointerSize))); |
2830 } | 2868 } |
2831 } | 2869 } |
2832 | 2870 |
2833 | 2871 |
2834 void MacroAssembler::GetRelocatedValueLocation(Register ldr_location, | 2872 void MacroAssembler::GetRelocatedValueLocation(Register ldr_location, |
2835 Register result) { | 2873 Register result) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2886 void CodePatcher::EmitCondition(Condition cond) { | 2924 void CodePatcher::EmitCondition(Condition cond) { |
2887 Instr instr = Assembler::instr_at(masm_.pc_); | 2925 Instr instr = Assembler::instr_at(masm_.pc_); |
2888 instr = (instr & ~kCondMask) | cond; | 2926 instr = (instr & ~kCondMask) | cond; |
2889 masm_.emit(instr); | 2927 masm_.emit(instr); |
2890 } | 2928 } |
2891 | 2929 |
2892 | 2930 |
2893 } } // namespace v8::internal | 2931 } } // namespace v8::internal |
2894 | 2932 |
2895 #endif // V8_TARGET_ARCH_ARM | 2933 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |