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/class_finalizer.h" | 6 #include "vm/class_finalizer.h" |
7 #include "vm/code_patcher.h" | 7 #include "vm/code_patcher.h" |
8 #include "vm/compiler.h" | 8 #include "vm/compiler.h" |
9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 Class& cls = Class::Handle( | 91 Class& cls = Class::Handle( |
92 lib_handle.LookupClass(String::Handle(Symbols::New("A")))); | 92 lib_handle.LookupClass(String::Handle(Symbols::New("A")))); |
93 EXPECT(!cls.IsNull()); | 93 EXPECT(!cls.IsNull()); |
94 | 94 |
95 Isolate* isolate = Isolate::Current(); | 95 Isolate* isolate = Isolate::Current(); |
96 StubCode* stub_code = isolate->stub_code(); | 96 StubCode* stub_code = isolate->stub_code(); |
97 const Code& stub = Code::Handle(isolate, | 97 const Code& stub = Code::Handle(isolate, |
98 stub_code->GetAllocationStubForClass(cls)); | 98 stub_code->GetAllocationStubForClass(cls)); |
99 Class& owner = Class::Handle(); | 99 Class& owner = Class::Handle(); |
100 owner ^= stub.owner(); | 100 owner ^= stub.owner(); |
101 owner.SwitchAllocationStub(); | 101 owner.DisableAllocationStub(); |
102 result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 102 result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
103 EXPECT_VALID(result); | 103 EXPECT_VALID(result); |
104 | 104 |
105 owner.SwitchAllocationStub(); | 105 owner.DisableAllocationStub(); |
106 result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 106 result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
107 EXPECT_VALID(result); | 107 EXPECT_VALID(result); |
108 | 108 |
109 owner.SwitchAllocationStub(); | 109 owner.DisableAllocationStub(); |
110 result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 110 result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
111 EXPECT_VALID(result); | 111 EXPECT_VALID(result); |
112 | 112 |
113 FLAG_enable_type_checks = old_enable_type_checks; | 113 FLAG_enable_type_checks = old_enable_type_checks; |
114 } | 114 } |
115 | 115 |
116 | 116 |
117 TEST_CASE(EvalExpression) { | 117 TEST_CASE(EvalExpression) { |
118 const char* kScriptChars = | 118 const char* kScriptChars = |
119 "int ten = 2 * 5; \n" | 119 "int ten = 2 * 5; \n" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 val = lib.Evaluate(expression, Array::empty_array(), Array::empty_array()); | 173 val = lib.Evaluate(expression, Array::empty_array(), Array::empty_array()); |
174 } | 174 } |
175 | 175 |
176 EXPECT(!val.IsNull()); | 176 EXPECT(!val.IsNull()); |
177 EXPECT(!val.IsError()); | 177 EXPECT(!val.IsError()); |
178 EXPECT(val.IsInteger()); | 178 EXPECT(val.IsInteger()); |
179 EXPECT_EQ(7, Integer::Cast(val).AsInt64Value()); | 179 EXPECT_EQ(7, Integer::Cast(val).AsInt64Value()); |
180 } | 180 } |
181 | 181 |
182 } // namespace dart | 182 } // namespace dart |
OLD | NEW |