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

Side by Side Diff: src/ia32/virtual-frame-ia32.h

Issue 844006: Merge changes up to V8 version 2.1.3 into the partial snapshots (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/partial_snapshots/
Patch Set: Created 10 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/stub-cache-ia32.cc ('k') | src/ia32/virtual-frame-ia32.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 private: 66 private:
67 bool previous_state_; 67 bool previous_state_;
68 68
69 CodeGenerator* cgen() {return CodeGeneratorScope::Current();} 69 CodeGenerator* cgen() {return CodeGeneratorScope::Current();}
70 }; 70 };
71 71
72 // An illegal index into the virtual frame. 72 // An illegal index into the virtual frame.
73 static const int kIllegalIndex = -1; 73 static const int kIllegalIndex = -1;
74 74
75 // Construct an initial virtual frame on entry to a JS function. 75 // Construct an initial virtual frame on entry to a JS function.
76 VirtualFrame(); 76 inline VirtualFrame();
77 77
78 // Construct a virtual frame as a clone of an existing one. 78 // Construct a virtual frame as a clone of an existing one.
79 explicit VirtualFrame(VirtualFrame* original); 79 explicit inline VirtualFrame(VirtualFrame* original);
80 80
81 CodeGenerator* cgen() { return CodeGeneratorScope::Current(); } 81 CodeGenerator* cgen() { return CodeGeneratorScope::Current(); }
82 82
83 MacroAssembler* masm() { return cgen()->masm(); } 83 MacroAssembler* masm() { return cgen()->masm(); }
84 84
85 // Create a duplicate of an existing valid frame element. 85 // Create a duplicate of an existing valid frame element.
86 FrameElement CopyElementAt(int index, 86 FrameElement CopyElementAt(int index,
87 NumberInfo::Type info = NumberInfo::kUninitialized); 87 NumberInfo info = NumberInfo::Uninitialized());
88 88
89 // The number of elements on the virtual frame. 89 // The number of elements on the virtual frame.
90 int element_count() { return elements_.length(); } 90 int element_count() { return elements_.length(); }
91 91
92 // The height of the virtual expression stack. 92 // The height of the virtual expression stack.
93 int height() { return element_count() - expression_base_index(); } 93 int height() { return element_count() - expression_base_index(); }
94 94
95 int register_location(int num) { 95 int register_location(int num) {
96 ASSERT(num >= 0 && num < RegisterAllocator::kNumRegisters); 96 ASSERT(num >= 0 && num < RegisterAllocator::kNumRegisters);
97 return register_locations_[num]; 97 return register_locations_[num];
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 Result Pop(); 381 Result Pop();
382 382
383 // Pop and save an element from the top of the expression stack and 383 // Pop and save an element from the top of the expression stack and
384 // emit a corresponding pop instruction. 384 // emit a corresponding pop instruction.
385 void EmitPop(Register reg); 385 void EmitPop(Register reg);
386 void EmitPop(Operand operand); 386 void EmitPop(Operand operand);
387 387
388 // Push an element on top of the expression stack and emit a 388 // Push an element on top of the expression stack and emit a
389 // corresponding push instruction. 389 // corresponding push instruction.
390 void EmitPush(Register reg, 390 void EmitPush(Register reg,
391 NumberInfo::Type info = NumberInfo::kUnknown); 391 NumberInfo info = NumberInfo::Unknown());
392 void EmitPush(Operand operand, 392 void EmitPush(Operand operand,
393 NumberInfo::Type info = NumberInfo::kUnknown); 393 NumberInfo info = NumberInfo::Unknown());
394 void EmitPush(Immediate immediate, 394 void EmitPush(Immediate immediate,
395 NumberInfo::Type info = NumberInfo::kUnknown); 395 NumberInfo info = NumberInfo::Unknown());
396 396
397 // Push an element on the virtual frame. 397 // Push an element on the virtual frame.
398 void Push(Register reg, NumberInfo::Type info = NumberInfo::kUnknown); 398 inline void Push(Register reg, NumberInfo info = NumberInfo::Unknown());
399 void Push(Handle<Object> value); 399 inline void Push(Handle<Object> value);
400 void Push(Smi* value) { 400 inline void Push(Smi* value);
401 Push(Handle<Object> (value));
402 }
403 401
404 // Pushing a result invalidates it (its contents become owned by the 402 // Pushing a result invalidates it (its contents become owned by the
405 // frame). 403 // frame).
406 void Push(Result* result) { 404 void Push(Result* result) {
407 // This assert will trigger if you try to push the same value twice. 405 // This assert will trigger if you try to push the same value twice.
408 ASSERT(result->is_valid()); 406 ASSERT(result->is_valid());
409 if (result->is_register()) { 407 if (result->is_register()) {
410 Push(result->reg(), result->number_info()); 408 Push(result->reg(), result->number_info());
411 } else { 409 } else {
412 ASSERT(result->is_constant()); 410 ASSERT(result->is_constant());
413 Push(result->handle()); 411 Push(result->handle());
414 } 412 }
415 result->Unuse(); 413 result->Unuse();
416 } 414 }
417 415
418 // Pushing an expression expects that the expression is trivial (according 416 // Pushing an expression expects that the expression is trivial (according
419 // to Expression::IsTrivial). 417 // to Expression::IsTrivial).
420 void Push(Expression* expr); 418 void Push(Expression* expr);
421 419
422 // Nip removes zero or more elements from immediately below the top 420 // Nip removes zero or more elements from immediately below the top
423 // of the frame, leaving the previous top-of-frame value on top of 421 // of the frame, leaving the previous top-of-frame value on top of
424 // the frame. Nip(k) is equivalent to x = Pop(), Drop(k), Push(x). 422 // the frame. Nip(k) is equivalent to x = Pop(), Drop(k), Push(x).
425 void Nip(int num_dropped); 423 inline void Nip(int num_dropped);
426 424
427 private: 425 private:
428 static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset; 426 static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset;
429 static const int kFunctionOffset = JavaScriptFrameConstants::kFunctionOffset; 427 static const int kFunctionOffset = JavaScriptFrameConstants::kFunctionOffset;
430 static const int kContextOffset = StandardFrameConstants::kContextOffset; 428 static const int kContextOffset = StandardFrameConstants::kContextOffset;
431 429
432 static const int kHandlerSize = StackHandlerConstants::kSize / kPointerSize; 430 static const int kHandlerSize = StackHandlerConstants::kSize / kPointerSize;
433 static const int kPreallocatedElements = 5 + 8; // 8 expression stack slots. 431 static const int kPreallocatedElements = 5 + 8; // 8 expression stack slots.
434 432
435 ZoneList<FrameElement> elements_; 433 ZoneList<FrameElement> elements_;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 void SyncElementAt(int index); 521 void SyncElementAt(int index);
524 522
525 // Sync a single unsynced element that lies beneath or at the stack pointer. 523 // Sync a single unsynced element that lies beneath or at the stack pointer.
526 void SyncElementBelowStackPointer(int index); 524 void SyncElementBelowStackPointer(int index);
527 525
528 // Sync a single unsynced element that lies just above the stack pointer. 526 // Sync a single unsynced element that lies just above the stack pointer.
529 void SyncElementByPushing(int index); 527 void SyncElementByPushing(int index);
530 528
531 // Push a copy of a frame slot (typically a local or parameter) on top of 529 // Push a copy of a frame slot (typically a local or parameter) on top of
532 // the frame. 530 // the frame.
533 void PushFrameSlotAt(int index); 531 inline void PushFrameSlotAt(int index);
534 532
535 // Push a the value of a frame slot (typically a local or parameter) on 533 // Push a the value of a frame slot (typically a local or parameter) on
536 // top of the frame and invalidate the slot. 534 // top of the frame and invalidate the slot.
537 void TakeFrameSlotAt(int index); 535 void TakeFrameSlotAt(int index);
538 536
539 // Store the value on top of the frame to a frame slot (typically a local 537 // Store the value on top of the frame to a frame slot (typically a local
540 // or parameter). 538 // or parameter).
541 void StoreToFrameSlotAt(int index); 539 void StoreToFrameSlotAt(int index);
542 540
543 // Spill all elements in registers. Spill the top spilled_args elements 541 // Spill all elements in registers. Spill the top spilled_args elements
(...skipping 22 matching lines...) Expand all
566 // should be equal. 564 // should be equal.
567 void MergeMoveMemoryToRegisters(VirtualFrame* expected); 565 void MergeMoveMemoryToRegisters(VirtualFrame* expected);
568 566
569 // Invalidates a frame slot (puts an invalid frame element in it). 567 // Invalidates a frame slot (puts an invalid frame element in it).
570 // Copies on the frame are correctly handled, and if this slot was 568 // Copies on the frame are correctly handled, and if this slot was
571 // the backing store of copies, the index of the new backing store 569 // the backing store of copies, the index of the new backing store
572 // is returned. Otherwise, returns kIllegalIndex. 570 // is returned. Otherwise, returns kIllegalIndex.
573 // Register counts are correctly updated. 571 // Register counts are correctly updated.
574 int InvalidateFrameSlotAt(int index); 572 int InvalidateFrameSlotAt(int index);
575 573
574 // This function assumes that a and b are the only results that could be in
575 // the registers a_reg or b_reg. Other results can be live, but must not
576 // be in the registers a_reg or b_reg. The results a and b are invalidated.
577 void MoveResultsToRegisters(Result* a,
578 Result* b,
579 Register a_reg,
580 Register b_reg);
581
576 // Call a code stub that has already been prepared for calling (via 582 // Call a code stub that has already been prepared for calling (via
577 // PrepareForCall). 583 // PrepareForCall).
578 Result RawCallStub(CodeStub* stub); 584 Result RawCallStub(CodeStub* stub);
579 585
580 // Calls a code object which has already been prepared for calling 586 // Calls a code object which has already been prepared for calling
581 // (via PrepareForCall). 587 // (via PrepareForCall).
582 Result RawCallCodeObject(Handle<Code> code, RelocInfo::Mode rmode); 588 Result RawCallCodeObject(Handle<Code> code, RelocInfo::Mode rmode);
583 589
584 bool Equals(VirtualFrame* other); 590 inline bool Equals(VirtualFrame* other);
585 591
586 // Classes that need raw access to the elements_ array. 592 // Classes that need raw access to the elements_ array.
587 friend class DeferredCode; 593 friend class DeferredCode;
588 friend class JumpTarget; 594 friend class JumpTarget;
589 }; 595 };
590 596
591 } } // namespace v8::internal 597 } } // namespace v8::internal
592 598
593 #endif // V8_IA32_VIRTUAL_FRAME_IA32_H_ 599 #endif // V8_IA32_VIRTUAL_FRAME_IA32_H_
OLDNEW
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/ia32/virtual-frame-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698