Chromium Code Reviews| 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/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 15422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 15433 } | 15433 } |
| 15434 | 15434 |
| 15435 | 15435 |
| 15436 RawInteger* Integer::New(int64_t value, Heap::Space space, const bool silent) { | 15436 RawInteger* Integer::New(int64_t value, Heap::Space space, const bool silent) { |
| 15437 const bool is_smi = Smi::IsValid(value); | 15437 const bool is_smi = Smi::IsValid(value); |
| 15438 if (!silent && | 15438 if (!silent && |
| 15439 FLAG_throw_on_javascript_int_overflow && | 15439 FLAG_throw_on_javascript_int_overflow && |
| 15440 !IsJavascriptInt(value)) { | 15440 !IsJavascriptInt(value)) { |
| 15441 const Integer& i = is_smi ? | 15441 const Integer& i = is_smi ? |
| 15442 Integer::Handle(Smi::New(static_cast<intptr_t>(value))) : | 15442 Integer::Handle(Smi::New(static_cast<intptr_t>(value))) : |
| 15443 Integer::Handle(Mint::New(value)); | 15443 Integer::Handle(Mint::New(value, space)); |
| 15444 ThrowJavascriptIntegerOverflow(i); | 15444 ThrowJavascriptIntegerOverflow(i); |
| 15445 } | 15445 } |
| 15446 if (is_smi) { | 15446 if (is_smi) { |
| 15447 return Smi::New(static_cast<intptr_t>(value)); | 15447 return Smi::New(static_cast<intptr_t>(value)); |
| 15448 } | 15448 } |
| 15449 return Mint::New(value, space); | 15449 return Mint::New(value, space); |
| 15450 } | 15450 } |
| 15451 | 15451 |
| 15452 | 15452 |
| 15453 RawInteger* Integer::NewFromUint64(uint64_t value, Heap::Space space) { | 15453 RawInteger* Integer::NewFromUint64(uint64_t value, Heap::Space space) { |
| 15454 if (value > static_cast<uint64_t>(Mint::kMaxValue)) { | 15454 if (value > static_cast<uint64_t>(Mint::kMaxValue)) { |
| 15455 if (FLAG_throw_on_javascript_int_overflow) { | 15455 if (FLAG_throw_on_javascript_int_overflow) { |
| 15456 const Integer &i = | 15456 const Integer &i = |
| 15457 Integer::Handle(BigintOperations::NewFromUint64(value)); | 15457 Integer::Handle(BigintOperations::NewFromUint64(value, space)); |
| 15458 ThrowJavascriptIntegerOverflow(i); | 15458 ThrowJavascriptIntegerOverflow(i); |
| 15459 } | 15459 } |
| 15460 return BigintOperations::NewFromUint64(value); | 15460 return BigintOperations::NewFromUint64(value, space); |
| 15461 } else { | 15461 } else { |
| 15462 return Integer::New(value); | 15462 return Integer::New(value, space); |
| 15463 } | 15463 } |
| 15464 } | 15464 } |
| 15465 | 15465 |
| 15466 | 15466 |
| 15467 double Integer::AsDoubleValue() const { | 15467 double Integer::AsDoubleValue() const { |
| 15468 UNIMPLEMENTED(); | 15468 UNIMPLEMENTED(); |
| 15469 return 0.0; | 15469 return 0.0; |
| 15470 } | 15470 } |
| 15471 | 15471 |
| 15472 | 15472 |
| (...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16976 } | 16976 } |
| 16977 | 16977 |
| 16978 | 16978 |
| 16979 RawString* String::SubString(const String& str, | 16979 RawString* String::SubString(const String& str, |
| 16980 intptr_t begin_index, | 16980 intptr_t begin_index, |
| 16981 Heap::Space space) { | 16981 Heap::Space space) { |
| 16982 ASSERT(!str.IsNull()); | 16982 ASSERT(!str.IsNull()); |
| 16983 if (begin_index >= str.Length()) { | 16983 if (begin_index >= str.Length()) { |
| 16984 return String::null(); | 16984 return String::null(); |
| 16985 } | 16985 } |
| 16986 return String::SubString(str, begin_index, (str.Length() - begin_index)); | 16986 return String::SubString(str, begin_index, (str.Length() - begin_index), |
|
Vyacheslav Egorov (Google)
2014/09/04 15:37:26
I usually reformat such call sites as argument-per
jgruber1
2014/09/04 15:40:57
Done.
| |
| 16987 space); | |
|
Ivan Posva
2014/09/04 15:37:07
All arguments on a new line, please.
jgruber1
2014/09/04 15:40:57
Done.
| |
| 16987 } | 16988 } |
| 16988 | 16989 |
| 16989 | 16990 |
| 16990 RawString* String::SubString(const String& str, | 16991 RawString* String::SubString(const String& str, |
| 16991 intptr_t begin_index, | 16992 intptr_t begin_index, |
| 16992 intptr_t length, | 16993 intptr_t length, |
| 16993 Heap::Space space) { | 16994 Heap::Space space) { |
| 16994 ASSERT(!str.IsNull()); | 16995 ASSERT(!str.IsNull()); |
| 16995 ASSERT(begin_index >= 0); | 16996 ASSERT(begin_index >= 0); |
| 16996 ASSERT(length >= 0); | 16997 ASSERT(length >= 0); |
| (...skipping 2583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 19580 return tag_label.ToCString(); | 19581 return tag_label.ToCString(); |
| 19581 } | 19582 } |
| 19582 | 19583 |
| 19583 | 19584 |
| 19584 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 19585 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 19585 Instance::PrintJSONImpl(stream, ref); | 19586 Instance::PrintJSONImpl(stream, ref); |
| 19586 } | 19587 } |
| 19587 | 19588 |
| 19588 | 19589 |
| 19589 } // namespace dart | 19590 } // namespace dart |
| OLD | NEW |