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

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

Issue 6909026: Additional minor cleanup regarding CallWrapper: Use the null object pattern. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 7 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/assembler.h » ('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 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 } 879 }
880 } 880 }
881 881
882 882
883 void MacroAssembler::InvokePrologue(const ParameterCount& expected, 883 void MacroAssembler::InvokePrologue(const ParameterCount& expected,
884 const ParameterCount& actual, 884 const ParameterCount& actual,
885 Handle<Code> code_constant, 885 Handle<Code> code_constant,
886 Register code_reg, 886 Register code_reg,
887 Label* done, 887 Label* done,
888 InvokeFlag flag, 888 InvokeFlag flag,
889 CallWrapper* call_wrapper) { 889 const CallWrapper& call_wrapper) {
890 bool definitely_matches = false; 890 bool definitely_matches = false;
891 Label regular_invoke; 891 Label regular_invoke;
892 892
893 // Check whether the expected and actual arguments count match. If not, 893 // Check whether the expected and actual arguments count match. If not,
894 // setup registers according to contract with ArgumentsAdaptorTrampoline: 894 // setup registers according to contract with ArgumentsAdaptorTrampoline:
895 // r0: actual arguments count 895 // r0: actual arguments count
896 // r1: function (passed through to callee) 896 // r1: function (passed through to callee)
897 // r2: expected arguments count 897 // r2: expected arguments count
898 // r3: callee code entry 898 // r3: callee code entry
899 899
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 934
935 if (!definitely_matches) { 935 if (!definitely_matches) {
936 if (!code_constant.is_null()) { 936 if (!code_constant.is_null()) {
937 mov(r3, Operand(code_constant)); 937 mov(r3, Operand(code_constant));
938 add(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); 938 add(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag));
939 } 939 }
940 940
941 Handle<Code> adaptor = 941 Handle<Code> adaptor =
942 isolate()->builtins()->ArgumentsAdaptorTrampoline(); 942 isolate()->builtins()->ArgumentsAdaptorTrampoline();
943 if (flag == CALL_FUNCTION) { 943 if (flag == CALL_FUNCTION) {
944 if (call_wrapper != NULL) { 944 call_wrapper.BeforeCall(CallSize(adaptor, RelocInfo::CODE_TARGET));
945 call_wrapper->BeforeCall(CallSize(adaptor, RelocInfo::CODE_TARGET));
946 }
947 Call(adaptor, RelocInfo::CODE_TARGET); 945 Call(adaptor, RelocInfo::CODE_TARGET);
948 if (call_wrapper != NULL) call_wrapper->AfterCall(); 946 call_wrapper.AfterCall();
949 b(done); 947 b(done);
950 } else { 948 } else {
951 Jump(adaptor, RelocInfo::CODE_TARGET); 949 Jump(adaptor, RelocInfo::CODE_TARGET);
952 } 950 }
953 bind(&regular_invoke); 951 bind(&regular_invoke);
954 } 952 }
955 } 953 }
956 954
957 955
958 void MacroAssembler::InvokeCode(Register code, 956 void MacroAssembler::InvokeCode(Register code,
959 const ParameterCount& expected, 957 const ParameterCount& expected,
960 const ParameterCount& actual, 958 const ParameterCount& actual,
961 InvokeFlag flag, 959 InvokeFlag flag,
962 CallWrapper* call_wrapper) { 960 const CallWrapper& call_wrapper) {
963 Label done; 961 Label done;
964 962
965 InvokePrologue(expected, actual, Handle<Code>::null(), code, &done, flag, 963 InvokePrologue(expected, actual, Handle<Code>::null(), code, &done, flag,
966 call_wrapper); 964 call_wrapper);
967 if (flag == CALL_FUNCTION) { 965 if (flag == CALL_FUNCTION) {
968 if (call_wrapper != NULL) call_wrapper->BeforeCall(CallSize(code)); 966 call_wrapper.BeforeCall(CallSize(code));
969 Call(code); 967 Call(code);
970 if (call_wrapper != NULL) call_wrapper->AfterCall(); 968 call_wrapper.AfterCall();
971 } else { 969 } else {
972 ASSERT(flag == JUMP_FUNCTION); 970 ASSERT(flag == JUMP_FUNCTION);
973 Jump(code); 971 Jump(code);
974 } 972 }
975 973
976 // Continue here if InvokePrologue does handle the invocation due to 974 // Continue here if InvokePrologue does handle the invocation due to
977 // mismatched parameter counts. 975 // mismatched parameter counts.
978 bind(&done); 976 bind(&done);
979 } 977 }
980 978
(...skipping 14 matching lines...) Expand all
995 993
996 // Continue here if InvokePrologue does handle the invocation due to 994 // Continue here if InvokePrologue does handle the invocation due to
997 // mismatched parameter counts. 995 // mismatched parameter counts.
998 bind(&done); 996 bind(&done);
999 } 997 }
1000 998
1001 999
1002 void MacroAssembler::InvokeFunction(Register fun, 1000 void MacroAssembler::InvokeFunction(Register fun,
1003 const ParameterCount& actual, 1001 const ParameterCount& actual,
1004 InvokeFlag flag, 1002 InvokeFlag flag,
1005 CallWrapper* call_wrapper) { 1003 const CallWrapper& call_wrapper) {
1006 // Contract with called JS functions requires that function is passed in r1. 1004 // Contract with called JS functions requires that function is passed in r1.
1007 ASSERT(fun.is(r1)); 1005 ASSERT(fun.is(r1));
1008 1006
1009 Register expected_reg = r2; 1007 Register expected_reg = r2;
1010 Register code_reg = r3; 1008 Register code_reg = r3;
1011 1009
1012 ldr(code_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); 1010 ldr(code_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
1013 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); 1011 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
1014 ldr(expected_reg, 1012 ldr(expected_reg,
1015 FieldMemOperand(code_reg, 1013 FieldMemOperand(code_reg,
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after
2307 ASSERT((reinterpret_cast<intptr_t>(builtin.address()) & 1) == 1); 2305 ASSERT((reinterpret_cast<intptr_t>(builtin.address()) & 1) == 1);
2308 #endif 2306 #endif
2309 mov(r1, Operand(builtin)); 2307 mov(r1, Operand(builtin));
2310 CEntryStub stub(1); 2308 CEntryStub stub(1);
2311 return TryTailCallStub(&stub); 2309 return TryTailCallStub(&stub);
2312 } 2310 }
2313 2311
2314 2312
2315 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, 2313 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id,
2316 InvokeFlag flag, 2314 InvokeFlag flag,
2317 CallWrapper* call_wrapper) { 2315 const CallWrapper& call_wrapper) {
2318 GetBuiltinEntry(r2, id); 2316 GetBuiltinEntry(r2, id);
2319 if (flag == CALL_FUNCTION) { 2317 if (flag == CALL_FUNCTION) {
2320 if (call_wrapper != NULL) call_wrapper->BeforeCall(CallSize(r2)); 2318 call_wrapper.BeforeCall(CallSize(r2));
2321 Call(r2); 2319 Call(r2);
2322 if (call_wrapper != NULL) call_wrapper->AfterCall(); 2320 call_wrapper.AfterCall();
2323 } else { 2321 } else {
2324 ASSERT(flag == JUMP_FUNCTION); 2322 ASSERT(flag == JUMP_FUNCTION);
2325 Jump(r2); 2323 Jump(r2);
2326 } 2324 }
2327 } 2325 }
2328 2326
2329 2327
2330 void MacroAssembler::GetBuiltinFunction(Register target, 2328 void MacroAssembler::GetBuiltinFunction(Register target,
2331 Builtins::JavaScript id) { 2329 Builtins::JavaScript id) {
2332 // Load the builtins object into target register. 2330 // Load the builtins object into target register.
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
3054 void CodePatcher::EmitCondition(Condition cond) { 3052 void CodePatcher::EmitCondition(Condition cond) {
3055 Instr instr = Assembler::instr_at(masm_.pc_); 3053 Instr instr = Assembler::instr_at(masm_.pc_);
3056 instr = (instr & ~kCondMask) | cond; 3054 instr = (instr & ~kCondMask) | cond;
3057 masm_.emit(instr); 3055 masm_.emit(instr);
3058 } 3056 }
3059 3057
3060 3058
3061 } } // namespace v8::internal 3059 } } // namespace v8::internal
3062 3060
3063 #endif // V8_TARGET_ARCH_ARM 3061 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698