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

Side by Side Diff: src/ia32/lithium-codegen-ia32.cc

Issue 9716028: Merge r11075 from bleeding_edge to 3.8 branch: Revert dynamic frame alignment. (Closed) Base URL: http://v8.googlecode.com/svn/branches/3.8/
Patch Set: Created 8 years, 9 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/ia32/lithium-codegen-ia32.h ('k') | src/ia32/lithium-ia32.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 status_ = GENERATING; 72 status_ = GENERATING;
73 CpuFeatures::Scope scope(SSE2); 73 CpuFeatures::Scope scope(SSE2);
74 74
75 CodeStub::GenerateFPStubs(); 75 CodeStub::GenerateFPStubs();
76 76
77 // Open a frame scope to indicate that there is a frame on the stack. The 77 // Open a frame scope to indicate that there is a frame on the stack. The
78 // MANUAL indicates that the scope shouldn't actually generate code to set up 78 // MANUAL indicates that the scope shouldn't actually generate code to set up
79 // the frame (that is done in GeneratePrologue). 79 // the frame (that is done in GeneratePrologue).
80 FrameScope frame_scope(masm_, StackFrame::MANUAL); 80 FrameScope frame_scope(masm_, StackFrame::MANUAL);
81 81
82 dynamic_frame_alignment_ = chunk()->num_double_slots() > 2 ||
83 info()->osr_ast_id() != AstNode::kNoNumber;
84
85 return GeneratePrologue() && 82 return GeneratePrologue() &&
86 GenerateBody() && 83 GenerateBody() &&
87 GenerateDeferredCode() && 84 GenerateDeferredCode() &&
88 GenerateSafepointTable(); 85 GenerateSafepointTable();
89 } 86 }
90 87
91 88
92 void LCodeGen::FinishCode(Handle<Code> code) { 89 void LCodeGen::FinishCode(Handle<Code> code) {
93 ASSERT(is_done()); 90 ASSERT(is_done());
94 code->set_stack_slots(GetStackSlotCount()); 91 code->set_stack_slots(GetStackSlotCount());
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 Label ok; 146 Label ok;
150 __ test(ecx, Operand(ecx)); 147 __ test(ecx, Operand(ecx));
151 __ j(zero, &ok, Label::kNear); 148 __ j(zero, &ok, Label::kNear);
152 // +1 for return address. 149 // +1 for return address.
153 int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize; 150 int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize;
154 __ mov(Operand(esp, receiver_offset), 151 __ mov(Operand(esp, receiver_offset),
155 Immediate(isolate()->factory()->undefined_value())); 152 Immediate(isolate()->factory()->undefined_value()));
156 __ bind(&ok); 153 __ bind(&ok);
157 } 154 }
158 155
159 if (dynamic_frame_alignment_) {
160 Label do_not_pad, align_loop;
161 STATIC_ASSERT(kDoubleSize == 2 * kPointerSize);
162 // Align esp to a multiple of 2 * kPointerSize.
163 __ test(esp, Immediate(kPointerSize));
164 __ j(zero, &do_not_pad, Label::kNear);
165 __ push(Immediate(0));
166 __ mov(ebx, esp);
167 // Copy arguments, receiver, and return address.
168 __ mov(ecx, Immediate(scope()->num_parameters() + 2));
169
170 __ bind(&align_loop);
171 __ mov(eax, Operand(ebx, 1 * kPointerSize));
172 __ mov(Operand(ebx, 0), eax);
173 __ add(Operand(ebx), Immediate(kPointerSize));
174 __ dec(ecx);
175 __ j(not_zero, &align_loop, Label::kNear);
176 __ mov(Operand(ebx, 0),
177 Immediate(isolate()->factory()->frame_alignment_marker()));
178
179 __ bind(&do_not_pad);
180 }
181
182 __ push(ebp); // Caller's frame pointer. 156 __ push(ebp); // Caller's frame pointer.
183 __ mov(ebp, esp); 157 __ mov(ebp, esp);
184 __ push(esi); // Callee's context. 158 __ push(esi); // Callee's context.
185 __ push(edi); // Callee's JS function. 159 __ push(edi); // Callee's JS function.
186 160
187 // Reserve space for the stack slots needed by the code. 161 // Reserve space for the stack slots needed by the code.
188 int slots = GetStackSlotCount(); 162 int slots = GetStackSlotCount();
189 if (slots > 0) { 163 if (slots > 0) {
190 if (FLAG_debug_code) { 164 if (FLAG_debug_code) {
191 __ mov(Operand(eax), Immediate(slots)); 165 __ mov(Operand(eax), Immediate(slots));
(...skipping 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after
2073 // Preserve the return value on the stack and rely on the runtime call 2047 // Preserve the return value on the stack and rely on the runtime call
2074 // to return the value in the same register. We're leaving the code 2048 // to return the value in the same register. We're leaving the code
2075 // managed by the register allocator and tearing down the frame, it's 2049 // managed by the register allocator and tearing down the frame, it's
2076 // safe to write to the context register. 2050 // safe to write to the context register.
2077 __ push(eax); 2051 __ push(eax);
2078 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 2052 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
2079 __ CallRuntime(Runtime::kTraceExit, 1); 2053 __ CallRuntime(Runtime::kTraceExit, 1);
2080 } 2054 }
2081 __ mov(esp, ebp); 2055 __ mov(esp, ebp);
2082 __ pop(ebp); 2056 __ pop(ebp);
2083 if (dynamic_frame_alignment_) {
2084 Label aligned;
2085 // Frame alignment marker (padding) is below arguments,
2086 // and receiver, so its return-address-relative offset is
2087 // (num_arguments + 2) words.
2088 __ cmp(Operand(esp, (GetParameterCount() + 2) * kPointerSize),
2089 Immediate(factory()->frame_alignment_marker()));
2090 __ j(not_equal, &aligned);
2091 __ Ret((GetParameterCount() + 2) * kPointerSize, ecx);
2092 __ bind(&aligned);
2093 }
2094 __ Ret((GetParameterCount() + 1) * kPointerSize, ecx); 2057 __ Ret((GetParameterCount() + 1) * kPointerSize, ecx);
2095 } 2058 }
2096 2059
2097 2060
2098 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { 2061 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
2099 Register result = ToRegister(instr->result()); 2062 Register result = ToRegister(instr->result());
2100 __ mov(result, Operand::Cell(instr->hydrogen()->cell())); 2063 __ mov(result, Operand::Cell(instr->hydrogen()->cell()));
2101 if (instr->hydrogen()->RequiresHoleCheck()) { 2064 if (instr->hydrogen()->RequiresHoleCheck()) {
2102 __ cmp(result, factory()->the_hole_value()); 2065 __ cmp(result, factory()->the_hole_value());
2103 DeoptimizeIf(equal, instr->environment()); 2066 DeoptimizeIf(equal, instr->environment());
(...skipping 2576 matching lines...) Expand 10 before | Expand all | Expand 10 after
4680 this, pointers, Safepoint::kLazyDeopt); 4643 this, pointers, Safepoint::kLazyDeopt);
4681 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); 4644 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator);
4682 } 4645 }
4683 4646
4684 4647
4685 #undef __ 4648 #undef __
4686 4649
4687 } } // namespace v8::internal 4650 } } // namespace v8::internal
4688 4651
4689 #endif // V8_TARGET_ARCH_IA32 4652 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.h ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698