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

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

Issue 1454553004: Create code and instruction object, and install them in the background compilation thread while br… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments Created 5 years, 1 month 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/compiler_test.cc ('k') | runtime/vm/object.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 #ifndef VM_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 4330 matching lines...) Expand 10 before | Expand all | Expand 10 after
4341 } 4341 }
4342 static intptr_t InstanceSize(intptr_t len) { 4342 static intptr_t InstanceSize(intptr_t len) {
4343 ASSERT(0 <= len && len <= kMaxElements); 4343 ASSERT(0 <= len && len <= kMaxElements);
4344 return RoundedAllocationSize(sizeof(RawCode) + (len * kBytesPerElement)); 4344 return RoundedAllocationSize(sizeof(RawCode) + (len * kBytesPerElement));
4345 } 4345 }
4346 static RawCode* FinalizeCode(const Function& function, 4346 static RawCode* FinalizeCode(const Function& function,
4347 Assembler* assembler, 4347 Assembler* assembler,
4348 bool optimized = false); 4348 bool optimized = false);
4349 static RawCode* FinalizeCode(const char* name, 4349 static RawCode* FinalizeCode(const char* name,
4350 Assembler* assembler, 4350 Assembler* assembler,
4351 bool optimized = false); 4351 bool optimized);
4352 static RawCode* LookupCode(uword pc); 4352 static RawCode* LookupCode(uword pc);
4353 static RawCode* LookupCodeInVmIsolate(uword pc); 4353 static RawCode* LookupCodeInVmIsolate(uword pc);
4354 static RawCode* FindCode(uword pc, int64_t timestamp); 4354 static RawCode* FindCode(uword pc, int64_t timestamp);
4355 4355
4356 int32_t GetPointerOffsetAt(int index) const { 4356 int32_t GetPointerOffsetAt(int index) const {
4357 NoSafepointScope no_safepoint; 4357 NoSafepointScope no_safepoint;
4358 return *PointerOffsetAddrAt(index); 4358 return *PointerOffsetAddrAt(index);
4359 } 4359 }
4360 intptr_t GetTokenIndexOfPC(uword pc) const; 4360 intptr_t GetTokenIndexOfPC(uword pc) const;
4361 4361
(...skipping 26 matching lines...) Expand all
4388 bool IsFunctionCode() const; 4388 bool IsFunctionCode() const;
4389 4389
4390 void DisableDartCode() const; 4390 void DisableDartCode() const;
4391 4391
4392 void DisableStubCode() const; 4392 void DisableStubCode() const;
4393 4393
4394 void Enable() const { 4394 void Enable() const {
4395 if (!IsDisabled()) return; 4395 if (!IsDisabled()) return;
4396 ASSERT(Thread::Current()->IsMutatorThread()); 4396 ASSERT(Thread::Current()->IsMutatorThread());
4397 ASSERT(instructions() != active_instructions()); 4397 ASSERT(instructions() != active_instructions());
4398 set_active_instructions(instructions()); 4398 SetActiveInstructions(instructions());
4399 } 4399 }
4400 4400
4401 bool IsDisabled() const { 4401 bool IsDisabled() const {
4402 return instructions() != active_instructions(); 4402 return instructions() != active_instructions();
4403 } 4403 }
4404 4404
4405 private: 4405 private:
4406 void set_state_bits(intptr_t bits) const; 4406 void set_state_bits(intptr_t bits) const;
4407 4407
4408 void set_object_pool(RawObjectPool* object_pool) const { 4408 void set_object_pool(RawObjectPool* object_pool) const {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
4440 static bool IsOptimized(RawCode* code) { 4440 static bool IsOptimized(RawCode* code) {
4441 return Code::OptimizedBit::decode(code->ptr()->state_bits_); 4441 return Code::OptimizedBit::decode(code->ptr()->state_bits_);
4442 } 4442 }
4443 4443
4444 static const intptr_t kEntrySize = sizeof(int32_t); // NOLINT 4444 static const intptr_t kEntrySize = sizeof(int32_t); // NOLINT
4445 4445
4446 void set_compile_timestamp(int64_t timestamp) const { 4446 void set_compile_timestamp(int64_t timestamp) const {
4447 StoreNonPointer(&raw_ptr()->compile_timestamp_, timestamp); 4447 StoreNonPointer(&raw_ptr()->compile_timestamp_, timestamp);
4448 } 4448 }
4449 4449
4450 void set_active_instructions(RawInstructions* instructions) const { 4450 void SetActiveInstructions(RawInstructions* instructions) const;
4451 ASSERT(Thread::Current()->IsMutatorThread() || !is_alive());
4452 // RawInstructions are never allocated in New space and hence a
4453 // store buffer update is not needed here.
4454 StorePointer(&raw_ptr()->active_instructions_, instructions);
4455 StoreNonPointer(&raw_ptr()->entry_point_,
4456 reinterpret_cast<uword>(instructions->ptr()) +
4457 Instructions::HeaderSize());
4458 }
4459 4451
4460 void set_instructions(RawInstructions* instructions) const { 4452 void set_instructions(RawInstructions* instructions) const {
4461 ASSERT(Thread::Current()->IsMutatorThread() || !is_alive()); 4453 ASSERT(Thread::Current()->IsMutatorThread() || !is_alive());
4462 StorePointer(&raw_ptr()->instructions_, instructions); 4454 StorePointer(&raw_ptr()->instructions_, instructions);
4463 } 4455 }
4464 4456
4465 void set_pointer_offsets_length(intptr_t value) { 4457 void set_pointer_offsets_length(intptr_t value) {
4466 // The number of fixups is limited to 1-billion. 4458 // The number of fixups is limited to 1-billion.
4467 ASSERT(Utils::IsUint(30, value)); 4459 ASSERT(Utils::IsUint(30, value));
4468 set_state_bits(PtrOffBits::update(value, raw_ptr()->state_bits_)); 4460 set_state_bits(PtrOffBits::update(value, raw_ptr()->state_bits_));
(...skipping 3741 matching lines...) Expand 10 before | Expand all | Expand 10 after
8210 8202
8211 8203
8212 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 8204 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
8213 intptr_t index) { 8205 intptr_t index) {
8214 return array.At((index * kEntryLength) + kTargetFunctionIndex); 8206 return array.At((index * kEntryLength) + kTargetFunctionIndex);
8215 } 8207 }
8216 8208
8217 } // namespace dart 8209 } // namespace dart
8218 8210
8219 #endif // VM_OBJECT_H_ 8211 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/compiler_test.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698