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 "platform/assert.h" | 5 #include "platform/assert.h" |
6 #include "vm/globals.h" | 6 #include "vm/globals.h" |
7 | 7 |
8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/code_descriptors.h" | 10 #include "vm/code_descriptors.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 | 22 |
23 CODEGEN_TEST_GENERATE(StackmapCodegen, test) { | 23 CODEGEN_TEST_GENERATE(StackmapCodegen, test) { |
24 Assembler assembler; | 24 Assembler assembler; |
25 const String& function_name = String::ZoneHandle(Symbols::New("test")); | 25 const String& function_name = String::ZoneHandle(Symbols::New("test")); |
26 Class& cls = Class::ZoneHandle(); | 26 Class& cls = Class::ZoneHandle(); |
27 const Script& script = Script::Handle(); | 27 const Script& script = Script::Handle(); |
28 cls = Class::New(function_name, script, Scanner::kDummyTokenIndex); | 28 cls = Class::New(function_name, script, Scanner::kDummyTokenIndex); |
29 const Function& function = Function::ZoneHandle( | 29 const Function& function = Function::ZoneHandle( |
30 Function::New(function_name, RawFunction::kRegularFunction, | 30 Function::New(function_name, RawFunction::kRegularFunction, |
31 true, false, false, false, cls, 0)); | 31 true, false, false, false, false, cls, 0)); |
32 function.set_result_type(Type::Handle(Type::DynamicType())); | 32 function.set_result_type(Type::Handle(Type::DynamicType())); |
33 const Array& functions = Array::Handle(Array::New(1)); | 33 const Array& functions = Array::Handle(Array::New(1)); |
34 functions.SetAt(0, function); | 34 functions.SetAt(0, function); |
35 cls.SetFunctions(functions); | 35 cls.SetFunctions(functions); |
36 Library& lib = Library::Handle(Library::CoreLibrary()); | 36 Library& lib = Library::Handle(Library::CoreLibrary()); |
37 lib.AddClass(cls); | 37 lib.AddClass(cls); |
38 ParsedFunction* parsed_function = new ParsedFunction(function); | 38 ParsedFunction* parsed_function = new ParsedFunction(function); |
39 LiteralNode* l = new LiteralNode(kPos, Smi::ZoneHandle(Smi::New(1))); | 39 LiteralNode* l = new LiteralNode(kPos, Smi::ZoneHandle(Smi::New(1))); |
40 test->node_sequence()->Add(new ReturnNode(kPos, l)); | 40 test->node_sequence()->Add(new ReturnNode(kPos, l)); |
41 l = new LiteralNode(kPos, Smi::ZoneHandle(Smi::New(2))); | 41 l = new LiteralNode(kPos, Smi::ZoneHandle(Smi::New(2))); |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 273 |
274 // Now invoke 'A.moo' and it will trigger a GC when the native function | 274 // Now invoke 'A.moo' and it will trigger a GC when the native function |
275 // is called, this should then cause the stack map of function 'A.foo' | 275 // is called, this should then cause the stack map of function 'A.foo' |
276 // to be traversed and the appropriate objects visited. | 276 // to be traversed and the appropriate objects visited. |
277 const Object& result = Object::Handle( | 277 const Object& result = Object::Handle( |
278 DartEntry::InvokeFunction(function_foo, Object::empty_array())); | 278 DartEntry::InvokeFunction(function_foo, Object::empty_array())); |
279 EXPECT(!result.IsError()); | 279 EXPECT(!result.IsError()); |
280 } | 280 } |
281 | 281 |
282 } // namespace dart | 282 } // namespace dart |
OLD | NEW |