| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 __ j(above_equal, &ok, taken); | 72 __ j(above_equal, &ok, taken); |
| 73 StackCheckStub stub; | 73 StackCheckStub stub; |
| 74 __ CallStub(&stub); | 74 __ CallStub(&stub); |
| 75 __ bind(&ok); | 75 __ bind(&ok); |
| 76 } | 76 } |
| 77 | 77 |
| 78 { Comment cmnt(masm_, "[ Declarations"); | 78 { Comment cmnt(masm_, "[ Declarations"); |
| 79 VisitDeclarations(fun->scope()->declarations()); | 79 VisitDeclarations(fun->scope()->declarations()); |
| 80 } | 80 } |
| 81 | 81 |
| 82 if (FLAG_trace) { |
| 83 __ CallRuntime(Runtime::kTraceEnter, 0); |
| 84 } |
| 85 |
| 82 { Comment cmnt(masm_, "[ Body"); | 86 { Comment cmnt(masm_, "[ Body"); |
| 83 VisitStatements(fun->body()); | 87 VisitStatements(fun->body()); |
| 84 } | 88 } |
| 85 | 89 |
| 86 { Comment cmnt(masm_, "[ return <undefined>;"); | 90 { Comment cmnt(masm_, "[ return <undefined>;"); |
| 87 // Emit a 'return undefined' in case control fell off the end of the | 91 // Emit a 'return undefined' in case control fell off the end of the |
| 88 // body. | 92 // body. |
| 89 __ mov(eax, Factory::undefined_value()); | 93 __ mov(eax, Factory::undefined_value()); |
| 90 SetReturnPosition(fun); | 94 SetReturnPosition(fun); |
| 95 |
| 96 if (FLAG_trace) { |
| 97 __ push(eax); |
| 98 __ CallRuntime(Runtime::kTraceExit, 1); |
| 99 } |
| 91 __ RecordJSReturn(); | 100 __ RecordJSReturn(); |
| 92 // Do not use the leave instruction here because it is too short to | 101 // Do not use the leave instruction here because it is too short to |
| 93 // patch with the code required by the debugger. | 102 // patch with the code required by the debugger. |
| 94 __ mov(esp, ebp); | 103 __ mov(esp, ebp); |
| 95 __ pop(ebp); | 104 __ pop(ebp); |
| 96 __ ret((fun->scope()->num_parameters() + 1) * kPointerSize); | 105 __ ret((fun->scope()->num_parameters() + 1) * kPointerSize); |
| 97 } | 106 } |
| 98 } | 107 } |
| 99 | 108 |
| 100 | 109 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 131 // Complete the statement based on the location of the subexpression. | 140 // Complete the statement based on the location of the subexpression. |
| 132 Location source = expr->location(); | 141 Location source = expr->location(); |
| 133 ASSERT(!source.is_nowhere()); | 142 ASSERT(!source.is_nowhere()); |
| 134 if (source.is_temporary()) { | 143 if (source.is_temporary()) { |
| 135 __ pop(eax); | 144 __ pop(eax); |
| 136 } else { | 145 } else { |
| 137 ASSERT(source.is_constant()); | 146 ASSERT(source.is_constant()); |
| 138 ASSERT(expr->AsLiteral() != NULL); | 147 ASSERT(expr->AsLiteral() != NULL); |
| 139 __ mov(eax, expr->AsLiteral()->handle()); | 148 __ mov(eax, expr->AsLiteral()->handle()); |
| 140 } | 149 } |
| 150 if (FLAG_trace) { |
| 151 __ push(eax); |
| 152 __ CallRuntime(Runtime::kTraceExit, 1); |
| 153 } |
| 141 __ RecordJSReturn(); | 154 __ RecordJSReturn(); |
| 155 |
| 142 // Do not use the leave instruction here because it is too short to | 156 // Do not use the leave instruction here because it is too short to |
| 143 // patch with the code required by the debugger. | 157 // patch with the code required by the debugger. |
| 144 __ mov(esp, ebp); | 158 __ mov(esp, ebp); |
| 145 __ pop(ebp); | 159 __ pop(ebp); |
| 146 __ ret((function_->scope()->num_parameters() + 1) * kPointerSize); | 160 __ ret((function_->scope()->num_parameters() + 1) * kPointerSize); |
| 147 } | 161 } |
| 148 | 162 |
| 149 | 163 |
| 150 void FastCodeGenerator::VisitFunctionLiteral(FunctionLiteral* expr) { | 164 void FastCodeGenerator::VisitFunctionLiteral(FunctionLiteral* expr) { |
| 151 Comment cmnt(masm_, "[ FunctionLiteral"); | 165 Comment cmnt(masm_, "[ FunctionLiteral"); |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 __ CallRuntime(function, arg_count); | 348 __ CallRuntime(function, arg_count); |
| 335 if (expr->location().is_temporary()) { | 349 if (expr->location().is_temporary()) { |
| 336 __ push(eax); | 350 __ push(eax); |
| 337 } else { | 351 } else { |
| 338 ASSERT(expr->location().is_nowhere()); | 352 ASSERT(expr->location().is_nowhere()); |
| 339 } | 353 } |
| 340 } | 354 } |
| 341 | 355 |
| 342 | 356 |
| 343 } } // namespace v8::internal | 357 } } // namespace v8::internal |
| OLD | NEW |