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

Side by Side Diff: src/x64/macro-assembler-x64.h

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/x64/lithium-codegen-x64.cc ('k') | src/x64/macro-assembler-x64.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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 } 237 }
238 238
239 // --------------------------------------------------------------------------- 239 // ---------------------------------------------------------------------------
240 // JavaScript invokes 240 // JavaScript invokes
241 241
242 // Invoke the JavaScript function code by either calling or jumping. 242 // Invoke the JavaScript function code by either calling or jumping.
243 void InvokeCode(Register code, 243 void InvokeCode(Register code,
244 const ParameterCount& expected, 244 const ParameterCount& expected,
245 const ParameterCount& actual, 245 const ParameterCount& actual,
246 InvokeFlag flag, 246 InvokeFlag flag,
247 CallWrapper* call_wrapper = NULL); 247 const CallWrapper& call_wrapper = NullCallWrapper());
248 248
249 void InvokeCode(Handle<Code> code, 249 void InvokeCode(Handle<Code> code,
250 const ParameterCount& expected, 250 const ParameterCount& expected,
251 const ParameterCount& actual, 251 const ParameterCount& actual,
252 RelocInfo::Mode rmode, 252 RelocInfo::Mode rmode,
253 InvokeFlag flag, 253 InvokeFlag flag,
254 CallWrapper* call_wrapper = NULL); 254 const CallWrapper& call_wrapper = NullCallWrapper());
255 255
256 // Invoke the JavaScript function in the given register. Changes the 256 // Invoke the JavaScript function in the given register. Changes the
257 // current context to the context in the function before invoking. 257 // current context to the context in the function before invoking.
258 void InvokeFunction(Register function, 258 void InvokeFunction(Register function,
259 const ParameterCount& actual, 259 const ParameterCount& actual,
260 InvokeFlag flag, 260 InvokeFlag flag,
261 CallWrapper* call_wrapper = NULL); 261 const CallWrapper& call_wrapper = NullCallWrapper());
262 262
263 void InvokeFunction(JSFunction* function, 263 void InvokeFunction(JSFunction* function,
264 const ParameterCount& actual, 264 const ParameterCount& actual,
265 InvokeFlag flag, 265 InvokeFlag flag,
266 CallWrapper* call_wrapper = NULL); 266 const CallWrapper& call_wrapper = NullCallWrapper());
267 267
268 // Invoke specified builtin JavaScript function. Adds an entry to 268 // Invoke specified builtin JavaScript function. Adds an entry to
269 // the unresolved list if the name does not resolve. 269 // the unresolved list if the name does not resolve.
270 void InvokeBuiltin(Builtins::JavaScript id, 270 void InvokeBuiltin(Builtins::JavaScript id,
271 InvokeFlag flag, 271 InvokeFlag flag,
272 CallWrapper* call_wrapper = NULL); 272 const CallWrapper& call_wrapper = NullCallWrapper());
273 273
274 // Store the function for the given builtin in the target register. 274 // Store the function for the given builtin in the target register.
275 void GetBuiltinFunction(Register target, Builtins::JavaScript id); 275 void GetBuiltinFunction(Register target, Builtins::JavaScript id);
276 276
277 // Store the code object for the given builtin in the target register. 277 // Store the code object for the given builtin in the target register.
278 void GetBuiltinEntry(Register target, Builtins::JavaScript id); 278 void GetBuiltinEntry(Register target, Builtins::JavaScript id);
279 279
280 280
281 // --------------------------------------------------------------------------- 281 // ---------------------------------------------------------------------------
282 // Smi tagging, untagging and operations on tagged smis. 282 // Smi tagging, untagging and operations on tagged smis.
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 Handle<Object> code_object_; 1119 Handle<Object> code_object_;
1120 1120
1121 // Helper functions for generating invokes. 1121 // Helper functions for generating invokes.
1122 template <typename LabelType> 1122 template <typename LabelType>
1123 void InvokePrologue(const ParameterCount& expected, 1123 void InvokePrologue(const ParameterCount& expected,
1124 const ParameterCount& actual, 1124 const ParameterCount& actual,
1125 Handle<Code> code_constant, 1125 Handle<Code> code_constant,
1126 Register code_register, 1126 Register code_register,
1127 LabelType* done, 1127 LabelType* done,
1128 InvokeFlag flag, 1128 InvokeFlag flag,
1129 CallWrapper* call_wrapper); 1129 const CallWrapper& call_wrapper);
1130 1130
1131 // Activation support. 1131 // Activation support.
1132 void EnterFrame(StackFrame::Type type); 1132 void EnterFrame(StackFrame::Type type);
1133 void LeaveFrame(StackFrame::Type type); 1133 void LeaveFrame(StackFrame::Type type);
1134 1134
1135 void EnterExitFramePrologue(bool save_rax); 1135 void EnterExitFramePrologue(bool save_rax);
1136 1136
1137 // Allocates arg_stack_space * kPointerSize memory (not GCed) on the stack 1137 // Allocates arg_stack_space * kPointerSize memory (not GCed) on the stack
1138 // accessible via StackSpaceOperand. 1138 // accessible via StackSpaceOperand.
1139 void EnterExitFrameEpilogue(int arg_stack_space, bool save_doubles); 1139 void EnterExitFrameEpilogue(int arg_stack_space, bool save_doubles);
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
1929 } 1929 }
1930 1930
1931 1931
1932 template <typename LabelType> 1932 template <typename LabelType>
1933 void MacroAssembler::InvokePrologue(const ParameterCount& expected, 1933 void MacroAssembler::InvokePrologue(const ParameterCount& expected,
1934 const ParameterCount& actual, 1934 const ParameterCount& actual,
1935 Handle<Code> code_constant, 1935 Handle<Code> code_constant,
1936 Register code_register, 1936 Register code_register,
1937 LabelType* done, 1937 LabelType* done,
1938 InvokeFlag flag, 1938 InvokeFlag flag,
1939 CallWrapper* call_wrapper) { 1939 const CallWrapper& call_wrapper) {
1940 bool definitely_matches = false; 1940 bool definitely_matches = false;
1941 NearLabel invoke; 1941 NearLabel invoke;
1942 if (expected.is_immediate()) { 1942 if (expected.is_immediate()) {
1943 ASSERT(actual.is_immediate()); 1943 ASSERT(actual.is_immediate());
1944 if (expected.immediate() == actual.immediate()) { 1944 if (expected.immediate() == actual.immediate()) {
1945 definitely_matches = true; 1945 definitely_matches = true;
1946 } else { 1946 } else {
1947 Set(rax, actual.immediate()); 1947 Set(rax, actual.immediate());
1948 if (expected.immediate() == 1948 if (expected.immediate() ==
1949 SharedFunctionInfo::kDontAdaptArgumentsSentinel) { 1949 SharedFunctionInfo::kDontAdaptArgumentsSentinel) {
(...skipping 28 matching lines...) Expand all
1978 if (!definitely_matches) { 1978 if (!definitely_matches) {
1979 Handle<Code> adaptor = isolate()->builtins()->ArgumentsAdaptorTrampoline(); 1979 Handle<Code> adaptor = isolate()->builtins()->ArgumentsAdaptorTrampoline();
1980 if (!code_constant.is_null()) { 1980 if (!code_constant.is_null()) {
1981 movq(rdx, code_constant, RelocInfo::EMBEDDED_OBJECT); 1981 movq(rdx, code_constant, RelocInfo::EMBEDDED_OBJECT);
1982 addq(rdx, Immediate(Code::kHeaderSize - kHeapObjectTag)); 1982 addq(rdx, Immediate(Code::kHeaderSize - kHeapObjectTag));
1983 } else if (!code_register.is(rdx)) { 1983 } else if (!code_register.is(rdx)) {
1984 movq(rdx, code_register); 1984 movq(rdx, code_register);
1985 } 1985 }
1986 1986
1987 if (flag == CALL_FUNCTION) { 1987 if (flag == CALL_FUNCTION) {
1988 if (call_wrapper != NULL) call_wrapper->BeforeCall(CallSize(adaptor)); 1988 call_wrapper.BeforeCall(CallSize(adaptor));
1989 Call(adaptor, RelocInfo::CODE_TARGET); 1989 Call(adaptor, RelocInfo::CODE_TARGET);
1990 if (call_wrapper != NULL) call_wrapper->AfterCall(); 1990 call_wrapper.AfterCall();
1991 jmp(done); 1991 jmp(done);
1992 } else { 1992 } else {
1993 Jump(adaptor, RelocInfo::CODE_TARGET); 1993 Jump(adaptor, RelocInfo::CODE_TARGET);
1994 } 1994 }
1995 bind(&invoke); 1995 bind(&invoke);
1996 } 1996 }
1997 } 1997 }
1998 1998
1999 1999
2000 } } // namespace v8::internal 2000 } } // namespace v8::internal
2001 2001
2002 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ 2002 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_
OLDNEW
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698