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 2297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2308 const ExternalLabel label(cls.ToCString(), stub.EntryPoint()); | 2308 const ExternalLabel label(cls.ToCString(), stub.EntryPoint()); |
2309 GenerateCall(node->token_index(), &label); | 2309 GenerateCall(node->token_index(), &label); |
2310 if (requires_type_arguments) { | 2310 if (requires_type_arguments) { |
2311 __ popl(ECX); // Pop type arguments. | 2311 __ popl(ECX); // Pop type arguments. |
2312 __ popl(ECX); // Pop instantiator type arguments. | 2312 __ popl(ECX); // Pop instantiator type arguments. |
2313 } | 2313 } |
2314 | 2314 |
2315 if (IsResultNeeded(node)) { | 2315 if (IsResultNeeded(node)) { |
2316 __ pushl(EAX); // Set up return value from allocate. | 2316 __ pushl(EAX); // Set up return value from allocate. |
2317 } | 2317 } |
2318 __ pushl(EAX); // First argument(this) for constructor call which follows. | 2318 |
| 2319 // First argument(this) for constructor call which follows. |
| 2320 __ pushl(EAX); |
| 2321 // Second argument is the implicit constructor phase parameter. |
| 2322 // Run both the constructor initializer list and the constructor body. |
| 2323 __ PushObject(Smi::ZoneHandle(Smi::New(Function::kCtorPhaseAll))); |
| 2324 |
2319 | 2325 |
2320 // Now setup rest of the arguments for the constructor call. | 2326 // Now setup rest of the arguments for the constructor call. |
2321 node->arguments()->Visit(this); | 2327 node->arguments()->Visit(this); |
2322 | 2328 |
2323 // Call the constructor. | 2329 // Call the constructor. |
2324 int num_args = node->arguments()->length() + 1; // +1 to include receiver. | 2330 // +2 to include implicit receiver and phase arguments. |
| 2331 int num_args = node->arguments()->length() + 2; |
2325 __ LoadObject(ECX, node->constructor()); | 2332 __ LoadObject(ECX, node->constructor()); |
2326 __ LoadObject(EDX, ArgumentsDescriptor(num_args, node->arguments()->names())); | 2333 __ LoadObject(EDX, ArgumentsDescriptor(num_args, node->arguments()->names())); |
2327 GenerateCall(node->token_index(), &StubCode::CallStaticFunctionLabel()); | 2334 GenerateCall(node->token_index(), &StubCode::CallStaticFunctionLabel()); |
2328 // Constructors do not return any value. | 2335 // Constructors do not return any value. |
2329 | 2336 |
2330 // Pop out all the other arguments on the stack. | 2337 // Pop out all the other arguments on the stack. |
2331 __ addl(ESP, Immediate(num_args * kWordSize)); | 2338 __ addl(ESP, Immediate(num_args * kWordSize)); |
2332 } | 2339 } |
2333 | 2340 |
2334 | 2341 |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2638 const Class& cls = Class::Handle(parsed_function_.function().owner()); | 2645 const Class& cls = Class::Handle(parsed_function_.function().owner()); |
2639 const Script& script = Script::Handle(cls.script()); | 2646 const Script& script = Script::Handle(cls.script()); |
2640 Parser::ReportMsg(script, token_index, "Error", error_msg, format, args); | 2647 Parser::ReportMsg(script, token_index, "Error", error_msg, format, args); |
2641 Isolate::Current()->long_jump_base()->Jump(1, error_msg); | 2648 Isolate::Current()->long_jump_base()->Jump(1, error_msg); |
2642 UNREACHABLE(); | 2649 UNREACHABLE(); |
2643 } | 2650 } |
2644 | 2651 |
2645 } // namespace dart | 2652 } // namespace dart |
2646 | 2653 |
2647 #endif // defined TARGET_ARCH_IA32 | 2654 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |