| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
| 7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
| 8 | 8 |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| (...skipping 4238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4249 const String& getter_name = | 4249 const String& getter_name = |
| 4250 String::Handle(Z, Field::GetterName(field_name)); | 4250 String::Handle(Z, Field::GetterName(field_name)); |
| 4251 getter = cls.LookupStaticFunctionAllowPrivate(getter_name); | 4251 getter = cls.LookupStaticFunctionAllowPrivate(getter_name); |
| 4252 } | 4252 } |
| 4253 | 4253 |
| 4254 if (!getter.IsNull()) { | 4254 if (!getter.IsNull()) { |
| 4255 // Invoke the getter and return the result. | 4255 // Invoke the getter and return the result. |
| 4256 return Api::NewHandle(I, | 4256 return Api::NewHandle(I, |
| 4257 DartEntry::InvokeFunction(getter, Object::empty_array())); | 4257 DartEntry::InvokeFunction(getter, Object::empty_array())); |
| 4258 } else if (!field.IsNull()) { | 4258 } else if (!field.IsNull()) { |
| 4259 return Api::NewHandle(I, field.value()); | 4259 return Api::NewHandle(I, field.StaticValue()); |
| 4260 } else { | 4260 } else { |
| 4261 return Api::NewError("%s: did not find static field '%s'.", | 4261 return Api::NewError("%s: did not find static field '%s'.", |
| 4262 CURRENT_FUNC, field_name.ToCString()); | 4262 CURRENT_FUNC, field_name.ToCString()); |
| 4263 } | 4263 } |
| 4264 | 4264 |
| 4265 } else if (obj.IsInstance()) { | 4265 } else if (obj.IsInstance()) { |
| 4266 // Every instance field has a getter Function. Try to find the | 4266 // Every instance field has a getter Function. Try to find the |
| 4267 // getter in any superclass and use that function to access the | 4267 // getter in any superclass and use that function to access the |
| 4268 // field. | 4268 // field. |
| 4269 const Instance& instance = Instance::Cast(obj); | 4269 const Instance& instance = Instance::Cast(obj); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4316 Field::GetterName(field_name)); | 4316 Field::GetterName(field_name)); |
| 4317 getter = cls.LookupStaticFunctionAllowPrivate(getter_name); | 4317 getter = cls.LookupStaticFunctionAllowPrivate(getter_name); |
| 4318 } | 4318 } |
| 4319 | 4319 |
| 4320 if (!getter.IsNull()) { | 4320 if (!getter.IsNull()) { |
| 4321 // Invoke the getter and return the result. | 4321 // Invoke the getter and return the result. |
| 4322 return Api::NewHandle(I, | 4322 return Api::NewHandle(I, |
| 4323 DartEntry::InvokeFunction(getter, Object::empty_array())); | 4323 DartEntry::InvokeFunction(getter, Object::empty_array())); |
| 4324 } | 4324 } |
| 4325 if (!field.IsNull()) { | 4325 if (!field.IsNull()) { |
| 4326 return Api::NewHandle(I, field.value()); | 4326 return Api::NewHandle(I, field.StaticValue()); |
| 4327 } | 4327 } |
| 4328 return Api::NewError("%s: did not find top-level variable '%s'.", | 4328 return Api::NewError("%s: did not find top-level variable '%s'.", |
| 4329 CURRENT_FUNC, field_name.ToCString()); | 4329 CURRENT_FUNC, field_name.ToCString()); |
| 4330 | 4330 |
| 4331 } else if (obj.IsError()) { | 4331 } else if (obj.IsError()) { |
| 4332 return container; | 4332 return container; |
| 4333 } else { | 4333 } else { |
| 4334 return Api::NewError( | 4334 return Api::NewError( |
| 4335 "%s expects argument 'container' to be an object, type, or library.", | 4335 "%s expects argument 'container' to be an object, type, or library.", |
| 4336 CURRENT_FUNC); | 4336 CURRENT_FUNC); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4390 if (result.IsError()) { | 4390 if (result.IsError()) { |
| 4391 return Api::NewHandle(I, result.raw()); | 4391 return Api::NewHandle(I, result.raw()); |
| 4392 } else { | 4392 } else { |
| 4393 return Api::Success(); | 4393 return Api::Success(); |
| 4394 } | 4394 } |
| 4395 } else if (!field.IsNull()) { | 4395 } else if (!field.IsNull()) { |
| 4396 if (field.is_final()) { | 4396 if (field.is_final()) { |
| 4397 return Api::NewError("%s: cannot set final field '%s'.", | 4397 return Api::NewError("%s: cannot set final field '%s'.", |
| 4398 CURRENT_FUNC, field_name.ToCString()); | 4398 CURRENT_FUNC, field_name.ToCString()); |
| 4399 } else { | 4399 } else { |
| 4400 field.set_value(value_instance); | 4400 field.SetStaticValue(value_instance); |
| 4401 return Api::Success(); | 4401 return Api::Success(); |
| 4402 } | 4402 } |
| 4403 } else { | 4403 } else { |
| 4404 return Api::NewError("%s: did not find static field '%s'.", | 4404 return Api::NewError("%s: did not find static field '%s'.", |
| 4405 CURRENT_FUNC, field_name.ToCString()); | 4405 CURRENT_FUNC, field_name.ToCString()); |
| 4406 } | 4406 } |
| 4407 | 4407 |
| 4408 } else if (obj.IsInstance()) { | 4408 } else if (obj.IsInstance()) { |
| 4409 // Every instance field has a setter Function. Try to find the | 4409 // Every instance field has a setter Function. Try to find the |
| 4410 // setter in any superclass and use that function to access the | 4410 // setter in any superclass and use that function to access the |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4468 if (result.IsError()) { | 4468 if (result.IsError()) { |
| 4469 return Api::NewHandle(I, result.raw()); | 4469 return Api::NewHandle(I, result.raw()); |
| 4470 } | 4470 } |
| 4471 return Api::Success(); | 4471 return Api::Success(); |
| 4472 } | 4472 } |
| 4473 if (!field.IsNull()) { | 4473 if (!field.IsNull()) { |
| 4474 if (field.is_final()) { | 4474 if (field.is_final()) { |
| 4475 return Api::NewError("%s: cannot set final top-level variable '%s'.", | 4475 return Api::NewError("%s: cannot set final top-level variable '%s'.", |
| 4476 CURRENT_FUNC, field_name.ToCString()); | 4476 CURRENT_FUNC, field_name.ToCString()); |
| 4477 } | 4477 } |
| 4478 field.set_value(value_instance); | 4478 field.SetStaticValue(value_instance); |
| 4479 return Api::Success(); | 4479 return Api::Success(); |
| 4480 } | 4480 } |
| 4481 return Api::NewError("%s: did not find top-level variable '%s'.", | 4481 return Api::NewError("%s: did not find top-level variable '%s'.", |
| 4482 CURRENT_FUNC, field_name.ToCString()); | 4482 CURRENT_FUNC, field_name.ToCString()); |
| 4483 | 4483 |
| 4484 } else if (obj.IsError()) { | 4484 } else if (obj.IsError()) { |
| 4485 return container; | 4485 return container; |
| 4486 } | 4486 } |
| 4487 return Api::NewError( | 4487 return Api::NewError( |
| 4488 "%s expects argument 'container' to be an object, type, or library.", | 4488 "%s expects argument 'container' to be an object, type, or library.", |
| (...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5496 // the new code, the debugger convert them to unresolved source breakpoints. | 5496 // the new code, the debugger convert them to unresolved source breakpoints. |
| 5497 // The code that completes the futures (invoked below) may call into the | 5497 // The code that completes the futures (invoked below) may call into the |
| 5498 // newly loaded code and trigger one of these breakpoints. | 5498 // newly loaded code and trigger one of these breakpoints. |
| 5499 I->debugger()->NotifyDoneLoading(); | 5499 I->debugger()->NotifyDoneLoading(); |
| 5500 | 5500 |
| 5501 // Notify mirrors that MirrorSystem.libraries needs to be recomputed. | 5501 // Notify mirrors that MirrorSystem.libraries needs to be recomputed. |
| 5502 const Library& libmirrors = Library::Handle(Z, Library::MirrorsLibrary()); | 5502 const Library& libmirrors = Library::Handle(Z, Library::MirrorsLibrary()); |
| 5503 const Field& dirty_bit = Field::Handle(Z, | 5503 const Field& dirty_bit = Field::Handle(Z, |
| 5504 libmirrors.LookupLocalField(String::Handle(String::New("dirty")))); | 5504 libmirrors.LookupLocalField(String::Handle(String::New("dirty")))); |
| 5505 ASSERT(!dirty_bit.IsNull() && dirty_bit.is_static()); | 5505 ASSERT(!dirty_bit.IsNull() && dirty_bit.is_static()); |
| 5506 dirty_bit.set_value(Bool::True()); | 5506 dirty_bit.SetStaticValue(Bool::True()); |
| 5507 | 5507 |
| 5508 if (complete_futures) { | 5508 if (complete_futures) { |
| 5509 const Library& corelib = Library::Handle(Z, Library::CoreLibrary()); | 5509 const Library& corelib = Library::Handle(Z, Library::CoreLibrary()); |
| 5510 const String& function_name = | 5510 const String& function_name = |
| 5511 String::Handle(Z, String::New("_completeDeferredLoads")); | 5511 String::Handle(Z, String::New("_completeDeferredLoads")); |
| 5512 const Function& function = Function::Handle(Z, | 5512 const Function& function = Function::Handle(Z, |
| 5513 corelib.LookupFunctionAllowPrivate(function_name)); | 5513 corelib.LookupFunctionAllowPrivate(function_name)); |
| 5514 ASSERT(!function.IsNull()); | 5514 ASSERT(!function.IsNull()); |
| 5515 const Array& args = Array::empty_array(); | 5515 const Array& args = Array::empty_array(); |
| 5516 | 5516 |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5933 ApiReallocate); | 5933 ApiReallocate); |
| 5934 writer.WriteFullSnapshot(); | 5934 writer.WriteFullSnapshot(); |
| 5935 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); | 5935 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); |
| 5936 *isolate_snapshot_size = writer.IsolateSnapshotSize(); | 5936 *isolate_snapshot_size = writer.IsolateSnapshotSize(); |
| 5937 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); | 5937 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); |
| 5938 | 5938 |
| 5939 return Api::Success(); | 5939 return Api::Success(); |
| 5940 } | 5940 } |
| 5941 | 5941 |
| 5942 } // namespace dart | 5942 } // namespace dart |
| OLD | NEW |