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

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

Issue 14652008: Fix error reporting when calling static methods and closures withh mismatched arguments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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/flow_graph_builder.cc ('k') | runtime/vm/object_test.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/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 12346 matching lines...) Expand 10 before | Expand all | Expand 10 after
12357 12357
12358 void Array::MakeImmutable() const { 12358 void Array::MakeImmutable() const {
12359 NoGCScope no_gc; 12359 NoGCScope no_gc;
12360 uword tags = raw_ptr()->tags_; 12360 uword tags = raw_ptr()->tags_;
12361 tags = RawObject::ClassIdTag::update(kImmutableArrayCid, tags); 12361 tags = RawObject::ClassIdTag::update(kImmutableArrayCid, tags);
12362 raw_ptr()->tags_ = tags; 12362 raw_ptr()->tags_ = tags;
12363 } 12363 }
12364 12364
12365 12365
12366 const char* Array::ToCString() const { 12366 const char* Array::ToCString() const {
12367 return "Array"; 12367 if (IsNull()) {
12368 return "Array NULL";
12369 }
12370 const char* format = "Array len:%"Pd"";
12371 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1;
12372 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
12373 OS::SNPrint(chars, len, format, Length());
12374 return chars;
12368 } 12375 }
12369 12376
12370 12377
12371 RawArray* Array::Grow(const Array& source, int new_length, Heap::Space space) { 12378 RawArray* Array::Grow(const Array& source, int new_length, Heap::Space space) {
12372 const Array& result = Array::Handle(Array::New(new_length, space)); 12379 const Array& result = Array::Handle(Array::New(new_length, space));
12373 intptr_t len = 0; 12380 intptr_t len = 0;
12374 if (!source.IsNull()) { 12381 if (!source.IsNull()) {
12375 len = source.Length(); 12382 len = source.Length();
12376 result.SetTypeArguments( 12383 result.SetTypeArguments(
12377 AbstractTypeArguments::Handle(source.GetTypeArguments())); 12384 AbstractTypeArguments::Handle(source.GetTypeArguments()));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
12422 12429
12423 RawImmutableArray* ImmutableArray::New(intptr_t len, 12430 RawImmutableArray* ImmutableArray::New(intptr_t len,
12424 Heap::Space space) { 12431 Heap::Space space) {
12425 ASSERT(Isolate::Current()->object_store()->immutable_array_class() != 12432 ASSERT(Isolate::Current()->object_store()->immutable_array_class() !=
12426 Class::null()); 12433 Class::null());
12427 return reinterpret_cast<RawImmutableArray*>(Array::New(kClassId, len, space)); 12434 return reinterpret_cast<RawImmutableArray*>(Array::New(kClassId, len, space));
12428 } 12435 }
12429 12436
12430 12437
12431 const char* ImmutableArray::ToCString() const { 12438 const char* ImmutableArray::ToCString() const {
12432 return "ImmutableArray"; 12439 if (IsNull()) {
12440 return "ImmutableArray NULL";
12441 }
12442 const char* format = "ImmutableArray len:%"Pd"";
12443 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1;
12444 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
12445 OS::SNPrint(chars, len, format, Length());
12446 return chars;
12433 } 12447 }
12434 12448
12435 12449
12436 void GrowableObjectArray::Add(const Object& value, Heap::Space space) const { 12450 void GrowableObjectArray::Add(const Object& value, Heap::Space space) const {
12437 ASSERT(!IsNull()); 12451 ASSERT(!IsNull());
12438 if (Length() == Capacity()) { 12452 if (Length() == Capacity()) {
12439 // TODO(Issue 2500): Need a better growth strategy. 12453 // TODO(Issue 2500): Need a better growth strategy.
12440 intptr_t new_capacity = (Capacity() == 0) ? 4 : Capacity() * 2; 12454 intptr_t new_capacity = (Capacity() == 0) ? 4 : Capacity() * 2;
12441 if (new_capacity <= Capacity()) { 12455 if (new_capacity <= Capacity()) {
12442 // Use the preallocated out of memory exception to avoid calling 12456 // Use the preallocated out of memory exception to avoid calling
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
12533 NoGCScope no_gc; 12547 NoGCScope no_gc;
12534 result ^= raw; 12548 result ^= raw;
12535 result.SetLength(0); 12549 result.SetLength(0);
12536 result.SetData(array); 12550 result.SetData(array);
12537 } 12551 }
12538 return result.raw(); 12552 return result.raw();
12539 } 12553 }
12540 12554
12541 12555
12542 const char* GrowableObjectArray::ToCString() const { 12556 const char* GrowableObjectArray::ToCString() const {
12543 return "GrowableObjectArray"; 12557 if (IsNull()) {
12558 return "GrowableObjectArray NULL";
12559 }
12560 const char* format = "GrowableObjectArray len:%"Pd"";
12561 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1;
12562 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
12563 OS::SNPrint(chars, len, format, Length());
12564 return chars;
12544 } 12565 }
12545 12566
12546 12567
12547 RawFloat32x4* Float32x4::New(float v0, float v1, float v2, float v3, 12568 RawFloat32x4* Float32x4::New(float v0, float v1, float v2, float v3,
12548 Heap::Space space) { 12569 Heap::Space space) {
12549 ASSERT(Isolate::Current()->object_store()->float32x4_class() != 12570 ASSERT(Isolate::Current()->object_store()->float32x4_class() !=
12550 Class::null()); 12571 Class::null());
12551 Float32x4& result = Float32x4::Handle(); 12572 Float32x4& result = Float32x4::Handle();
12552 { 12573 {
12553 RawObject* raw = Object::Allocate(Float32x4::kClassId, 12574 RawObject* raw = Object::Allocate(Float32x4::kClassId,
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
13204 } 13225 }
13205 return result.raw(); 13226 return result.raw();
13206 } 13227 }
13207 13228
13208 13229
13209 const char* WeakProperty::ToCString() const { 13230 const char* WeakProperty::ToCString() const {
13210 return "_WeakProperty"; 13231 return "_WeakProperty";
13211 } 13232 }
13212 13233
13213 } // namespace dart 13234 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/object_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698