| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/code_generator.h" | 8 #include "vm/code_generator.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2132 GenerateCall(node->token_index(), &StubCode::CallStaticFunctionLabel()); | 2132 GenerateCall(node->token_index(), &StubCode::CallStaticFunctionLabel()); |
| 2133 __ addl(ESP, Immediate(node->arguments()->length() * kWordSize)); | 2133 __ addl(ESP, Immediate(node->arguments()->length() * kWordSize)); |
| 2134 // Result is in EAX. | 2134 // Result is in EAX. |
| 2135 if (IsResultNeeded(node)) { | 2135 if (IsResultNeeded(node)) { |
| 2136 __ pushl(EAX); | 2136 __ pushl(EAX); |
| 2137 } | 2137 } |
| 2138 } | 2138 } |
| 2139 | 2139 |
| 2140 | 2140 |
| 2141 void CodeGenerator::VisitClosureCallNode(ClosureCallNode* node) { | 2141 void CodeGenerator::VisitClosureCallNode(ClosureCallNode* node) { |
| 2142 // TODO(regis): Does the spec mention if the closure is evaluated before or | 2142 // The spec states that the closure is evaluated before the arguments. |
| 2143 // after the arguments? We evaluate it first, i.e. left to right. | |
| 2144 // Preserve the current context, since it will be overridden by the closure | 2143 // Preserve the current context, since it will be overridden by the closure |
| 2145 // context during the call. | 2144 // context during the call. |
| 2146 __ pushl(CTX); | 2145 __ pushl(CTX); |
| 2147 // Compute the closure object and pass it as first argument to the stub. | 2146 // Compute the closure object and pass it as first argument to the stub. |
| 2148 node->closure()->Visit(this); | 2147 node->closure()->Visit(this); |
| 2149 // Now compute the arguments to the call. | 2148 // Now compute the arguments to the call. |
| 2150 node->arguments()->Visit(this); | 2149 node->arguments()->Visit(this); |
| 2151 // Set up the number of arguments (excluding the closure) to the ClosureCall | 2150 // Set up the number of arguments (excluding the closure) to the ClosureCall |
| 2152 // stub which will setup the closure context and jump to the entrypoint of the | 2151 // stub which will setup the closure context and jump to the entrypoint of the |
| 2153 // closure function (the function will be compiled if it has not already been | 2152 // closure function (the function will be compiled if it has not already been |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2627 const Class& cls = Class::Handle(parsed_function_.function().owner()); | 2626 const Class& cls = Class::Handle(parsed_function_.function().owner()); |
| 2628 const Script& script = Script::Handle(cls.script()); | 2627 const Script& script = Script::Handle(cls.script()); |
| 2629 Parser::ReportMsg(script, token_index, "Error", error_msg, format, args); | 2628 Parser::ReportMsg(script, token_index, "Error", error_msg, format, args); |
| 2630 Isolate::Current()->long_jump_base()->Jump(1, error_msg); | 2629 Isolate::Current()->long_jump_base()->Jump(1, error_msg); |
| 2631 UNREACHABLE(); | 2630 UNREACHABLE(); |
| 2632 } | 2631 } |
| 2633 | 2632 |
| 2634 } // namespace dart | 2633 } // namespace dart |
| 2635 | 2634 |
| 2636 #endif // defined TARGET_ARCH_IA32 | 2635 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |