Chromium Code Reviews

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

Issue 6447007: Fix a bug that occurs when functions are defined with more than 16,382 parame... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
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 2975 matching lines...)
2986 2986
2987 // Add a label for checking the size of the code used for returning. 2987 // Add a label for checking the size of the code used for returning.
2988 #ifdef DEBUG 2988 #ifdef DEBUG
2989 Label check_exit_codesize; 2989 Label check_exit_codesize;
2990 masm_->bind(&check_exit_codesize); 2990 masm_->bind(&check_exit_codesize);
2991 #endif 2991 #endif
2992 2992
2993 // Leave the frame and return popping the arguments and the 2993 // Leave the frame and return popping the arguments and the
2994 // receiver. 2994 // receiver.
2995 frame_->Exit(); 2995 frame_->Exit();
2996 masm_->ret((scope()->num_parameters() + 1) * kPointerSize); 2996 int arguments_bytes = (scope()->num_parameters() + 1) * kPointerSize;
2997 if (is_uint16(arguments_bytes)) {
2998 __ ret(arguments_bytes);
2999 } else {
3000 __ pop(rcx);
3001 __ addq(rsp, Immediate(arguments_bytes));
3002 __ push(rcx);
3003 __ ret(0);
3004 }
2997 DeleteFrame(); 3005 DeleteFrame();
2998 3006
2999 #ifdef ENABLE_DEBUGGER_SUPPORT 3007 #ifdef ENABLE_DEBUGGER_SUPPORT
3000 // Add padding that will be overwritten by a debugger breakpoint. 3008 // Add padding that will be overwritten by a debugger breakpoint.
3001 // frame_->Exit() generates "movq rsp, rbp; pop rbp; ret k" 3009 // frame_->Exit() generates "movq rsp, rbp; pop rbp; ret k"
3002 // with length 7 (3 + 1 + 3). 3010 // with length 7 (3 + 1 + 3).
3003 const int kPadding = Assembler::kJSReturnSequenceLength - 7; 3011 const int kPadding = Assembler::kJSReturnSequenceLength - 7;
3004 for (int i = 0; i < kPadding; ++i) { 3012 for (int i = 0; i < kPadding; ++i) {
3005 masm_->int3(); 3013 masm_->int3();
3006 } 3014 }
3007 // Check that the size of the code used for returning matches what is 3015 // Check that the size of the code used for returning matches what is
3008 // expected by the debugger. 3016 // expected by the debugger.
3009 ASSERT_EQ(Assembler::kJSReturnSequenceLength, 3017 ASSERT(Assembler::kJSReturnSequenceLength <=
3010 masm_->SizeOfCodeGeneratedSince(&check_exit_codesize)); 3018 masm_->SizeOfCodeGeneratedSince(&check_exit_codesize));
3011 #endif 3019 #endif
3012 } 3020 }
3013 3021
3014 3022
3015 void CodeGenerator::VisitWithEnterStatement(WithEnterStatement* node) { 3023 void CodeGenerator::VisitWithEnterStatement(WithEnterStatement* node) {
3016 ASSERT(!in_spilled_code()); 3024 ASSERT(!in_spilled_code());
3017 Comment cmnt(masm_, "[ WithEnterStatement"); 3025 Comment cmnt(masm_, "[ WithEnterStatement");
3018 CodeForStatementPosition(node); 3026 CodeForStatementPosition(node);
3019 Load(node->expression()); 3027 Load(node->expression());
3020 Result context; 3028 Result context;
(...skipping 5787 matching lines...)
8808 } 8816 }
8809 8817
8810 #endif 8818 #endif
8811 8819
8812 8820
8813 #undef __ 8821 #undef __
8814 8822
8815 } } // namespace v8::internal 8823 } } // namespace v8::internal
8816 8824
8817 #endif // V8_TARGET_ARCH_X64 8825 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine