| 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 "vm/ast_printer.h" | 7 #include "vm/ast_printer.h" |
| 8 #include "vm/bit_vector.h" | 8 #include "vm/bit_vector.h" |
| 9 #include "vm/code_descriptors.h" | 9 #include "vm/code_descriptors.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1537 Smi::ZoneHandle(Smi::New( | 1537 Smi::ZoneHandle(Smi::New( |
| 1538 StubCode::kNoInstantiator)))); | 1538 StubCode::kNoInstantiator)))); |
| 1539 AddInstruction(no_instantiator); | 1539 AddInstruction(no_instantiator); |
| 1540 args->Add(new UseVal(type_args)); | 1540 args->Add(new UseVal(type_args)); |
| 1541 args->Add(new UseVal(no_instantiator)); | 1541 args->Add(new UseVal(no_instantiator)); |
| 1542 return; | 1542 return; |
| 1543 } | 1543 } |
| 1544 // The type arguments are uninstantiated. The generated pseudo code: | 1544 // The type arguments are uninstantiated. The generated pseudo code: |
| 1545 // t1 = InstantiatorTypeArguments(); | 1545 // t1 = InstantiatorTypeArguments(); |
| 1546 // t2 = ExtractConstructorTypeArguments(t1); | 1546 // t2 = ExtractConstructorTypeArguments(t1); |
| 1547 // t1 = ExtractConstructorInstantiator(t1, t2); | 1547 // t1 = ExtractConstructorInstantiator(t1); |
| 1548 // t_n <- t2 | 1548 // t_n <- t2 |
| 1549 // t_n+1 <- t1 | 1549 // t_n+1 <- t1 |
| 1550 // Use expression_temp_var and node->allocated_object_var() locals to keep | 1550 // Use expression_temp_var and node->allocated_object_var() locals to keep |
| 1551 // intermediate results around (t1 and t2 above). | 1551 // intermediate results around (t1 and t2 above). |
| 1552 ASSERT(owner()->parsed_function().expression_temp_var() != NULL); | 1552 ASSERT(owner()->parsed_function().expression_temp_var() != NULL); |
| 1553 const LocalVariable& t1 = *owner()->parsed_function().expression_temp_var(); | 1553 const LocalVariable& t1 = *owner()->parsed_function().expression_temp_var(); |
| 1554 const LocalVariable& t2 = node->allocated_object_var(); | 1554 const LocalVariable& t2 = node->allocated_object_var(); |
| 1555 Value* instantiator = BuildInstantiatorTypeArguments(node->token_index()); | 1555 Value* instantiator = BuildInstantiatorTypeArguments(node->token_index()); |
| 1556 ASSERT(instantiator->IsUse()); | 1556 ASSERT(instantiator->IsUse()); |
| 1557 Definition* stored_instantiator = new BindInstr( | 1557 Definition* stored_instantiator = new BindInstr( |
| 1558 BuildStoreLocal(t1, instantiator)); | 1558 BuildStoreLocal(t1, instantiator)); |
| 1559 AddInstruction(stored_instantiator); | 1559 AddInstruction(stored_instantiator); |
| 1560 // t1: instantiator type arguments. | 1560 // t1: instantiator type arguments. |
| 1561 | 1561 |
| 1562 BindInstr* extract_type_arguments = new BindInstr( | 1562 BindInstr* extract_type_arguments = new BindInstr( |
| 1563 new ExtractConstructorTypeArgumentsComp( | 1563 new ExtractConstructorTypeArgumentsComp( |
| 1564 node->token_index(), | 1564 node->token_index(), |
| 1565 owner()->try_index(), | 1565 owner()->try_index(), |
| 1566 node->type_arguments(), | 1566 node->type_arguments(), |
| 1567 new UseVal(stored_instantiator))); | 1567 new UseVal(stored_instantiator))); |
| 1568 AddInstruction(extract_type_arguments); | 1568 AddInstruction(extract_type_arguments); |
| 1569 | 1569 |
| 1570 Instruction* stored_type_arguments = new DoInstr( | 1570 Instruction* stored_type_arguments = new DoInstr( |
| 1571 BuildStoreLocal(t2, new UseVal(extract_type_arguments))); | 1571 BuildStoreLocal(t2, new UseVal(extract_type_arguments))); |
| 1572 AddInstruction(stored_type_arguments); | 1572 AddInstruction(stored_type_arguments); |
| 1573 // t2: extracted constructor type arguments. | 1573 // t2: extracted constructor type arguments. |
| 1574 Definition* load_instantiator = new BindInstr(BuildLoadLocal(t1)); | 1574 Definition* load_instantiator = new BindInstr(BuildLoadLocal(t1)); |
| 1575 AddInstruction(load_instantiator); | 1575 AddInstruction(load_instantiator); |
| 1576 Definition* load_type_arguments = new BindInstr(BuildLoadLocal(t2)); | |
| 1577 AddInstruction(load_type_arguments); | |
| 1578 | 1576 |
| 1579 BindInstr* extract_instantiator = | 1577 BindInstr* extract_instantiator = |
| 1580 new BindInstr(new ExtractConstructorInstantiatorComp( | 1578 new BindInstr(new ExtractConstructorInstantiatorComp( |
| 1581 node, | 1579 node, |
| 1582 new UseVal(load_instantiator), | 1580 new UseVal(load_instantiator))); |
| 1583 new UseVal(load_type_arguments))); | |
| 1584 AddInstruction(extract_instantiator); | 1581 AddInstruction(extract_instantiator); |
| 1585 AddInstruction(new DoInstr( | 1582 AddInstruction(new DoInstr( |
| 1586 BuildStoreLocal(t1, new UseVal(extract_instantiator)))); | 1583 BuildStoreLocal(t1, new UseVal(extract_instantiator)))); |
| 1587 // t2: extracted constructor type arguments. | 1584 // t2: extracted constructor type arguments. |
| 1588 // t1: extracted constructor instantiator. | 1585 // t1: extracted constructor instantiator. |
| 1589 Definition* load_0 = new BindInstr(BuildLoadLocal(t2)); | 1586 Definition* load_0 = new BindInstr(BuildLoadLocal(t2)); |
| 1590 AddInstruction(load_0); | 1587 AddInstruction(load_0); |
| 1591 Definition* load_1 = new BindInstr(BuildLoadLocal(t1)); | 1588 Definition* load_1 = new BindInstr(BuildLoadLocal(t1)); |
| 1592 AddInstruction(load_1); | 1589 AddInstruction(load_1); |
| 1593 args->Add(new UseVal(load_0)); | 1590 args->Add(new UseVal(load_0)); |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2286 char* chars = reinterpret_cast<char*>( | 2283 char* chars = reinterpret_cast<char*>( |
| 2287 Isolate::Current()->current_zone()->Allocate(len)); | 2284 Isolate::Current()->current_zone()->Allocate(len)); |
| 2288 OS::SNPrint(chars, len, kFormat, function_name, reason); | 2285 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 2289 const Error& error = Error::Handle( | 2286 const Error& error = Error::Handle( |
| 2290 LanguageError::New(String::Handle(String::New(chars)))); | 2287 LanguageError::New(String::Handle(String::New(chars)))); |
| 2291 Isolate::Current()->long_jump_base()->Jump(1, error); | 2288 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2292 } | 2289 } |
| 2293 | 2290 |
| 2294 | 2291 |
| 2295 } // namespace dart | 2292 } // namespace dart |
| OLD | NEW |