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