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

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

Issue 544573003: Forward heap space argument in String and Integer::New* (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reformat long line. Created 6 years, 3 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 | « no previous file | no next file » | 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/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
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
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,
16987 begin_index,
16988 (str.Length() - begin_index),
16989 space);
16987 } 16990 }
16988 16991
16989 16992
16990 RawString* String::SubString(const String& str, 16993 RawString* String::SubString(const String& str,
16991 intptr_t begin_index, 16994 intptr_t begin_index,
16992 intptr_t length, 16995 intptr_t length,
16993 Heap::Space space) { 16996 Heap::Space space) {
16994 ASSERT(!str.IsNull()); 16997 ASSERT(!str.IsNull());
16995 ASSERT(begin_index >= 0); 16998 ASSERT(begin_index >= 0);
16996 ASSERT(length >= 0); 16999 ASSERT(length >= 0);
(...skipping 2583 matching lines...) Expand 10 before | Expand all | Expand 10 after
19580 return tag_label.ToCString(); 19583 return tag_label.ToCString();
19581 } 19584 }
19582 19585
19583 19586
19584 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 19587 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
19585 Instance::PrintJSONImpl(stream, ref); 19588 Instance::PrintJSONImpl(stream, ref);
19586 } 19589 }
19587 19590
19588 19591
19589 } // namespace dart 19592 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698