Chromium Code Reviews| 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 | 6 |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 4404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4415 if (source_str.IsNull()) { | 4415 if (source_str.IsNull()) { |
| 4416 RETURN_TYPE_ERROR(isolate, source, String); | 4416 RETURN_TYPE_ERROR(isolate, source, String); |
| 4417 } | 4417 } |
| 4418 Dart_Handle result; | 4418 Dart_Handle result; |
| 4419 CompileSource(isolate, lib, url_str, source_str, | 4419 CompileSource(isolate, lib, url_str, source_str, |
| 4420 RawScript::kSourceTag, &result); | 4420 RawScript::kSourceTag, &result); |
| 4421 return result; | 4421 return result; |
| 4422 } | 4422 } |
| 4423 | 4423 |
| 4424 | 4424 |
| 4425 DART_EXPORT Dart_Handle Dart_LoadPatch(Dart_Handle library, | |
|
Mads Ager (google)
2012/10/25 10:47:46
This code is completely duplicated from LoadSource
| |
| 4426 Dart_Handle url, | |
| 4427 Dart_Handle patch_source) { | |
| 4428 TIMERSCOPE(time_script_loading); | |
| 4429 Isolate* isolate = Isolate::Current(); | |
| 4430 DARTSCOPE(isolate); | |
| 4431 if (FLAG_use_cha) { | |
|
Ivan Posva
2012/10/26 04:33:34
Leave it like this but note: dartbug.com/6288
| |
| 4432 RemoveOptimizedCode(); | |
| 4433 } | |
| 4434 const Library& lib = Api::UnwrapLibraryHandle(isolate, library); | |
| 4435 if (lib.IsNull()) { | |
| 4436 RETURN_TYPE_ERROR(isolate, library, Library); | |
| 4437 } | |
| 4438 const String& url_str = Api::UnwrapStringHandle(isolate, url); | |
| 4439 if (url_str.IsNull()) { | |
| 4440 RETURN_TYPE_ERROR(isolate, url, String); | |
| 4441 } | |
| 4442 const String& source_str = Api::UnwrapStringHandle(isolate, patch_source); | |
| 4443 if (source_str.IsNull()) { | |
| 4444 RETURN_TYPE_ERROR(isolate, patch_source, String); | |
| 4445 } | |
| 4446 Dart_Handle result; | |
| 4447 CompileSource(isolate, lib, url_str, source_str, | |
| 4448 RawScript::kPatchTag, &result); | |
| 4449 return result; | |
| 4450 } | |
| 4451 | |
| 4452 | |
| 4425 DART_EXPORT Dart_Handle Dart_SetNativeResolver( | 4453 DART_EXPORT Dart_Handle Dart_SetNativeResolver( |
| 4426 Dart_Handle library, | 4454 Dart_Handle library, |
| 4427 Dart_NativeEntryResolver resolver) { | 4455 Dart_NativeEntryResolver resolver) { |
| 4428 Isolate* isolate = Isolate::Current(); | 4456 Isolate* isolate = Isolate::Current(); |
| 4429 DARTSCOPE(isolate); | 4457 DARTSCOPE(isolate); |
| 4430 const Library& lib = Api::UnwrapLibraryHandle(isolate, library); | 4458 const Library& lib = Api::UnwrapLibraryHandle(isolate, library); |
| 4431 if (lib.IsNull()) { | 4459 if (lib.IsNull()) { |
| 4432 RETURN_TYPE_ERROR(isolate, library, Library); | 4460 RETURN_TYPE_ERROR(isolate, library, Library); |
| 4433 } | 4461 } |
| 4434 lib.set_native_entry_resolver(resolver); | 4462 lib.set_native_entry_resolver(resolver); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4509 } | 4537 } |
| 4510 { | 4538 { |
| 4511 NoGCScope no_gc; | 4539 NoGCScope no_gc; |
| 4512 RawObject* raw_obj = obj.raw(); | 4540 RawObject* raw_obj = obj.raw(); |
| 4513 isolate->heap()->SetPeer(raw_obj, peer); | 4541 isolate->heap()->SetPeer(raw_obj, peer); |
| 4514 } | 4542 } |
| 4515 return Api::Success(isolate); | 4543 return Api::Success(isolate); |
| 4516 } | 4544 } |
| 4517 | 4545 |
| 4518 } // namespace dart | 4546 } // namespace dart |
| OLD | NEW |