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

Side by Side Diff: src/arm/macro-assembler-arm.cc

Issue 6691054: [Arguments] Merge (7442,7496] from bleeding_edge. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/arguments
Patch Set: Created 9 years, 8 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/macro-assembler-arm.h ('k') | src/arm/regexp-macro-assembler-arm.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 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 21 matching lines...) Expand all
32 #if defined(V8_TARGET_ARCH_ARM) 32 #if defined(V8_TARGET_ARCH_ARM)
33 33
34 #include "bootstrapper.h" 34 #include "bootstrapper.h"
35 #include "codegen-inl.h" 35 #include "codegen-inl.h"
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(Isolate* arg_isolate, void* buffer, int size)
43 : Assembler(buffer, size), 43 : Assembler(arg_isolate, 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 if (isolate() != NULL) {
47 code_object_ = Handle<Object>(isolate()->heap()->undefined_value(),
48 isolate());
49 }
47 } 50 }
48 51
49 52
50 // We always generate arm code, never thumb code, even if V8 is compiled to 53 // We always generate arm code, never thumb code, even if V8 is compiled to
51 // thumb, so we require inter-working support 54 // thumb, so we require inter-working support
52 #if defined(__thumb__) && !defined(USE_THUMB_INTERWORK) 55 #if defined(__thumb__) && !defined(USE_THUMB_INTERWORK)
53 #error "flag -mthumb-interwork missing" 56 #error "flag -mthumb-interwork missing"
54 #endif 57 #endif
55 58
56 59
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 288
286 void MacroAssembler::And(Register dst, Register src1, const Operand& src2, 289 void MacroAssembler::And(Register dst, Register src1, const Operand& src2,
287 Condition cond) { 290 Condition cond) {
288 if (!src2.is_reg() && 291 if (!src2.is_reg() &&
289 !src2.must_use_constant_pool() && 292 !src2.must_use_constant_pool() &&
290 src2.immediate() == 0) { 293 src2.immediate() == 0) {
291 mov(dst, Operand(0, RelocInfo::NONE), LeaveCC, cond); 294 mov(dst, Operand(0, RelocInfo::NONE), LeaveCC, cond);
292 295
293 } else if (!src2.is_single_instruction() && 296 } else if (!src2.is_single_instruction() &&
294 !src2.must_use_constant_pool() && 297 !src2.must_use_constant_pool() &&
295 Isolate::Current()->cpu_features()->IsSupported(ARMv7) && 298 CpuFeatures::IsSupported(ARMv7) &&
296 IsPowerOf2(src2.immediate() + 1)) { 299 IsPowerOf2(src2.immediate() + 1)) {
297 ubfx(dst, src1, 0, WhichPowerOf2(src2.immediate() + 1), cond); 300 ubfx(dst, src1, 0, WhichPowerOf2(src2.immediate() + 1), cond);
298 301
299 } else { 302 } else {
300 and_(dst, src1, src2, LeaveCC, cond); 303 and_(dst, src1, src2, LeaveCC, cond);
301 } 304 }
302 } 305 }
303 306
304 307
305 void MacroAssembler::Ubfx(Register dst, Register src1, int lsb, int width, 308 void MacroAssembler::Ubfx(Register dst, Register src1, int lsb, int width,
306 Condition cond) { 309 Condition cond) {
307 ASSERT(lsb < 32); 310 ASSERT(lsb < 32);
308 if (!Isolate::Current()->cpu_features()->IsSupported(ARMv7)) { 311 if (!CpuFeatures::IsSupported(ARMv7)) {
309 int mask = (1 << (width + lsb)) - 1 - ((1 << lsb) - 1); 312 int mask = (1 << (width + lsb)) - 1 - ((1 << lsb) - 1);
310 and_(dst, src1, Operand(mask), LeaveCC, cond); 313 and_(dst, src1, Operand(mask), LeaveCC, cond);
311 if (lsb != 0) { 314 if (lsb != 0) {
312 mov(dst, Operand(dst, LSR, lsb), LeaveCC, cond); 315 mov(dst, Operand(dst, LSR, lsb), LeaveCC, cond);
313 } 316 }
314 } else { 317 } else {
315 ubfx(dst, src1, lsb, width, cond); 318 ubfx(dst, src1, lsb, width, cond);
316 } 319 }
317 } 320 }
318 321
319 322
320 void MacroAssembler::Sbfx(Register dst, Register src1, int lsb, int width, 323 void MacroAssembler::Sbfx(Register dst, Register src1, int lsb, int width,
321 Condition cond) { 324 Condition cond) {
322 ASSERT(lsb < 32); 325 ASSERT(lsb < 32);
323 if (!Isolate::Current()->cpu_features()->IsSupported(ARMv7)) { 326 if (!CpuFeatures::IsSupported(ARMv7)) {
324 int mask = (1 << (width + lsb)) - 1 - ((1 << lsb) - 1); 327 int mask = (1 << (width + lsb)) - 1 - ((1 << lsb) - 1);
325 and_(dst, src1, Operand(mask), LeaveCC, cond); 328 and_(dst, src1, Operand(mask), LeaveCC, cond);
326 int shift_up = 32 - lsb - width; 329 int shift_up = 32 - lsb - width;
327 int shift_down = lsb + shift_up; 330 int shift_down = lsb + shift_up;
328 if (shift_up != 0) { 331 if (shift_up != 0) {
329 mov(dst, Operand(dst, LSL, shift_up), LeaveCC, cond); 332 mov(dst, Operand(dst, LSL, shift_up), LeaveCC, cond);
330 } 333 }
331 if (shift_down != 0) { 334 if (shift_down != 0) {
332 mov(dst, Operand(dst, ASR, shift_down), LeaveCC, cond); 335 mov(dst, Operand(dst, ASR, shift_down), LeaveCC, cond);
333 } 336 }
334 } else { 337 } else {
335 sbfx(dst, src1, lsb, width, cond); 338 sbfx(dst, src1, lsb, width, cond);
336 } 339 }
337 } 340 }
338 341
339 342
340 void MacroAssembler::Bfi(Register dst, 343 void MacroAssembler::Bfi(Register dst,
341 Register src, 344 Register src,
342 Register scratch, 345 Register scratch,
343 int lsb, 346 int lsb,
344 int width, 347 int width,
345 Condition cond) { 348 Condition cond) {
346 ASSERT(0 <= lsb && lsb < 32); 349 ASSERT(0 <= lsb && lsb < 32);
347 ASSERT(0 <= width && width < 32); 350 ASSERT(0 <= width && width < 32);
348 ASSERT(lsb + width < 32); 351 ASSERT(lsb + width < 32);
349 ASSERT(!scratch.is(dst)); 352 ASSERT(!scratch.is(dst));
350 if (width == 0) return; 353 if (width == 0) return;
351 if (!Isolate::Current()->cpu_features()->IsSupported(ARMv7)) { 354 if (!CpuFeatures::IsSupported(ARMv7)) {
352 int mask = (1 << (width + lsb)) - 1 - ((1 << lsb) - 1); 355 int mask = (1 << (width + lsb)) - 1 - ((1 << lsb) - 1);
353 bic(dst, dst, Operand(mask)); 356 bic(dst, dst, Operand(mask));
354 and_(scratch, src, Operand((1 << width) - 1)); 357 and_(scratch, src, Operand((1 << width) - 1));
355 mov(scratch, Operand(scratch, LSL, lsb)); 358 mov(scratch, Operand(scratch, LSL, lsb));
356 orr(dst, dst, scratch); 359 orr(dst, dst, scratch);
357 } else { 360 } else {
358 bfi(dst, src, lsb, width, cond); 361 bfi(dst, src, lsb, width, cond);
359 } 362 }
360 } 363 }
361 364
362 365
363 void MacroAssembler::Bfc(Register dst, int lsb, int width, Condition cond) { 366 void MacroAssembler::Bfc(Register dst, int lsb, int width, Condition cond) {
364 ASSERT(lsb < 32); 367 ASSERT(lsb < 32);
365 if (!Isolate::Current()->cpu_features()->IsSupported(ARMv7)) { 368 if (!CpuFeatures::IsSupported(ARMv7)) {
366 int mask = (1 << (width + lsb)) - 1 - ((1 << lsb) - 1); 369 int mask = (1 << (width + lsb)) - 1 - ((1 << lsb) - 1);
367 bic(dst, dst, Operand(mask)); 370 bic(dst, dst, Operand(mask));
368 } else { 371 } else {
369 bfc(dst, lsb, width, cond); 372 bfc(dst, lsb, width, cond);
370 } 373 }
371 } 374 }
372 375
373 376
374 void MacroAssembler::Usat(Register dst, int satpos, const Operand& src, 377 void MacroAssembler::Usat(Register dst, int satpos, const Operand& src,
375 Condition cond) { 378 Condition cond) {
376 if (!Isolate::Current()->cpu_features()->IsSupported(ARMv7)) { 379 if (!CpuFeatures::IsSupported(ARMv7)) {
377 ASSERT(!dst.is(pc) && !src.rm().is(pc)); 380 ASSERT(!dst.is(pc) && !src.rm().is(pc));
378 ASSERT((satpos >= 0) && (satpos <= 31)); 381 ASSERT((satpos >= 0) && (satpos <= 31));
379 382
380 // These asserts are required to ensure compatibility with the ARMv7 383 // These asserts are required to ensure compatibility with the ARMv7
381 // implementation. 384 // implementation.
382 ASSERT((src.shift_op() == ASR) || (src.shift_op() == LSL)); 385 ASSERT((src.shift_op() == ASR) || (src.shift_op() == LSL));
383 ASSERT(src.rs().is(no_reg)); 386 ASSERT(src.rs().is(no_reg));
384 387
385 Label done; 388 Label done;
386 int satval = (1 << satpos) - 1; 389 int satval = (1 << satpos) - 1;
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 615
613 616
614 void MacroAssembler::Ldrd(Register dst1, Register dst2, 617 void MacroAssembler::Ldrd(Register dst1, Register dst2,
615 const MemOperand& src, Condition cond) { 618 const MemOperand& src, Condition cond) {
616 ASSERT(src.rm().is(no_reg)); 619 ASSERT(src.rm().is(no_reg));
617 ASSERT(!dst1.is(lr)); // r14. 620 ASSERT(!dst1.is(lr)); // r14.
618 ASSERT_EQ(0, dst1.code() % 2); 621 ASSERT_EQ(0, dst1.code() % 2);
619 ASSERT_EQ(dst1.code() + 1, dst2.code()); 622 ASSERT_EQ(dst1.code() + 1, dst2.code());
620 623
621 // Generate two ldr instructions if ldrd is not available. 624 // Generate two ldr instructions if ldrd is not available.
622 if (Isolate::Current()->cpu_features()->IsSupported(ARMv7)) { 625 if (CpuFeatures::IsSupported(ARMv7)) {
623 CpuFeatures::Scope scope(ARMv7); 626 CpuFeatures::Scope scope(ARMv7);
624 ldrd(dst1, dst2, src, cond); 627 ldrd(dst1, dst2, src, cond);
625 } else { 628 } else {
626 MemOperand src2(src); 629 MemOperand src2(src);
627 src2.set_offset(src2.offset() + 4); 630 src2.set_offset(src2.offset() + 4);
628 if (dst1.is(src.rn())) { 631 if (dst1.is(src.rn())) {
629 ldr(dst2, src2, cond); 632 ldr(dst2, src2, cond);
630 ldr(dst1, src, cond); 633 ldr(dst1, src, cond);
631 } else { 634 } else {
632 ldr(dst1, src, cond); 635 ldr(dst1, src, cond);
633 ldr(dst2, src2, cond); 636 ldr(dst2, src2, cond);
634 } 637 }
635 } 638 }
636 } 639 }
637 640
638 641
639 void MacroAssembler::Strd(Register src1, Register src2, 642 void MacroAssembler::Strd(Register src1, Register src2,
640 const MemOperand& dst, Condition cond) { 643 const MemOperand& dst, Condition cond) {
641 ASSERT(dst.rm().is(no_reg)); 644 ASSERT(dst.rm().is(no_reg));
642 ASSERT(!src1.is(lr)); // r14. 645 ASSERT(!src1.is(lr)); // r14.
643 ASSERT_EQ(0, src1.code() % 2); 646 ASSERT_EQ(0, src1.code() % 2);
644 ASSERT_EQ(src1.code() + 1, src2.code()); 647 ASSERT_EQ(src1.code() + 1, src2.code());
645 648
646 // Generate two str instructions if strd is not available. 649 // Generate two str instructions if strd is not available.
647 if (Isolate::Current()->cpu_features()->IsSupported(ARMv7)) { 650 if (CpuFeatures::IsSupported(ARMv7)) {
648 CpuFeatures::Scope scope(ARMv7); 651 CpuFeatures::Scope scope(ARMv7);
649 strd(src1, src2, dst, cond); 652 strd(src1, src2, dst, cond);
650 } else { 653 } else {
651 MemOperand dst2(dst); 654 MemOperand dst2(dst);
652 dst2.set_offset(dst2.offset() + 4); 655 dst2.set_offset(dst2.offset() + 4);
653 str(src1, dst, cond); 656 str(src1, dst, cond);
654 str(src2, dst2, cond); 657 str(src2, dst2, cond);
655 } 658 }
656 } 659 }
657 660
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1792 0, 1795 0,
1793 1); 1796 1);
1794 if (result->IsFailure()) { 1797 if (result->IsFailure()) {
1795 return result; 1798 return result;
1796 } 1799 }
1797 1800
1798 // HandleScope limit has changed. Delete allocated extensions. 1801 // HandleScope limit has changed. Delete allocated extensions.
1799 bind(&delete_allocated_handles); 1802 bind(&delete_allocated_handles);
1800 str(r5, MemOperand(r7, kLimitOffset)); 1803 str(r5, MemOperand(r7, kLimitOffset));
1801 mov(r4, r0); 1804 mov(r4, r0);
1802 PrepareCallCFunction(0, r5); 1805 PrepareCallCFunction(1, r5);
1806 mov(r0, Operand(ExternalReference::isolate_address()));
1803 CallCFunction( 1807 CallCFunction(
1804 ExternalReference::delete_handle_scope_extensions(isolate()), 0); 1808 ExternalReference::delete_handle_scope_extensions(isolate()), 1);
1805 mov(r0, r4); 1809 mov(r0, r4);
1806 jmp(&leave_exit_frame); 1810 jmp(&leave_exit_frame);
1807 1811
1808 return result; 1812 return result;
1809 } 1813 }
1810 1814
1811 1815
1812 void MacroAssembler::IllegalOperation(int num_arguments) { 1816 void MacroAssembler::IllegalOperation(int num_arguments) {
1813 if (num_arguments > 0) { 1817 if (num_arguments > 0) {
1814 add(sp, sp, Operand(num_arguments * kPointerSize)); 1818 add(sp, sp, Operand(num_arguments * kPointerSize));
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1895 1899
1896 // Tries to get a signed int32 out of a double precision floating point heap 1900 // Tries to get a signed int32 out of a double precision floating point heap
1897 // number. Rounds towards 0. Branch to 'not_int32' if the double is out of the 1901 // number. Rounds towards 0. Branch to 'not_int32' if the double is out of the
1898 // 32bits signed integer range. 1902 // 32bits signed integer range.
1899 void MacroAssembler::ConvertToInt32(Register source, 1903 void MacroAssembler::ConvertToInt32(Register source,
1900 Register dest, 1904 Register dest,
1901 Register scratch, 1905 Register scratch,
1902 Register scratch2, 1906 Register scratch2,
1903 DwVfpRegister double_scratch, 1907 DwVfpRegister double_scratch,
1904 Label *not_int32) { 1908 Label *not_int32) {
1905 if (Isolate::Current()->cpu_features()->IsSupported(VFP3)) { 1909 if (CpuFeatures::IsSupported(VFP3)) {
1906 CpuFeatures::Scope scope(VFP3); 1910 CpuFeatures::Scope scope(VFP3);
1907 sub(scratch, source, Operand(kHeapObjectTag)); 1911 sub(scratch, source, Operand(kHeapObjectTag));
1908 vldr(double_scratch, scratch, HeapNumber::kValueOffset); 1912 vldr(double_scratch, scratch, HeapNumber::kValueOffset);
1909 vcvt_s32_f64(double_scratch.low(), double_scratch); 1913 vcvt_s32_f64(double_scratch.low(), double_scratch);
1910 vmov(dest, double_scratch.low()); 1914 vmov(dest, double_scratch.low());
1911 // Signed vcvt instruction will saturate to the minimum (0x80000000) or 1915 // Signed vcvt instruction will saturate to the minimum (0x80000000) or
1912 // maximun (0x7fffffff) signed 32bits integer when the double is out of 1916 // maximun (0x7fffffff) signed 32bits integer when the double is out of
1913 // range. When substracting one, the minimum signed integer becomes the 1917 // range. When substracting one, the minimum signed integer becomes the
1914 // maximun signed integer. 1918 // maximun signed integer.
1915 sub(scratch, dest, Operand(1)); 1919 sub(scratch, dest, Operand(1));
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1991 } 1995 }
1992 } 1996 }
1993 1997
1994 1998
1995 void MacroAssembler::EmitVFPTruncate(VFPRoundingMode rounding_mode, 1999 void MacroAssembler::EmitVFPTruncate(VFPRoundingMode rounding_mode,
1996 SwVfpRegister result, 2000 SwVfpRegister result,
1997 DwVfpRegister double_input, 2001 DwVfpRegister double_input,
1998 Register scratch1, 2002 Register scratch1,
1999 Register scratch2, 2003 Register scratch2,
2000 CheckForInexactConversion check_inexact) { 2004 CheckForInexactConversion check_inexact) {
2001 ASSERT(Isolate::Current()->cpu_features()->IsSupported(VFP3)); 2005 ASSERT(CpuFeatures::IsSupported(VFP3));
2002 CpuFeatures::Scope scope(VFP3); 2006 CpuFeatures::Scope scope(VFP3);
2003 Register prev_fpscr = scratch1; 2007 Register prev_fpscr = scratch1;
2004 Register scratch = scratch2; 2008 Register scratch = scratch2;
2005 2009
2006 int32_t check_inexact_conversion = 2010 int32_t check_inexact_conversion =
2007 (check_inexact == kCheckForInexactConversion) ? kVFPInexactExceptionBit : 0; 2011 (check_inexact == kCheckForInexactConversion) ? kVFPInexactExceptionBit : 0;
2008 2012
2009 // Set custom FPCSR: 2013 // Set custom FPCSR:
2010 // - Set rounding mode. 2014 // - Set rounding mode.
2011 // - Clear vfp cumulative exception flags. 2015 // - Clear vfp cumulative exception flags.
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
2149 input_high, 2153 input_high,
2150 input_low, 2154 input_low,
2151 scratch); 2155 scratch);
2152 bind(&done); 2156 bind(&done);
2153 } 2157 }
2154 2158
2155 2159
2156 void MacroAssembler::GetLeastBitsFromSmi(Register dst, 2160 void MacroAssembler::GetLeastBitsFromSmi(Register dst,
2157 Register src, 2161 Register src,
2158 int num_least_bits) { 2162 int num_least_bits) {
2159 if (Isolate::Current()->cpu_features()->IsSupported(ARMv7)) { 2163 if (CpuFeatures::IsSupported(ARMv7)) {
2160 ubfx(dst, src, kSmiTagSize, num_least_bits); 2164 ubfx(dst, src, kSmiTagSize, num_least_bits);
2161 } else { 2165 } else {
2162 mov(dst, Operand(src, ASR, kSmiTagSize)); 2166 mov(dst, Operand(src, ASR, kSmiTagSize));
2163 and_(dst, dst, Operand((1 << num_least_bits) - 1)); 2167 and_(dst, dst, Operand((1 << num_least_bits) - 1));
2164 } 2168 }
2165 } 2169 }
2166 2170
2167 2171
2168 void MacroAssembler::GetLeastBitsFromInt32(Register dst, 2172 void MacroAssembler::GetLeastBitsFromInt32(Register dst,
2169 Register src, 2173 Register src,
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
2790 and_(scratch, type, Operand(kFlatAsciiStringMask)); 2794 and_(scratch, type, Operand(kFlatAsciiStringMask));
2791 cmp(scratch, Operand(kFlatAsciiStringTag)); 2795 cmp(scratch, Operand(kFlatAsciiStringTag));
2792 b(ne, failure); 2796 b(ne, failure);
2793 } 2797 }
2794 2798
2795 static const int kRegisterPassedArguments = 4; 2799 static const int kRegisterPassedArguments = 4;
2796 2800
2797 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) { 2801 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) {
2798 int frame_alignment = ActivationFrameAlignment(); 2802 int frame_alignment = ActivationFrameAlignment();
2799 2803
2800 // Reserve space for Isolate address which is always passed as last parameter
2801 num_arguments += 1;
2802
2803 // Up to four simple arguments are passed in registers r0..r3. 2804 // Up to four simple arguments are passed in registers r0..r3.
2804 int stack_passed_arguments = (num_arguments <= kRegisterPassedArguments) ? 2805 int stack_passed_arguments = (num_arguments <= kRegisterPassedArguments) ?
2805 0 : num_arguments - kRegisterPassedArguments; 2806 0 : num_arguments - kRegisterPassedArguments;
2806 if (frame_alignment > kPointerSize) { 2807 if (frame_alignment > kPointerSize) {
2807 // Make stack end at alignment and make room for num_arguments - 4 words 2808 // Make stack end at alignment and make room for num_arguments - 4 words
2808 // and the original value of sp. 2809 // and the original value of sp.
2809 mov(scratch, sp); 2810 mov(scratch, sp);
2810 sub(sp, sp, Operand((stack_passed_arguments + 1) * kPointerSize)); 2811 sub(sp, sp, Operand((stack_passed_arguments + 1) * kPointerSize));
2811 ASSERT(IsPowerOf2(frame_alignment)); 2812 ASSERT(IsPowerOf2(frame_alignment));
2812 and_(sp, sp, Operand(-frame_alignment)); 2813 and_(sp, sp, Operand(-frame_alignment));
(...skipping 16 matching lines...) Expand all
2829 ExternalReference::the_hole_value_location(isolate()), 2830 ExternalReference::the_hole_value_location(isolate()),
2830 scratch, 2831 scratch,
2831 num_arguments); 2832 num_arguments);
2832 } 2833 }
2833 2834
2834 2835
2835 void MacroAssembler::CallCFunctionHelper(Register function, 2836 void MacroAssembler::CallCFunctionHelper(Register function,
2836 ExternalReference function_reference, 2837 ExternalReference function_reference,
2837 Register scratch, 2838 Register scratch,
2838 int num_arguments) { 2839 int num_arguments) {
2839 // Push Isolate address as the last argument.
2840 if (num_arguments < kRegisterPassedArguments) {
2841 Register arg_to_reg[] = {r0, r1, r2, r3};
2842 Register r = arg_to_reg[num_arguments];
2843 mov(r, Operand(ExternalReference::isolate_address()));
2844 } else {
2845 int stack_passed_arguments = num_arguments - kRegisterPassedArguments;
2846 // Push Isolate address on the stack after the arguments.
2847 mov(scratch, Operand(ExternalReference::isolate_address()));
2848 str(scratch, MemOperand(sp, stack_passed_arguments * kPointerSize));
2849 }
2850 num_arguments += 1;
2851
2852 // Make sure that the stack is aligned before calling a C function unless 2840 // Make sure that the stack is aligned before calling a C function unless
2853 // running in the simulator. The simulator has its own alignment check which 2841 // running in the simulator. The simulator has its own alignment check which
2854 // provides more information. 2842 // provides more information.
2855 #if defined(V8_HOST_ARCH_ARM) 2843 #if defined(V8_HOST_ARCH_ARM)
2856 if (emit_debug_code()) { 2844 if (emit_debug_code()) {
2857 int frame_alignment = OS::ActivationFrameAlignment(); 2845 int frame_alignment = OS::ActivationFrameAlignment();
2858 int frame_alignment_mask = frame_alignment - 1; 2846 int frame_alignment_mask = frame_alignment - 1;
2859 if (frame_alignment > kPointerSize) { 2847 if (frame_alignment > kPointerSize) {
2860 ASSERT(IsPowerOf2(frame_alignment)); 2848 ASSERT(IsPowerOf2(frame_alignment));
2861 Label alignment_as_expected; 2849 Label alignment_as_expected;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2904 and_(result, result, Operand(kLdrOffsetMask)); 2892 and_(result, result, Operand(kLdrOffsetMask));
2905 add(result, ldr_location, Operand(result)); 2893 add(result, ldr_location, Operand(result));
2906 add(result, result, Operand(kPCRegOffset)); 2894 add(result, result, Operand(kPCRegOffset));
2907 } 2895 }
2908 2896
2909 2897
2910 CodePatcher::CodePatcher(byte* address, int instructions) 2898 CodePatcher::CodePatcher(byte* address, int instructions)
2911 : address_(address), 2899 : address_(address),
2912 instructions_(instructions), 2900 instructions_(instructions),
2913 size_(instructions * Assembler::kInstrSize), 2901 size_(instructions * Assembler::kInstrSize),
2914 masm_(address, size_ + Assembler::kGap) { 2902 masm_(Isolate::Current(), address, size_ + Assembler::kGap) {
2915 // Create a new macro assembler pointing to the address of the code to patch. 2903 // Create a new macro assembler pointing to the address of the code to patch.
2916 // The size is adjusted with kGap on order for the assembler to generate size 2904 // The size is adjusted with kGap on order for the assembler to generate size
2917 // bytes of instructions without failing with buffer size constraints. 2905 // bytes of instructions without failing with buffer size constraints.
2918 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2906 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2919 } 2907 }
2920 2908
2921 2909
2922 CodePatcher::~CodePatcher() { 2910 CodePatcher::~CodePatcher() {
2923 // Indicate that code has changed. 2911 // Indicate that code has changed.
2924 CPU::FlushICache(address_, size_); 2912 CPU::FlushICache(address_, size_);
(...skipping 17 matching lines...) Expand all
2942 void CodePatcher::EmitCondition(Condition cond) { 2930 void CodePatcher::EmitCondition(Condition cond) {
2943 Instr instr = Assembler::instr_at(masm_.pc_); 2931 Instr instr = Assembler::instr_at(masm_.pc_);
2944 instr = (instr & ~kCondMask) | cond; 2932 instr = (instr & ~kCondMask) | cond;
2945 masm_.emit(instr); 2933 masm_.emit(instr);
2946 } 2934 }
2947 2935
2948 2936
2949 } } // namespace v8::internal 2937 } } // namespace v8::internal
2950 2938
2951 #endif // V8_TARGET_ARCH_ARM 2939 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/arm/regexp-macro-assembler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698