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 | 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/compiler_stats.h" | 10 #include "vm/compiler_stats.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 a.SetTypeAt(i, type); | 99 a.SetTypeAt(i, type); |
100 } | 100 } |
101 // Cannot canonicalize TypeArgument yet as its types may not have been | 101 // Cannot canonicalize TypeArgument yet as its types may not have been |
102 // finalized yet. | 102 // finalized yet. |
103 return a.raw(); | 103 return a.raw(); |
104 } | 104 } |
105 | 105 |
106 | 106 |
107 static ThrowNode* GenerateRethrow(intptr_t token_pos, const Object& obj) { | 107 static ThrowNode* GenerateRethrow(intptr_t token_pos, const Object& obj) { |
108 const UnhandledException& excp = UnhandledException::Cast(obj); | 108 const UnhandledException& excp = UnhandledException::Cast(obj); |
109 const Instance& exception = Instance::ZoneHandle(excp.exception()); | 109 Instance& exception = Instance::ZoneHandle(excp.exception()); |
110 const Instance& stack_trace = Instance::ZoneHandle(excp.stacktrace()); | 110 if (exception.IsNew()) { |
| 111 exception ^= Object::Clone(exception, Heap::kOld); |
| 112 } |
| 113 Instance& stack_trace = Instance::ZoneHandle(excp.stacktrace()); |
| 114 if (stack_trace.IsNew()) { |
| 115 stack_trace ^= Object::Clone(stack_trace, Heap::kOld); |
| 116 } |
111 return new ThrowNode(token_pos, | 117 return new ThrowNode(token_pos, |
112 new LiteralNode(token_pos, exception), | 118 new LiteralNode(token_pos, exception), |
113 new LiteralNode(token_pos, stack_trace)); | 119 new LiteralNode(token_pos, stack_trace)); |
114 } | 120 } |
115 | 121 |
116 | 122 |
117 LocalVariable* ParsedFunction::CreateExpressionTempVar(intptr_t token_pos) { | 123 LocalVariable* ParsedFunction::CreateExpressionTempVar(intptr_t token_pos) { |
118 return new LocalVariable(token_pos, | 124 return new LocalVariable(token_pos, |
119 String::ZoneHandle(String::NewSymbol(":expr_temp")), | 125 String::ZoneHandle(String::NewSymbol(":expr_temp")), |
120 Type::ZoneHandle(Type::DynamicType())); | 126 Type::ZoneHandle(Type::DynamicType())); |
(...skipping 6916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7037 | 7043 |
7038 RawObject* Parser::EvaluateConstConstructorCall( | 7044 RawObject* Parser::EvaluateConstConstructorCall( |
7039 const Class& type_class, | 7045 const Class& type_class, |
7040 const AbstractTypeArguments& type_arguments, | 7046 const AbstractTypeArguments& type_arguments, |
7041 const Function& constructor, | 7047 const Function& constructor, |
7042 ArgumentListNode* arguments) { | 7048 ArgumentListNode* arguments) { |
7043 // +2 for implicit receiver and construction phase arguments. | 7049 // +2 for implicit receiver and construction phase arguments. |
7044 GrowableArray<const Object*> arg_values(arguments->length() + 2); | 7050 GrowableArray<const Object*> arg_values(arguments->length() + 2); |
7045 Instance& instance = Instance::Handle(); | 7051 Instance& instance = Instance::Handle(); |
7046 if (!constructor.IsFactory()) { | 7052 if (!constructor.IsFactory()) { |
7047 instance = Instance::New(type_class); | 7053 instance = Instance::New(type_class, Heap::kOld); |
7048 if (!type_arguments.IsNull()) { | 7054 if (!type_arguments.IsNull()) { |
7049 if (!type_arguments.IsInstantiated()) { | 7055 if (!type_arguments.IsInstantiated()) { |
7050 ErrorMsg("type must be constant in const constructor"); | 7056 ErrorMsg("type must be constant in const constructor"); |
7051 } | 7057 } |
7052 instance.SetTypeArguments( | 7058 instance.SetTypeArguments( |
7053 AbstractTypeArguments::Handle(type_arguments.Canonicalize())); | 7059 AbstractTypeArguments::Handle(type_arguments.Canonicalize())); |
7054 } | 7060 } |
7055 arg_values.Add(&instance); | 7061 arg_values.Add(&instance); |
7056 arg_values.Add(&Smi::ZoneHandle(Smi::New(Function::kCtorPhaseAll))); | 7062 arg_values.Add(&Smi::ZoneHandle(Smi::New(Function::kCtorPhaseAll))); |
7057 } else { | 7063 } else { |
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8653 void Parser::SkipQualIdent() { | 8659 void Parser::SkipQualIdent() { |
8654 ASSERT(IsIdentifier()); | 8660 ASSERT(IsIdentifier()); |
8655 ConsumeToken(); | 8661 ConsumeToken(); |
8656 if (CurrentToken() == Token::kPERIOD) { | 8662 if (CurrentToken() == Token::kPERIOD) { |
8657 ConsumeToken(); // Consume the kPERIOD token. | 8663 ConsumeToken(); // Consume the kPERIOD token. |
8658 ExpectIdentifier("identifier expected after '.'"); | 8664 ExpectIdentifier("identifier expected after '.'"); |
8659 } | 8665 } |
8660 } | 8666 } |
8661 | 8667 |
8662 } // namespace dart | 8668 } // namespace dart |
OLD | NEW |