OLD | NEW |
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 __ j(above_equal, &ok); | 71 __ j(above_equal, &ok); |
72 StackCheckStub stub; | 72 StackCheckStub stub; |
73 __ CallStub(&stub); | 73 __ CallStub(&stub); |
74 __ bind(&ok); | 74 __ bind(&ok); |
75 } | 75 } |
76 | 76 |
77 { Comment cmnt(masm_, "[ Declarations"); | 77 { Comment cmnt(masm_, "[ Declarations"); |
78 VisitDeclarations(fun->scope()->declarations()); | 78 VisitDeclarations(fun->scope()->declarations()); |
79 } | 79 } |
80 | 80 |
| 81 if (FLAG_trace) { |
| 82 __ CallRuntime(Runtime::kTraceEnter, 0); |
| 83 } |
| 84 |
81 { Comment cmnt(masm_, "[ Body"); | 85 { Comment cmnt(masm_, "[ Body"); |
82 VisitStatements(fun->body()); | 86 VisitStatements(fun->body()); |
83 } | 87 } |
84 | 88 |
85 { Comment cmnt(masm_, "[ return <undefined>;"); | 89 { Comment cmnt(masm_, "[ return <undefined>;"); |
86 // Emit a 'return undefined' in case control fell off the end of the | 90 // Emit a 'return undefined' in case control fell off the end of the |
87 // body. | 91 // body. |
88 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); | 92 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); |
89 SetReturnPosition(fun); | 93 SetReturnPosition(fun); |
| 94 if (FLAG_trace) { |
| 95 __ push(rax); |
| 96 __ CallRuntime(Runtime::kTraceExit, 1); |
| 97 } |
90 __ RecordJSReturn(); | 98 __ RecordJSReturn(); |
| 99 |
91 // Do not use the leave instruction here because it is too short to | 100 // Do not use the leave instruction here because it is too short to |
92 // patch with the code required by the debugger. | 101 // patch with the code required by the debugger. |
93 __ movq(rsp, rbp); | 102 __ movq(rsp, rbp); |
94 __ pop(rbp); | 103 __ pop(rbp); |
95 __ ret((fun->scope()->num_parameters() + 1) * kPointerSize); | 104 __ ret((fun->scope()->num_parameters() + 1) * kPointerSize); |
96 #ifdef ENABLE_DEBUGGER_SUPPORT | 105 #ifdef ENABLE_DEBUGGER_SUPPORT |
97 // Add padding that will be overwritten by a debugger breakpoint. We | 106 // Add padding that will be overwritten by a debugger breakpoint. We |
98 // have just generated "movq rsp, rbp; pop rbp; ret k" with length 7 | 107 // have just generated "movq rsp, rbp; pop rbp; ret k" with length 7 |
99 // (3 + 1 + 3). | 108 // (3 + 1 + 3). |
100 const int kPadding = Debug::kX64JSReturnSequenceLength - 7; | 109 const int kPadding = Debug::kX64JSReturnSequenceLength - 7; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 // Complete the statement based on the location of the subexpression. | 148 // Complete the statement based on the location of the subexpression. |
140 Location source = expr->location(); | 149 Location source = expr->location(); |
141 ASSERT(!source.is_nowhere()); | 150 ASSERT(!source.is_nowhere()); |
142 if (source.is_temporary()) { | 151 if (source.is_temporary()) { |
143 __ pop(rax); | 152 __ pop(rax); |
144 } else { | 153 } else { |
145 ASSERT(source.is_constant()); | 154 ASSERT(source.is_constant()); |
146 ASSERT(expr->AsLiteral() != NULL); | 155 ASSERT(expr->AsLiteral() != NULL); |
147 __ Move(rax, expr->AsLiteral()->handle()); | 156 __ Move(rax, expr->AsLiteral()->handle()); |
148 } | 157 } |
| 158 if (FLAG_trace) { |
| 159 __ push(rax); |
| 160 __ CallRuntime(Runtime::kTraceExit, 1); |
| 161 } |
| 162 |
149 __ RecordJSReturn(); | 163 __ RecordJSReturn(); |
150 // Do not use the leave instruction here because it is too short to | 164 // Do not use the leave instruction here because it is too short to |
151 // patch with the code required by the debugger. | 165 // patch with the code required by the debugger. |
152 __ movq(rsp, rbp); | 166 __ movq(rsp, rbp); |
153 __ pop(rbp); | 167 __ pop(rbp); |
154 __ ret((function_->scope()->num_parameters() + 1) * kPointerSize); | 168 __ ret((function_->scope()->num_parameters() + 1) * kPointerSize); |
155 #ifdef ENABLE_DEBUGGER_SUPPORT | 169 #ifdef ENABLE_DEBUGGER_SUPPORT |
156 // Add padding that will be overwritten by a debugger breakpoint. We | 170 // Add padding that will be overwritten by a debugger breakpoint. We |
157 // have just generated "movq rsp, rbp; pop rbp; ret k" with length 7 | 171 // have just generated "movq rsp, rbp; pop rbp; ret k" with length 7 |
158 // (3 + 1 + 3). | 172 // (3 + 1 + 3). |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 __ CallRuntime(function, arg_count); | 361 __ CallRuntime(function, arg_count); |
348 if (expr->location().is_temporary()) { | 362 if (expr->location().is_temporary()) { |
349 __ push(rax); | 363 __ push(rax); |
350 } else { | 364 } else { |
351 ASSERT(expr->location().is_nowhere()); | 365 ASSERT(expr->location().is_nowhere()); |
352 } | 366 } |
353 } | 367 } |
354 | 368 |
355 | 369 |
356 } } // namespace v8::internal | 370 } } // namespace v8::internal |
OLD | NEW |