| 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/compiler.h" | 5 #include "vm/compiler.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/ast_printer.h" | 8 #include "vm/ast_printer.h" |
| 9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 // Function fits the bill. | 484 // Function fits the bill. |
| 485 func.set_owner(Class::Handle( | 485 func.set_owner(Class::Handle( |
| 486 Type::Handle(Type::FunctionInterface()).type_class())); | 486 Type::Handle(Type::FunctionInterface()).type_class())); |
| 487 | 487 |
| 488 // We compile the function here, even though InvokeStatic() below | 488 // We compile the function here, even though InvokeStatic() below |
| 489 // would compile func automatically. We are checking fewer invariants | 489 // would compile func automatically. We are checking fewer invariants |
| 490 // here. | 490 // here. |
| 491 ParsedFunction parsed_function(func); | 491 ParsedFunction parsed_function(func); |
| 492 parsed_function.SetNodeSequence(fragment); | 492 parsed_function.SetNodeSequence(fragment); |
| 493 parsed_function.set_default_parameter_values(Array::Handle()); | 493 parsed_function.set_default_parameter_values(Array::Handle()); |
| 494 parsed_function.set_expression_temp_var( |
| 495 ParsedFunction::CreateExpressionTempVar(0)); |
| 496 fragment->scope()->AddVariable(parsed_function.expression_temp_var()); |
| 497 parsed_function.AllocateVariables(); |
| 494 | 498 |
| 495 CompileParsedFunctionHelper(parsed_function, false); // Non-optimized. | 499 CompileParsedFunctionHelper(parsed_function, false); // Non-optimized. |
| 496 | 500 |
| 497 GrowableArray<const Object*> arguments; // no arguments. | 501 GrowableArray<const Object*> arguments; // no arguments. |
| 498 const Array& kNoArgumentNames = Array::Handle(); | 502 const Array& kNoArgumentNames = Array::Handle(); |
| 499 Object& result = Object::Handle(); | 503 Object& result = Object::Handle(); |
| 500 result = DartEntry::InvokeStatic(func, | 504 result = DartEntry::InvokeStatic(func, |
| 501 arguments, | 505 arguments, |
| 502 kNoArgumentNames); | 506 kNoArgumentNames); |
| 503 isolate->set_long_jump_base(base); | 507 isolate->set_long_jump_base(base); |
| 504 return result.raw(); | 508 return result.raw(); |
| 505 } else { | 509 } else { |
| 506 Object& result = Object::Handle(); | 510 Object& result = Object::Handle(); |
| 507 result = isolate->object_store()->sticky_error(); | 511 result = isolate->object_store()->sticky_error(); |
| 508 isolate->object_store()->clear_sticky_error(); | 512 isolate->object_store()->clear_sticky_error(); |
| 509 isolate->set_long_jump_base(base); | 513 isolate->set_long_jump_base(base); |
| 510 return result.raw(); | 514 return result.raw(); |
| 511 } | 515 } |
| 512 UNREACHABLE(); | 516 UNREACHABLE(); |
| 513 return Object::null(); | 517 return Object::null(); |
| 514 } | 518 } |
| 515 | 519 |
| 516 | 520 |
| 517 } // namespace dart | 521 } // namespace dart |
| OLD | NEW |