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

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

Issue 1012743002: CpuProfiler: x64. put right address to the stack, so the callee would be able... (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: minor changes in comments Created 5 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
« no previous file with comments | « no previous file | 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 DCHECK(instr->result()->IsStackSlot()); 290 DCHECK(instr->result()->IsStackSlot());
291 Operand src = ToOperand(instr->result()); 291 Operand src = ToOperand(instr->result());
292 __ movsxlq(kScratchRegister, src); 292 __ movsxlq(kScratchRegister, src);
293 __ movq(src, kScratchRegister); 293 __ movq(src, kScratchRegister);
294 } 294 }
295 } 295 }
296 } 296 }
297 297
298 298
299 bool LCodeGen::GenerateJumpTable() { 299 bool LCodeGen::GenerateJumpTable() {
300 if (jump_table_.length() == 0) return !is_aborted();
301
300 Label needs_frame; 302 Label needs_frame;
301 if (jump_table_.length() > 0) { 303 Comment(";;; -------------------- Jump table --------------------");
302 Comment(";;; -------------------- Jump table --------------------");
303 }
304 for (int i = 0; i < jump_table_.length(); i++) { 304 for (int i = 0; i < jump_table_.length(); i++) {
305 Deoptimizer::JumpTableEntry* table_entry = &jump_table_[i]; 305 Deoptimizer::JumpTableEntry* table_entry = &jump_table_[i];
306 __ bind(&table_entry->label); 306 __ bind(&table_entry->label);
307 Address entry = table_entry->address; 307 Address entry = table_entry->address;
308 DeoptComment(table_entry->deopt_info); 308 DeoptComment(table_entry->deopt_info);
309 if (table_entry->needs_frame) { 309 if (table_entry->needs_frame) {
310 DCHECK(!info()->saves_caller_doubles()); 310 DCHECK(!info()->saves_caller_doubles());
311 __ Move(kScratchRegister, ExternalReference::ForDeoptEntry(entry)); 311 __ Move(kScratchRegister, ExternalReference::ForDeoptEntry(entry));
312 if (needs_frame.is_bound()) { 312 __ call(&needs_frame);
313 __ jmp(&needs_frame);
314 } else {
315 __ bind(&needs_frame);
316 __ movp(rsi, MemOperand(rbp, StandardFrameConstants::kContextOffset));
317 __ pushq(rbp);
318 __ movp(rbp, rsp);
319 __ Push(rsi);
320 // This variant of deopt can only be used with stubs. Since we don't
321 // have a function pointer to install in the stack frame that we're
322 // building, install a special marker there instead.
323 DCHECK(info()->IsStub());
324 __ Move(rsi, Smi::FromInt(StackFrame::STUB));
325 __ Push(rsi);
326 __ movp(rsi, MemOperand(rsp, kPointerSize));
327 __ call(kScratchRegister);
328 }
329 } else { 313 } else {
330 if (info()->saves_caller_doubles()) { 314 if (info()->saves_caller_doubles()) {
331 DCHECK(info()->IsStub()); 315 DCHECK(info()->IsStub());
332 RestoreCallerDoubles(); 316 RestoreCallerDoubles();
333 } 317 }
334 __ call(entry, RelocInfo::RUNTIME_ENTRY); 318 __ call(entry, RelocInfo::RUNTIME_ENTRY);
335 } 319 }
336 } 320 }
321
322 if (needs_frame.is_linked()) {
323 __ bind(&needs_frame);
324 /* stack layout
325 4: return address <-- rsp
326 3: garbage
327 2: garbage
328 1: garbage
329 0: garbage
330 */
331 // Reserve space for context and stub marker.
332 __ subp(rsp, Immediate(2 * kPointerSize));
333 __ Push(MemOperand(rsp, 2 * kPointerSize)); // Copy return address.
334 __ Push(kScratchRegister); // Save entry address for ret(0)
335
336 /* stack layout
337 4: return address
338 3: garbage
339 2: garbage
340 1: return address
341 0: entry address <-- rsp
342 */
343
344 // Remember context pointer.
345 __ movp(kScratchRegister,
346 MemOperand(rbp, StandardFrameConstants::kContextOffset));
347 // Save context pointer into the stack frame.
348 __ movp(MemOperand(rsp, 3 * kPointerSize), kScratchRegister);
349
350 // Create a stack frame.
351 __ movp(MemOperand(rsp, 4 * kPointerSize), rbp);
352 __ leap(rbp, MemOperand(rsp, 4 * kPointerSize));
353
354 // This variant of deopt can only be used with stubs. Since we don't
355 // have a function pointer to install in the stack frame that we're
356 // building, install a special marker there instead.
357 DCHECK(info()->IsStub());
358 __ Move(MemOperand(rsp, 2 * kPointerSize), Smi::FromInt(StackFrame::STUB));
359
360 /* stack layout
361 4: old ebp
362 3: context pointer
363 2: stub marker
364 1: return address
365 0: entry address <-- rsp
366 */
367 __ ret(0);
368 }
369
337 return !is_aborted(); 370 return !is_aborted();
338 } 371 }
339 372
340 373
341 bool LCodeGen::GenerateDeferredCode() { 374 bool LCodeGen::GenerateDeferredCode() {
342 DCHECK(is_generating()); 375 DCHECK(is_generating());
343 if (deferred_.length() > 0) { 376 if (deferred_.length() > 0) {
344 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) { 377 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) {
345 LDeferredCode* code = deferred_[i]; 378 LDeferredCode* code = deferred_[i];
346 379
(...skipping 5592 matching lines...) Expand 10 before | Expand all | Expand 10 after
5939 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5972 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5940 RecordSafepoint(Safepoint::kNoLazyDeopt); 5973 RecordSafepoint(Safepoint::kNoLazyDeopt);
5941 } 5974 }
5942 5975
5943 5976
5944 #undef __ 5977 #undef __
5945 5978
5946 } } // namespace v8::internal 5979 } } // namespace v8::internal
5947 5980
5948 #endif // V8_TARGET_ARCH_X64 5981 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698