| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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.SwitchAllocationStub(); |
| 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 |
| 105 owner.SwitchAllocationStub(); |
| 106 result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
| 107 EXPECT_VALID(result); |
| 108 |
| 109 owner.SwitchAllocationStub(); |
| 110 result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
| 111 EXPECT_VALID(result); |
| 112 |
| 104 FLAG_enable_type_checks = old_enable_type_checks; | 113 FLAG_enable_type_checks = old_enable_type_checks; |
| 105 } | 114 } |
| 106 | 115 |
| 107 | 116 |
| 108 TEST_CASE(EvalExpression) { | 117 TEST_CASE(EvalExpression) { |
| 109 const char* kScriptChars = | 118 const char* kScriptChars = |
| 110 "int ten = 2 * 5; \n" | 119 "int ten = 2 * 5; \n" |
| 111 "get dot => '.'; \n" | 120 "get dot => '.'; \n" |
| 112 "class A { \n" | 121 "class A { \n" |
| 113 " var apa = 'Herr Nilsson'; \n" | 122 " var apa = 'Herr Nilsson'; \n" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 val = lib.Evaluate(expression, Array::empty_array(), Array::empty_array()); | 173 val = lib.Evaluate(expression, Array::empty_array(), Array::empty_array()); |
| 165 } | 174 } |
| 166 | 175 |
| 167 EXPECT(!val.IsNull()); | 176 EXPECT(!val.IsNull()); |
| 168 EXPECT(!val.IsError()); | 177 EXPECT(!val.IsError()); |
| 169 EXPECT(val.IsInteger()); | 178 EXPECT(val.IsInteger()); |
| 170 EXPECT_EQ(7, Integer::Cast(val).AsInt64Value()); | 179 EXPECT_EQ(7, Integer::Cast(val).AsInt64Value()); |
| 171 } | 180 } |
| 172 | 181 |
| 173 } // namespace dart | 182 } // namespace dart |
| OLD | NEW |