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 24 matching lines...) Expand all Loading... |
35 #include "codegen.h" | 35 #include "codegen.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(Isolate* arg_isolate, void* buffer, int size) | 42 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) |
43 : Assembler(arg_isolate, 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 has_frame_(false) { | |
47 if (isolate() != NULL) { | 46 if (isolate() != NULL) { |
48 code_object_ = Handle<Object>(isolate()->heap()->undefined_value(), | 47 code_object_ = Handle<Object>(isolate()->heap()->undefined_value(), |
49 isolate()); | 48 isolate()); |
50 } | 49 } |
51 } | 50 } |
52 | 51 |
53 | 52 |
54 // 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 |
55 // thumb, so we require inter-working support | 54 // thumb, so we require inter-working support |
56 #if defined(__thumb__) && !defined(USE_THUMB_INTERWORK) | 55 #if defined(__thumb__) && !defined(USE_THUMB_INTERWORK) |
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 } | 969 } |
971 } | 970 } |
972 | 971 |
973 | 972 |
974 void MacroAssembler::InvokeCode(Register code, | 973 void MacroAssembler::InvokeCode(Register code, |
975 const ParameterCount& expected, | 974 const ParameterCount& expected, |
976 const ParameterCount& actual, | 975 const ParameterCount& actual, |
977 InvokeFlag flag, | 976 InvokeFlag flag, |
978 const CallWrapper& call_wrapper, | 977 const CallWrapper& call_wrapper, |
979 CallKind call_kind) { | 978 CallKind call_kind) { |
980 // You can't call a function without a valid frame. | |
981 ASSERT(flag == JUMP_FUNCTION || has_frame()); | |
982 | |
983 Label done; | 979 Label done; |
984 | 980 |
985 InvokePrologue(expected, actual, Handle<Code>::null(), code, &done, flag, | 981 InvokePrologue(expected, actual, Handle<Code>::null(), code, &done, flag, |
986 call_wrapper, call_kind); | 982 call_wrapper, call_kind); |
987 if (flag == CALL_FUNCTION) { | 983 if (flag == CALL_FUNCTION) { |
988 call_wrapper.BeforeCall(CallSize(code)); | 984 call_wrapper.BeforeCall(CallSize(code)); |
989 SetCallKind(r5, call_kind); | 985 SetCallKind(r5, call_kind); |
990 Call(code); | 986 Call(code); |
991 call_wrapper.AfterCall(); | 987 call_wrapper.AfterCall(); |
992 } else { | 988 } else { |
993 ASSERT(flag == JUMP_FUNCTION); | 989 ASSERT(flag == JUMP_FUNCTION); |
994 SetCallKind(r5, call_kind); | 990 SetCallKind(r5, call_kind); |
995 Jump(code); | 991 Jump(code); |
996 } | 992 } |
997 | 993 |
998 // Continue here if InvokePrologue does handle the invocation due to | 994 // Continue here if InvokePrologue does handle the invocation due to |
999 // mismatched parameter counts. | 995 // mismatched parameter counts. |
1000 bind(&done); | 996 bind(&done); |
1001 } | 997 } |
1002 | 998 |
1003 | 999 |
1004 void MacroAssembler::InvokeCode(Handle<Code> code, | 1000 void MacroAssembler::InvokeCode(Handle<Code> code, |
1005 const ParameterCount& expected, | 1001 const ParameterCount& expected, |
1006 const ParameterCount& actual, | 1002 const ParameterCount& actual, |
1007 RelocInfo::Mode rmode, | 1003 RelocInfo::Mode rmode, |
1008 InvokeFlag flag, | 1004 InvokeFlag flag, |
1009 CallKind call_kind) { | 1005 CallKind call_kind) { |
1010 // You can't call a function without a valid frame. | |
1011 ASSERT(flag == JUMP_FUNCTION || has_frame()); | |
1012 | |
1013 Label done; | 1006 Label done; |
1014 | 1007 |
1015 InvokePrologue(expected, actual, code, no_reg, &done, flag, | 1008 InvokePrologue(expected, actual, code, no_reg, &done, flag, |
1016 NullCallWrapper(), call_kind); | 1009 NullCallWrapper(), call_kind); |
1017 if (flag == CALL_FUNCTION) { | 1010 if (flag == CALL_FUNCTION) { |
1018 SetCallKind(r5, call_kind); | 1011 SetCallKind(r5, call_kind); |
1019 Call(code, rmode); | 1012 Call(code, rmode); |
1020 } else { | 1013 } else { |
1021 SetCallKind(r5, call_kind); | 1014 SetCallKind(r5, call_kind); |
1022 Jump(code, rmode); | 1015 Jump(code, rmode); |
1023 } | 1016 } |
1024 | 1017 |
1025 // Continue here if InvokePrologue does handle the invocation due to | 1018 // Continue here if InvokePrologue does handle the invocation due to |
1026 // mismatched parameter counts. | 1019 // mismatched parameter counts. |
1027 bind(&done); | 1020 bind(&done); |
1028 } | 1021 } |
1029 | 1022 |
1030 | 1023 |
1031 void MacroAssembler::InvokeFunction(Register fun, | 1024 void MacroAssembler::InvokeFunction(Register fun, |
1032 const ParameterCount& actual, | 1025 const ParameterCount& actual, |
1033 InvokeFlag flag, | 1026 InvokeFlag flag, |
1034 const CallWrapper& call_wrapper, | 1027 const CallWrapper& call_wrapper, |
1035 CallKind call_kind) { | 1028 CallKind call_kind) { |
1036 // You can't call a function without a valid frame. | |
1037 ASSERT(flag == JUMP_FUNCTION || has_frame()); | |
1038 | |
1039 // Contract with called JS functions requires that function is passed in r1. | 1029 // Contract with called JS functions requires that function is passed in r1. |
1040 ASSERT(fun.is(r1)); | 1030 ASSERT(fun.is(r1)); |
1041 | 1031 |
1042 Register expected_reg = r2; | 1032 Register expected_reg = r2; |
1043 Register code_reg = r3; | 1033 Register code_reg = r3; |
1044 | 1034 |
1045 ldr(code_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 1035 ldr(code_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
1046 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 1036 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
1047 ldr(expected_reg, | 1037 ldr(expected_reg, |
1048 FieldMemOperand(code_reg, | 1038 FieldMemOperand(code_reg, |
1049 SharedFunctionInfo::kFormalParameterCountOffset)); | 1039 SharedFunctionInfo::kFormalParameterCountOffset)); |
1050 mov(expected_reg, Operand(expected_reg, ASR, kSmiTagSize)); | 1040 mov(expected_reg, Operand(expected_reg, ASR, kSmiTagSize)); |
1051 ldr(code_reg, | 1041 ldr(code_reg, |
1052 FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); | 1042 FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
1053 | 1043 |
1054 ParameterCount expected(expected_reg); | 1044 ParameterCount expected(expected_reg); |
1055 InvokeCode(code_reg, expected, actual, flag, call_wrapper, call_kind); | 1045 InvokeCode(code_reg, expected, actual, flag, call_wrapper, call_kind); |
1056 } | 1046 } |
1057 | 1047 |
1058 | 1048 |
1059 void MacroAssembler::InvokeFunction(JSFunction* function, | 1049 void MacroAssembler::InvokeFunction(JSFunction* function, |
1060 const ParameterCount& actual, | 1050 const ParameterCount& actual, |
1061 InvokeFlag flag, | 1051 InvokeFlag flag, |
1062 CallKind call_kind) { | 1052 CallKind call_kind) { |
1063 // You can't call a function without a valid frame. | |
1064 ASSERT(flag == JUMP_FUNCTION || has_frame()); | |
1065 | |
1066 ASSERT(function->is_compiled()); | 1053 ASSERT(function->is_compiled()); |
1067 | 1054 |
1068 // Get the function and setup the context. | 1055 // Get the function and setup the context. |
1069 mov(r1, Operand(Handle<JSFunction>(function))); | 1056 mov(r1, Operand(Handle<JSFunction>(function))); |
1070 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 1057 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
1071 | 1058 |
1072 // Invoke the cached code. | 1059 // Invoke the cached code. |
1073 Handle<Code> code(function->code()); | 1060 Handle<Code> code(function->code()); |
1074 ParameterCount expected(function->shared()->formal_parameter_count()); | 1061 ParameterCount expected(function->shared()->formal_parameter_count()); |
1075 if (V8::UseCrankshaft()) { | 1062 if (V8::UseCrankshaft()) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 | 1098 |
1112 ldr(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); | 1099 ldr(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); |
1113 ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); | 1100 ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); |
1114 tst(scratch, Operand(kIsNotStringMask)); | 1101 tst(scratch, Operand(kIsNotStringMask)); |
1115 b(ne, fail); | 1102 b(ne, fail); |
1116 } | 1103 } |
1117 | 1104 |
1118 | 1105 |
1119 #ifdef ENABLE_DEBUGGER_SUPPORT | 1106 #ifdef ENABLE_DEBUGGER_SUPPORT |
1120 void MacroAssembler::DebugBreak() { | 1107 void MacroAssembler::DebugBreak() { |
| 1108 ASSERT(allow_stub_calls()); |
1121 mov(r0, Operand(0, RelocInfo::NONE)); | 1109 mov(r0, Operand(0, RelocInfo::NONE)); |
1122 mov(r1, Operand(ExternalReference(Runtime::kDebugBreak, isolate()))); | 1110 mov(r1, Operand(ExternalReference(Runtime::kDebugBreak, isolate()))); |
1123 CEntryStub ces(1); | 1111 CEntryStub ces(1); |
1124 ASSERT(AllowThisStubCall(&ces)); | |
1125 Call(ces.GetCode(), RelocInfo::DEBUG_BREAK); | 1112 Call(ces.GetCode(), RelocInfo::DEBUG_BREAK); |
1126 } | 1113 } |
1127 #endif | 1114 #endif |
1128 | 1115 |
1129 | 1116 |
1130 void MacroAssembler::PushTryHandler(CodeLocation try_location, | 1117 void MacroAssembler::PushTryHandler(CodeLocation try_location, |
1131 HandlerType type) { | 1118 HandlerType type) { |
1132 // Adjust this code if not the case. | 1119 // Adjust this code if not the case. |
1133 ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize); | 1120 ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize); |
1134 // The pc (return address) is passed in register lr. | 1121 // The pc (return address) is passed in register lr. |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1778 // in initial map. | 1765 // in initial map. |
1779 bind(&non_instance); | 1766 bind(&non_instance); |
1780 ldr(result, FieldMemOperand(result, Map::kConstructorOffset)); | 1767 ldr(result, FieldMemOperand(result, Map::kConstructorOffset)); |
1781 | 1768 |
1782 // All done. | 1769 // All done. |
1783 bind(&done); | 1770 bind(&done); |
1784 } | 1771 } |
1785 | 1772 |
1786 | 1773 |
1787 void MacroAssembler::CallStub(CodeStub* stub, Condition cond) { | 1774 void MacroAssembler::CallStub(CodeStub* stub, Condition cond) { |
1788 ASSERT(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs. | 1775 ASSERT(allow_stub_calls()); // Stub calls are not allowed in some stubs. |
1789 Call(stub->GetCode(), RelocInfo::CODE_TARGET, cond); | 1776 Call(stub->GetCode(), RelocInfo::CODE_TARGET, cond); |
1790 } | 1777 } |
1791 | 1778 |
1792 | 1779 |
1793 MaybeObject* MacroAssembler::TryCallStub(CodeStub* stub, Condition cond) { | 1780 MaybeObject* MacroAssembler::TryCallStub(CodeStub* stub, Condition cond) { |
1794 ASSERT(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs. | 1781 ASSERT(allow_stub_calls()); // Stub calls are not allowed in some stubs. |
1795 Object* result; | 1782 Object* result; |
1796 { MaybeObject* maybe_result = stub->TryGetCode(); | 1783 { MaybeObject* maybe_result = stub->TryGetCode(); |
1797 if (!maybe_result->ToObject(&result)) return maybe_result; | 1784 if (!maybe_result->ToObject(&result)) return maybe_result; |
1798 } | 1785 } |
1799 Call(Handle<Code>(Code::cast(result)), RelocInfo::CODE_TARGET, cond); | 1786 Call(Handle<Code>(Code::cast(result)), RelocInfo::CODE_TARGET, cond); |
1800 return result; | 1787 return result; |
1801 } | 1788 } |
1802 | 1789 |
1803 | 1790 |
1804 void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) { | 1791 void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) { |
1805 ASSERT(stub->CompilingCallsToThisStubIsGCSafe() || allow_stub_calls_); | 1792 ASSERT(allow_stub_calls()); // Stub calls are not allowed in some stubs. |
1806 Jump(stub->GetCode(), RelocInfo::CODE_TARGET, cond); | 1793 Jump(stub->GetCode(), RelocInfo::CODE_TARGET, cond); |
1807 } | 1794 } |
1808 | 1795 |
1809 | 1796 |
1810 MaybeObject* MacroAssembler::TryTailCallStub(CodeStub* stub, Condition cond) { | 1797 MaybeObject* MacroAssembler::TryTailCallStub(CodeStub* stub, Condition cond) { |
| 1798 ASSERT(allow_stub_calls()); // Stub calls are not allowed in some stubs. |
1811 Object* result; | 1799 Object* result; |
1812 { MaybeObject* maybe_result = stub->TryGetCode(); | 1800 { MaybeObject* maybe_result = stub->TryGetCode(); |
1813 if (!maybe_result->ToObject(&result)) return maybe_result; | 1801 if (!maybe_result->ToObject(&result)) return maybe_result; |
1814 } | 1802 } |
1815 Jump(Handle<Code>(Code::cast(result)), RelocInfo::CODE_TARGET, cond); | 1803 Jump(Handle<Code>(Code::cast(result)), RelocInfo::CODE_TARGET, cond); |
1816 return result; | 1804 return result; |
1817 } | 1805 } |
1818 | 1806 |
1819 | 1807 |
1820 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { | 1808 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1903 mov(r0, Operand(ExternalReference::isolate_address())); | 1891 mov(r0, Operand(ExternalReference::isolate_address())); |
1904 CallCFunction( | 1892 CallCFunction( |
1905 ExternalReference::delete_handle_scope_extensions(isolate()), 1); | 1893 ExternalReference::delete_handle_scope_extensions(isolate()), 1); |
1906 mov(r0, r4); | 1894 mov(r0, r4); |
1907 jmp(&leave_exit_frame); | 1895 jmp(&leave_exit_frame); |
1908 | 1896 |
1909 return result; | 1897 return result; |
1910 } | 1898 } |
1911 | 1899 |
1912 | 1900 |
1913 bool MacroAssembler::AllowThisStubCall(CodeStub* stub) { | |
1914 if (!has_frame_ && stub->SometimesSetsUpAFrame()) return false; | |
1915 return stub->CompilingCallsToThisStubIsGCSafe() || allow_stub_calls_; | |
1916 } | |
1917 | |
1918 | |
1919 void MacroAssembler::IllegalOperation(int num_arguments) { | 1901 void MacroAssembler::IllegalOperation(int num_arguments) { |
1920 if (num_arguments > 0) { | 1902 if (num_arguments > 0) { |
1921 add(sp, sp, Operand(num_arguments * kPointerSize)); | 1903 add(sp, sp, Operand(num_arguments * kPointerSize)); |
1922 } | 1904 } |
1923 LoadRoot(r0, Heap::kUndefinedValueRootIndex); | 1905 LoadRoot(r0, Heap::kUndefinedValueRootIndex); |
1924 } | 1906 } |
1925 | 1907 |
1926 | 1908 |
1927 void MacroAssembler::IndexFromHash(Register hash, Register index) { | 1909 void MacroAssembler::IndexFromHash(Register hash, Register index) { |
1928 // If the hash field contains an array index pick it out. The assert checks | 1910 // If the hash field contains an array index pick it out. The assert checks |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2378 #endif | 2360 #endif |
2379 mov(r1, Operand(builtin)); | 2361 mov(r1, Operand(builtin)); |
2380 CEntryStub stub(1); | 2362 CEntryStub stub(1); |
2381 return TryTailCallStub(&stub); | 2363 return TryTailCallStub(&stub); |
2382 } | 2364 } |
2383 | 2365 |
2384 | 2366 |
2385 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, | 2367 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, |
2386 InvokeFlag flag, | 2368 InvokeFlag flag, |
2387 const CallWrapper& call_wrapper) { | 2369 const CallWrapper& call_wrapper) { |
2388 // You can't call a builtin without a valid frame. | |
2389 ASSERT(flag == JUMP_FUNCTION || has_frame()); | |
2390 | |
2391 GetBuiltinEntry(r2, id); | 2370 GetBuiltinEntry(r2, id); |
2392 if (flag == CALL_FUNCTION) { | 2371 if (flag == CALL_FUNCTION) { |
2393 call_wrapper.BeforeCall(CallSize(r2)); | 2372 call_wrapper.BeforeCall(CallSize(r2)); |
2394 SetCallKind(r5, CALL_AS_METHOD); | 2373 SetCallKind(r5, CALL_AS_METHOD); |
2395 Call(r2); | 2374 Call(r2); |
2396 call_wrapper.AfterCall(); | 2375 call_wrapper.AfterCall(); |
2397 } else { | 2376 } else { |
2398 ASSERT(flag == JUMP_FUNCTION); | 2377 ASSERT(flag == JUMP_FUNCTION); |
2399 SetCallKind(r5, CALL_AS_METHOD); | 2378 SetCallKind(r5, CALL_AS_METHOD); |
2400 Jump(r2); | 2379 Jump(r2); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2509 // from the real pointer as a smi. | 2488 // from the real pointer as a smi. |
2510 intptr_t p1 = reinterpret_cast<intptr_t>(msg); | 2489 intptr_t p1 = reinterpret_cast<intptr_t>(msg); |
2511 intptr_t p0 = (p1 & ~kSmiTagMask) + kSmiTag; | 2490 intptr_t p0 = (p1 & ~kSmiTagMask) + kSmiTag; |
2512 ASSERT(reinterpret_cast<Object*>(p0)->IsSmi()); | 2491 ASSERT(reinterpret_cast<Object*>(p0)->IsSmi()); |
2513 #ifdef DEBUG | 2492 #ifdef DEBUG |
2514 if (msg != NULL) { | 2493 if (msg != NULL) { |
2515 RecordComment("Abort message: "); | 2494 RecordComment("Abort message: "); |
2516 RecordComment(msg); | 2495 RecordComment(msg); |
2517 } | 2496 } |
2518 #endif | 2497 #endif |
| 2498 // Disable stub call restrictions to always allow calls to abort. |
| 2499 AllowStubCallsScope allow_scope(this, true); |
2519 | 2500 |
2520 mov(r0, Operand(p0)); | 2501 mov(r0, Operand(p0)); |
2521 push(r0); | 2502 push(r0); |
2522 mov(r0, Operand(Smi::FromInt(p1 - p0))); | 2503 mov(r0, Operand(Smi::FromInt(p1 - p0))); |
2523 push(r0); | 2504 push(r0); |
2524 // Disable stub call restrictions to always allow calls to abort. | 2505 CallRuntime(Runtime::kAbort, 2); |
2525 if (!has_frame_) { | |
2526 // We don't actually want to generate a pile of code for this, so just | |
2527 // claim there is a stack frame, without generating one. | |
2528 FrameScope scope(this, StackFrame::NONE); | |
2529 CallRuntime(Runtime::kAbort, 2); | |
2530 } else { | |
2531 CallRuntime(Runtime::kAbort, 2); | |
2532 } | |
2533 // will not return here | 2506 // will not return here |
2534 if (is_const_pool_blocked()) { | 2507 if (is_const_pool_blocked()) { |
2535 // If the calling code cares about the exact number of | 2508 // If the calling code cares about the exact number of |
2536 // instructions generated, we insert padding here to keep the size | 2509 // instructions generated, we insert padding here to keep the size |
2537 // of the Abort macro constant. | 2510 // of the Abort macro constant. |
2538 static const int kExpectedAbortInstructions = 10; | 2511 static const int kExpectedAbortInstructions = 10; |
2539 int abort_instructions = InstructionsGeneratedSince(&abort_start); | 2512 int abort_instructions = InstructionsGeneratedSince(&abort_start); |
2540 ASSERT(abort_instructions <= kExpectedAbortInstructions); | 2513 ASSERT(abort_instructions <= kExpectedAbortInstructions); |
2541 while (abort_instructions++ < kExpectedAbortInstructions) { | 2514 while (abort_instructions++ < kExpectedAbortInstructions) { |
2542 nop(); | 2515 nop(); |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3035 int num_arguments) { | 3008 int num_arguments) { |
3036 CallCFunction(function, scratch, num_arguments, 0); | 3009 CallCFunction(function, scratch, num_arguments, 0); |
3037 } | 3010 } |
3038 | 3011 |
3039 | 3012 |
3040 void MacroAssembler::CallCFunctionHelper(Register function, | 3013 void MacroAssembler::CallCFunctionHelper(Register function, |
3041 ExternalReference function_reference, | 3014 ExternalReference function_reference, |
3042 Register scratch, | 3015 Register scratch, |
3043 int num_reg_arguments, | 3016 int num_reg_arguments, |
3044 int num_double_arguments) { | 3017 int num_double_arguments) { |
3045 ASSERT(has_frame()); | |
3046 // Make sure that the stack is aligned before calling a C function unless | 3018 // Make sure that the stack is aligned before calling a C function unless |
3047 // running in the simulator. The simulator has its own alignment check which | 3019 // running in the simulator. The simulator has its own alignment check which |
3048 // provides more information. | 3020 // provides more information. |
3049 #if defined(V8_HOST_ARCH_ARM) | 3021 #if defined(V8_HOST_ARCH_ARM) |
3050 if (emit_debug_code()) { | 3022 if (emit_debug_code()) { |
3051 int frame_alignment = OS::ActivationFrameAlignment(); | 3023 int frame_alignment = OS::ActivationFrameAlignment(); |
3052 int frame_alignment_mask = frame_alignment - 1; | 3024 int frame_alignment_mask = frame_alignment - 1; |
3053 if (frame_alignment > kPointerSize) { | 3025 if (frame_alignment > kPointerSize) { |
3054 ASSERT(IsPowerOf2(frame_alignment)); | 3026 ASSERT(IsPowerOf2(frame_alignment)); |
3055 Label alignment_as_expected; | 3027 Label alignment_as_expected; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3185 void CodePatcher::EmitCondition(Condition cond) { | 3157 void CodePatcher::EmitCondition(Condition cond) { |
3186 Instr instr = Assembler::instr_at(masm_.pc_); | 3158 Instr instr = Assembler::instr_at(masm_.pc_); |
3187 instr = (instr & ~kCondMask) | cond; | 3159 instr = (instr & ~kCondMask) | cond; |
3188 masm_.emit(instr); | 3160 masm_.emit(instr); |
3189 } | 3161 } |
3190 | 3162 |
3191 | 3163 |
3192 } } // namespace v8::internal | 3164 } } // namespace v8::internal |
3193 | 3165 |
3194 #endif // V8_TARGET_ARCH_ARM | 3166 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |