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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 | 373 |
374 // The function needs to be associated with a named Class: the interface | 374 // The function needs to be associated with a named Class: the interface |
375 // Function fits the bill. | 375 // Function fits the bill. |
376 func.set_owner(Class::Handle( | 376 func.set_owner(Class::Handle( |
377 Type::Handle(Type::FunctionInterface()).type_class())); | 377 Type::Handle(Type::FunctionInterface()).type_class())); |
378 | 378 |
379 // We compile the function here, even though InvokeStatic() below | 379 // We compile the function here, even though InvokeStatic() below |
380 // would compile func automatically. We are checking fewer invariants | 380 // would compile func automatically. We are checking fewer invariants |
381 // here. | 381 // here. |
382 ParsedFunction parsed_function(func); | 382 ParsedFunction parsed_function(func); |
383 parsed_function.set_node_sequence(fragment); | 383 parsed_function.SetNodeSequence(fragment); |
384 parsed_function.set_default_parameter_values(Array::Handle()); | 384 parsed_function.set_default_parameter_values(Array::Handle()); |
385 | 385 |
386 Assembler assembler; | 386 Assembler assembler; |
387 CodeGenerator code_gen(&assembler, parsed_function); | 387 CodeGenerator code_gen(&assembler, parsed_function); |
388 code_gen.GenerateCode(); | 388 code_gen.GenerateCode(); |
389 const Code& code = Code::Handle(Code::FinalizeCode(kEvalConst, &assembler)); | 389 const Code& code = Code::Handle(Code::FinalizeCode(kEvalConst, &assembler)); |
390 | 390 |
391 func.SetCode(code); | 391 func.SetCode(code); |
392 code_gen.FinalizePcDescriptors(code); | 392 code_gen.FinalizePcDescriptors(code); |
393 code_gen.FinalizeStackmaps(code); | 393 code_gen.FinalizeStackmaps(code); |
394 code_gen.FinalizeExceptionHandlers(code); | 394 code_gen.FinalizeExceptionHandlers(code); |
395 | 395 |
396 GrowableArray<const Object*> arguments; // no arguments. | 396 GrowableArray<const Object*> arguments; // no arguments. |
397 const Array& kNoArgumentNames = Array::Handle(); | 397 const Array& kNoArgumentNames = Array::Handle(); |
398 result = DartEntry::InvokeStatic(func, | 398 result = DartEntry::InvokeStatic(func, |
399 arguments, | 399 arguments, |
400 kNoArgumentNames); | 400 kNoArgumentNames); |
401 } else { | 401 } else { |
402 result = isolate->object_store()->sticky_error(); | 402 result = isolate->object_store()->sticky_error(); |
403 isolate->object_store()->clear_sticky_error(); | 403 isolate->object_store()->clear_sticky_error(); |
404 } | 404 } |
405 isolate->set_long_jump_base(base); | 405 isolate->set_long_jump_base(base); |
406 return result.raw(); | 406 return result.raw(); |
407 } | 407 } |
408 | 408 |
409 | 409 |
410 } // namespace dart | 410 } // namespace dart |
OLD | NEW |