| 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 "vm/parser.h" | 5 #include "vm/parser.h" |
| 6 #include "vm/flags.h" | 6 #include "vm/flags.h" |
| 7 | 7 |
| 8 #ifndef DART_PRECOMPILED_RUNTIME | 8 #ifndef DART_PRECOMPILED_RUNTIME |
| 9 | 9 |
| 10 #include "lib/invocation_mirror.h" | 10 #include "lib/invocation_mirror.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "vm/isolate.h" | 23 #include "vm/isolate.h" |
| 24 #include "vm/longjump.h" | 24 #include "vm/longjump.h" |
| 25 #include "vm/native_arguments.h" | 25 #include "vm/native_arguments.h" |
| 26 #include "vm/native_entry.h" | 26 #include "vm/native_entry.h" |
| 27 #include "vm/object.h" | 27 #include "vm/object.h" |
| 28 #include "vm/object_store.h" | 28 #include "vm/object_store.h" |
| 29 #include "vm/os.h" | 29 #include "vm/os.h" |
| 30 #include "vm/regexp_assembler.h" | 30 #include "vm/regexp_assembler.h" |
| 31 #include "vm/report.h" | 31 #include "vm/report.h" |
| 32 #include "vm/resolver.h" | 32 #include "vm/resolver.h" |
| 33 #include "vm/safepoint.h" |
| 33 #include "vm/scanner.h" | 34 #include "vm/scanner.h" |
| 34 #include "vm/scopes.h" | 35 #include "vm/scopes.h" |
| 35 #include "vm/stack_frame.h" | 36 #include "vm/stack_frame.h" |
| 36 #include "vm/symbols.h" | 37 #include "vm/symbols.h" |
| 37 #include "vm/tags.h" | 38 #include "vm/tags.h" |
| 38 #include "vm/timer.h" | 39 #include "vm/timer.h" |
| 39 #include "vm/zone.h" | 40 #include "vm/zone.h" |
| 40 | 41 |
| 41 namespace dart { | 42 namespace dart { |
| 42 | 43 |
| (...skipping 5622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5665 if (tag == Dart_kCanonicalizeUrl) { | 5666 if (tag == Dart_kCanonicalizeUrl) { |
| 5666 return url.raw(); | 5667 return url.raw(); |
| 5667 } | 5668 } |
| 5668 return Object::null(); | 5669 return Object::null(); |
| 5669 } | 5670 } |
| 5670 ReportError(token_pos, "no library handler registered"); | 5671 ReportError(token_pos, "no library handler registered"); |
| 5671 } | 5672 } |
| 5672 // Block class finalization attempts when calling into the library | 5673 // Block class finalization attempts when calling into the library |
| 5673 // tag handler. | 5674 // tag handler. |
| 5674 I->BlockClassFinalization(); | 5675 I->BlockClassFinalization(); |
| 5675 Api::Scope api_scope(T); | 5676 Object& result = Object::Handle(Z); |
| 5676 Dart_Handle result = handler(tag, | 5677 { |
| 5677 Api::NewHandle(T, library_.raw()), | 5678 TransitionVMToNative transition(T); |
| 5678 Api::NewHandle(T, url.raw())); | 5679 Api::Scope api_scope(T); |
| 5680 Dart_Handle retval = handler(tag, |
| 5681 Api::NewHandle(T, library_.raw()), |
| 5682 Api::NewHandle(T, url.raw())); |
| 5683 result = Api::UnwrapHandle(retval); |
| 5684 } |
| 5679 I->UnblockClassFinalization(); | 5685 I->UnblockClassFinalization(); |
| 5680 if (Dart_IsError(result)) { | 5686 if (result.IsError()) { |
| 5681 // In case of an error we append an explanatory error message to the | 5687 // In case of an error we append an explanatory error message to the |
| 5682 // error obtained from the library tag handler. | 5688 // error obtained from the library tag handler. |
| 5683 Error& prev_error = Error::Handle(Z); | 5689 const Error& prev_error = Error::Cast(result); |
| 5684 prev_error ^= Api::UnwrapHandle(result); | |
| 5685 Report::LongJumpF(prev_error, script_, token_pos, "library handler failed"); | 5690 Report::LongJumpF(prev_error, script_, token_pos, "library handler failed"); |
| 5686 } | 5691 } |
| 5687 if (tag == Dart_kCanonicalizeUrl) { | 5692 if (tag == Dart_kCanonicalizeUrl) { |
| 5688 if (!Dart_IsString(result)) { | 5693 if (!result.IsString()) { |
| 5689 ReportError(token_pos, "library handler failed URI canonicalization"); | 5694 ReportError(token_pos, "library handler failed URI canonicalization"); |
| 5690 } | 5695 } |
| 5691 } | 5696 } |
| 5692 return Api::UnwrapHandle(result); | 5697 return result.raw(); |
| 5693 } | 5698 } |
| 5694 | 5699 |
| 5695 | 5700 |
| 5696 void Parser::ParseLibraryName() { | 5701 void Parser::ParseLibraryName() { |
| 5697 ASSERT(CurrentToken() == Token::kLIBRARY); | 5702 ASSERT(CurrentToken() == Token::kLIBRARY); |
| 5698 ConsumeToken(); | 5703 ConsumeToken(); |
| 5699 String& lib_name = *ExpectIdentifier("library name expected"); | 5704 String& lib_name = *ExpectIdentifier("library name expected"); |
| 5700 if (CurrentToken() == Token::kPERIOD) { | 5705 if (CurrentToken() == Token::kPERIOD) { |
| 5701 GrowableHandlePtrArray<const String> pieces(Z, 3); | 5706 GrowableHandlePtrArray<const String> pieces(Z, 3); |
| 5702 pieces.Add(lib_name); | 5707 pieces.Add(lib_name); |
| (...skipping 8651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14354 const ArgumentListNode& function_args, | 14359 const ArgumentListNode& function_args, |
| 14355 const LocalVariable* temp_for_last_arg, | 14360 const LocalVariable* temp_for_last_arg, |
| 14356 bool is_super_invocation) { | 14361 bool is_super_invocation) { |
| 14357 UNREACHABLE(); | 14362 UNREACHABLE(); |
| 14358 return NULL; | 14363 return NULL; |
| 14359 } | 14364 } |
| 14360 | 14365 |
| 14361 } // namespace dart | 14366 } // namespace dart |
| 14362 | 14367 |
| 14363 #endif // DART_PRECOMPILED_RUNTIME | 14368 #endif // DART_PRECOMPILED_RUNTIME |
| OLD | NEW |