Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/kernel_binary_flowgraph.h" | 5 #include "vm/kernel_binary_flowgraph.h" |
| 6 | 6 |
| 7 #include "vm/compiler.h" | 7 #include "vm/compiler.h" |
| 8 #include "vm/longjump.h" | 8 #include "vm/longjump.h" |
| 9 #include "vm/object_store.h" | 9 #include "vm/object_store.h" |
| 10 | 10 |
| (...skipping 2249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2260 builder_->ReaderOffset(), false)); // read rest of initializer. | 2260 builder_->ReaderOffset(), false)); // read rest of initializer. |
| 2261 } | 2261 } |
| 2262 | 2262 |
| 2263 EvaluateExpression(builder_->ReaderOffset(), false); // read body | 2263 EvaluateExpression(builder_->ReaderOffset(), false); // read body |
| 2264 } | 2264 } |
| 2265 | 2265 |
| 2266 void StreamingConstantEvaluator::EvaluateBigIntLiteral() { | 2266 void StreamingConstantEvaluator::EvaluateBigIntLiteral() { |
| 2267 const dart::String& value = | 2267 const dart::String& value = |
| 2268 H.DartString(builder_->ReadStringReference()); // read string reference. | 2268 H.DartString(builder_->ReadStringReference()); // read string reference. |
| 2269 result_ = Integer::New(value, Heap::kOld); | 2269 result_ = Integer::New(value, Heap::kOld); |
| 2270 if (result_.IsNull()) { | |
| 2271 H.ReportError("Integer literal %s is out of range", value.ToCString()); | |
|
zra
2017/07/27 16:31:44
If code after ReportError is unreachable, it can b
alexmarkov
2017/07/28 17:42:43
Done.
| |
| 2272 } | |
| 2270 result_ = H.Canonicalize(result_); | 2273 result_ = H.Canonicalize(result_); |
| 2271 } | 2274 } |
| 2272 | 2275 |
| 2273 void StreamingConstantEvaluator::EvaluateStringLiteral() { | 2276 void StreamingConstantEvaluator::EvaluateStringLiteral() { |
| 2274 result_ = H.DartSymbol(builder_->ReadStringReference()) | 2277 result_ = H.DartSymbol(builder_->ReadStringReference()) |
| 2275 .raw(); // read string reference. | 2278 .raw(); // read string reference. |
| 2276 } | 2279 } |
| 2277 | 2280 |
| 2278 void StreamingConstantEvaluator::EvaluateIntLiteral(uint8_t payload) { | 2281 void StreamingConstantEvaluator::EvaluateIntLiteral(uint8_t payload) { |
| 2279 int64_t value = static_cast<int32_t>(payload) - SpecializedIntLiteralBias; | 2282 int64_t value = static_cast<int32_t>(payload) - SpecializedIntLiteralBias; |
| (...skipping 3487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5767 instructions += BuildExpression(); // read body. | 5770 instructions += BuildExpression(); // read body. |
| 5768 return instructions; | 5771 return instructions; |
| 5769 } | 5772 } |
| 5770 | 5773 |
| 5771 Fragment StreamingFlowGraphBuilder::BuildBigIntLiteral( | 5774 Fragment StreamingFlowGraphBuilder::BuildBigIntLiteral( |
| 5772 TokenPosition* position) { | 5775 TokenPosition* position) { |
| 5773 if (position != NULL) *position = TokenPosition::kNoSource; | 5776 if (position != NULL) *position = TokenPosition::kNoSource; |
| 5774 | 5777 |
| 5775 const dart::String& value = | 5778 const dart::String& value = |
| 5776 H.DartString(ReadStringReference()); // read index into string table. | 5779 H.DartString(ReadStringReference()); // read index into string table. |
| 5777 return Constant(Integer::ZoneHandle(Z, Integer::New(value, Heap::kOld))); | 5780 const Integer& integer = |
| 5781 Integer::ZoneHandle(Z, Integer::New(value, Heap::kOld)); | |
| 5782 if (integer.IsNull()) { | |
| 5783 H.ReportError("Integer literal %s is out of range", value.ToCString()); | |
| 5784 } | |
| 5785 return Constant(integer); | |
| 5778 } | 5786 } |
| 5779 | 5787 |
| 5780 Fragment StreamingFlowGraphBuilder::BuildStringLiteral( | 5788 Fragment StreamingFlowGraphBuilder::BuildStringLiteral( |
| 5781 TokenPosition* position) { | 5789 TokenPosition* position) { |
| 5782 if (position != NULL) *position = TokenPosition::kNoSource; | 5790 if (position != NULL) *position = TokenPosition::kNoSource; |
| 5783 | 5791 |
| 5784 return Constant( | 5792 return Constant( |
| 5785 H.DartSymbol(ReadStringReference())); // read index into string table. | 5793 H.DartSymbol(ReadStringReference())); // read index into string table. |
| 5786 } | 5794 } |
| 5787 | 5795 |
| (...skipping 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7271 } | 7279 } |
| 7272 } | 7280 } |
| 7273 | 7281 |
| 7274 return Array::Handle(Array::null()); | 7282 return Array::Handle(Array::null()); |
| 7275 } | 7283 } |
| 7276 | 7284 |
| 7277 } // namespace kernel | 7285 } // namespace kernel |
| 7278 } // namespace dart | 7286 } // namespace dart |
| 7279 | 7287 |
| 7280 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 7288 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| OLD | NEW |