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

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

Issue 1290933002: Toward precompiled snapshots. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
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 11059 matching lines...) Expand 10 before | Expand all | Expand 10 after
11070 const int addr_width = (kBitsPerWord / 4) + 2; 11070 const int addr_width = (kBitsPerWord / 4) + 2;
11071 // "*" in a printf format specifier tells it to read the field width from 11071 // "*" in a printf format specifier tells it to read the field width from
11072 // the printf argument list. 11072 // the printf argument list.
11073 ISL_Print("%-*s\tkind \tdeopt-id\ttok-ix\ttry-ix\n", 11073 ISL_Print("%-*s\tkind \tdeopt-id\ttok-ix\ttry-ix\n",
11074 addr_width, "pc"); 11074 addr_width, "pc");
11075 } 11075 }
11076 11076
11077 11077
11078 const char* PcDescriptors::ToCString() const { 11078 const char* PcDescriptors::ToCString() const {
11079 if (Length() == 0) { 11079 if (Length() == 0) {
11080 return "No pc descriptors\n"; 11080 return "empty PcDescriptors\n";
11081 } 11081 }
11082 // 4 bits per hex digit. 11082 // 4 bits per hex digit.
11083 const int addr_width = kBitsPerWord / 4; 11083 const int addr_width = kBitsPerWord / 4;
11084 // "*" in a printf format specifier tells it to read the field width from 11084 // "*" in a printf format specifier tells it to read the field width from
11085 // the printf argument list. 11085 // the printf argument list.
11086 const char* kFormat = 11086 const char* kFormat =
11087 "%#-*" Px "\t%s\t%" Pd "\t\t%" Pd "\t%" Pd "\n"; 11087 "%#-*" Px "\t%s\t%" Pd "\t\t%" Pd "\t%" Pd "\n";
11088 // First compute the buffer size required. 11088 // First compute the buffer size required.
11089 intptr_t len = 1; // Trailing '\0'. 11089 intptr_t len = 1; // Trailing '\0'.
11090 { 11090 {
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
11399 info.end_pos, 11399 info.end_pos,
11400 var_name.ToCString()); 11400 var_name.ToCString());
11401 } 11401 }
11402 } 11402 }
11403 11403
11404 11404
11405 const char* LocalVarDescriptors::ToCString() const { 11405 const char* LocalVarDescriptors::ToCString() const {
11406 if (IsNull()) { 11406 if (IsNull()) {
11407 return "LocalVarDescriptors(NULL)"; 11407 return "LocalVarDescriptors(NULL)";
11408 } 11408 }
11409 if (Length() == 0) {
11410 return "empty LocalVarDescriptors";
11411 }
11409 intptr_t len = 1; // Trailing '\0'. 11412 intptr_t len = 1; // Trailing '\0'.
11410 String& var_name = String::Handle(); 11413 String& var_name = String::Handle();
11411 for (intptr_t i = 0; i < Length(); i++) { 11414 for (intptr_t i = 0; i < Length(); i++) {
11412 RawLocalVarDescriptors::VarInfo info; 11415 RawLocalVarDescriptors::VarInfo info;
11413 var_name = GetName(i); 11416 var_name = GetName(i);
11414 GetInfo(i, &info); 11417 GetInfo(i, &info);
11415 len += PrintVarInfo(NULL, 0, i, var_name, info); 11418 len += PrintVarInfo(NULL, 0, i, var_name, info);
11416 } 11419 }
11417 char* buffer = Thread::Current()->zone()->Alloc<char>(len + 1); 11420 char* buffer = Thread::Current()->zone()->Alloc<char>(len + 1);
11418 buffer[0] = '\0'; 11421 buffer[0] = '\0';
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
12334 if (cid == kObjectCid) { 12337 if (cid == kObjectCid) {
12335 return true; 12338 return true;
12336 } 12339 }
12337 } 12340 }
12338 return false; 12341 return false;
12339 } 12342 }
12340 return true; 12343 return true;
12341 } 12344 }
12342 12345
12343 12346
12347 RawICData* ICData::New() {
12348 ICData& result = ICData::Handle();
12349 {
12350 // IC data objects are long living objects, allocate them in old generation.
12351 RawObject* raw = Object::Allocate(ICData::kClassId,
12352 ICData::InstanceSize(),
12353 Heap::kOld);
12354 NoSafepointScope no_safepoint;
12355 result ^= raw;
12356 }
12357 result.set_deopt_id(Isolate::kNoDeoptId);
12358 result.set_state_bits(0);
12359 return result.raw();
12360 }
12361
12362
12344 RawICData* ICData::New(const Function& owner, 12363 RawICData* ICData::New(const Function& owner,
12345 const String& target_name, 12364 const String& target_name,
12346 const Array& arguments_descriptor, 12365 const Array& arguments_descriptor,
12347 intptr_t deopt_id, 12366 intptr_t deopt_id,
12348 intptr_t num_args_tested) { 12367 intptr_t num_args_tested) {
12349 ASSERT(!owner.IsNull()); 12368 ASSERT(!owner.IsNull());
12350 ASSERT(!target_name.IsNull()); 12369 ASSERT(!target_name.IsNull());
12351 ASSERT(!arguments_descriptor.IsNull()); 12370 ASSERT(!arguments_descriptor.IsNull());
12352 ASSERT(Object::icdata_class() != Class::null()); 12371 ASSERT(Object::icdata_class() != Class::null());
12353 ASSERT(num_args_tested >= 0); 12372 ASSERT(num_args_tested >= 0);
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
13087 while (iter.MoveNext()) { 13106 while (iter.MoveNext()) {
13088 if (iter.PcOffset() == pc_offset) { 13107 if (iter.PcOffset() == pc_offset) {
13089 return iter.DeoptId(); 13108 return iter.DeoptId();
13090 } 13109 }
13091 } 13110 }
13092 return Isolate::kNoDeoptId; 13111 return Isolate::kNoDeoptId;
13093 } 13112 }
13094 13113
13095 13114
13096 const char* Code::ToCString() const { 13115 const char* Code::ToCString() const {
13097 const char* kFormat = "Code entry:%p"; 13116 Zone* zone = Thread::Current()->zone();
13098 intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1; 13117 if (IsStubCode()) {
13099 char* chars = Thread::Current()->zone()->Alloc<char>(len); 13118 const char* name = StubCode::NameOfStub(EntryPoint());
13100 OS::SNPrint(chars, len, kFormat, EntryPoint()); 13119 return zone->PrintToString("[stub: %s]", name);
13101 return chars; 13120 } else {
13121 return zone->PrintToString("Code entry:%" Px, EntryPoint());
13122 }
13102 } 13123 }
13103 13124
13104 13125
13105 RawString* Code::Name() const { 13126 RawString* Code::Name() const {
13106 const Object& obj = Object::Handle(owner()); 13127 const Object& obj = Object::Handle(owner());
13107 if (obj.IsNull()) { 13128 if (obj.IsNull()) {
13108 // Regular stub. 13129 // Regular stub.
13109 const char* name = StubCode::NameOfStub(EntryPoint()); 13130 const char* name = StubCode::NameOfStub(EntryPoint());
13110 ASSERT(name != NULL); 13131 ASSERT(name != NULL);
13111 const String& stub_name = String::Handle(String::New(name)); 13132 const String& stub_name = String::Handle(String::New(name));
(...skipping 8256 matching lines...) Expand 10 before | Expand all | Expand 10 after
21368 return tag_label.ToCString(); 21389 return tag_label.ToCString();
21369 } 21390 }
21370 21391
21371 21392
21372 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 21393 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
21373 Instance::PrintJSONImpl(stream, ref); 21394 Instance::PrintJSONImpl(stream, ref);
21374 } 21395 }
21375 21396
21376 21397
21377 } // namespace dart 21398 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698