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

Side by Side Diff: src/x64/codegen-x64.cc

Issue 604064: Fix stack corruption when calling non-function. (Closed)
Patch Set: Created 10 years, 10 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
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 7838 matching lines...) Expand 10 before | Expand all | Expand 10 after
7849 // Goto slow case if we do not have a function. 7849 // Goto slow case if we do not have a function.
7850 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); 7850 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx);
7851 __ j(not_equal, &slow); 7851 __ j(not_equal, &slow);
7852 7852
7853 // Fast-case: Just invoke the function. 7853 // Fast-case: Just invoke the function.
7854 ParameterCount actual(argc_); 7854 ParameterCount actual(argc_);
7855 __ InvokeFunction(rdi, actual, JUMP_FUNCTION); 7855 __ InvokeFunction(rdi, actual, JUMP_FUNCTION);
7856 7856
7857 // Slow-case: Non-function called. 7857 // Slow-case: Non-function called.
7858 __ bind(&slow); 7858 __ bind(&slow);
7859 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead
7860 // of the original receiver from the call site).
7861 __ movq(Operand(rsp, (argc_ + 1) * kPointerSize), rdi);
7859 __ Set(rax, argc_); 7862 __ Set(rax, argc_);
7860 __ Set(rbx, 0); 7863 __ Set(rbx, 0);
7861 __ GetBuiltinEntry(rdx, Builtins::CALL_NON_FUNCTION); 7864 __ GetBuiltinEntry(rdx, Builtins::CALL_NON_FUNCTION);
7862 Handle<Code> adaptor(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)); 7865 Handle<Code> adaptor(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline));
7863 __ Jump(adaptor, RelocInfo::CODE_TARGET); 7866 __ Jump(adaptor, RelocInfo::CODE_TARGET);
7864 } 7867 }
7865 7868
7866 7869
7867 void CEntryStub::Generate(MacroAssembler* masm) { 7870 void CEntryStub::Generate(MacroAssembler* masm) {
7868 // rax: number of arguments including receiver 7871 // rax: number of arguments including receiver
(...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after
9472 // Call the function from C++. 9475 // Call the function from C++.
9473 return FUNCTION_CAST<ModuloFunction>(buffer); 9476 return FUNCTION_CAST<ModuloFunction>(buffer);
9474 } 9477 }
9475 9478
9476 #endif 9479 #endif
9477 9480
9478 9481
9479 #undef __ 9482 #undef __
9480 9483
9481 } } // namespace v8::internal 9484 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698