| 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 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 7 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) |
| 8 | 8 |
| 9 #include "vm/ast.h" | 9 #include "vm/ast.h" |
| 10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 parsed_function.AllocateVariables(); | 49 parsed_function.AllocateVariables(); |
| 50 bool retval; | 50 bool retval; |
| 51 Isolate* isolate = Isolate::Current(); | 51 Isolate* isolate = Isolate::Current(); |
| 52 EXPECT(isolate != NULL); | 52 EXPECT(isolate != NULL); |
| 53 LongJump* base = isolate->long_jump_base(); | 53 LongJump* base = isolate->long_jump_base(); |
| 54 LongJump jump; | 54 LongJump jump; |
| 55 isolate->set_long_jump_base(&jump); | 55 isolate->set_long_jump_base(&jump); |
| 56 if (setjmp(*jump.Set()) == 0) { | 56 if (setjmp(*jump.Set()) == 0) { |
| 57 // Build a stackmap table and some stackmap table entries. | 57 // Build a stackmap table and some stackmap table entries. |
| 58 const intptr_t kStackSlotCount = 11; | 58 const intptr_t kStackSlotCount = 11; |
| 59 StackmapTableBuilder* stackmap_table_builder = | 59 StackmapTableBuilder* stackmap_table_builder = new StackmapTableBuilder(); |
| 60 new StackmapTableBuilder(kStackSlotCount); | |
| 61 EXPECT(stackmap_table_builder != NULL); | 60 EXPECT(stackmap_table_builder != NULL); |
| 62 | 61 |
| 63 BitmapBuilder* stack_bitmap = new BitmapBuilder(); | 62 BitmapBuilder* stack_bitmap = new BitmapBuilder(); |
| 64 EXPECT(stack_bitmap != NULL); | 63 EXPECT(stack_bitmap != NULL); |
| 65 EXPECT_EQ(0, stack_bitmap->Length()); | 64 EXPECT_EQ(0, stack_bitmap->Length()); |
| 66 stack_bitmap->Set(0, true); | 65 stack_bitmap->Set(0, true); |
| 67 EXPECT_EQ(1, stack_bitmap->Length()); | 66 EXPECT_EQ(1, stack_bitmap->Length()); |
| 68 stack_bitmap->SetLength(kStackSlotCount); | 67 stack_bitmap->SetLength(kStackSlotCount); |
| 69 EXPECT_EQ(kStackSlotCount, stack_bitmap->Length()); | 68 EXPECT_EQ(kStackSlotCount, stack_bitmap->Length()); |
| 70 | 69 |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 EXPECT(function_moo.HasCode()); | 233 EXPECT(function_moo.HasCode()); |
| 235 | 234 |
| 236 String& function_foo_name = String::Handle(String::New("foo")); | 235 String& function_foo_name = String::Handle(String::New("foo")); |
| 237 Function& function_foo = | 236 Function& function_foo = |
| 238 Function::Handle(cls.LookupStaticFunction(function_foo_name)); | 237 Function::Handle(cls.LookupStaticFunction(function_foo_name)); |
| 239 EXPECT(CompilerTest::TestCompileFunction(function_foo)); | 238 EXPECT(CompilerTest::TestCompileFunction(function_foo)); |
| 240 EXPECT(function_foo.HasCode()); | 239 EXPECT(function_foo.HasCode()); |
| 241 | 240 |
| 242 // Build and setup a stackmap for the call to 'func' in 'A.foo' in order | 241 // Build and setup a stackmap for the call to 'func' in 'A.foo' in order |
| 243 // to test the traversal of stack maps when a GC happens. | 242 // to test the traversal of stack maps when a GC happens. |
| 244 StackmapTableBuilder* stackmap_table_builder = new StackmapTableBuilder(5); | 243 StackmapTableBuilder* stackmap_table_builder = new StackmapTableBuilder(); |
| 245 EXPECT(stackmap_table_builder != NULL); | 244 EXPECT(stackmap_table_builder != NULL); |
| 246 BitmapBuilder* stack_bitmap = new BitmapBuilder(); | 245 BitmapBuilder* stack_bitmap = new BitmapBuilder(); |
| 247 EXPECT(stack_bitmap != NULL); | 246 EXPECT(stack_bitmap != NULL); |
| 248 stack_bitmap->Set(0, false); // var i. | 247 stack_bitmap->Set(0, false); // var i. |
| 249 stack_bitmap->Set(1, true); // var s1. | 248 stack_bitmap->Set(1, true); // var s1. |
| 250 stack_bitmap->Set(2, false); // var k. | 249 stack_bitmap->Set(2, false); // var k. |
| 251 stack_bitmap->Set(3, true); // var s2. | 250 stack_bitmap->Set(3, true); // var s2. |
| 252 stack_bitmap->Set(4, true); // var s3. | 251 stack_bitmap->Set(4, true); // var s3. |
| 253 const Code& code = Code::Handle(function_foo.unoptimized_code()); | 252 const Code& code = Code::Handle(function_foo.unoptimized_code()); |
| 254 // Search for the pc of the call to 'func'. | 253 // Search for the pc of the call to 'func'. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 275 GrowableArray<const Object*> arguments; | 274 GrowableArray<const Object*> arguments; |
| 276 const Array& kNoArgumentNames = Array::Handle(); | 275 const Array& kNoArgumentNames = Array::Handle(); |
| 277 Object& result = Object::Handle(); | 276 Object& result = Object::Handle(); |
| 278 result = DartEntry::InvokeStatic(function_foo, arguments, kNoArgumentNames); | 277 result = DartEntry::InvokeStatic(function_foo, arguments, kNoArgumentNames); |
| 279 EXPECT(!result.IsError()); | 278 EXPECT(!result.IsError()); |
| 280 } | 279 } |
| 281 | 280 |
| 282 } // namespace dart | 281 } // namespace dart |
| 283 | 282 |
| 284 #endif // defined TARGET_ARCH_IA32 || defined(TARGET_ARCH_X64) | 283 #endif // defined TARGET_ARCH_IA32 || defined(TARGET_ARCH_X64) |
| OLD | NEW |