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

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

Issue 159695: Basic infrastructure for fast two-pass compilation. A CFG is... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 4 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
OLDNEW
(Empty)
1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 #include "v8.h"
29
30 #include "cfg.h"
31 #include "codegen-inl.h"
32 #include "debug.h"
33 #include "macro-assembler-x64.h"
34
35 namespace v8 {
36 namespace internal {
37
38 #define __ ACCESS_MASM(masm)
39
40 void InstructionBlock::Compile(MacroAssembler* masm) {
41 ASSERT(!is_marked());
42 is_marked_ = true;
43 {
44 Comment cmt(masm, "[ InstructionBlock");
45 for (int i = 0, len = instructions_.length(); i < len; i++) {
46 instructions_[i]->Compile(masm);
47 }
48 }
49 successor_->Compile(masm);
50 }
51
52
53 void EntryNode::Compile(MacroAssembler* masm) {
54 ASSERT(!is_marked());
55 is_marked_ = true;
56 Label deferred_enter, deferred_exit;
57 {
58 Comment cmnt(masm, "[ EntryNode");
59 __ push(rbp);
60 __ movq(rbp, rsp);
61 __ push(rsi);
62 __ push(rdi);
63 if (local_count_ > 0) {
64 __ movq(kScratchRegister, Factory::undefined_value(),
65 RelocInfo::EMBEDDED_OBJECT);
66 for (int i = 0; i < local_count_; i++) {
67 __ push(kScratchRegister);
68 }
69 }
70 if (FLAG_check_stack) {
71 ExternalReference stack_limit =
72 ExternalReference::address_of_stack_guard_limit();
73 __ movq(kScratchRegister, stack_limit);
74 __ cmpq(rsp, Operand(kScratchRegister, 0));
75 __ j(below, &deferred_enter);
76 __ bind(&deferred_exit);
77 }
78 }
79 successor_->Compile(masm);
80 if (FLAG_check_stack) {
81 __ bind(&deferred_enter);
82 StackCheckStub stub;
83 __ CallStub(&stub);
84 __ jmp(&deferred_exit);
85 }
86 }
87
88
89 void ExitNode::Compile(MacroAssembler* masm) {
90 ASSERT(!is_marked());
91 is_marked_ = true;
92
93 Comment cmnt(masm, "[ ExitNode");
94 __ RecordJSReturn();
95 __ movq(rsp, rbp);
96 __ pop(rbp);
97 __ ret((parameter_count_ + 1) * kPointerSize);
98 // Add padding that will be overwritten by a debugger breakpoint.
99 // "movq rsp, rbp; pop rbp" has length 5. "ret k" has length 2.
100 const int kPadding = Debug::kX64JSReturnSequenceLength - 5 - 2;
101 for (int i = 0; i < kPadding; ++i) {
102 __ int3();
103 }
104 }
105
106
107 void ReturnInstr::Compile(MacroAssembler* masm) {
108 Comment cmnt(masm, "[ ReturnInstr");
109 value_->ToRegister(masm, rax);
110 }
111
112
113 void Constant::ToRegister(MacroAssembler* masm, Register reg) {
114 __ Move(reg, handle_);
115 }
116
117 #undef __
118
119 } } // namespace v8::internal
OLDNEW
« src/cfg.h ('K') | « src/ia32/cfg-ia32.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698