| 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 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 } | 955 } |
| 955 } | 956 } |
| 956 | 957 |
| 957 | 958 |
| 958 void MacroAssembler::InvokeCode(Register code, | 959 void MacroAssembler::InvokeCode(Register code, |
| 959 const ParameterCount& expected, | 960 const ParameterCount& expected, |
| 960 const ParameterCount& actual, | 961 const ParameterCount& actual, |
| 961 InvokeFlag flag, | 962 InvokeFlag flag, |
| 962 const CallWrapper& call_wrapper, | 963 const CallWrapper& call_wrapper, |
| 963 CallKind call_kind) { | 964 CallKind call_kind) { |
| 965 // You can't call a function without a valid frame. |
| 966 ASSERT(flag == JUMP_FUNCTION || has_frame()); |
| 967 |
| 964 Label done; | 968 Label done; |
| 965 | 969 |
| 966 InvokePrologue(expected, actual, Handle<Code>::null(), code, &done, flag, | 970 InvokePrologue(expected, actual, Handle<Code>::null(), code, &done, flag, |
| 967 call_wrapper, call_kind); | 971 call_wrapper, call_kind); |
| 968 if (flag == CALL_FUNCTION) { | 972 if (flag == CALL_FUNCTION) { |
| 969 call_wrapper.BeforeCall(CallSize(code)); | 973 call_wrapper.BeforeCall(CallSize(code)); |
| 970 SetCallKind(r5, call_kind); | 974 SetCallKind(r5, call_kind); |
| 971 Call(code); | 975 Call(code); |
| 972 call_wrapper.AfterCall(); | 976 call_wrapper.AfterCall(); |
| 973 } else { | 977 } else { |
| 974 ASSERT(flag == JUMP_FUNCTION); | 978 ASSERT(flag == JUMP_FUNCTION); |
| 975 SetCallKind(r5, call_kind); | 979 SetCallKind(r5, call_kind); |
| 976 Jump(code); | 980 Jump(code); |
| 977 } | 981 } |
| 978 | 982 |
| 979 // Continue here if InvokePrologue does handle the invocation due to | 983 // Continue here if InvokePrologue does handle the invocation due to |
| 980 // mismatched parameter counts. | 984 // mismatched parameter counts. |
| 981 bind(&done); | 985 bind(&done); |
| 982 } | 986 } |
| 983 | 987 |
| 984 | 988 |
| 985 void MacroAssembler::InvokeCode(Handle<Code> code, | 989 void MacroAssembler::InvokeCode(Handle<Code> code, |
| 986 const ParameterCount& expected, | 990 const ParameterCount& expected, |
| 987 const ParameterCount& actual, | 991 const ParameterCount& actual, |
| 988 RelocInfo::Mode rmode, | 992 RelocInfo::Mode rmode, |
| 989 InvokeFlag flag, | 993 InvokeFlag flag, |
| 990 CallKind call_kind) { | 994 CallKind call_kind) { |
| 995 // You can't call a function without a valid frame. |
| 996 ASSERT(flag == JUMP_FUNCTION || has_frame()); |
| 997 |
| 991 Label done; | 998 Label done; |
| 992 | 999 |
| 993 InvokePrologue(expected, actual, code, no_reg, &done, flag, | 1000 InvokePrologue(expected, actual, code, no_reg, &done, flag, |
| 994 NullCallWrapper(), call_kind); | 1001 NullCallWrapper(), call_kind); |
| 995 if (flag == CALL_FUNCTION) { | 1002 if (flag == CALL_FUNCTION) { |
| 996 SetCallKind(r5, call_kind); | 1003 SetCallKind(r5, call_kind); |
| 997 Call(code, rmode); | 1004 Call(code, rmode); |
| 998 } else { | 1005 } else { |
| 999 SetCallKind(r5, call_kind); | 1006 SetCallKind(r5, call_kind); |
| 1000 Jump(code, rmode); | 1007 Jump(code, rmode); |
| 1001 } | 1008 } |
| 1002 | 1009 |
| 1003 // Continue here if InvokePrologue does handle the invocation due to | 1010 // Continue here if InvokePrologue does handle the invocation due to |
| 1004 // mismatched parameter counts. | 1011 // mismatched parameter counts. |
| 1005 bind(&done); | 1012 bind(&done); |
| 1006 } | 1013 } |
| 1007 | 1014 |
| 1008 | 1015 |
| 1009 void MacroAssembler::InvokeFunction(Register fun, | 1016 void MacroAssembler::InvokeFunction(Register fun, |
| 1010 const ParameterCount& actual, | 1017 const ParameterCount& actual, |
| 1011 InvokeFlag flag, | 1018 InvokeFlag flag, |
| 1012 const CallWrapper& call_wrapper, | 1019 const CallWrapper& call_wrapper, |
| 1013 CallKind call_kind) { | 1020 CallKind call_kind) { |
| 1021 // You can't call a function without a valid frame. |
| 1022 ASSERT(flag == JUMP_FUNCTION || has_frame()); |
| 1023 |
| 1014 // Contract with called JS functions requires that function is passed in r1. | 1024 // Contract with called JS functions requires that function is passed in r1. |
| 1015 ASSERT(fun.is(r1)); | 1025 ASSERT(fun.is(r1)); |
| 1016 | 1026 |
| 1017 Register expected_reg = r2; | 1027 Register expected_reg = r2; |
| 1018 Register code_reg = r3; | 1028 Register code_reg = r3; |
| 1019 | 1029 |
| 1020 ldr(code_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 1030 ldr(code_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
| 1021 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 1031 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
| 1022 ldr(expected_reg, | 1032 ldr(expected_reg, |
| 1023 FieldMemOperand(code_reg, | 1033 FieldMemOperand(code_reg, |
| 1024 SharedFunctionInfo::kFormalParameterCountOffset)); | 1034 SharedFunctionInfo::kFormalParameterCountOffset)); |
| 1025 mov(expected_reg, Operand(expected_reg, ASR, kSmiTagSize)); | 1035 mov(expected_reg, Operand(expected_reg, ASR, kSmiTagSize)); |
| 1026 ldr(code_reg, | 1036 ldr(code_reg, |
| 1027 FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); | 1037 FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
| 1028 | 1038 |
| 1029 ParameterCount expected(expected_reg); | 1039 ParameterCount expected(expected_reg); |
| 1030 InvokeCode(code_reg, expected, actual, flag, call_wrapper, call_kind); | 1040 InvokeCode(code_reg, expected, actual, flag, call_wrapper, call_kind); |
| 1031 } | 1041 } |
| 1032 | 1042 |
| 1033 | 1043 |
| 1034 void MacroAssembler::InvokeFunction(JSFunction* function, | 1044 void MacroAssembler::InvokeFunction(JSFunction* function, |
| 1035 const ParameterCount& actual, | 1045 const ParameterCount& actual, |
| 1036 InvokeFlag flag, | 1046 InvokeFlag flag, |
| 1037 CallKind call_kind) { | 1047 CallKind call_kind) { |
| 1048 // You can't call a function without a valid frame. |
| 1049 ASSERT(flag == JUMP_FUNCTION || has_frame()); |
| 1050 |
| 1038 ASSERT(function->is_compiled()); | 1051 ASSERT(function->is_compiled()); |
| 1039 | 1052 |
| 1040 // Get the function and setup the context. | 1053 // Get the function and setup the context. |
| 1041 mov(r1, Operand(Handle<JSFunction>(function))); | 1054 mov(r1, Operand(Handle<JSFunction>(function))); |
| 1042 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 1055 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
| 1043 | 1056 |
| 1044 // Invoke the cached code. | 1057 // Invoke the cached code. |
| 1045 Handle<Code> code(function->code()); | 1058 Handle<Code> code(function->code()); |
| 1046 ParameterCount expected(function->shared()->formal_parameter_count()); | 1059 ParameterCount expected(function->shared()->formal_parameter_count()); |
| 1047 if (V8::UseCrankshaft()) { | 1060 if (V8::UseCrankshaft()) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1083 | 1096 |
| 1084 ldr(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); | 1097 ldr(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); |
| 1085 ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); | 1098 ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); |
| 1086 tst(scratch, Operand(kIsNotStringMask)); | 1099 tst(scratch, Operand(kIsNotStringMask)); |
| 1087 b(ne, fail); | 1100 b(ne, fail); |
| 1088 } | 1101 } |
| 1089 | 1102 |
| 1090 | 1103 |
| 1091 #ifdef ENABLE_DEBUGGER_SUPPORT | 1104 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 1092 void MacroAssembler::DebugBreak() { | 1105 void MacroAssembler::DebugBreak() { |
| 1093 ASSERT(allow_stub_calls()); | |
| 1094 mov(r0, Operand(0, RelocInfo::NONE)); | 1106 mov(r0, Operand(0, RelocInfo::NONE)); |
| 1095 mov(r1, Operand(ExternalReference(Runtime::kDebugBreak, isolate()))); | 1107 mov(r1, Operand(ExternalReference(Runtime::kDebugBreak, isolate()))); |
| 1096 CEntryStub ces(1); | 1108 CEntryStub ces(1); |
| 1109 ASSERT(AllowThisStubCall(&ces)); |
| 1097 Call(ces.GetCode(), RelocInfo::DEBUG_BREAK); | 1110 Call(ces.GetCode(), RelocInfo::DEBUG_BREAK); |
| 1098 } | 1111 } |
| 1099 #endif | 1112 #endif |
| 1100 | 1113 |
| 1101 | 1114 |
| 1102 void MacroAssembler::PushTryHandler(CodeLocation try_location, | 1115 void MacroAssembler::PushTryHandler(CodeLocation try_location, |
| 1103 HandlerType type) { | 1116 HandlerType type) { |
| 1104 // Adjust this code if not the case. | 1117 // Adjust this code if not the case. |
| 1105 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); | 1118 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); |
| 1106 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0 * kPointerSize); | 1119 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0 * kPointerSize); |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1888 // in initial map. | 1901 // in initial map. |
| 1889 bind(&non_instance); | 1902 bind(&non_instance); |
| 1890 ldr(result, FieldMemOperand(result, Map::kConstructorOffset)); | 1903 ldr(result, FieldMemOperand(result, Map::kConstructorOffset)); |
| 1891 | 1904 |
| 1892 // All done. | 1905 // All done. |
| 1893 bind(&done); | 1906 bind(&done); |
| 1894 } | 1907 } |
| 1895 | 1908 |
| 1896 | 1909 |
| 1897 void MacroAssembler::CallStub(CodeStub* stub, Condition cond) { | 1910 void MacroAssembler::CallStub(CodeStub* stub, Condition cond) { |
| 1898 ASSERT(allow_stub_calls()); // Stub calls are not allowed in some stubs. | 1911 ASSERT(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs. |
| 1899 Call(stub->GetCode(), RelocInfo::CODE_TARGET, kNoASTId, cond); | 1912 Call(stub->GetCode(), RelocInfo::CODE_TARGET, kNoASTId, cond); |
| 1900 } | 1913 } |
| 1901 | 1914 |
| 1902 | 1915 |
| 1903 MaybeObject* MacroAssembler::TryCallStub(CodeStub* stub, Condition cond) { | 1916 MaybeObject* MacroAssembler::TryCallStub(CodeStub* stub, Condition cond) { |
| 1904 ASSERT(allow_stub_calls()); // Stub calls are not allowed in some stubs. | 1917 ASSERT(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs. |
| 1905 Object* result; | 1918 Object* result; |
| 1906 { MaybeObject* maybe_result = stub->TryGetCode(); | 1919 { MaybeObject* maybe_result = stub->TryGetCode(); |
| 1907 if (!maybe_result->ToObject(&result)) return maybe_result; | 1920 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 1908 } | 1921 } |
| 1909 Handle<Code> code(Code::cast(result)); | 1922 Handle<Code> code(Code::cast(result)); |
| 1910 Call(code, RelocInfo::CODE_TARGET, kNoASTId, cond); | 1923 Call(code, RelocInfo::CODE_TARGET, kNoASTId, cond); |
| 1911 return result; | 1924 return result; |
| 1912 } | 1925 } |
| 1913 | 1926 |
| 1914 | 1927 |
| 1915 void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) { | 1928 void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) { |
| 1916 ASSERT(allow_stub_calls()); // Stub calls are not allowed in some stubs. | 1929 ASSERT(stub->CompilingCallsToThisStubIsGCSafe() || allow_stub_calls_); |
| 1917 Jump(stub->GetCode(), RelocInfo::CODE_TARGET, cond); | 1930 Jump(stub->GetCode(), RelocInfo::CODE_TARGET, cond); |
| 1918 } | 1931 } |
| 1919 | 1932 |
| 1920 | 1933 |
| 1921 MaybeObject* MacroAssembler::TryTailCallStub(CodeStub* stub, Condition cond) { | 1934 MaybeObject* MacroAssembler::TryTailCallStub(CodeStub* stub, Condition cond) { |
| 1922 ASSERT(allow_stub_calls()); // Stub calls are not allowed in some stubs. | |
| 1923 Object* result; | 1935 Object* result; |
| 1924 { MaybeObject* maybe_result = stub->TryGetCode(); | 1936 { MaybeObject* maybe_result = stub->TryGetCode(); |
| 1925 if (!maybe_result->ToObject(&result)) return maybe_result; | 1937 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 1926 } | 1938 } |
| 1927 Jump(Handle<Code>(Code::cast(result)), RelocInfo::CODE_TARGET, cond); | 1939 Jump(Handle<Code>(Code::cast(result)), RelocInfo::CODE_TARGET, cond); |
| 1928 return result; | 1940 return result; |
| 1929 } | 1941 } |
| 1930 | 1942 |
| 1931 | 1943 |
| 1932 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { | 1944 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2015 mov(r0, Operand(ExternalReference::isolate_address())); | 2027 mov(r0, Operand(ExternalReference::isolate_address())); |
| 2016 CallCFunction( | 2028 CallCFunction( |
| 2017 ExternalReference::delete_handle_scope_extensions(isolate()), 1); | 2029 ExternalReference::delete_handle_scope_extensions(isolate()), 1); |
| 2018 mov(r0, r4); | 2030 mov(r0, r4); |
| 2019 jmp(&leave_exit_frame); | 2031 jmp(&leave_exit_frame); |
| 2020 | 2032 |
| 2021 return result; | 2033 return result; |
| 2022 } | 2034 } |
| 2023 | 2035 |
| 2024 | 2036 |
| 2037 bool MacroAssembler::AllowThisStubCall(CodeStub* stub) { |
| 2038 if (!has_frame_ && stub->SometimesSetsUpAFrame()) return false; |
| 2039 return stub->CompilingCallsToThisStubIsGCSafe() || allow_stub_calls_; |
| 2040 } |
| 2041 |
| 2042 |
| 2025 void MacroAssembler::IllegalOperation(int num_arguments) { | 2043 void MacroAssembler::IllegalOperation(int num_arguments) { |
| 2026 if (num_arguments > 0) { | 2044 if (num_arguments > 0) { |
| 2027 add(sp, sp, Operand(num_arguments * kPointerSize)); | 2045 add(sp, sp, Operand(num_arguments * kPointerSize)); |
| 2028 } | 2046 } |
| 2029 LoadRoot(r0, Heap::kUndefinedValueRootIndex); | 2047 LoadRoot(r0, Heap::kUndefinedValueRootIndex); |
| 2030 } | 2048 } |
| 2031 | 2049 |
| 2032 | 2050 |
| 2033 void MacroAssembler::IndexFromHash(Register hash, Register index) { | 2051 void MacroAssembler::IndexFromHash(Register hash, Register index) { |
| 2034 // If the hash field contains an array index pick it out. The assert checks | 2052 // 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... |
| 2484 #endif | 2502 #endif |
| 2485 mov(r1, Operand(builtin)); | 2503 mov(r1, Operand(builtin)); |
| 2486 CEntryStub stub(1); | 2504 CEntryStub stub(1); |
| 2487 return TryTailCallStub(&stub); | 2505 return TryTailCallStub(&stub); |
| 2488 } | 2506 } |
| 2489 | 2507 |
| 2490 | 2508 |
| 2491 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, | 2509 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, |
| 2492 InvokeFlag flag, | 2510 InvokeFlag flag, |
| 2493 const CallWrapper& call_wrapper) { | 2511 const CallWrapper& call_wrapper) { |
| 2512 // You can't call a builtin without a valid frame. |
| 2513 ASSERT(flag == JUMP_FUNCTION || has_frame()); |
| 2514 |
| 2494 GetBuiltinEntry(r2, id); | 2515 GetBuiltinEntry(r2, id); |
| 2495 if (flag == CALL_FUNCTION) { | 2516 if (flag == CALL_FUNCTION) { |
| 2496 call_wrapper.BeforeCall(CallSize(r2)); | 2517 call_wrapper.BeforeCall(CallSize(r2)); |
| 2497 SetCallKind(r5, CALL_AS_METHOD); | 2518 SetCallKind(r5, CALL_AS_METHOD); |
| 2498 Call(r2); | 2519 Call(r2); |
| 2499 call_wrapper.AfterCall(); | 2520 call_wrapper.AfterCall(); |
| 2500 } else { | 2521 } else { |
| 2501 ASSERT(flag == JUMP_FUNCTION); | 2522 ASSERT(flag == JUMP_FUNCTION); |
| 2502 SetCallKind(r5, CALL_AS_METHOD); | 2523 SetCallKind(r5, CALL_AS_METHOD); |
| 2503 Jump(r2); | 2524 Jump(r2); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2615 // from the real pointer as a smi. | 2636 // from the real pointer as a smi. |
| 2616 intptr_t p1 = reinterpret_cast<intptr_t>(msg); | 2637 intptr_t p1 = reinterpret_cast<intptr_t>(msg); |
| 2617 intptr_t p0 = (p1 & ~kSmiTagMask) + kSmiTag; | 2638 intptr_t p0 = (p1 & ~kSmiTagMask) + kSmiTag; |
| 2618 ASSERT(reinterpret_cast<Object*>(p0)->IsSmi()); | 2639 ASSERT(reinterpret_cast<Object*>(p0)->IsSmi()); |
| 2619 #ifdef DEBUG | 2640 #ifdef DEBUG |
| 2620 if (msg != NULL) { | 2641 if (msg != NULL) { |
| 2621 RecordComment("Abort message: "); | 2642 RecordComment("Abort message: "); |
| 2622 RecordComment(msg); | 2643 RecordComment(msg); |
| 2623 } | 2644 } |
| 2624 #endif | 2645 #endif |
| 2625 // Disable stub call restrictions to always allow calls to abort. | |
| 2626 AllowStubCallsScope allow_scope(this, true); | |
| 2627 | 2646 |
| 2628 mov(r0, Operand(p0)); | 2647 mov(r0, Operand(p0)); |
| 2629 push(r0); | 2648 push(r0); |
| 2630 mov(r0, Operand(Smi::FromInt(p1 - p0))); | 2649 mov(r0, Operand(Smi::FromInt(p1 - p0))); |
| 2631 push(r0); | 2650 push(r0); |
| 2632 CallRuntime(Runtime::kAbort, 2); | 2651 // Disable stub call restrictions to always allow calls to abort. |
| 2652 if (!has_frame_) { |
| 2653 // We don't actually want to generate a pile of code for this, so just |
| 2654 // claim there is a stack frame, without generating one. |
| 2655 FrameScope scope(this, StackFrame::NONE); |
| 2656 CallRuntime(Runtime::kAbort, 2); |
| 2657 } else { |
| 2658 CallRuntime(Runtime::kAbort, 2); |
| 2659 } |
| 2633 // will not return here | 2660 // will not return here |
| 2634 if (is_const_pool_blocked()) { | 2661 if (is_const_pool_blocked()) { |
| 2635 // If the calling code cares about the exact number of | 2662 // If the calling code cares about the exact number of |
| 2636 // instructions generated, we insert padding here to keep the size | 2663 // instructions generated, we insert padding here to keep the size |
| 2637 // of the Abort macro constant. | 2664 // of the Abort macro constant. |
| 2638 static const int kExpectedAbortInstructions = 10; | 2665 static const int kExpectedAbortInstructions = 10; |
| 2639 int abort_instructions = InstructionsGeneratedSince(&abort_start); | 2666 int abort_instructions = InstructionsGeneratedSince(&abort_start); |
| 2640 ASSERT(abort_instructions <= kExpectedAbortInstructions); | 2667 ASSERT(abort_instructions <= kExpectedAbortInstructions); |
| 2641 while (abort_instructions++ < kExpectedAbortInstructions) { | 2668 while (abort_instructions++ < kExpectedAbortInstructions) { |
| 2642 nop(); | 2669 nop(); |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3120 int num_arguments) { | 3147 int num_arguments) { |
| 3121 CallCFunction(function, scratch, num_arguments, 0); | 3148 CallCFunction(function, scratch, num_arguments, 0); |
| 3122 } | 3149 } |
| 3123 | 3150 |
| 3124 | 3151 |
| 3125 void MacroAssembler::CallCFunctionHelper(Register function, | 3152 void MacroAssembler::CallCFunctionHelper(Register function, |
| 3126 ExternalReference function_reference, | 3153 ExternalReference function_reference, |
| 3127 Register scratch, | 3154 Register scratch, |
| 3128 int num_reg_arguments, | 3155 int num_reg_arguments, |
| 3129 int num_double_arguments) { | 3156 int num_double_arguments) { |
| 3157 ASSERT(has_frame()); |
| 3130 // Make sure that the stack is aligned before calling a C function unless | 3158 // Make sure that the stack is aligned before calling a C function unless |
| 3131 // running in the simulator. The simulator has its own alignment check which | 3159 // running in the simulator. The simulator has its own alignment check which |
| 3132 // provides more information. | 3160 // provides more information. |
| 3133 #if defined(V8_HOST_ARCH_ARM) | 3161 #if defined(V8_HOST_ARCH_ARM) |
| 3134 if (emit_debug_code()) { | 3162 if (emit_debug_code()) { |
| 3135 int frame_alignment = OS::ActivationFrameAlignment(); | 3163 int frame_alignment = OS::ActivationFrameAlignment(); |
| 3136 int frame_alignment_mask = frame_alignment - 1; | 3164 int frame_alignment_mask = frame_alignment - 1; |
| 3137 if (frame_alignment > kPointerSize) { | 3165 if (frame_alignment > kPointerSize) { |
| 3138 ASSERT(IsPowerOf2(frame_alignment)); | 3166 ASSERT(IsPowerOf2(frame_alignment)); |
| 3139 Label alignment_as_expected; | 3167 Label alignment_as_expected; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3269 void CodePatcher::EmitCondition(Condition cond) { | 3297 void CodePatcher::EmitCondition(Condition cond) { |
| 3270 Instr instr = Assembler::instr_at(masm_.pc_); | 3298 Instr instr = Assembler::instr_at(masm_.pc_); |
| 3271 instr = (instr & ~kCondMask) | cond; | 3299 instr = (instr & ~kCondMask) | cond; |
| 3272 masm_.emit(instr); | 3300 masm_.emit(instr); |
| 3273 } | 3301 } |
| 3274 | 3302 |
| 3275 | 3303 |
| 3276 } } // namespace v8::internal | 3304 } } // namespace v8::internal |
| 3277 | 3305 |
| 3278 #endif // V8_TARGET_ARCH_ARM | 3306 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |