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

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

Issue 1756403002: VM: Add smi fast path operations for precompiled code (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: addressed comments Created 4 years, 9 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
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('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 11483 matching lines...) Expand 10 before | Expand all | Expand 10 after
11494 if (value) { 11494 if (value) {
11495 *byte_addr |= byte_mask; 11495 *byte_addr |= byte_mask;
11496 } else { 11496 } else {
11497 *byte_addr &= ~byte_mask; 11497 *byte_addr &= ~byte_mask;
11498 } 11498 }
11499 } 11499 }
11500 11500
11501 11501
11502 RawStackmap* Stackmap::New(intptr_t pc_offset, 11502 RawStackmap* Stackmap::New(intptr_t pc_offset,
11503 BitmapBuilder* bmap, 11503 BitmapBuilder* bmap,
11504 intptr_t register_bit_count) { 11504 intptr_t slow_path_bit_count) {
11505 ASSERT(Object::stackmap_class() != Class::null()); 11505 ASSERT(Object::stackmap_class() != Class::null());
11506 ASSERT(bmap != NULL); 11506 ASSERT(bmap != NULL);
11507 Stackmap& result = Stackmap::Handle(); 11507 Stackmap& result = Stackmap::Handle();
11508 // Guard against integer overflow of the instance size computation. 11508 // Guard against integer overflow of the instance size computation.
11509 intptr_t length = bmap->Length(); 11509 intptr_t length = bmap->Length();
11510 intptr_t payload_size = 11510 intptr_t payload_size =
11511 Utils::RoundUp(length, kBitsPerByte) / kBitsPerByte; 11511 Utils::RoundUp(length, kBitsPerByte) / kBitsPerByte;
11512 if ((payload_size < 0) || 11512 if ((payload_size < 0) ||
11513 (payload_size > kMaxLengthInBytes)) { 11513 (payload_size > kMaxLengthInBytes)) {
11514 // This should be caught before we reach here. 11514 // This should be caught before we reach here.
(...skipping 11 matching lines...) Expand all
11526 result.SetLength(length); 11526 result.SetLength(length);
11527 } 11527 }
11528 // When constructing a stackmap we store the pc offset in the stackmap's 11528 // When constructing a stackmap we store the pc offset in the stackmap's
11529 // PC. StackmapTableBuilder::FinalizeStackmaps will replace it with the pc 11529 // PC. StackmapTableBuilder::FinalizeStackmaps will replace it with the pc
11530 // address. 11530 // address.
11531 ASSERT(pc_offset >= 0); 11531 ASSERT(pc_offset >= 0);
11532 result.SetPcOffset(pc_offset); 11532 result.SetPcOffset(pc_offset);
11533 for (intptr_t i = 0; i < length; ++i) { 11533 for (intptr_t i = 0; i < length; ++i) {
11534 result.SetBit(i, bmap->Get(i)); 11534 result.SetBit(i, bmap->Get(i));
11535 } 11535 }
11536 result.SetRegisterBitCount(register_bit_count); 11536 result.SetSlowPathBitCount(slow_path_bit_count);
11537 return result.raw(); 11537 return result.raw();
11538 } 11538 }
11539 11539
11540 11540
11541 RawStackmap* Stackmap::New(intptr_t length, 11541 RawStackmap* Stackmap::New(intptr_t length,
11542 intptr_t register_bit_count, 11542 intptr_t slow_path_bit_count,
11543 intptr_t pc_offset) { 11543 intptr_t pc_offset) {
11544 ASSERT(Object::stackmap_class() != Class::null()); 11544 ASSERT(Object::stackmap_class() != Class::null());
11545 Stackmap& result = Stackmap::Handle(); 11545 Stackmap& result = Stackmap::Handle();
11546 // Guard against integer overflow of the instance size computation. 11546 // Guard against integer overflow of the instance size computation.
11547 intptr_t payload_size = 11547 intptr_t payload_size =
11548 Utils::RoundUp(length, kBitsPerByte) / kBitsPerByte; 11548 Utils::RoundUp(length, kBitsPerByte) / kBitsPerByte;
11549 if ((payload_size < 0) || 11549 if ((payload_size < 0) ||
11550 (payload_size > kMaxLengthInBytes)) { 11550 (payload_size > kMaxLengthInBytes)) {
11551 // This should be caught before we reach here. 11551 // This should be caught before we reach here.
11552 FATAL1("Fatal error in Stackmap::New: invalid length %" Pd "\n", 11552 FATAL1("Fatal error in Stackmap::New: invalid length %" Pd "\n",
11553 length); 11553 length);
11554 } 11554 }
11555 { 11555 {
11556 // Stackmap data objects are associated with a code object, allocate them 11556 // Stackmap data objects are associated with a code object, allocate them
11557 // in old generation. 11557 // in old generation.
11558 RawObject* raw = Object::Allocate(Stackmap::kClassId, 11558 RawObject* raw = Object::Allocate(Stackmap::kClassId,
11559 Stackmap::InstanceSize(length), 11559 Stackmap::InstanceSize(length),
11560 Heap::kOld); 11560 Heap::kOld);
11561 NoSafepointScope no_safepoint; 11561 NoSafepointScope no_safepoint;
11562 result ^= raw; 11562 result ^= raw;
11563 result.SetLength(length); 11563 result.SetLength(length);
11564 } 11564 }
11565 // When constructing a stackmap we store the pc offset in the stackmap's 11565 // When constructing a stackmap we store the pc offset in the stackmap's
11566 // PC. StackmapTableBuilder::FinalizeStackmaps will replace it with the pc 11566 // PC. StackmapTableBuilder::FinalizeStackmaps will replace it with the pc
11567 // address. 11567 // address.
11568 ASSERT(pc_offset >= 0); 11568 ASSERT(pc_offset >= 0);
11569 result.SetPcOffset(pc_offset); 11569 result.SetPcOffset(pc_offset);
11570 result.SetRegisterBitCount(register_bit_count); 11570 result.SetSlowPathBitCount(slow_path_bit_count);
11571 return result.raw(); 11571 return result.raw();
11572 } 11572 }
11573 11573
11574 11574
11575 const char* Stackmap::ToCString() const { 11575 const char* Stackmap::ToCString() const {
11576 #define FORMAT "%#x: " 11576 #define FORMAT "%#x: "
11577 if (IsNull()) { 11577 if (IsNull()) {
11578 return "{null}"; 11578 return "{null}";
11579 } else { 11579 } else {
11580 intptr_t fixed_length = OS::SNPrint(NULL, 0, FORMAT, PcOffset()) + 1; 11580 intptr_t fixed_length = OS::SNPrint(NULL, 0, FORMAT, PcOffset()) + 1;
(...skipping 10290 matching lines...) Expand 10 before | Expand all | Expand 10 after
21871 return UserTag::null(); 21871 return UserTag::null();
21872 } 21872 }
21873 21873
21874 21874
21875 const char* UserTag::ToCString() const { 21875 const char* UserTag::ToCString() const {
21876 const String& tag_label = String::Handle(label()); 21876 const String& tag_label = String::Handle(label());
21877 return tag_label.ToCString(); 21877 return tag_label.ToCString();
21878 } 21878 }
21879 21879
21880 } // namespace dart 21880 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698