| 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 | 8 #ifndef DART_PRECOMPILED |
| 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 5656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5699 if (tag == Dart_kCanonicalizeUrl) { | 5700 if (tag == Dart_kCanonicalizeUrl) { |
| 5700 return url.raw(); | 5701 return url.raw(); |
| 5701 } | 5702 } |
| 5702 return Object::null(); | 5703 return Object::null(); |
| 5703 } | 5704 } |
| 5704 ReportError(token_pos, "no library handler registered"); | 5705 ReportError(token_pos, "no library handler registered"); |
| 5705 } | 5706 } |
| 5706 // Block class finalization attempts when calling into the library | 5707 // Block class finalization attempts when calling into the library |
| 5707 // tag handler. | 5708 // tag handler. |
| 5708 I->BlockClassFinalization(); | 5709 I->BlockClassFinalization(); |
| 5709 Api::Scope api_scope(T); | 5710 Object& result = Object::Handle(Z); |
| 5710 Dart_Handle result = handler(tag, | 5711 { |
| 5711 Api::NewHandle(T, library_.raw()), | 5712 TransitionVMToNative transition(T); |
| 5712 Api::NewHandle(T, url.raw())); | 5713 Api::Scope api_scope(T); |
| 5714 Dart_Handle retval = handler(tag, |
| 5715 Api::NewHandle(T, library_.raw()), |
| 5716 Api::NewHandle(T, url.raw())); |
| 5717 result = Api::UnwrapHandle(retval); |
| 5718 } |
| 5713 I->UnblockClassFinalization(); | 5719 I->UnblockClassFinalization(); |
| 5714 if (Dart_IsError(result)) { | 5720 if (result.IsError()) { |
| 5715 // In case of an error we append an explanatory error message to the | 5721 // In case of an error we append an explanatory error message to the |
| 5716 // error obtained from the library tag handler. | 5722 // error obtained from the library tag handler. |
| 5717 Error& prev_error = Error::Handle(Z); | 5723 const Error& prev_error = Error::Cast(result); |
| 5718 prev_error ^= Api::UnwrapHandle(result); | |
| 5719 Report::LongJumpF(prev_error, script_, token_pos, "library handler failed"); | 5724 Report::LongJumpF(prev_error, script_, token_pos, "library handler failed"); |
| 5720 } | 5725 } |
| 5721 if (tag == Dart_kCanonicalizeUrl) { | 5726 if (tag == Dart_kCanonicalizeUrl) { |
| 5722 if (!Dart_IsString(result)) { | 5727 if (!result.IsString()) { |
| 5723 ReportError(token_pos, "library handler failed URI canonicalization"); | 5728 ReportError(token_pos, "library handler failed URI canonicalization"); |
| 5724 } | 5729 } |
| 5725 } | 5730 } |
| 5726 return Api::UnwrapHandle(result); | 5731 return result.raw(); |
| 5727 } | 5732 } |
| 5728 | 5733 |
| 5729 | 5734 |
| 5730 void Parser::ParseLibraryName() { | 5735 void Parser::ParseLibraryName() { |
| 5731 ASSERT(CurrentToken() == Token::kLIBRARY); | 5736 ASSERT(CurrentToken() == Token::kLIBRARY); |
| 5732 ConsumeToken(); | 5737 ConsumeToken(); |
| 5733 String& lib_name = *ExpectIdentifier("library name expected"); | 5738 String& lib_name = *ExpectIdentifier("library name expected"); |
| 5734 if (CurrentToken() == Token::kPERIOD) { | 5739 if (CurrentToken() == Token::kPERIOD) { |
| 5735 GrowableHandlePtrArray<const String> pieces(Z, 3); | 5740 GrowableHandlePtrArray<const String> pieces(Z, 3); |
| 5736 pieces.Add(lib_name); | 5741 pieces.Add(lib_name); |
| (...skipping 8649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14386 const ArgumentListNode& function_args, | 14391 const ArgumentListNode& function_args, |
| 14387 const LocalVariable* temp_for_last_arg, | 14392 const LocalVariable* temp_for_last_arg, |
| 14388 bool is_super_invocation) { | 14393 bool is_super_invocation) { |
| 14389 UNREACHABLE(); | 14394 UNREACHABLE(); |
| 14390 return NULL; | 14395 return NULL; |
| 14391 } | 14396 } |
| 14392 | 14397 |
| 14393 } // namespace dart | 14398 } // namespace dart |
| 14394 | 14399 |
| 14395 #endif // DART_PRECOMPILED | 14400 #endif // DART_PRECOMPILED |
| OLD | NEW |