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

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

Issue 159701: Restructure to support recursive invocation of the CFG builder. Add... (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
« src/cfg.cc ('K') | « src/ia32/cfg-ia32.cc ('k') | 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 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 void EntryNode::Compile(MacroAssembler* masm) { 53 void EntryNode::Compile(MacroAssembler* masm) {
54 ASSERT(!is_marked()); 54 ASSERT(!is_marked());
55 is_marked_ = true; 55 is_marked_ = true;
56 Label deferred_enter, deferred_exit; 56 Label deferred_enter, deferred_exit;
57 { 57 {
58 Comment cmnt(masm, "[ EntryNode"); 58 Comment cmnt(masm, "[ EntryNode");
59 __ push(rbp); 59 __ push(rbp);
60 __ movq(rbp, rsp); 60 __ movq(rbp, rsp);
61 __ push(rsi); 61 __ push(rsi);
62 __ push(rdi); 62 __ push(rdi);
63 if (local_count_ > 0) { 63 int count = CfgGlobals::current()->fun()->scope()->num_stack_slots();
64 if (count > 0) {
64 __ movq(kScratchRegister, Factory::undefined_value(), 65 __ movq(kScratchRegister, Factory::undefined_value(),
65 RelocInfo::EMBEDDED_OBJECT); 66 RelocInfo::EMBEDDED_OBJECT);
66 for (int i = 0; i < local_count_; i++) { 67 for (int i = 0; i < count; i++) {
67 __ push(kScratchRegister); 68 __ push(kScratchRegister);
68 } 69 }
69 } 70 }
70 if (FLAG_trace) { 71 if (FLAG_trace) {
71 __ CallRuntime(Runtime::kTraceEnter, 0); 72 __ CallRuntime(Runtime::kTraceEnter, 0);
72 } 73 }
73 if (FLAG_check_stack) { 74 if (FLAG_check_stack) {
74 ExternalReference stack_limit = 75 ExternalReference stack_limit =
75 ExternalReference::address_of_stack_guard_limit(); 76 ExternalReference::address_of_stack_guard_limit();
76 __ movq(kScratchRegister, stack_limit); 77 __ movq(kScratchRegister, stack_limit);
(...skipping 17 matching lines...) Expand all
94 is_marked_ = true; 95 is_marked_ = true;
95 96
96 Comment cmnt(masm, "[ ExitNode"); 97 Comment cmnt(masm, "[ ExitNode");
97 if (FLAG_trace) { 98 if (FLAG_trace) {
98 __ push(rax); 99 __ push(rax);
99 __ CallRuntime(Runtime::kTraceExit, 1); 100 __ CallRuntime(Runtime::kTraceExit, 1);
100 } 101 }
101 __ RecordJSReturn(); 102 __ RecordJSReturn();
102 __ movq(rsp, rbp); 103 __ movq(rsp, rbp);
103 __ pop(rbp); 104 __ pop(rbp);
104 __ ret((parameter_count_ + 1) * kPointerSize); 105 int count = CfgGlobals::current()->fun()->scope()->num_parameters();
106 __ ret((count + 1) * kPointerSize);
105 // Add padding that will be overwritten by a debugger breakpoint. 107 // Add padding that will be overwritten by a debugger breakpoint.
106 // "movq rsp, rbp; pop rbp" has length 5. "ret k" has length 2. 108 // "movq rsp, rbp; pop rbp" has length 5. "ret k" has length 2.
107 const int kPadding = Debug::kX64JSReturnSequenceLength - 5 - 2; 109 const int kPadding = Debug::kX64JSReturnSequenceLength - 5 - 2;
108 for (int i = 0; i < kPadding; ++i) { 110 for (int i = 0; i < kPadding; ++i) {
109 __ int3(); 111 __ int3();
110 } 112 }
111 } 113 }
112 114
113 115
114 void ReturnInstr::Compile(MacroAssembler* masm) { 116 void ReturnInstr::Compile(MacroAssembler* masm) {
115 Comment cmnt(masm, "[ ReturnInstr"); 117 Comment cmnt(masm, "[ ReturnInstr");
116 value_->ToRegister(masm, rax); 118 value_->ToRegister(masm, rax);
117 } 119 }
118 120
119 121
120 void Constant::ToRegister(MacroAssembler* masm, Register reg) { 122 void Constant::ToRegister(MacroAssembler* masm, Register reg) {
121 __ Move(reg, handle_); 123 __ Move(reg, handle_);
122 } 124 }
123 125
126
127 void SlotLocation::ToRegister(MacroAssembler* masm, Register reg) {
128 switch (type_) {
129 case Slot::PARAMETER: {
130 int count = CfgGlobals::current()->fun()->scope()->num_parameters();
131 __ movq(reg, Operand(rbp, (1 + count - index_) * kPointerSize));
132 break;
133 }
134 case Slot::LOCAL: {
135 const int kOffset = JavaScriptFrameConstants::kLocal0Offset;
136 __ movq(reg, Operand(rbp, kOffset - index_ * kPointerSize));
137 break;
138 }
139 default:
140 UNREACHABLE();
141 }
142 }
143
124 #undef __ 144 #undef __
125 145
126 } } // namespace v8::internal 146 } } // namespace v8::internal
OLDNEW
« src/cfg.cc ('K') | « src/ia32/cfg-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698