| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/flow_graph_builder.h" | 5 #include "vm/flow_graph_builder.h" |
| 6 | 6 |
| 7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
| 8 #include "vm/ast_printer.h" | 8 #include "vm/ast_printer.h" |
| 9 #include "vm/bit_vector.h" | 9 #include "vm/bit_vector.h" |
| 10 #include "vm/code_descriptors.h" | 10 #include "vm/code_descriptors.h" |
| (...skipping 1795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1806 } | 1806 } |
| 1807 Goto(jump_target); | 1807 Goto(jump_target); |
| 1808 } | 1808 } |
| 1809 | 1809 |
| 1810 | 1810 |
| 1811 void EffectGraphVisitor::VisitArgumentListNode(ArgumentListNode* node) { | 1811 void EffectGraphVisitor::VisitArgumentListNode(ArgumentListNode* node) { |
| 1812 UNREACHABLE(); | 1812 UNREACHABLE(); |
| 1813 } | 1813 } |
| 1814 | 1814 |
| 1815 | 1815 |
| 1816 void EffectGraphVisitor::VisitArgumentDefinitionTestNode( | |
| 1817 ArgumentDefinitionTestNode* node) { | |
| 1818 InlineBailout("EffectGraphVisitor::VisitArgumentDefinitionTestNode"); | |
| 1819 Definition* load = BuildLoadLocal(node->saved_arguments_descriptor()); | |
| 1820 Value* arguments_descriptor = Bind(load); | |
| 1821 ArgumentDefinitionTestInstr* arg_def_test = | |
| 1822 new ArgumentDefinitionTestInstr(node, arguments_descriptor); | |
| 1823 ReturnDefinition(arg_def_test); | |
| 1824 } | |
| 1825 | |
| 1826 | |
| 1827 intptr_t EffectGraphVisitor::GetCurrentTempLocalIndex() const { | 1816 intptr_t EffectGraphVisitor::GetCurrentTempLocalIndex() const { |
| 1828 return kFirstLocalSlotFromFp | 1817 return kFirstLocalSlotFromFp |
| 1829 - owner()->num_stack_locals() | 1818 - owner()->num_stack_locals() |
| 1830 - owner()->num_copied_params() | 1819 - owner()->num_copied_params() |
| 1831 - owner()->args_pushed() | 1820 - owner()->args_pushed() |
| 1832 - temp_index() + 1; | 1821 - temp_index() + 1; |
| 1833 } | 1822 } |
| 1834 | 1823 |
| 1835 | 1824 |
| 1836 LocalVariable* EffectGraphVisitor::EnterTempLocalScope(Value* value) { | 1825 LocalVariable* EffectGraphVisitor::EnterTempLocalScope(Value* value) { |
| (...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3110 } | 3099 } |
| 3111 | 3100 |
| 3112 AddInstruction(new ChainContextInstr(allocated_context)); | 3101 AddInstruction(new ChainContextInstr(allocated_context)); |
| 3113 owner()->set_context_level(scope->context_level()); | 3102 owner()->set_context_level(scope->context_level()); |
| 3114 | 3103 |
| 3115 // If this node_sequence is the body of the function being compiled, copy | 3104 // If this node_sequence is the body of the function being compiled, copy |
| 3116 // the captured parameters from the frame into the context. | 3105 // the captured parameters from the frame into the context. |
| 3117 if (node == owner()->parsed_function()->node_sequence()) { | 3106 if (node == owner()->parsed_function()->node_sequence()) { |
| 3118 ASSERT(scope->context_level() == 1); | 3107 ASSERT(scope->context_level() == 1); |
| 3119 const Function& function = owner()->parsed_function()->function(); | 3108 const Function& function = owner()->parsed_function()->function(); |
| 3120 int num_params = function.NumParameters(); | 3109 const int num_params = function.NumParameters(); |
| 3121 int param_frame_index = (num_params == function.num_fixed_parameters()) ? | 3110 int param_frame_index = (num_params == function.num_fixed_parameters()) ? |
| 3122 (kParamEndSlotFromFp + num_params) : kFirstLocalSlotFromFp; | 3111 (kParamEndSlotFromFp + num_params) : kFirstLocalSlotFromFp; |
| 3123 // Handle the saved arguments descriptor as an additional parameter. | |
| 3124 if (owner()->parsed_function()->GetSavedArgumentsDescriptorVar() != | |
| 3125 NULL) { | |
| 3126 ASSERT(param_frame_index == kFirstLocalSlotFromFp); | |
| 3127 num_params++; | |
| 3128 } | |
| 3129 for (int pos = 0; pos < num_params; param_frame_index--, pos++) { | 3112 for (int pos = 0; pos < num_params; param_frame_index--, pos++) { |
| 3130 const LocalVariable& parameter = *scope->VariableAt(pos); | 3113 const LocalVariable& parameter = *scope->VariableAt(pos); |
| 3131 ASSERT(parameter.owner() == scope); | 3114 ASSERT(parameter.owner() == scope); |
| 3132 if (parameter.is_captured()) { | 3115 if (parameter.is_captured()) { |
| 3133 // Create a temporary local describing the original position. | 3116 // Create a temporary local describing the original position. |
| 3134 const String& temp_name = String::ZoneHandle(String::Concat( | 3117 const String& temp_name = String::ZoneHandle(String::Concat( |
| 3135 parameter.name(), String::Handle(Symbols::New("-orig")))); | 3118 parameter.name(), String::Handle(Symbols::New("-orig")))); |
| 3136 LocalVariable* temp_local = new LocalVariable( | 3119 LocalVariable* temp_local = new LocalVariable( |
| 3137 0, // Token index. | 3120 0, // Token index. |
| 3138 temp_name, | 3121 temp_name, |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3510 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; | 3493 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; |
| 3511 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 3494 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 3512 OS::SNPrint(chars, len, kFormat, function_name, reason); | 3495 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 3513 const Error& error = Error::Handle( | 3496 const Error& error = Error::Handle( |
| 3514 LanguageError::New(String::Handle(String::New(chars)))); | 3497 LanguageError::New(String::Handle(String::New(chars)))); |
| 3515 Isolate::Current()->long_jump_base()->Jump(1, error); | 3498 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 3516 } | 3499 } |
| 3517 | 3500 |
| 3518 | 3501 |
| 3519 } // namespace dart | 3502 } // namespace dart |
| OLD | NEW |