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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 Operand(reinterpret_cast<intptr_t>(stub.GetCode().location()), | 82 Operand(reinterpret_cast<intptr_t>(stub.GetCode().location()), |
83 RelocInfo::CODE_TARGET), | 83 RelocInfo::CODE_TARGET), |
84 LeaveCC, | 84 LeaveCC, |
85 lo); | 85 lo); |
86 } | 86 } |
87 | 87 |
88 { Comment cmnt(masm_, "[ Declarations"); | 88 { Comment cmnt(masm_, "[ Declarations"); |
89 VisitDeclarations(fun->scope()->declarations()); | 89 VisitDeclarations(fun->scope()->declarations()); |
90 } | 90 } |
91 | 91 |
| 92 if (FLAG_trace) { |
| 93 __ CallRuntime(Runtime::kTraceEnter, 0); |
| 94 } |
| 95 |
92 { Comment cmnt(masm_, "[ Body"); | 96 { Comment cmnt(masm_, "[ Body"); |
93 VisitStatements(fun->body()); | 97 VisitStatements(fun->body()); |
94 } | 98 } |
95 | 99 |
96 { Comment cmnt(masm_, "[ return <undefined>;"); | 100 { Comment cmnt(masm_, "[ return <undefined>;"); |
97 // Emit a 'return undefined' in case control fell off the end of the | 101 // Emit a 'return undefined' in case control fell off the end of the |
98 // body. | 102 // body. |
99 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); | 103 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); |
100 SetReturnPosition(fun); | 104 SetReturnPosition(fun); |
| 105 if (FLAG_trace) { |
| 106 // Push the return value on the stack as the parameter. |
| 107 // Runtime::TraceExit returns its parameter in r0. |
| 108 __ push(r0); |
| 109 __ CallRuntime(Runtime::kTraceExit, 1); |
| 110 } |
| 111 |
101 __ RecordJSReturn(); | 112 __ RecordJSReturn(); |
102 __ mov(sp, fp); | 113 __ mov(sp, fp); |
103 __ ldm(ia_w, sp, fp.bit() | lr.bit()); | 114 __ ldm(ia_w, sp, fp.bit() | lr.bit()); |
104 int num_parameters = function_->scope()->num_parameters(); | 115 int num_parameters = function_->scope()->num_parameters(); |
105 __ add(sp, sp, Operand((num_parameters + 1) * kPointerSize)); | 116 __ add(sp, sp, Operand((num_parameters + 1) * kPointerSize)); |
106 __ Jump(lr); | 117 __ Jump(lr); |
107 } | 118 } |
108 } | 119 } |
109 | 120 |
110 | 121 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // Complete the statement based on the location of the subexpression. | 154 // Complete the statement based on the location of the subexpression. |
144 Location source = expr->location(); | 155 Location source = expr->location(); |
145 ASSERT(!source.is_nowhere()); | 156 ASSERT(!source.is_nowhere()); |
146 if (source.is_temporary()) { | 157 if (source.is_temporary()) { |
147 __ pop(r0); | 158 __ pop(r0); |
148 } else { | 159 } else { |
149 ASSERT(source.is_constant()); | 160 ASSERT(source.is_constant()); |
150 ASSERT(expr->AsLiteral() != NULL); | 161 ASSERT(expr->AsLiteral() != NULL); |
151 __ mov(r0, Operand(expr->AsLiteral()->handle())); | 162 __ mov(r0, Operand(expr->AsLiteral()->handle())); |
152 } | 163 } |
| 164 |
| 165 if (FLAG_trace) { |
| 166 // Push the return value on the stack as the parameter. |
| 167 // Runtime::TraceExit returns its parameter in r0. |
| 168 __ push(r0); |
| 169 __ CallRuntime(Runtime::kTraceExit, 1); |
| 170 } |
| 171 |
153 __ RecordJSReturn(); | 172 __ RecordJSReturn(); |
154 __ mov(sp, fp); | 173 __ mov(sp, fp); |
155 __ ldm(ia_w, sp, fp.bit() | lr.bit()); | 174 __ ldm(ia_w, sp, fp.bit() | lr.bit()); |
156 int num_parameters = function_->scope()->num_parameters(); | 175 int num_parameters = function_->scope()->num_parameters(); |
157 __ add(sp, sp, Operand((num_parameters + 1) * kPointerSize)); | 176 __ add(sp, sp, Operand((num_parameters + 1) * kPointerSize)); |
158 __ Jump(lr); | 177 __ Jump(lr); |
159 } | 178 } |
160 | 179 |
161 | 180 |
162 void FastCodeGenerator::VisitFunctionLiteral(FunctionLiteral* expr) { | 181 void FastCodeGenerator::VisitFunctionLiteral(FunctionLiteral* expr) { |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 __ CallRuntime(function, arg_count); | 367 __ CallRuntime(function, arg_count); |
349 if (expr->location().is_temporary()) { | 368 if (expr->location().is_temporary()) { |
350 __ push(r0); | 369 __ push(r0); |
351 } else { | 370 } else { |
352 ASSERT(expr->location().is_nowhere()); | 371 ASSERT(expr->location().is_nowhere()); |
353 } | 372 } |
354 } | 373 } |
355 | 374 |
356 | 375 |
357 } } // namespace v8::internal | 376 } } // namespace v8::internal |
OLD | NEW |