Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: runtime/vm/code_generator_x64.cc

Issue 9186058: Make the "sticky error" an Error instead of a String. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/code_generator_ia32.cc ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/globals.h" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/code_generator.h" 8 #include "vm/code_generator.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 2293 matching lines...) Expand 10 before | Expand all | Expand 10 after
2304 instantiator_class = outer_function.signature_class(); 2304 instantiator_class = outer_function.signature_class();
2305 } else { 2305 } else {
2306 instantiator_class = outer_function.owner(); 2306 instantiator_class = outer_function.owner();
2307 } 2307 }
2308 if (instantiator_class.NumTypeParameters() == 0) { 2308 if (instantiator_class.NumTypeParameters() == 0) {
2309 // The type arguments are compile time constants. 2309 // The type arguments are compile time constants.
2310 AbstractTypeArguments& type_arguments = AbstractTypeArguments::ZoneHandle(); 2310 AbstractTypeArguments& type_arguments = AbstractTypeArguments::ZoneHandle();
2311 // TODO(regis): Temporary type should be allocated in new gen heap. 2311 // TODO(regis): Temporary type should be allocated in new gen heap.
2312 Type& type = Type::Handle( 2312 Type& type = Type::Handle(
2313 Type::NewParameterizedType(instantiator_class, type_arguments)); 2313 Type::NewParameterizedType(instantiator_class, type_arguments));
2314 String& errmsg = String::Handle(); 2314 Error& error = Error::Handle();
2315 type ^= ClassFinalizer::FinalizeAndCanonicalizeType(instantiator_class, 2315 type ^= ClassFinalizer::FinalizeAndCanonicalizeType(instantiator_class,
2316 type, 2316 type,
2317 &errmsg); 2317 &error);
2318 if (!errmsg.IsNull()) { 2318 if (!error.IsNull()) {
2319 ErrorMsg(token_index, errmsg.ToCString()); 2319 ErrorMsg(token_index, error.ToErrorCString());
2320 } 2320 }
2321 type_arguments = type.arguments(); 2321 type_arguments = type.arguments();
2322 __ PushObject(type_arguments); 2322 __ PushObject(type_arguments);
2323 } else { 2323 } else {
2324 ASSERT(parsed_function().instantiator() != NULL); 2324 ASSERT(parsed_function().instantiator() != NULL);
2325 parsed_function().instantiator()->Visit(this); 2325 parsed_function().instantiator()->Visit(this);
2326 if (!outer_function.IsFactory()) { 2326 if (!outer_function.IsFactory()) {
2327 __ popq(RAX); // Pop instantiator. 2327 __ popq(RAX); // Pop instantiator.
2328 // The instantiator is the receiver of the caller, which is not a factory. 2328 // The instantiator is the receiver of the caller, which is not a factory.
2329 // The receiver cannot be null; extract its AbstractTypeArguments object. 2329 // The receiver cannot be null; extract its AbstractTypeArguments object.
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
2784 intptr_t token_index) { 2784 intptr_t token_index) {
2785 pc_descriptors_list_->AddDescriptor(kind, 2785 pc_descriptors_list_->AddDescriptor(kind,
2786 assembler_->CodeSize(), 2786 assembler_->CodeSize(),
2787 node_id, 2787 node_id,
2788 token_index, 2788 token_index,
2789 state()->try_index()); 2789 state()->try_index());
2790 } 2790 }
2791 2791
2792 2792
2793 void CodeGenerator::ErrorMsg(intptr_t token_index, const char* format, ...) { 2793 void CodeGenerator::ErrorMsg(intptr_t token_index, const char* format, ...) {
2794 const intptr_t kMessageBufferSize = 512;
2795 char message_buffer[kMessageBufferSize];
2796 va_list args; 2794 va_list args;
2797 va_start(args, format); 2795 va_start(args, format);
2798 const Class& cls = Class::Handle(parsed_function_.function().owner()); 2796 const Class& cls = Class::Handle(parsed_function_.function().owner());
2799 const Script& script = Script::Handle(cls.script()); 2797 const Script& script = Script::Handle(cls.script());
2800 Parser::FormatMessage(script, token_index, "Error", 2798 const Error& error = Error::Handle(
2801 message_buffer, kMessageBufferSize, 2799 Parser::FormatError(script, token_index, "Error", format, args));
2802 format, args);
2803 va_end(args); 2800 va_end(args);
2804 Isolate::Current()->long_jump_base()->Jump(1, message_buffer); 2801 Isolate::Current()->long_jump_base()->Jump(1, error);
2805 UNREACHABLE(); 2802 UNREACHABLE();
2806 } 2803 }
2807 2804
2808 } // namespace dart 2805 } // namespace dart
2809 2806
2810 #endif // defined TARGET_ARCH_X64 2807 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/code_generator_ia32.cc ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698